EDGESEC  0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
Macros | Functions
sqlite_header.c File Reference

File containing the implementation of the sqlite header utilities. More...

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sqlite3.h>
#include <string.h>
#include "../../../utils/allocs.h"
#include "../../../utils/log.h"
#include "../../../utils/os.h"
#include "../../../utils/sqliteu.h"
#include "packet_decoder.h"
#include "sqlite_header.h"
Include dependency graph for sqlite_header.c:

Macros

#define EXTRACT_META_PACKET(term, tp)
 

Functions

int extract_eth_statement (sqlite3 *db, struct eth_schema *eths)
 
int extract_arp_statement (sqlite3 *db, struct arp_schema *arps)
 
int extract_ip4_statement (sqlite3 *db, struct ip4_schema *ip4s)
 
int extract_ip6_statement (sqlite3 *db, struct ip6_schema *ip6s)
 
int extract_tcp_statement (sqlite3 *db, struct tcp_schema *tcps)
 
int extract_udp_statement (sqlite3 *db, struct udp_schema *udps)
 
int extract_icmp4_statement (sqlite3 *db, struct icmp4_schema *icmp4s)
 
int extract_icmp6_statement (sqlite3 *db, struct icmp6_schema *icmp6s)
 
int extract_dns_statement (sqlite3 *db, struct dns_schema *dnss)
 
int extract_mdsn_statement (sqlite3 *db, struct mdns_schema *mdnss)
 
int extract_dhcp_statement (sqlite3 *db, struct dhcp_schema *dhcps)
 
int save_packet_statement (sqlite3 *db, struct tuple_packet *tp)
 Save packets to sqlite db. More...
 
int init_sqlite_header_db (sqlite3 *db)
 Initialises the sqlite3 header db tables. More...
 

Detailed Description

File containing the implementation of the sqlite header utilities.

Author
Alexandru Mereacre
Date
2021

Macro Definition Documentation

◆ EXTRACT_META_PACKET

#define EXTRACT_META_PACKET (   term,
  tp 
)
Value:
term.hash = tp->mp.hash; \
term.timestamp = tp->mp.timestamp; \
term.caplen = tp->mp.caplen; \
term.length = tp->mp.length;

Function Documentation

◆ extract_arp_statement()

int extract_arp_statement ( sqlite3 *  db,
struct arp_schema arps 
)

◆ extract_dhcp_statement()

int extract_dhcp_statement ( sqlite3 *  db,
struct dhcp_schema dhcps 
)

◆ extract_dns_statement()

int extract_dns_statement ( sqlite3 *  db,
struct dns_schema dnss 
)

◆ extract_eth_statement()

int extract_eth_statement ( sqlite3 *  db,
struct eth_schema eths 
)

◆ extract_icmp4_statement()

int extract_icmp4_statement ( sqlite3 *  db,
struct icmp4_schema icmp4s 
)

◆ extract_icmp6_statement()

int extract_icmp6_statement ( sqlite3 *  db,
struct icmp6_schema icmp6s 
)

◆ extract_ip4_statement()

int extract_ip4_statement ( sqlite3 *  db,
struct ip4_schema ip4s 
)

◆ extract_ip6_statement()

int extract_ip6_statement ( sqlite3 *  db,
struct ip6_schema ip6s 
)

◆ extract_mdsn_statement()

int extract_mdsn_statement ( sqlite3 *  db,
struct mdns_schema mdnss 
)

◆ extract_tcp_statement()

int extract_tcp_statement ( sqlite3 *  db,
struct tcp_schema tcps 
)

◆ extract_udp_statement()

int extract_udp_statement ( sqlite3 *  db,
struct udp_schema udps 
)

◆ init_sqlite_header_db()

int init_sqlite_header_db ( sqlite3 *  db)

Initialises the sqlite3 header db tables.

Parameters
dbThe sqlite3 db
Returns
0 on success, -1 on failure

◆ save_packet_statement()

int save_packet_statement ( sqlite3 *  db,
struct tuple_packet tp 
)

Save packets to sqlite db.

Parameters
dbThe sqlite3 db
tpThe packet tuple structure
Returns
int 0 on success, -1 o failure