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

File containing the implementation of the protobuf middleware utilities. More...

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <eloop.h>
#include <libgen.h>
#include <sqlite3.h>
#include <string.h>
#include "protobuf_encoder.h"
#include "protobuf_middleware.h"
#include "../../../utils/allocs.h"
#include "../../../utils/log.h"
#include "../../../utils/os.h"
#include "../../../utils/squeue.h"
#include "../../pcap_service.h"
#include "../header_middleware/packet_decoder.h"
#include "../header_middleware/packet_queue.h"
Include dependency graph for protobuf_middleware.c:

Functions

int pipe_protobuf_tuple_packet (const char *path, int *fd, struct tuple_packet *p)
 pipe the serialised protobuf tuple packets More...
 
int pipe_protobuf_packets (const char *path, int *fd, UT_array *packets)
 pipe the serialised protobuf packets More...
 
void free_protobuf_middleware (struct middleware_context *context)
 
struct middleware_contextinit_protobuf_middleware (sqlite3 *db, char *db_path, struct eloop_data *eloop, struct pcap_context *pc, char *params)
 
int process_protobuf_middleware (struct middleware_context *context, const char *ltype, struct pcap_pkthdr *header, uint8_t *packet, char *ifname)
 

Variables

struct capture_middleware protobuf_middleware
 protobuf Capture Middleware. The protobuf capture middleware generates protobuf messages from caprtured traffic. More...
 

Detailed Description

File containing the implementation of the protobuf middleware utilities.

Author
Alexandru Mereacre
Date
2022

Function Documentation

◆ free_protobuf_middleware()

void free_protobuf_middleware ( struct middleware_context context)

◆ init_protobuf_middleware()

struct middleware_context* init_protobuf_middleware ( sqlite3 *  db,
char *  db_path,
struct eloop_data *  eloop,
struct pcap_context pc,
char *  params 
)

◆ pipe_protobuf_packets()

int pipe_protobuf_packets ( const char *  path,
int *  fd,
UT_array *  packets 
)

pipe the serialised protobuf packets

Parameters
path[in]The pipe file path
fd[in]The pipe file descriptor
packets[in]The array of packets
Returns
0 on success, -1 otherwise

◆ pipe_protobuf_tuple_packet()

int pipe_protobuf_tuple_packet ( const char *  path,
int *  fd,
struct tuple_packet p 
)

pipe the serialised protobuf tuple packets

Parameters
path[in]The pipe file path
fd[in,out]The pipe file descriptor. If 0, this will be set to a new fd pointing to path.
p[in]The tuple packet
Returns
0 on success, -1 otherwise

◆ process_protobuf_middleware()

int process_protobuf_middleware ( struct middleware_context context,
const char *  ltype,
struct pcap_pkthdr *  header,
uint8_t *  packet,
char *  ifname 
)

Variable Documentation

◆ protobuf_middleware

struct capture_middleware protobuf_middleware
Initial value:
= {
.name = "protobuf middleware",
}
int process_protobuf_middleware(struct middleware_context *context, const char *ltype, struct pcap_pkthdr *header, uint8_t *packet, char *ifname)
Definition: protobuf_middleware.c:109
struct middleware_context * init_protobuf_middleware(sqlite3 *db, char *db_path, struct eloop_data *eloop, struct pcap_context *pc, char *params)
Definition: protobuf_middleware.c:77
void free_protobuf_middleware(struct middleware_context *context)
Definition: protobuf_middleware.c:66

protobuf Capture Middleware. The protobuf capture middleware generates protobuf messages from caprtured traffic.

Authors
Alexandru Mereacre