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

Implementation of construct holding details of security operations for a bundle. More...

+ Include dependency graph for SecurityActionSet.c:

Go to the source code of this file.

Functions

bool BSL_SecurityActionSet_IsConsistent (const BSL_SecurityActionSet_t *self)
 Return true if internal sanity and consistency checks pass.
 
size_t BSL_SecurityActionSet_Sizeof (void)
 Returns size of the struct, helpful for dynamic allocation.
 
void BSL_SecurityActionSet_Init (BSL_SecurityActionSet_t *self)
 Initialize a new security action set.
 
void BSL_SecurityActionSet_IncrError (BSL_SecurityActionSet_t *self)
 Increment a security failure for this action set.
 
size_t BSL_SecurityActionSet_CountErrors (const BSL_SecurityActionSet_t *self)
 Returns count of failures after processing this action set.
 
void BSL_SecurityActionSet_Deinit (BSL_SecurityActionSet_t *self)
 Zeroize, clear, and release itself and any owned resources.
 
int BSL_SecurityActionSet_AppendSecOper (BSL_SecurityActionSet_t *self, const BSL_SecOper_t *sec_oper)
 Append a security operation to the security action set.
 
size_t BSL_SecurityActionSet_CountSecOpers (const BSL_SecurityActionSet_t *self)
 Count number of security operations present in this policy action set.
 
const BSL_SecOper_tBSL_SecurityActionSet_GetSecOperAtIndex (const BSL_SecurityActionSet_t *self, size_t index)
 Returns the Security Operation at the given index.
 
int BSL_SecurityActionSet_GetErrCode (const BSL_SecurityActionSet_t *self)
 Get the error code after querying (inspecting) policy actions.
 

Detailed Description

Implementation of construct holding details of security operations for a bundle.

Definition in file SecurityActionSet.c.

Function Documentation

◆ BSL_SecurityActionSet_AppendSecOper()

int BSL_SecurityActionSet_AppendSecOper ( BSL_SecurityActionSet_t self,
const BSL_SecOper_t sec_oper 
)

Append a security operation to the security action set.

Parameters
[in,out]selfThis security action set.
[in]sec_operSecurity operation to include.
Returns
0 on success, negative on error

Definition at line 90 of file SecurityActionSet.c.

References BSL_SecurityActionSet_s::arrays_capacity, BSL_SecOper_IsConsistent(), BSL_SecurityActionSet_IsConsistent(), BSL_SUCCESS, BSL_SecurityActionSet_s::sec_operations, and BSL_SecurityActionSet_s::sec_operations_count.

Referenced by BSLP_QueryPolicy().

◆ BSL_SecurityActionSet_CountErrors()

size_t BSL_SecurityActionSet_CountErrors ( const BSL_SecurityActionSet_t self)

Returns count of failures after processing this action set.

Parameters
[in]selfPointer ot this security action set.
Returns
Count of errors.

Definition at line 72 of file SecurityActionSet.c.

References BSL_SecurityActionSet_IsConsistent(), and BSL_SecurityActionSet_s::err_code.

Referenced by BSLP_QueryPolicy().

◆ BSL_SecurityActionSet_CountSecOpers()

size_t BSL_SecurityActionSet_CountSecOpers ( const BSL_SecurityActionSet_t self)

Count number of security operations present in this policy action set.

Parameters
selfThis action set.
Returns
Number of operations, 0 indicates no policy matched.

Definition at line 102 of file SecurityActionSet.c.

References BSL_SecurityActionSet_IsConsistent(), and BSL_SecurityActionSet_s::sec_operations_count.

Referenced by BSL_SecCtx_ExecutePolicyActionSet(), and BSL_SecurityActionSet_GetSecOperAtIndex().

◆ BSL_SecurityActionSet_Deinit()

void BSL_SecurityActionSet_Deinit ( BSL_SecurityActionSet_t self)

Zeroize, clear, and release itself and any owned resources.

Parameters
selfThis action set.

Definition at line 79 of file SecurityActionSet.c.

References BSL_SecurityActionSet_s::arrays_capacity, BSL_SecOper_Deinit(), BSL_SecurityActionSet_IsConsistent(), and BSL_SecurityActionSet_s::sec_operations.

◆ BSL_SecurityActionSet_GetErrCode()

int BSL_SecurityActionSet_GetErrCode ( const BSL_SecurityActionSet_t self)

Get the error code after querying (inspecting) policy actions.

Non-zero indicates error

Parameters
[in]selfthis action set
Returns
Anomaly on non-zero

Definition at line 121 of file SecurityActionSet.c.

References BSL_SecurityActionSet_IsConsistent(), and BSL_SecurityActionSet_s::err_code.

◆ BSL_SecurityActionSet_GetSecOperAtIndex()

const BSL_SecOper_t * BSL_SecurityActionSet_GetSecOperAtIndex ( const BSL_SecurityActionSet_t self,
size_t  index 
)

Returns the Security Operation at the given index.

Parameters
selfThis action set
indexindex
Returns
pointer to security operation at given index, asserting false if not in bound

Definition at line 108 of file SecurityActionSet.c.

References BSL_SecOper_IsConsistent(), BSL_SecurityActionSet_CountSecOpers(), BSL_SecurityActionSet_IsConsistent(), and BSL_SecurityActionSet_s::sec_operations.

Referenced by BSL_SecCtx_ExecutePolicyActionSet().

◆ BSL_SecurityActionSet_IncrError()

void BSL_SecurityActionSet_IncrError ( BSL_SecurityActionSet_t self)

Increment a security failure for this action set.

Parameters
[in,out]selfPointer to this security action set.

Definition at line 66 of file SecurityActionSet.c.

References BSL_SecurityActionSet_IsConsistent(), and BSL_SecurityActionSet_s::err_code.

Referenced by BSLP_QueryPolicy().

◆ BSL_SecurityActionSet_Init()

void BSL_SecurityActionSet_Init ( BSL_SecurityActionSet_t self)

Initialize a new security action set.

Parameters
[in,out]selfThis pre-allocated action set

Definition at line 56 of file SecurityActionSet.c.

References BSL_SecurityActionSet_s::arrays_capacity, BSL_SecurityActionSet_IsConsistent(), and BSL_SecurityActionSet_s::sec_operations.

Referenced by BSLP_QueryPolicy().

◆ BSL_SecurityActionSet_IsConsistent()

◆ BSL_SecurityActionSet_Sizeof()

size_t BSL_SecurityActionSet_Sizeof ( void  )

Returns size of the struct, helpful for dynamic allocation.

Returns
Size of the struct

Definition at line 51 of file SecurityActionSet.c.

Referenced by BSLP_QueryPolicy().