BSL v1.1.1 - 39.g9f43410
AMMOS Bundle Protocol Security Library (BSL)
Loading...
Searching...
No Matches
PolicyParser.h File Reference

Entry point for the sample policy provider of the BSL. More...

#include "SamplePolicyProvider.h"
#include "bsl/BPSecLib_Private.h"
#include "bsl/default_sc/rfc9173.h"
#include <inttypes.h>
#include <stdio.h>
+ Include dependency graph for PolicyParser.h:
+ This graph shows which files directly or indirectly include this file:

Typedefs

typedef uint32_t BSLP_PolicyParser_BitstringConfig_t
 Bitwise Diagram of the mock bpa config data structure:
 

Functions

int BSLP_PolicyParser_FromJSON (const char *policy_cfg_path, BSLP_PolicyProvider_t *policy)
 Initialize local policy provider from JSON file.
 
int BSLP_PolicyParser_FromBitstringList (const char *policies, BSLP_PolicyProvider_t *policy)
 Initialize local policy provider from list of bit strings.
 

Detailed Description

Entry point for the sample policy provider of the BSL.

Configuration input is handled by PolicyParser.h functions.

Typedef Documentation

◆ BSLP_PolicyParser_BitstringConfig_t

Bitwise Diagram of the mock bpa config data structure:

uint32_t : BSLP_PolicyParser_BitstringConfig_t
[ x x x x | x x x x | x x x x | x x x x ]
[ --------- unused -------] | | [---] [---] [---] | |
| | | | | | |
"Don't care": set EIDs s.t. -| | | | | | |
bundle doens't match any rule -| | | | | | |
| | | | | |
Use Wrapped Key for BCB -| | | | | |
| | | | |
BSL Role: 00 - source, 01 - verifier, -| | | | |
10 - acceptor, 11: undefined -| | | | |
| | | |
Policy Action: 00 - nothing, 01 - drop block, -| | | |
10 - drop bundle, 11: undefined -| | | |
| | |
Target Block Type: 00 - primary, 01 - payload, -| | |
10 - private/experimental (192), 11 - bundle age -| | |
| |
Target Block Type: -| | |
Policy Location: 0 - CLOUT, 1 - CLIN -| |
|
Sec Block Type: 0 - BIB, 1 - BCB -|

Function Documentation

◆ BSLP_PolicyParser_FromBitstringList()

int BSLP_PolicyParser_FromBitstringList ( const char *  policies,
BSLP_PolicyProvider_t policy 
)

Initialize local policy provider from list of bit strings.

Parameters
[in]policiescomma separated policy bit strings as described by BSLP_PolicyParser_BitstringConfig_t
[in,out]policypolicy provider to configure. Must be initialize/allocated

References BSL_LOG_ERR, BSL_SUCCESS, BSLP_RegisterPolicyFromBitstring(), CHK_ARG_NONNULL, and policy.

Referenced by main().

◆ BSLP_PolicyParser_FromJSON()

int BSLP_PolicyParser_FromJSON ( const char *  policy_cfg_path,
BSLP_PolicyProvider_t policy 
)

Initialize local policy provider from JSON file.

Parameters
[in]policy_cfg_pathpath to JSON file containing policy configuration
[in,out]policypolicy provider to configure. Must be initialize/allocated

References BSL_ERR_POLICY_CONFIG, BSL_LOG_DEBUG, BSL_LOG_ERR, BSL_SUCCESS, BSLP_PolicyParser_ReadOneRule(), CHK_ARG_NONNULL, and policy.

Referenced by main(), test_PolicyParser_ReadConfigEmpty(), test_PolicyParser_ReadConfigInvalid(), and test_PolicyParser_ReadConfigValid().