|
BSL v1.0.0 - 16.g9d98179
AMMOS Bundle Protocol Security Library (BSL)
|
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. | |
Declarations for Agent initialization.
| #define MOCKBPA_DATA_QUEUE_SIZE 100 |
Queue size for bundle queues.
| void MockBPA_Agent_Deinit | ( | MockBPA_Agent_t * | agent | ) |
Clean up the mock BPA for the current process.
| [out] | agent | The agent to deinitialize. |
References agent, MockBPA_Agent_t::appin, MockBPA_Agent_t::appout, BSL_API_DeinitLib(), BSL_free(), BSL_LOG_ERR, MockBPA_Agent_t::clin, MockBPA_Agent_t::clout, ctx, MockBPA_Agent_t::deliver, MockBPA_Agent_t::forward, MockBPA_Agent_t::over_rx, MockBPA_Agent_t::over_tx, MockBPA_Agent_t::tx_notify_r, MockBPA_Agent_t::tx_notify_w, MockBPA_Agent_t::under_rx, and MockBPA_Agent_t::under_tx.
Referenced by main().
| BSL_HostDescriptors_t MockBPA_Agent_Descriptors | ( | MockBPA_Agent_t * | agent | ) |
Get host descriptors without a specific agent.
| [in] | agent | The agent to associate as user data. |
References agent, bsl_mock_decode_eid(), bsl_mock_encode_eid(), mock_bpa_eid_from_text(), mock_bpa_eidpat_deinit(), mock_bpa_eidpat_from_text(), mock_bpa_eidpat_init(), mock_bpa_eidpat_match(), mock_bpa_LogEvent(), mock_bpa_LogIsEnabledFor(), MockBPA_CreateBlock(), MockBPA_DeleteBundle(), MockBPA_EID_Deinit(), MockBPA_EID_Init(), MockBPA_GetBlockMetadata(), MockBPA_GetBundleMetadata(), MockBPA_GetEid(), MockBPA_ReadBTSD(), MockBPA_ReallocBTSD(), MockBPA_RemoveBlock(), MockBPA_WriteBTSD(), and BSL_HostDescriptors_t::user_data.
Referenced by LLVMFuzzerInitialize(), main(), and suiteSetUp().
| int MockBPA_Agent_Exec | ( | MockBPA_Agent_t * | agent | ) |
Execute the main thread activity while work threads are running.
This will block until MockBPA_Agent_Stop() is called.
| [out] | agent | The agent to work for. |
References agent, MockBPA_Agent_t::app_addr, bind_udp(), BSL_Data_AppendFrom(), BSL_LOG_DEBUG, BSL_LOG_ERR, BSL_LOG_INFO, buf, mock_bpa_ctr_t::encoded, BSL_Data_t::len, mock_bpa_ctr_deinit(), mock_bpa_ctr_init(), MockBPA_Agent_t::over_addr, MockBPA_Agent_t::over_rx, MockBPA_Agent_t::over_tx, BSL_Data_t::ptr, MockBPA_Agent_t::router_addr, MockBPA_Agent_t::stop_state, MockBPA_Agent_t::tx_notify_r, MockBPA_Agent_t::under_addr, MockBPA_Agent_t::under_rx, and MockBPA_Agent_t::under_tx.
Referenced by main().
| int MockBPA_Agent_Init | ( | MockBPA_Agent_t * | agent | ) |
Initialize and register this mock BPA for the current process.
| [out] | agent | The agent to initialize. |
References agent, MockBPA_Agent_t::app_addr, MockBPA_Agent_t::appin, MockBPA_Agent_t::appout, ASSERT_PROPERTY, MockBPA_Agent_BSL_Ctx_t::bsl, BSL_API_InitLib(), BSL_API_RegisterPolicyProvider(), BSL_API_RegisterSecurityContext(), BSL_calloc(), BSL_LibCtx_Sizeof(), BSL_LOG_ERR, BSL_SUCCESS, BSLP_Deinit(), BSLP_FinalizePolicy(), BSLP_QueryPolicy(), BSLX_BCB_Execute(), BSLX_BCB_Validate(), BSLX_BIB_Execute(), BSLX_BIB_Validate(), MockBPA_Agent_t::clin, MockBPA_Agent_t::clout, ctx, MockBPA_Agent_t::deliver, MockBPA_Agent_t::forward, MOCKBPA_DATA_QUEUE_SIZE, MockBPA_Agent_t::over_addr, MockBPA_Agent_t::over_rx, MockBPA_Agent_t::over_tx, MockBPA_Agent_BSL_Ctx_t::policy, BSLP_PolicyProvider_t::pp_id, MockBPA_Agent_t::router_addr, MockBPA_Agent_t::stop_state, MockBPA_Agent_t::tx_notify_r, MockBPA_Agent_t::tx_notify_w, MockBPA_Agent_t::under_addr, MockBPA_Agent_t::under_rx, and MockBPA_Agent_t::under_tx.
Referenced by main().
| int MockBPA_Agent_Join | ( | MockBPA_Agent_t * | agent | ) |
Wait for and join worker threads.
| [out] | agent | The agent to start threads for. |
References agent, BSL_LOG_ERR, BSL_LOG_INFO, MockBPA_Agent_t::deliver, MockBPA_Agent_t::forward, mock_bpa_ctr_init(), MockBPA_Agent_t::over_rx, MockBPA_Agent_t::thr_deliver, MockBPA_Agent_t::thr_forward, MockBPA_Agent_t::thr_over_rx, MockBPA_Agent_t::thr_under_rx, and MockBPA_Agent_t::under_rx.
Referenced by main().
| int MockBPA_Agent_Start | ( | MockBPA_Agent_t * | agent | ) |
Start worker threads.
| [out] | agent | The agent to start threads for. |
References agent, MockBPA_Agent_work_deliver(), MockBPA_Agent_work_forward(), MockBPA_Agent_work_over_rx(), MockBPA_Agent_work_under_rx(), MockBPA_Agent_t::thr_deliver, MockBPA_Agent_t::thr_forward, MockBPA_Agent_t::thr_over_rx, and MockBPA_Agent_t::thr_under_rx.
Referenced by main().
| void MockBPA_Agent_Stop | ( | MockBPA_Agent_t * | agent | ) |
Stop an agent from another thread or a signal handler.
| [in,out] | agent | The agent to set the stopping state on. |
References agent, BSL_LOG_ERR, buf, MockBPA_Agent_t::stop_state, and MockBPA_Agent_t::tx_notify_w.
Referenced by sig_stop().
| int MockBPA_CreateBlock | ( | BSL_BundleRef_t * | bundle_ref, |
| uint64_t | block_type_code, | ||
| uint64_t * | result_block_num | ||
| ) |
References MockBPA_CanonicalBlock_t::blk_num, MockBPA_CanonicalBlock_t::blk_type, MockBPA_Bundle_t::blocks, MockBPA_Bundle_t::blocks_num, MockBPA_CanonicalBlock_t::btsd, MockBPA_CanonicalBlock_t::btsd_len, MockBPA_CanonicalBlock_t::crc_type, BSL_BundleRef_t::data, and MockBPA_CanonicalBlock_t::flags.
Referenced by MockBPA_Agent_Descriptors().
| int MockBPA_DeleteBundle | ( | BSL_BundleRef_t * | bundle_ref, |
| BSL_ReasonCode_t | reason | ||
| ) |
References BSL_LOG_INFO, BSL_BundleRef_t::data, and MockBPA_Bundle_t::retain.
Referenced by MockBPA_Agent_Descriptors().
| int MockBPA_GetBlockMetadata | ( | const BSL_BundleRef_t * | bundle_ref, |
| uint64_t | block_num, | ||
| BSL_CanonicalBlock_t * | result_canonical_block | ||
| ) |
References MockBPA_CanonicalBlock_t::blk_num, MockBPA_CanonicalBlock_t::blk_type, BSL_CanonicalBlock_t::block_num, MockBPA_Bundle_t::blocks_num, BSL_CanonicalBlock_t::btsd_len, MockBPA_CanonicalBlock_t::btsd_len, BSL_CanonicalBlock_t::crc_type, MockBPA_CanonicalBlock_t::crc_type, BSL_BundleRef_t::data, BSL_CanonicalBlock_t::flags, MockBPA_CanonicalBlock_t::flags, and BSL_CanonicalBlock_t::type_code.
Referenced by MockBPA_Agent_Descriptors().
| 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_GetBundleMetadata | ( | const BSL_BundleRef_t * | bundle_ref, |
| BSL_PrimaryBlock_t * | result_primary_block | ||
| ) |
References MockBPA_PrimaryBlock_t::adu_length, MockBPA_CanonicalBlock_t::blk_num, BSL_PrimaryBlock_t::block_count, BSL_PrimaryBlock_t::block_numbers, MockBPA_Bundle_t::blocks, BSL_calloc(), BSL_Data_InitView(), MockBPA_CreationTimestamp_t::bundle_creation_time, MockBPA_PrimaryBlock_t::crc_type, BSL_BundleRef_t::data, MockBPA_PrimaryBlock_t::dest_eid, BSL_PrimaryBlock_t::encoded, MockBPA_PrimaryBlock_t::encoded, BSL_PrimaryBlock_t::field_adu_length, BSL_PrimaryBlock_t::field_bundle_creation_time, BSL_PrimaryBlock_t::field_crc_type, BSL_PrimaryBlock_t::field_dest_eid, BSL_PrimaryBlock_t::field_flags, BSL_PrimaryBlock_t::field_frag_offset, BSL_PrimaryBlock_t::field_lifetime, BSL_PrimaryBlock_t::field_report_to_eid, BSL_PrimaryBlock_t::field_seq_num, BSL_PrimaryBlock_t::field_src_node_id, BSL_PrimaryBlock_t::field_version, MockBPA_PrimaryBlock_t::flags, MockBPA_PrimaryBlock_t::frag_offset, BSL_Data_t::len, MockBPA_PrimaryBlock_t::lifetime, MockBPA_Bundle_t::primary_block, BSL_Data_t::ptr, MockBPA_PrimaryBlock_t::report_to_eid, MockBPA_CreationTimestamp_t::seq_num, MockBPA_PrimaryBlock_t::src_node_id, MockBPA_PrimaryBlock_t::timestamp, and MockBPA_PrimaryBlock_t::version.
Referenced by MockBPA_Agent_Descriptors().
| int MockBPA_ReallocBTSD | ( | BSL_BundleRef_t * | bundle_ref, |
| uint64_t | block_num, | ||
| size_t | bytesize | ||
| ) |
References MockBPA_Bundle_t::blocks_num, BSL_calloc(), BSL_realloc(), MockBPA_CanonicalBlock_t::btsd, MockBPA_CanonicalBlock_t::btsd_len, and BSL_BundleRef_t::data.
Referenced by MockBPA_Agent_Descriptors().
| int MockBPA_RemoveBlock | ( | BSL_BundleRef_t * | bundle_ref, |
| uint64_t | block_num | ||
| ) |