EDGESEC  0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
packet_decoder.h File Reference

File containing the definition of the packet decoder utilities. More...

#include <net/if.h>
#include <pcap.h>
#include <utarray.h>
#include "../../../utils/allocs.h"
#include "../../../utils/attributes.h"
#include "../../../utils/net.h"
#include "../../../utils/os.h"
Include dependency graph for packet_decoder.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  tuple_packet
 
struct  eth_schema
 Ethernet protocol schema definition. More...
 
struct  arp_schema
 ARP protocol schema definition. More...
 
struct  ip4_schema
 IP4 protocol schema definition. More...
 
struct  ip6_schema
 IP6 protocol schema definition. More...
 
struct  tcp_schema
 TCP protocol schema definition. More...
 
struct  udp_schema
 UDP protocol schema definition. More...
 
struct  icmp4_schema
 ICMP4 protocol schema definition. More...
 
struct  icmp6_schema
 ICMP6 protocol schema definition. More...
 
struct  dns_schema
 DNS protocol schema definition. More...
 
struct  mdns_schema
 mDNS protocol schema definition More...
 
struct  dhcp_schema
 DHCP protocol schema definition. More...
 
struct  dns_header
 DNS header definition. More...
 
struct  mdns_header
 mDNS header definition More...
 
struct  mdns_query_meta
 mDNS query meta definition More...
 
struct  mdns_answer_meta
 mDNS response meta definition More...
 
struct  dhcp_header
 DHCP header definition (truncated) More...
 
struct  capture_packet
 Capture structure definition. More...
 

Macros

#define MAX_QUESTION_LEN   255
 

Typedefs

typedef enum packet_types PACKET_TYPES
 

Enumerations

enum  packet_types {
  PACKET_NONE = 0 , PACKET_ETHERNET , PACKET_ARP , PACKET_IP4 ,
  PACKET_IP6 , PACKET_TCP , PACKET_UDP , PACKET_ICMP4 ,
  PACKET_ICMP6 , PACKET_DNS , PACKET_MDNS , PACKET_DHCP
}
 

Functions

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...
 

Variables

struct mdns_query_meta STRUCT_PACKED
 

Detailed Description

File containing the definition of the packet decoder utilities.

Author
Alexandru Mereacre
Date
2021

Macro Definition Documentation

◆ MAX_QUESTION_LEN

#define MAX_QUESTION_LEN   255

Typedef Documentation

◆ PACKET_TYPES

typedef enum packet_types PACKET_TYPES

Enumeration Type Documentation

◆ packet_types

Enumerator
PACKET_NONE 
PACKET_ETHERNET 
PACKET_ARP 
PACKET_IP4 
PACKET_IP6 
PACKET_TCP 
PACKET_UDP 
PACKET_ICMP4 
PACKET_ICMP6 
PACKET_DNS 
PACKET_MDNS 
PACKET_DHCP 

Function Documentation

◆ extract_packets()

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.

Parameters
ltypeThe link type
headerThe packet header as per pcap
packetThe packet data
interfaceThe packet interface
tp_arrayThe array of returned packet tuples
Returns
int Total count of packet tuples

Variable Documentation

◆ STRUCT_PACKED

struct dhcp_header STRUCT_PACKED