Example #1
0
/*
 * This is the entry point for the packet dissector machine. It is 
 * developed for being as generic as possible, so that other linktypes
 * can be implemented, too. Only the direct entry point functions
 * that are linktype specific are called.
 */
void dissector_entry_point(uint8_t *packet, size_t len, int linktype)
{
	struct protocol *proto_start = NULL;
	struct protocol *proto_end = NULL;

	switch (linktype) {
	case LINKTYPE_EN10MB:
		proto_start = dissector_get_ethernet_entry_point();
		proto_end = dissector_get_ethernet_exit_point();
		break;
	default:
		return;
	};

	dissector_main(packet, len, proto_start, proto_end);
}
Example #2
0
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);
}
Example #3
0
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);
}