BSL v0.0.0
AMMOS Bundle Protocol Security Library (BSL)
Loading...
Searching...
No Matches
bsl_mock_bpa_eidpat.h
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 */
22
28#ifndef BSL_MOCK_BPA_EIDPAT_H_
29#define BSL_MOCK_BPA_EIDPAT_H_
30
31#include <inttypes.h>
32#include <m-bptree.h>
33#include <m-deque.h>
34
35#include <BPSecLib_Private.h>
36
37#include "bsl_mock_bpa_eid.h"
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
44typedef struct
45{
47 uint64_t first;
49 uint64_t last;
51
52int bsl_eidpat_numrange_seg_cmp(const bsl_eidpat_numrange_seg_t *left, const bsl_eidpat_numrange_seg_t *right);
53bool bsl_eidpat_numrange_seg_overlap(const bsl_eidpat_numrange_seg_t *left, const bsl_eidpat_numrange_seg_t *right);
54
55#define M_OPL_bsl_eidpat_numrange_seg_t() M_OPEXTEND(M_POD_OPLIST, CMP(API_6(bsl_eidpat_numrange_seg_cmp)))
56
63
74
76typedef struct
77{
81 union
82 {
84 uint64_t as_single;
86 bsl_eidpat_numrage_t as_range;
87 } val;
89
90void bsl_eidpat_numcomp_init(bsl_eidpat_numcomp_t *obj);
91void bsl_eidpat_numcomp_deinit(bsl_eidpat_numcomp_t *obj);
92void bsl_eidpat_numcomp_set_form(bsl_eidpat_numcomp_t *obj, bsl_eidpat_numcomp_form_t form);
93int bsl_eidpat_numcomp_from_text(bsl_eidpat_numcomp_t *obj, const char *curs, const char **endptr);
94bool bsl_eidpat_numcomp_match(const bsl_eidpat_numcomp_t *obj, uint64_t val);
95
97typedef struct
98{
103
104void bsl_eidpat_ipn_ssp_init(bsl_eidpat_ipn_ssp_t *obj);
105void bsl_eidpat_ipn_ssp_deinit(bsl_eidpat_ipn_ssp_t *obj);
106bool bsl_eidpat_ipn_ssp_match(const bsl_eidpat_ipn_ssp_t *pat, const bsl_eid_ipn_ssp_t *val);
107
109typedef struct
110{
112 uint64_t scheme;
115
117 union
118 {
121 } ssp;
123
124int bsl_mock_eidpat_item_init(bsl_mock_eidpat_item_t *obj);
125void bsl_mock_eidpat_item_deinit(bsl_mock_eidpat_item_t *obj);
126int mock_bpa_eidpat_item_from_text(bsl_mock_eidpat_item_t *item, const char *text, const char **endptr);
127bool mock_bpa_eidpat_item_match(const bsl_mock_eidpat_item_t *item, const bsl_mock_eid_t *eid);
128
129#define M_OPL_bsl_mock_eidpat_item_t() \
130 (INIT(API_2(bsl_mock_eidpat_item_init)), CLEAR(API_2(bsl_mock_eidpat_item_deinit)))
131
133DEQUE_DEF(bsl_mock_eidpat_item_list, bsl_mock_eidpat_item_t)
135
137typedef struct
138{
142 bsl_mock_eidpat_item_list_t items;
144
146int mock_bpa_eidpat_init(BSL_HostEIDPattern_t *pat, void *user_data);
147
149void mock_bpa_eidpat_deinit(BSL_HostEIDPattern_t *pat, void *user_data);
150
152int mock_bpa_eidpat_from_text(BSL_HostEIDPattern_t *pat, const char *text, void *user_data);
153
155bool mock_bpa_eidpat_match(const BSL_HostEIDPattern_t *pat, const BSL_HostEID_t *eid, void *user_data);
156
157#ifdef __cplusplus
158} // extern C
159#endif
160
161#endif // BSL_MOCK_BPA_EIDPAT_H_
Single entry-point include file for all of the BPSec Lib (BSL) frontend API.
Declarations for EID handling.
void mock_bpa_eidpat_deinit(BSL_HostEIDPattern_t *pat, void *user_data)
Interface for BSL_HostDescriptors_t::eidpat_deinit.
bsl_eidpat_numcomp_form_t
The component type for a numeric tuple pattern.
@ BSL_EIDPAT_NUMCOMP_RANGE
A multi-segment range of values.
@ BSL_EIDPAT_NUMCOMP_SINGLE
A single numeric value.
@ BSL_EIDPAT_NUMCOMP_WILDCARD
This form has no associated value.
bool mock_bpa_eidpat_match(const BSL_HostEIDPattern_t *pat, const BSL_HostEID_t *eid, void *user_data)
Interface for BSL_HostDescriptors_t::eidpat_match.
int mock_bpa_eidpat_from_text(BSL_HostEIDPattern_t *pat, const char *text, void *user_data)
Interface for BSL_HostDescriptors_t::eidpat_from_text.
int mock_bpa_eidpat_init(BSL_HostEIDPattern_t *pat, void *user_data)
Interface for BSL_HostDescriptors_t::eidpat_init.
Reference to a EID pattern owned and stored in the BPA.
Opaque pointer to BPA-specific Endpoint ID storage.
Scheme-specific part for IPN scheme.
Scheme-specific part for IPN scheme.
Each component of a numeric tuple pattern.
bsl_eidpat_numcomp_form_t form
The form of the component val.
bsl_eidpat_numrage_t as_range
Used for BSL_EIDPAT_NUMCOMP_RANGE.
uint64_t as_single
Used for BSL_EIDPAT_NUMCOMP_SINGLE.
An ordered set of range segments with fast lookup.
A single numeric range segment pair.
uint64_t last
The last value in this segment, also used to sort segments.
uint64_t first
The first value in this segment.
Struct to be used as a BSL_HostEID_t::handle.
One item of an EID Pattern.
bool any_ssp
True if this is a match-any-SSP item.
uint64_t scheme
Code point for EID schemes from .
bsl_eidpat_ipn_ssp_t as_ipn
Used when scheme is BSL_MOCK_EID_IPN.
Struct to be used as a BSL_HostEIDPattern_t::handle.
bsl_mock_eidpat_item_list_t items
The list of pattern items, or an empty list to indicate the any-scheme pattern.