void hex_ascii_string(unsigned char *hex, unsigned char *ascii, unsigned char length) { //unsigned char *ptr = ascii; while (length-- > 0) { *ascii++ = hex_ascii((*hex >> 4) & 0x0F); *ascii++ = hex_ascii(*hex++ & 0x0F); } //return &ascii; }
void dissector_entry_point(uint8_t *packet, size_t len, int linktype, int mode) { struct protocol *proto_start, *proto_end; struct pkt_buff *pkt = NULL; if (mode == PRINT_NONE) return; pkt = pkt_alloc(packet, len); switch (linktype) { case LINKTYPE_EN10MB: case ___constant_swab32(LINKTYPE_EN10MB): proto_start = dissector_get_ethernet_entry_point(); proto_end = dissector_get_ethernet_exit_point(); break; case LINKTYPE_IEEE802_11: case ___constant_swab32(LINKTYPE_IEEE802_11): proto_start = dissector_get_ieee80211_entry_point(); proto_end = dissector_get_ieee80211_exit_point(); break; default: panic("Linktype not supported!\n"); }; dissector_main(pkt, proto_start, proto_end); switch (mode) { case PRINT_HEX: hex(pkt); break; case PRINT_ASCII: ascii(pkt); break; case PRINT_HEX_ASCII: hex_ascii(pkt); break; } tprintf_flush(); pkt_free(pkt); }
void dissector_entry_point(uint8_t *packet, struct frame_map *hdr, int linktype, int mode, char **buffer_pkt, uint8_t *switch_filter, uint8_t *stats) { struct protocol *proto_start = NULL; struct protocol *proto_end = NULL; struct pkt_buff *pkt = NULL; if (mode == FNTTYPE_PRINT_NONE) return; pkt = pkt_alloc(packet, hdr->tp_h.tp_snaplen); switch (linktype) { case LINKTYPE_EN10MB: proto_start = dissector_get_ethernet_entry_point(); proto_end = dissector_get_ethernet_exit_point(); break; default: panic("Linktype not supported!\n"); }; dissector_main(pkt, proto_start, proto_end, buffer_pkt, switch_filter, stats); switch (mode) { case FNTTYPE_PRINT_HEX: hex(pkt); break; case FNTTYPE_PRINT_ASCII: ascii(pkt); break; case FNTTYPE_PRINT_HEX_ASCII: hex_ascii(pkt); break; } tprintf_flush(); pkt_free(pkt); }