BSL v0.0.0 - 0.g33cf081
AMMOS Bundle Protocol Security Library (BSL)
Loading...
Searching...
No Matches
agent.h File Reference

Declarations for Agent initialization. More...

#include "ctr.h"
#include "policy_registry.h"
#include <BPSecLib_Public.h>
#include <BPSecLib_Private.h>
#include <policy_provider/SamplePolicyProvider.h>
#include <m-atomic.h>
#include <m-buffer.h>
#include <m-string.h>
#include <arpa/inet.h>
#include <pthread.h>
#include <inttypes.h>
+ Include dependency graph for agent.h:
+ This graph shows which files directly or indirectly include this file:

Data Structures

struct  MockBPA_Agent_BSL_Ctx_t
 Each BSL context and its associated control state. More...
 
struct  MockBPA_Agent_t
 Overall Mock BPA state above any particular bundle handling. More...
 

Macros

#define MOCKBPA_DATA_QUEUE_SIZE   100
 Queue size for bundle queues.
 

Functions

int MockBPA_GetBundleMetadata (const BSL_BundleRef_t *bundle_ref, BSL_PrimaryBlock_t *result_primary_block)
 
int MockBPA_GetBlockNums (const BSL_BundleRef_t *bundle_ref, size_t block_id_array_capacity, uint64_t *block_id_array_result, size_t *result_count)
 
int MockBPA_GetBlockMetadata (const BSL_BundleRef_t *bundle_ref, uint64_t block_num, BSL_CanonicalBlock_t *result_canonical_block)
 
int MockBPA_ReallocBTSD (BSL_BundleRef_t *bundle_ref, uint64_t block_num, size_t bytesize)
 
int MockBPA_CreateBlock (BSL_BundleRef_t *bundle_ref, uint64_t block_type_code, uint64_t *result_block_num)
 
int MockBPA_RemoveBlock (BSL_BundleRef_t *bundle_ref, uint64_t block_num)
 
int MockBPA_DeleteBundle (BSL_BundleRef_t *bundle_ref, BSL_ReasonCode_t reason)
 
BSL_HostDescriptors_t MockBPA_Agent_Descriptors (MockBPA_Agent_t *agent)
 Get host descriptors without a specific agent.
 
int MockBPA_Agent_Init (MockBPA_Agent_t *agent)
 Initialize and register this mock BPA for the current process.
 
void MockBPA_Agent_Deinit (MockBPA_Agent_t *agent)
 Clean up the mock BPA for the current process.
 
int MockBPA_Agent_Start (MockBPA_Agent_t *agent)
 Start worker threads.
 
void MockBPA_Agent_Stop (MockBPA_Agent_t *agent)
 Stop an agent from another thread or a signal handler.
 
int MockBPA_Agent_Exec (MockBPA_Agent_t *agent)
 Execute the main thread activity while work threads are running.
 
int MockBPA_Agent_Join (MockBPA_Agent_t *agent)
 Wait for and join worker threads.
 

Detailed Description

Declarations for Agent initialization.

Function Documentation

◆ MockBPA_Agent_Deinit()

◆ MockBPA_Agent_Descriptors()

BSL_HostDescriptors_t MockBPA_Agent_Descriptors ( MockBPA_Agent_t agent)

Get host descriptors without a specific agent.

Parameters
[in]agentThe agent to associate as user data.

References agent, bsl_mock_decode_eid(), bsl_mock_encode_eid(), mock_bpa_eid_from_text(), MockBPA_EID_Deinit(), MockBPA_EID_Init(), and BSL_HostDescriptors_t::user_data.

Referenced by main().

◆ MockBPA_Agent_Exec()

◆ MockBPA_Agent_Init()

◆ MockBPA_Agent_Join()

int MockBPA_Agent_Join ( MockBPA_Agent_t agent)

Wait for and join worker threads.

Parameters
[out]agentThe agent to start threads for.
Returns
Zero if successful.
See also
MockBPA_Agent_Start()

References agent, BSL_LOG_ERR, BSL_LOG_INFO, MockBPA_Agent_t::deliver, MockBPA_Agent_t::forward, MockBPA_Agent_t::over_rx, MockBPA_Agent_t::thr_over_rx, and MockBPA_Agent_t::under_rx.

Referenced by main().

◆ MockBPA_Agent_Start()

int MockBPA_Agent_Start ( MockBPA_Agent_t agent)

Start worker threads.

Parameters
[out]agentThe agent to start threads for.
Returns
Zero if successful.
See also
MockBPA_Agent_Join()

References agent, and MockBPA_Agent_t::thr_over_rx.

Referenced by main().

◆ MockBPA_Agent_Stop()

void MockBPA_Agent_Stop ( MockBPA_Agent_t agent)

Stop an agent from another thread or a signal handler.

Parameters
[in,out]agentThe agent to set the stopping state on.

References agent, BSL_LOG_ERR, MockBPA_Agent_t::stop_state, and MockBPA_Agent_t::tx_notify_w.