source: libpacketdump/parser/grammar.h @ af980d5

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since af980d5 was af980d5, checked in by Shane Alcock <salcock@…>, 15 years ago

Captain Spelling, ahoy!

  • Property mode set to 100644
File size: 1.3 KB
Line 
1#ifndef _PARSER_H
2#define _PARSER_H
3
4#include <stdint.h>
5
6enum node_type_t {
7    NEXTHEADER,
8    FIELD
9};
10
11enum byte_order_t {
12    BIGENDIAN,
13    LITTLEENDIAN
14}; 
15
16enum display_t {
17    DISPLAY_NONE,
18    DISPLAY_HEX,
19    DISPLAY_INT,
20    DISPLAY_IPV4,
21    DISPLAY_MAC,
22    DISPLAY_FLAG
23};
24
25/* This is more complicated that I feel it needs to be... */
26
27typedef struct next {
28    char *prefix;                   /* search prefix for nextheader file */
29    char *fieldname;                /* name of the field whose value we use */
30    struct field *target;           /* link to the field whose value we use */
31} next_t;
32   
33typedef struct field {
34    enum byte_order_t order;        /* byte order of field */
35    uint16_t size;                  /* size of the field in bits */
36    enum display_t display;         /* how the data should be displayed */
37    char *identifier;               /* display prefix + field identifier */
38    uint64_t value;                 /* calculated value for this field */
39} field_t; 
40
41typedef union node {
42    field_t *field;
43    next_t *nextheader;
44} node_t;
45
46typedef struct element {
47    enum node_type_t type;
48    struct element *next;
49    node_t *data;
50} element_t;
51   
52element_t *parse_protocol_file(char *filename);
53void decode_protocol_file(uint16_t link_type,char *packet,int len, element_t* el);
54
55typedef uint64_t bitbuffer_t;
56#endif
Note: See TracBrowser for help on using the repository browser.