1 #ifndef TRAFGEN_PROTO_I_H
2 #define TRAFGEN_PROTO_I_H
23 PROTO_L0
, /* invalid layer */
42 enum proto_layer layer
;
44 struct proto_hdr
*next
;
45 struct proto_ctx
*ctx
;
47 struct proto_field
*fields
;
50 void (*header_init
)(struct proto_hdr
*hdr
);
51 void (*header_finish
)(struct proto_hdr
*hdr
);
52 void (*packet_finish
)(struct proto_hdr
*hdr
);
55 extern void protos_init(const char *dev
);
56 extern void proto_header_register(struct proto_hdr
*hdr
);
58 extern void proto_header_init(enum proto_id pid
);
59 extern void proto_header_finish(struct proto_hdr
*hdr
);
60 extern void proto_packet_finish(void);
61 extern void proto_lower_default_add(enum proto_id pid
);
63 extern struct proto_hdr
*proto_current_header(void);
64 extern struct proto_hdr
*proto_lower_header(struct proto_hdr
*hdr
);
65 extern uint8_t *proto_header_ptr(struct proto_hdr
*hdr
);
67 extern void proto_header_fields_add(struct proto_hdr
*hdr
,
68 struct proto_field
*fields
, size_t count
);
70 extern bool proto_field_is_set(struct proto_hdr
*hdr
, uint32_t fid
);
71 extern void proto_field_set_bytes(struct proto_hdr
*hdr
, uint32_t fid
,
73 extern void proto_field_set_u8(struct proto_hdr
*hdr
, uint32_t fid
, uint8_t val
);
74 extern uint8_t proto_field_get_u8(struct proto_hdr
*hdr
, uint32_t fid
);
75 extern void proto_field_set_u16(struct proto_hdr
*hdr
, uint32_t fid
, uint16_t val
);
76 extern uint16_t proto_field_get_u16(struct proto_hdr
*hdr
, uint32_t fid
);
77 extern void proto_field_set_u32(struct proto_hdr
*hdr
, uint32_t fid
, uint32_t val
);
78 extern uint32_t proto_field_get_u32(struct proto_hdr
*hdr
, uint32_t fid
);
80 extern void proto_field_set_default_bytes(struct proto_hdr
*hdr
, uint32_t fid
,
82 extern void proto_field_set_default_u8(struct proto_hdr
*hdr
, uint32_t fid
,
84 extern void proto_field_set_default_u16(struct proto_hdr
*hdr
, uint32_t fid
,
86 extern void proto_field_set_default_u32(struct proto_hdr
*hdr
, uint32_t fid
,
89 extern void proto_field_set_be16(struct proto_hdr
*hdr
, uint32_t fid
, uint16_t val
);
90 extern void proto_field_set_be32(struct proto_hdr
*hdr
, uint32_t fid
, uint32_t val
);
92 extern void proto_field_set_default_be16(struct proto_hdr
*hdr
, uint32_t fid
,
94 extern void proto_field_set_default_be32(struct proto_hdr
*hdr
, uint32_t fid
,
97 extern void proto_field_set_dev_mac(struct proto_hdr
*hdr
, uint32_t fid
);
98 extern void proto_field_set_default_dev_mac(struct proto_hdr
*hdr
, uint32_t fid
);
100 extern void proto_field_set_dev_ipv4(struct proto_hdr
*hdr
, uint32_t fid
);
101 extern void proto_field_set_default_dev_ipv4(struct proto_hdr
*hdr
, uint32_t fid
);
103 #endif /* TRAFGEN_PROTO_I_H */