EDGESEC
0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
|
File containing the implementation of the packet decoder utilities. More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/icmp6.h>
#include <netinet/if_ether.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <netinet/ip_icmp.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <pcap.h>
#include "../../../utils/allocs.h"
#include "../../../utils/hash.h"
#include "../../../utils/log.h"
#include "../../../utils/net.h"
#include "../../../utils/os.h"
#include "dns_decoder.h"
#include "mdns_decoder.h"
#include "packet_decoder.h"
Macros | |
#define | _GNU_SOURCE |
#define | LINKTYPE_LINUX_SLL "LINUX_SLL" |
#define | LINKTYPE_ETHERNET "EN10MB" |
#define | IPV6_VERSION 0x60 |
#define | IPV6_VERSION_MASK 0xf0 |
#define | DNS_PORT 53 |
#define | MDNS_PORT 5353 |
#define | DHCP_CLIENT_PORT 68 |
#define | DHCP_SERVER_PORT 67 |
#define | MAX_PACKET_TYPES 10 |
Functions | |
bool | decode_dhcp_packet (struct capture_packet *cpac) |
bool | decode_udp_packet (struct capture_packet *cpac) |
bool | decode_tcp_packet (struct capture_packet *cpac) |
bool | decode_icmp4_packet (struct capture_packet *cpac) |
bool | decode_icmp6_packet (struct capture_packet *cpac) |
bool | decode_ip4_packet (struct capture_packet *cpac) |
bool | decode_ip6_packet (struct capture_packet *cpac) |
bool | decode_arp_packet (struct capture_packet *cpac) |
bool | decode_eth_packet (const struct pcap_pkthdr *header, const uint8_t *packet, struct capture_packet *cpac) |
int | decode_packet (const struct pcap_pkthdr *header, const uint8_t *packet, struct capture_packet *cpac) |
int | extract_packets (const char *ltype, const struct pcap_pkthdr *header, const uint8_t *packet, char *interface, UT_array *tp_array) |
Extract packets from pcap packet data. More... | |
File containing the implementation of the packet decoder utilities.
#define _GNU_SOURCE |
#define DHCP_CLIENT_PORT 68 |
#define DHCP_SERVER_PORT 67 |
#define DNS_PORT 53 |
#define IPV6_VERSION 0x60 |
#define IPV6_VERSION_MASK 0xf0 |
#define LINKTYPE_ETHERNET "EN10MB" |
#define LINKTYPE_LINUX_SLL "LINUX_SLL" |
#define MAX_PACKET_TYPES 10 |
#define MDNS_PORT 5353 |
bool decode_arp_packet | ( | struct capture_packet * | cpac | ) |
bool decode_dhcp_packet | ( | struct capture_packet * | cpac | ) |
bool decode_eth_packet | ( | const struct pcap_pkthdr * | header, |
const uint8_t * | packet, | ||
struct capture_packet * | cpac | ||
) |
bool decode_icmp4_packet | ( | struct capture_packet * | cpac | ) |
bool decode_icmp6_packet | ( | struct capture_packet * | cpac | ) |
bool decode_ip4_packet | ( | struct capture_packet * | cpac | ) |
bool decode_ip6_packet | ( | struct capture_packet * | cpac | ) |
int decode_packet | ( | const struct pcap_pkthdr * | header, |
const uint8_t * | packet, | ||
struct capture_packet * | cpac | ||
) |
bool decode_tcp_packet | ( | struct capture_packet * | cpac | ) |
bool decode_udp_packet | ( | struct capture_packet * | cpac | ) |
int extract_packets | ( | const char * | ltype, |
const struct pcap_pkthdr * | header, | ||
const uint8_t * | packet, | ||
char * | interface, | ||
UT_array * | tp_array | ||
) |
Extract packets from pcap packet data.
ltype | The link type |
header | The packet header as per pcap |
packet | The packet data |
interface | The packet interface |
tp_array | The array of returned packet tuples |