aboutsummaryrefslogtreecommitdiff
path: root/analyzer/utils/pcap.h
blob: 16da7cd0f881df8be94f3cbb222b5306c1e49c3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// utils/pcap.h
// helper functions for usage of libpcap

#include <pcap.h>

// get payload from a TCP/IP packet
// params:
//      - packet - captured packet
//      - packet_data - metadata about packet
//      - payload_len - pointer to save the payload length to or -1 if not a correct packet
//      - tcp_seq - pointer to save the TCP sequence number
// returns:
//      pointer to the payload or NULL if not a correct packet
extern const unsigned char *get_payload_from_packet(const unsigned char *packet, const struct pcap_pkthdr *packet_data, int *payload_len, uint32_t *tcp_seq);