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

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

#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <libgen.h>
#include <pthread.h>
#include <unistd.h>
#include "capture_config.h"
#include "capture_service.h"
#include "pcap_service.h"
#include <eloop.h>
#include "../utils/allocs.h"
#include "../utils/log.h"
#include "../utils/os.h"
#include "../utils/sockctl.h"
#include "../utils/squeue.h"
#include "middlewares_list.h"
Include dependency graph for capture_service.c:

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...
 
void eloop_read_fd_handler (int sock, void *eloop_ctx, void *sock_ctx)
 
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...
 
void * capture_thread (void *arg)
 
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 implementation of the capture service.

Author
Alexandru Mereacre
Date
2021

Function Documentation

◆ capture_thread()

void* capture_thread ( void *  arg)

◆ eloop_read_fd_handler()

void eloop_read_fd_handler ( int  sock,
void *  eloop_ctx,
void *  sock_ctx 
)

◆ free_capture_context()

void free_capture_context ( struct capture_middleware_context context)

Frees the capture context.

Parameters
contextThe middleware context

◆ 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