From 9d5e303a998e4618d492c9d0befb09e3cd3d746b Mon Sep 17 00:00:00 2001 From: Vadim Kochan Date: Thu, 1 Jun 2017 13:12:28 +0300 Subject: trafgen: l7: Add DNS header generation API Add trafgen_l7.c module with DNS proto header generation with support of filling DNS query/answer/authority/additional sections as sub headers. Introcuded new concept as 'sub header' which is needed to easy handle DNS sections which might be added on-demand, and to simplify using sub-header as regular header with a fields, offset, etc. There is a parent header which contains array of pointers of sub-headers, and the array is ordered as they are located in the parent header. The sub-headers mostly encapsulated by the parent header which 'knows' the semantic of them. The new proto_hdr->push_sub_header(...) callback was added to tell the parent header to push the sub-header's fields, sub-header also may have proto_ops which must be filled by the parent. This sub-header concept might be used in the future if it will be needed to support DHCP, WLAN headers. There are 4 kinds of DNS sub-headers - query, answer, authority, additional. 'id' of each sub-header is used to only differentiate these types of sections. These sections have strict order inside DNS header, and there was added the proto_hdr_move_sub_header(...) to sort them in required order. Actually there are only 2 proto_hdr's which describes 4 DNS sections - query & rrecord, because rrecord covers another 3 - answer, auhority, additional which have the same layout. Signed-off-by: Vadim Kochan Signed-off-by: Tobias Klauser --- trafgen/Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'trafgen') diff --git a/trafgen/Makefile b/trafgen/Makefile index 3369d4a..d38f0b0 100644 --- a/trafgen/Makefile +++ b/trafgen/Makefile @@ -29,6 +29,7 @@ trafgen-objs = xmalloc.o \ trafgen_l2.o \ trafgen_l3.o \ trafgen_l4.o \ + trafgen_l7.o \ trafgen_lexer.yy.o \ trafgen_parser.tab.o \ trafgen.o -- cgit v1.2.3-54-g00ecf