BSL v0.0.0
AMMOS Bundle Protocol Security Library (BSL)
Loading...
Searching...
No Matches
SecurityResultSet.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 The Johns Hopkins University Applied Physics
3 * Laboratory LLC.
4 *
5 * This file is part of the Bundle Protocol Security Library (BSL).
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * This work was performed for the Jet Propulsion Laboratory, California
18 * Institute of Technology, sponsored by the United States Government under
19 * the prime contract 80NM0018D0004 between the Caltech and NASA under
20 * subcontract 1700763.
21 */
26#include "SecurityResultSet.h"
27
32
34{
35 CHK_AS_BOOL(self != NULL);
36 CHK_AS_BOOL(self->err_msg[sizeof(self->err_msg) - 1] == '\0');
37 CHK_AS_BOOL(strlen(self->err_msg) < sizeof(self->err_msg));
38 return true;
39}
40
41void BSL_SecurityResponseSet_Init(BSL_SecurityResponseSet_t *self, size_t noperations, size_t nfailed)
42{
43 ASSERT_ARG_NONNULL(self);
44 self->failure_count = nfailed;
45 self->total_operations = noperations;
46 self->err_code = (nfailed == 0 && noperations > 1) ? 0 : 1;
47}
48
50{
51 ASSERT_PRECONDITION(BSL_SecurityResponseSet_IsConsistent(self));
52 memset(self, 0, sizeof(*self));
53}
54
56{
57 ASSERT_PRECONDITION(BSL_SecurityResponseSet_IsConsistent(self));
58 return self->total_operations;
59}
struct BSL_SecurityResponseSet_s BSL_SecurityResponseSet_t
Forward declaration of SecurityResponseSet, which contains information for BSL and the host BPA to pr...
bool BSL_SecurityResponseSet_IsConsistent(const BSL_SecurityResponseSet_t *self)
Return true if internal consistency checks pass.
size_t BSL_SecurityResponseSet_Sizeof()
Returns size of this struct type.
void BSL_SecurityResponseSet_Deinit(BSL_SecurityResponseSet_t *self)
Zeroize itself and release any owned resources.
void BSL_SecurityResponseSet_Init(BSL_SecurityResponseSet_t *self, size_t noperations, size_t nfailed)
Initialize with the given count of operations and nailures.
size_t BSL_SecurityResponseSet_CountResponses(const BSL_SecurityResponseSet_t *self)
Return number of responses (operations acted upon)
SecurityResultSet implementation for result after application of security operations.
Contains the results and outcomes after performing the security operations.