52 uint64_t max_first = (left->
first > right->
first) ? left->
first : right->first;
53 uint64_t min_last = (left->
last < right->
last) ? left->
last : right->last;
54 return (max_first <= min_last);
73 if (obj->
form == form)
90static int one_uint64_from_text(uint64_t *val,
const char *curs,
const char **endptr)
93 *val = strtoul(curs, &pend, 10);
103int bsl_eidpat_numcomp_from_text(
bsl_eidpat_numcomp_t *obj,
const char *curs,
const char **endptr)
117 else if (*curs ==
'[')
123 const char *range_end = strchr(curs,
']');
124 while (curs < range_end)
129 if (one_uint64_from_text(&seg.
first, curs, &pend))
140 if (one_uint64_from_text(&seg.
last, curs, &pend))
154 if (!bsl_eidpat_numrage_empty_p(obj->
val.
as_range))
156 bsl_eidpat_numrage_it_t existing;
157 bsl_eidpat_numrage_it_from(existing, obj->
val.
as_range, seg);
158 if (bsl_eidpat_numrage_end_p(existing))
160 near_low = bsl_eidpat_numrage_max(obj->
val.
as_range);
164 near_high = bsl_eidpat_numrage_cref(existing);
169 if (near_low && bsl_eidpat_numrange_seg_overlap(&seg, near_low))
174 if (near_high && bsl_eidpat_numrange_seg_overlap(&seg, near_high))
194 if (one_uint64_from_text(&obj->
val.
as_single, curs, &pend))
221 bsl_eidpat_numrage_it_t it;
222 bsl_eidpat_numrage_it_from(it, obj->
val.
as_range, key);
223 if (bsl_eidpat_numrage_end_p(it))
228 return ((val >= found->
first) && (val <= found->last));
236 bsl_eidpat_numcomp_init(&(obj->auth));
237 bsl_eidpat_numcomp_init(&(obj->node));
238 bsl_eidpat_numcomp_init(&(obj->svc));
243 bsl_eidpat_numcomp_deinit(&(obj->auth));
244 bsl_eidpat_numcomp_deinit(&(obj->node));
245 bsl_eidpat_numcomp_deinit(&(obj->svc));
250 return (bsl_eidpat_numcomp_match(&(pat->auth), val->
auth_num)
251 && bsl_eidpat_numcomp_match(&(pat->node), val->
node_num)
252 && bsl_eidpat_numcomp_match(&(pat->svc), val->
svc_num));
266 bsl_eidpat_ipn_ssp_deinit(&(obj->
ssp.
as_ipn));
281 bsl_mock_eidpat_item_deinit(item);
283 const char *curs = text;
284 const char *pend = strchr(text,
':');
289 size_t scheme_len = pend - text;
292 if (strncasecmp(text,
"ipn", scheme_len) == 0)
296 if (strncmp(curs,
"**", 2) == 0)
304 bsl_eidpat_ipn_ssp_init(ipn_ssp);
306 if (bsl_eidpat_numcomp_from_text(&ipn_ssp->auth, curs, &pend))
308 bsl_eidpat_ipn_ssp_deinit(ipn_ssp);
314 bsl_eidpat_ipn_ssp_deinit(ipn_ssp);
319 if (bsl_eidpat_numcomp_from_text(&ipn_ssp->node, curs, &pend))
321 bsl_eidpat_ipn_ssp_deinit(ipn_ssp);
327 bsl_eidpat_ipn_ssp_deinit(ipn_ssp);
332 if (bsl_eidpat_numcomp_from_text(&ipn_ssp->svc, curs, &pend))
334 bsl_eidpat_ipn_ssp_deinit(ipn_ssp);
384 bsl_mock_eidpat_item_list_init(obj->
items);
392 bsl_mock_eidpat_item_list_clear(pat->
items);
401 bsl_mock_eidpat_deinit(pat->
handle);
415 bsl_mock_eidpat_item_list_reset(obj->
items);
417 const char *curs = text;
418 const char *end = curs + strlen(text);
421 bool match_all =
false;
422 if (strcmp(curs,
"*:**") == 0)
432 if (mock_bpa_eidpat_item_from_text(item, curs, &pend))
434 bsl_mock_eidpat_item_list_reset(obj->
items);
446 if (match_all ^ bsl_mock_eidpat_item_list_empty_p(obj->
items))
464 if (bsl_mock_eidpat_item_list_empty_p(patobj->
items))
469 bsl_mock_eidpat_item_list_it_t it;
470 for (bsl_mock_eidpat_item_list_it(it, patobj->
items); !bsl_mock_eidpat_item_list_end_p(it);
471 bsl_mock_eidpat_item_list_next(it))
474 if (mock_bpa_eidpat_item_match(item, eidobj))
Single entry-point include file for all of the BPSec Lib (BSL) frontend API.
#define CHKVOID(cond)
Return from void functions if condition fails.
#define _U_
Mark an unused parameter Within a function definition.
#define CHKERR1(cond)
Return the error value 1 if condition fails.
#define BSL_LOG_ERR(...)
This is an overloaded member function, provided for convenience. It differs from the above function o...
@ BSL_MOCK_EID_IPN
The "ipn" scheme.
Declarations for EID Pattern handling.
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.
Reference to a EID pattern owned and stored in the BPA.
void * handle
Opaque pointer for BPA backend to use.
Opaque pointer to BPA-specific Endpoint ID storage.
void * handle
Opaque pointer for BPA backend to use.
Scheme-specific part for IPN scheme.
uint64_t svc_num
The service number component.
uint64_t node_num
The node number component.
uint64_t auth_num
The authority number component.
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.
union bsl_eidpat_numcomp_t::@1 val
The component value interpreted according to form.
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.
union bsl_mock_eid_t::@0 ssp
Interpreted according to scheme code.
bsl_eid_ipn_ssp_t as_ipn
Used when scheme is BSL_MOCK_EID_IPN.
uint64_t scheme
Code point for EID schemes from .
One item of an EID Pattern.
bool any_ssp
True if this is a match-any-SSP item.
union bsl_mock_eidpat_item_t::@2 ssp
Interpreted according to scheme code when any_ssp is false.
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.