static void ipf_print_reass_packet(const char *es, const void *pkt) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(10, 10); if (!VLOG_DROP_WARN(&rl)) { struct ds ds = DS_EMPTY_INITIALIZER; ds_put_hex_dump(&ds, pkt, 128, 0, false); VLOG_WARN("%s\n%s", es, ds_cstr(&ds)); ds_destroy(&ds); } }
/* Returns a string that describes some of 'b''s metadata plus a hex dump of up * to 'maxbytes' from the start of the buffer. */ char * ofpbuf_to_string(const struct ofpbuf *b, size_t maxbytes) { struct ds s; ds_init(&s); ds_put_format(&s, "size=%"PRIu32", allocated=%"PRIu32", head=%"PRIuSIZE", tail=%"PRIuSIZE"\n", b->size, b->allocated, ofpbuf_headroom(b), ofpbuf_tailroom(b)); ds_put_hex_dump(&s, b->data, MIN(b->size, maxbytes), 0, false); return ds_cstr(&s); }
/* Returns a string that describes some of 'b''s metadata plus a hex dump of up * to 'maxbytes' from the start of the buffer. */ char * dp_packet_to_string(const struct dp_packet *b, size_t maxbytes) { struct ds s; ds_init(&s); ds_put_format(&s, "size=%"PRIu32", allocated=%"PRIu32", head=%"PRIuSIZE", tail=%"PRIuSIZE"\n", dp_packet_size(b), b->allocated, dp_packet_headroom(b), dp_packet_tailroom(b)); ds_put_hex_dump(&s, dp_packet_data(b), MIN(dp_packet_size(b), maxbytes), 0, false); return ds_cstr(&s); }