Refactored packet API to support struct layer (using union to contain different types of encapsulation headers)
This commit is contained in:
@@ -95,7 +95,7 @@ static void packet_to_tshark_format(const struct packet *pkt, uint64_t idx)
|
||||
memset(tmp_src_buff, 0, sizeof(tmp_src_buff));
|
||||
memset(tmp_dst_buff, 0, sizeof(tmp_dst_buff));
|
||||
const struct raw_layer *layer = packet_get_raw_layer(pkt, i);
|
||||
switch (layer->type)
|
||||
switch (layer->proto)
|
||||
{
|
||||
case LAYER_PROTO_ETHER:
|
||||
buffer_push(&buff_proto, "eth:ethertype");
|
||||
@@ -232,6 +232,7 @@ static void packet_handler(u_char *user, const struct pcap_pkthdr *h, const u_ch
|
||||
struct options *opts = (struct options *)user;
|
||||
|
||||
struct packet pkt;
|
||||
memset(&pkt, 0, sizeof(pkt));
|
||||
packet_parse(&pkt, (const char *)bytes, h->caplen);
|
||||
number++;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user