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

File containing the definition of the capture service. More...

#include <pcap.h>
#include <sqlite3.h>
#include <eloop.h>
#include "capture_config.h"
#include "pcap_service.h"
Include dependency graph for capture_service.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  capture_middleware_context
 

Macros

#define DB_BUSY_TIMEOUT   5000
 

Functions

void pcap_callback (const void *ctx, const void *pcap_ctx, char *ltype, struct pcap_pkthdr *header, uint8_t *packet)
 Callback for pcap packet module. More...
 
int get_pcap_folder_path (char *capture_db_path, char *pcap_path)
 Return the pcap folder path. More...
 
int run_capture (struct capture_middleware_context *context)
 Runs the capture service. More...
 
void free_capture_context (struct capture_middleware_context *context)
 Frees the capture context. More...
 
int run_capture_thread (char *ifname, struct capture_conf const *config, pthread_t *id)
 Runs the capture service thread. More...
 

Detailed Description

File containing the definition of the capture service.

Author
Alexandru Mereacre
Date
2021

Macro Definition Documentation

◆ DB_BUSY_TIMEOUT

#define DB_BUSY_TIMEOUT   5000

Function Documentation

◆ free_capture_context()

void free_capture_context ( struct capture_middleware_context context)

Frees the capture context.

Parameters
contextThe middleware context

◆ get_pcap_folder_path()

int get_pcap_folder_path ( char *  capture_db_path,
char *  pcap_path 
)

Return the pcap folder path.

Parameters
capture_db_pathThe capture db path
pcap_pathThe returned pcap folder path
Returns
int 0 on success, -1 on failure

◆ pcap_callback()

void pcap_callback ( const void *  ctx,
const void *  pcap_ctx,
char *  ltype,
struct pcap_pkthdr *  header,
uint8_t *  packet 
)

Callback for pcap packet module.

Parameters
ctxThe capture context
pcap_ctxThe pcap context
ltypeThe link type
headerpcap header structure
packetReturned pcap packet

◆ run_capture()

int run_capture ( struct capture_middleware_context context)

Runs the capture service.

Parameters
contextThe middleware context
Returns
int 0 on success, -1 on failure

◆ run_capture_thread()

int run_capture_thread ( char *  ifname,
struct capture_conf const *  config,
pthread_t *  id 
)

Runs the capture service thread.

Parameters
ifnameThe capture interface name
configThe capture service config structure
[out]idThe returned thread id
Returns
int 0 on success, -1 on error