]>
git.proxmox.com Git - mirror_frr.git/blob - tests/lib/test_stream.c
3 * Copyright (C) 2006 Sun Microsystems, Inc.
5 * This file is part of Quagga.
7 * Quagga is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2, or (at your option) any
12 * Quagga is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; see the file COPYING; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 static unsigned long long ham
= 0xdeadbeefdeadbeef;
27 struct thread_master
*master
;
29 static void print_stream(struct stream
*s
)
31 size_t getp
= stream_get_getp(s
);
33 printf("endp: %zu, readable: %zu, writeable: %zu\n", stream_get_endp(s
),
34 STREAM_READABLE(s
), STREAM_WRITEABLE(s
));
36 while (STREAM_READABLE(s
)) {
37 printf("0x%x ", *stream_pnt(s
));
38 stream_forward_getp(s
, 1);
43 /* put getp back to where it was */
44 stream_set_getp(s
, getp
);
60 stream_resize(s
, stream_get_endp(s
));
64 printf("c: 0x%hhx\n", stream_getc(s
));
65 printf("w: 0x%hx\n", stream_getw(s
));
66 printf("l: 0x%x\n", stream_getl(s
));
67 printf("q: 0x%" PRIx64
"\n", stream_getq(s
));