Added trafgen_dump.c module which dumps headers from packet
in .cfg format. Packet is dumped if -o <file>.cfg was specified,
it might be useful to specify *.pcap file as input and convert it
into .cfg file to edit proto fields in human readable format.

To make it possible several main changes were added:

    1) packet id is embedded into struct packet.id, and
       it is updated on each realloc_packet()

    2) Added new struct proto_hdr.get_next_proto callback
       to make possible apply fields of next header.

    3) Added new dev_io ops for writting packets into .cfg file,
       to re-use common dev_io mechsnism for packets dumping.

    4) Changed dev_io ops read/write to specify struct packet * instead of
       buf & count.

    5) Updated trafgen_proto.c to obtain packet from the header if possible to
       do not depend on last packet, which is not right way to get related 
packet.

Before dump the default ETH_PROTO fields are applied as first header and
then next proto_hdr is identified via .get_next_proto(...) callback.

Meanwhile only eth, arp, vlan, ip4, udp, & tcp protos can be dissected
into *.cfg format.

v2:
    1) Missed local patch

Vadim Kochan (3):
  trafgen: Get packet from proto_hdr if possible
  trafgen: dev_io: Change read/write to specify struct packet *
  trafgen: Dump proto headers in *.cfg format

 trafgen.8        |   4 +-
 trafgen.c        |  79 +++++++----------
 trafgen/Makefile |   1 +
 trafgen_conf.h   |   4 +-
 trafgen_dev.c    |  78 +++++++++++++----
 trafgen_dev.h    |  12 +--
 trafgen_dump.c   | 258 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 trafgen_dump.h   |   8 ++
 trafgen_l2.c     |  33 +++++++
 trafgen_l3.c     |  25 +++++-
 trafgen_l4.c     |   4 +-
 trafgen_parser.y |  11 ++-
 trafgen_proto.c  |  79 +++++++++++++++--
 trafgen_proto.h  |  10 +++
 14 files changed, 519 insertions(+), 87 deletions(-)
 create mode 100644 trafgen_dump.c
 create mode 100644 trafgen_dump.h

-- 
2.9.3

-- 
You received this message because you are subscribed to the Google Groups 
"netsniff-ng" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to netsniff-ng+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to