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

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

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "../../../utils/allocs.h"
#include "../../../utils/log.h"
#include "../../../utils/os.h"
#include "../header_middleware/packet_decoder.h"
#include "arp.pb-c.h"
#include "dhcp.pb-c.h"
#include "dns.pb-c.h"
#include "eth.pb-c.h"
#include "icmp4.pb-c.h"
#include "icmp6.pb-c.h"
#include "ip4.pb-c.h"
#include "ip6.pb-c.h"
#include "mdns.pb-c.h"
#include "sync.pb-c.h"
#include "tcp.pb-c.h"
#include "udp.pb-c.h"
#include "protobuf_utils.h"
Include dependency graph for protobuf_encoder.c:

Functions

ssize_t encode_eth_packet (const struct eth_schema *eths, uint8_t **buffer)
 
ssize_t encode_arp_packet (const struct arp_schema *arps, uint8_t **buffer)
 
ssize_t encode_ip4_pcaket (const struct ip4_schema *ip4s, uint8_t **buffer)
 
ssize_t encode_ip6_packet (const struct ip6_schema *ip6s, uint8_t **buffer)
 
ssize_t encode_tcp_packet (const struct tcp_schema *tcps, uint8_t **buffer)
 
ssize_t encode_udp_packet (const struct udp_schema *udps, uint8_t **buffer)
 
ssize_t encode_icmp4_packet (const struct icmp4_schema *icmp4s, uint8_t **buffer)
 
ssize_t encode_icmp6_packet (const struct icmp6_schema *icmp6s, uint8_t **buffer)
 
ssize_t encode_dns_packet (const struct dns_schema *dnss, uint8_t **buffer)
 
ssize_t encode_mdsn_packet (const struct mdns_schema *mdnss, uint8_t **buffer)
 
ssize_t encode_dhcp_packet (struct dhcp_schema *dhcps, uint8_t **buffer)
 
ssize_t encode_protobuf_packet (const struct tuple_packet *tp, uint8_t **buffer)
 
ssize_t encode_protobuf_sync_delimited (const PACKET_TYPES type, uint8_t *packet_buffer, size_t length, uint8_t **buffer)
 
ssize_t encode_protobuf_sync_wrapper (struct tuple_packet *tp, uint8_t **buffer)
 Encodes the packet into a wrapper protobuf message. More...
 

Detailed Description

File containing the implementation of the protobuf encoder utilities.

Author
Alexandru Mereacre
Date
2022

Function Documentation

◆ encode_arp_packet()

ssize_t encode_arp_packet ( const struct arp_schema arps,
uint8_t **  buffer 
)

◆ encode_dhcp_packet()

ssize_t encode_dhcp_packet ( struct dhcp_schema dhcps,
uint8_t **  buffer 
)

◆ encode_dns_packet()

ssize_t encode_dns_packet ( const struct dns_schema dnss,
uint8_t **  buffer 
)

◆ encode_eth_packet()

ssize_t encode_eth_packet ( const struct eth_schema eths,
uint8_t **  buffer 
)

◆ encode_icmp4_packet()

ssize_t encode_icmp4_packet ( const struct icmp4_schema icmp4s,
uint8_t **  buffer 
)

◆ encode_icmp6_packet()

ssize_t encode_icmp6_packet ( const struct icmp6_schema icmp6s,
uint8_t **  buffer 
)

◆ encode_ip4_pcaket()

ssize_t encode_ip4_pcaket ( const struct ip4_schema ip4s,
uint8_t **  buffer 
)

◆ encode_ip6_packet()

ssize_t encode_ip6_packet ( const struct ip6_schema ip6s,
uint8_t **  buffer 
)

◆ encode_mdsn_packet()

ssize_t encode_mdsn_packet ( const struct mdns_schema mdnss,
uint8_t **  buffer 
)

◆ encode_protobuf_packet()

ssize_t encode_protobuf_packet ( const struct tuple_packet tp,
uint8_t **  buffer 
)

◆ encode_protobuf_sync_delimited()

ssize_t encode_protobuf_sync_delimited ( const PACKET_TYPES  type,
uint8_t *  packet_buffer,
size_t  length,
uint8_t **  buffer 
)

◆ encode_protobuf_sync_wrapper()

ssize_t encode_protobuf_sync_wrapper ( struct tuple_packet tp,
uint8_t **  buffer 
)

Encodes the packet into a wrapper protobuf message.

Parameters
[in]tpThe packet
[out]bufferThe encoded wrapper protobuf packet
Returns
the output buffer size, -1 on failure

◆ encode_tcp_packet()

ssize_t encode_tcp_packet ( const struct tcp_schema tcps,
uint8_t **  buffer 
)

◆ encode_udp_packet()

ssize_t encode_udp_packet ( const struct udp_schema udps,
uint8_t **  buffer 
)