BSL v0.0.0
AMMOS Bundle Protocol Security Library (BSL)
Loading...
Searching...
No Matches
mock_bpa.c File Reference

This is the main entry for a mock BPA daemon that communicates through unix domain sockets. More...

#include <arpa/inet.h>
#include <errno.h>
#include <m-atomic.h>
#include <m-buffer.h>
#include <netdb.h>
#include <poll.h>
#include <signal.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/un.h>
#include <unistd.h>
#include <BPSecLib_Private.h>
#include <BPSecLib_Public.h>
#include "bsl_mock_bpa.h"
#include "mock_bpa_ctr.h"
#include <security_context/DefaultSecContext.h>
#include <policy_provider/SamplePolicyProvider.h>
+ Include dependency graph for mock_bpa.c:

Go to the source code of this file.

Macros

#define DATA_QUEUE_SIZE   100
 

Functions

 BUFFER_DEF (data_queue, mock_bpa_ctr_t, DATA_QUEUE_SIZE, BUFFER_QUEUE|BUFFER_THREAD_SAFE|BUFFER_PUSH_INIT_POP_MOVE|BUFFER_BLOCKING) static data_queue_t over_rx
 
static int ingest_netaddr (struct sockaddr_in6 *addr, const char *optarg)
 
static int bind_udp (int *sock, const struct sockaddr_in6 *addr)
 
static int mock_bpa_process (BSL_PolicyLocation_e loc, MockBPA_Bundle_t *bundle)
 
static void sig_stop (int signum)
 
static void * work_over_rx (void *arg)
 
static void * work_under_rx (void *arg)
 
static void * work_deliver (void *arg)
 
static void * work_forward (void *arg)
 
static int bpa_init (void)
 
static int bpa_exec (void)
 
static void bpa_cleanup (void)
 
static void show_usage (const char *argv0)
 
int main (int argc, char **argv)
 

Variables

static atomic_bool stop_state
 
static data_queue_t over_tx
 
static data_queue_t under_rx
 
static data_queue_t under_tx
 
static data_queue_t deliver
 
static data_queue_t forward
 
static pthread_t thr_over_rx
 
static pthread_t thr_under_rx
 
static pthread_t thr_deliver
 
static pthread_t thr_forward
 
static BSL_LibCtx_tbsl
 
static BSL_HostEID_t app_eid
 
static struct sockaddr_in6 over_addr = { .sin6_family = 0 }
 
static struct sockaddr_in6 app_addr = { .sin6_family = 0 }
 
static struct sockaddr_in6 under_addr = { .sin6_family = 0 }
 
static struct sockaddr_in6 router_addr = { .sin6_family = 0 }
 
static int tx_notify_r
 
static int tx_notify_w
 
static BSL_HostEID_t sec_eid
 

Detailed Description

This is the main entry for a mock BPA daemon that communicates through unix domain sockets.

Definition in file mock_bpa.c.

Macro Definition Documentation

◆ DATA_QUEUE_SIZE

#define DATA_QUEUE_SIZE   100

Definition at line 46 of file mock_bpa.c.

Function Documentation

◆ bind_udp()

static int bind_udp ( int *  sock,
const struct sockaddr_in6 *  addr 
)
static

Definition at line 113 of file mock_bpa.c.

◆ bpa_cleanup()

static void bpa_cleanup ( void  )
static

Definition at line 517 of file mock_bpa.c.

◆ bpa_exec()

static int bpa_exec ( void  )
static

Definition at line 362 of file mock_bpa.c.

◆ bpa_init()

static int bpa_init ( void  )
static

Definition at line 315 of file mock_bpa.c.

◆ ingest_netaddr()

static int ingest_netaddr ( struct sockaddr_in6 *  addr,
const char *  optarg 
)
static

Definition at line 72 of file mock_bpa.c.

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 575 of file mock_bpa.c.

◆ mock_bpa_process()

static int mock_bpa_process ( BSL_PolicyLocation_e  loc,
MockBPA_Bundle_t bundle 
)
static

Definition at line 138 of file mock_bpa.c.

◆ show_usage()

static void show_usage ( const char *  argv0)
static

Definition at line 563 of file mock_bpa.c.

◆ sig_stop()

static void sig_stop ( int  signum)
static

Definition at line 173 of file mock_bpa.c.

◆ work_deliver()

static void * work_deliver ( void *  arg)
static

Definition at line 243 of file mock_bpa.c.

◆ work_forward()

static void * work_forward ( void *  arg)
static

Definition at line 279 of file mock_bpa.c.

◆ work_over_rx()

static void * work_over_rx ( void *  arg)
static

Definition at line 179 of file mock_bpa.c.

◆ work_under_rx()

static void * work_under_rx ( void *  arg)
static

Definition at line 208 of file mock_bpa.c.

Variable Documentation

◆ app_addr

struct sockaddr_in6 app_addr = { .sin6_family = 0 }
static

Definition at line 66 of file mock_bpa.c.

◆ app_eid

BSL_HostEID_t app_eid
static

Definition at line 64 of file mock_bpa.c.

◆ bsl

BSL_LibCtx_t* bsl
static

Definition at line 61 of file mock_bpa.c.

◆ deliver

data_queue_t deliver
static

Definition at line 55 of file mock_bpa.c.

◆ forward

data_queue_t forward
static

Definition at line 56 of file mock_bpa.c.

◆ over_addr

struct sockaddr_in6 over_addr = { .sin6_family = 0 }
static

Definition at line 65 of file mock_bpa.c.

◆ over_tx

data_queue_t over_tx
static

Definition at line 52 of file mock_bpa.c.

◆ router_addr

struct sockaddr_in6 router_addr = { .sin6_family = 0 }
static

Definition at line 68 of file mock_bpa.c.

◆ sec_eid

BSL_HostEID_t sec_eid
static

Definition at line 70 of file mock_bpa.c.

◆ stop_state

atomic_bool stop_state
static

Definition at line 44 of file mock_bpa.c.

◆ thr_deliver

pthread_t thr_deliver
static

Definition at line 58 of file mock_bpa.c.

◆ thr_forward

pthread_t thr_forward
static

Definition at line 58 of file mock_bpa.c.

◆ thr_over_rx

pthread_t thr_over_rx
static

Definition at line 58 of file mock_bpa.c.

◆ thr_under_rx

pthread_t thr_under_rx
static

Definition at line 58 of file mock_bpa.c.

◆ tx_notify_r

int tx_notify_r
static

Definition at line 69 of file mock_bpa.c.

◆ tx_notify_w

int tx_notify_w
static

Definition at line 69 of file mock_bpa.c.

◆ under_addr

struct sockaddr_in6 under_addr = { .sin6_family = 0 }
static

Definition at line 67 of file mock_bpa.c.

◆ under_rx

data_queue_t under_rx
static

Definition at line 53 of file mock_bpa.c.

◆ under_tx

data_queue_t under_tx
static

Definition at line 54 of file mock_bpa.c.