16 #include <libnetfilter_log/libipulog.h>
21 void handle_packet(ulog_packet_msg_t *pkt)
26 printf(
"Hook=%u Mark=%lu len=%zu ",
27 pkt->hook, pkt->mark, pkt->data_len);
28 if (strlen(pkt->prefix))
29 printf(
"Prefix=%s ", pkt->prefix);
35 for (i = 0; i < pkt->mac_len; i++, p++)
36 printf(
"%02x%c", *p, i==pkt->mac_len-1 ?
' ':
':');
42 int main(
int argc,
char *argv[])
47 ulog_packet_msg_t *upkt;
51 fprintf(stderr,
"Usage: %s count group timeout\n", argv[0]);
56 buf = malloc(MYBUFSIZ);
61 h = ipulog_create_handle(ipulog_group2gmask(atoi(argv[2])), 65535);
72 for (i = 0; i < atoi(argv[1]); i++) {
73 len = ipulog_read(h, buf, MYBUFSIZ, 1);
75 ipulog_perror(
"ulog_test: short read");
78 printf(
"%d bytes received\n", len);
79 while ((upkt = ipulog_get_packet(h, buf, len)) != NULL) {
85 ipulog_destroy_handle(h);