Changeset 41ab052 for libpacketdump
- Timestamp:
- 05/25/06 18:46:51 (15 years ago)
- Branches:
- 4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
- Children:
- 701e164
- Parents:
- 49e3fff
- Location:
- libpacketdump/parser
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libpacketdump/parser/Makefile.am
rfc3dcfa r41ab052 3 3 4 4 #libparser_la_SOURCES = libconfig.c libconfig.h config_internal.h config.lexer.c config.parser.h configuration.h config.parser.c 5 libparser_la_SOURCES = parser.lexer.c parser.tab.c parser.h 5 libparser_la_SOURCES = parser.lexer.c parser.tab.c parser.h bitbuffer.c 6 6 libparser_la_LIBADD = @ADD_LIBS@ @LEXLIB@ 7 7 libparser_la_LDFLAGS = @ADD_LDFLAGS@ -L../ -
libpacketdump/parser/parser.h
rf6c2d8d r41ab052 53 53 void decode_protocol_file(uint16_t link_type,char *packet,int len, element_t* el); 54 54 55 typedef uint64_t bitbuffer_t; 55 56 #endif -
libpacketdump/parser/parser.y
rf6c2d8d r41ab052 12 12 #define YYERROR_VERBOSE 1 13 13 14 typedef uint64_t bitbuffer_t;15 14 16 15 int yylex(void); … … 150 149 %% 151 150 151 #include "bitbuffer.h" 152 152 153 element_t* parse_protocol_file(char *filename) 153 154 { … … 172 173 173 174 174 bitbuffer_t getbit(void **packet, int *packlen, uint64_t numbits)175 {176 bitbuffer_t ret;177 bitbuffer_t one = 1;178 179 /* While the buffer is not filled up and there is still180 * data in the packet to read, read a byte...181 *182 * The buffer gets filled from right to left183 */184 while(bits < (sizeof(bitbuffer_t)-1)*8 && *packlen > 0)185 {186 /* read in one byte from the packet */187 buffer |= ((* ((bitbuffer_t*)*packet) )&0xff) << bits;188 /* update the position within the packet */189 *packet = ((char*)*packet) + 1;190 191 bits += 8;192 *packlen -= 1;193 }194 195 /* our return value is the last <numbits> of the buffer */196 ret = buffer & ( (one<<numbits) -1);197 198 /* remove the bits that are being returned from out buffer */199 buffer >>= numbits;200 201 /* and update our position inside this buffer */202 bits -= numbits;203 204 return ret;205 }206 175 207 176 … … 371 340 372 341 decode_next(packet, len, el->data->nextheader->prefix, 373 el->data->nextheader->target->value);342 ntohs(el->data->nextheader->target->value)); 374 343 break; 375 344 };
Note: See TracChangeset
for help on using the changeset viewer.