Add description (basic syntax, proto header fields) for newer added
proto headers:

    Ethernet, ARP, IPv4, UDP.

Signed-off-by: Vadim Kochan <vadi...@gmail.com>
---
 trafgen.8 | 174 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 174 insertions(+)

diff --git a/trafgen.8 b/trafgen.8
index ce82a5b..ae68a38 100644
--- a/trafgen.8
+++ b/trafgen.8
@@ -271,6 +271,180 @@ configuration, e.g. const16(0xaa) will result in ''00 
aa''. Within c*()
 functions, it is possible to do some arithmetics: -,+,*,/,%,&,|,<<,>>,^
 E.g. const16((((1<<8)+0x32)|0b110)*2) will be evaluated to ''02 6c''.
 .PP
+IV) Proto header functions, fill protocol header with specified parameters.
+The protocol header follows the generic syntax:
+.in +8
+.sp
+<proto>(<param>=<value>,<param2>=<value2>,...,<flag>,...)
+.sp
+.in -8
+.in +4
+Parameter might be ignored and specified in any order, once parameter is set
+- the default value is ignored. So just proto header might be specified.
+.sp
+All required lower layer headers will be filled automatically in case if they
+were not specified by the user. The headers will be filled in the order as they
+were specified. Each header will be filled with some mimimum required set of 
fields.
+.in -4
+.sp
+.in +4
+Supported proto headers:
+.sp
+
+.in +4
+.I Ethernet
+:
+.B eth(da=<mac>, sa=<mac>, prot[o]=<number>)
+.sp
+.in +15
+.B da|daddr
+- set destination MAC address (default 00:00:00:00:00:00).
+.sp
+.B sa|saddr
+- set source MAC address (default device's MAC address).
+.sp
+.B prot|proto
+- set Ethernet type/proro number (default 0).
+.in -15
+.in -4
+
+.in +4
+.I ARP
+:
+.B arp(op=<req|reply|resp>, smac=<mac>, sip=<ip4_addr>, tmac=<mac>, 
tip=<ip4_addr>)
+.sp
+.in +15
+.B op
+- set ARP operation type (request/reply/response) (default request).
+.sp
+.B smac|sha
+- set sender HW (MAC) address (default device's MAC address).
+.sp
+.B sip|spa
+- set sender proto (IPv4) address (default device's IPv4 address).
+.sp
+.B tmac|tha
+- set target HW (MAC) address (default 00:00:00:00:00:00).
+.sp
+.B tip|tpa
+- set target proto (IPv4) address (default device's IPv4 address).
+.in -15
+.sp
+.in +4
+By default ARP Announcement request packet is filled, Ethernet destination MAC
+set to broadcast.
+.in -4
+.in -4
+
+.in +4
+.I IPv4
+:
+.B ip4|ipv4(ihl=<number>, ver=<number>, len=<number>, csum=<number>,
+.B ttl=<number>, tos=<number>, dscp=<number>, ecn=<number>,
+.in +15
+.B id=<number>, flags=<number>, frag=<number>, df, mf, da=<ip4_addr>, 
sa=<ip4_addr>,
+.B prot[o]=<number>)
+.in -15
+.sp
+.in +15
+.B ver|version
+- set version field (default 4).
+.sp
+.B ihl
+- set header length in the numbers of 4 bytes (default 5).
+.sp
+.B tos
+- set TOS (Type Of Service) field (default 0).
+.sp
+.B dscp
+- set DSCP (DiffServ) field (default 0).
+.sp
+.B ecn
+- set ECN field (default 0).
+.sp
+.B len|length
+- set total length of header and data (calculated by default).
+.sp
+.B id
+- set IPv4 datagram identificator (default 0).
+.sp
+.B flags
+- set IPv4 flags value (DF,MF) (default 0).
+.sp
+.B df
+- set DF (dont fragment) flag (default 0).
+.sp
+.B mf
+- set MF (more fragment) flag (default 0).
+.sp
+.B frag
+- set fragment offset field in numbers of 8 bytes (default 0).
+.sp
+.B ttl
+- set TTL (time to live) field (default 0).
+.sp
+.B csum
+- set header checksum field (calculated by default).
+.sp
+.B sa|saddr
+- set source IPv4 address (default device's IPv4 address).
+.sp
+.B da|daddr
+- set destination IPv4 address (default 0.0.0.0).
+.sp
+.B prot|proto
+- set IPv4 proro number (default 0).
+.in -15
+.sp
+.in +4
+By default if lower header is Ethernet - ether type is set to IPv4,
+if lower header is IPv4 - proto is set to value 0x4 (IP-in-IP).
+.in -4
+.in -4
+
+.in +4
+.I UDP
+:
+.B udp(sp=<number>, dp=<number>, len=<number>, csum=<number>)
+.sp
+.in +15
+.B sp|sport
+- set source UDP port (default 0).
+.sp
+.B dp|dport
+- set destination UDP port (default 0).
+.sp
+.B len|length
+- set length field of UDP header and data (calculated by default).
+.sp
+.B csum
+- set checksum field calculated on IPv4 pseudo header (calculated by default).
+.sp
+.in -15
+.in +4
+By default if lower header is IPv4 - proto is set to UDP.
+.in -4
+.in -4
+
+Example of some invalid DNS packet:
+.sp
+.in +4
+{
+.in +4
+eth(da=11:22:33:44:55:66),
+.sp
+ip4(da=2.2.2.2),
+.sp
+udp(sp=111, dp=53),
+.sp
+fill(0xff, 10),
+.in -4
+}
+.in -4
+
+.in -4
+
+.PP
 Furthermore, there are two types of comments in trafgen configuration files:
 .PP
   1. Multi-line C-style comments:        /* put comment here */
-- 
2.6.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