lib: Add SRv6 flavors manipulation macros

`struct seg6local_context` contains a `struct seg6local_flavors_info`
that carries SRv6 flavors information. The `seg6local_flavors_info`
data structure contains a field `flv_ops` that indicates which flavors
are enabled for the `seg6local` nexthop. `flv_ops` is a bit-map where
each bit indicates if a particular SRv6 flavor is enabled (bit set to
1) or not (bit set to 0).

This commit defines some macros that can be used to manipulate the SRv6
flavors bit-map:
* CHECK_SRV6_FLV_OP(OPS,OP) - check if a particular flavor is enabled;
* SET_SRV6_FLV_OP(OPS,OP) - enable a particular flavor (OP);
* UNSET_SRV6_FLV_OP(OPS,OP) - disable a particular flavor (OP);
* RESET_SRV6_FLV_OP(OPS) - disable all SRv6 flavors.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
This commit is contained in:
Carmine Scarpitta 2023-04-15 18:11:10 +02:00
parent 164bcddab7
commit f26becb27a

View File

@ -24,6 +24,12 @@ extern "C" {
#define sid2str(sid, str, size) \
inet_ntop(AF_INET6, sid, str, size)
/* SRv6 flavors manipulation macros */
#define CHECK_SRV6_FLV_OP(OPS,OP) ((OPS) & (1 << OP))
#define SET_SRV6_FLV_OP(OPS,OP) (OPS) |= (1 << OP)
#define UNSET_SRV6_FLV_OP(OPS,OP) (OPS) &= ~(1 << OP)
#define RESET_SRV6_FLV_OP(OPS) (OPS) = 0
enum seg6_mode_t {
INLINE,
ENCAP,