diff options
| author | Carmine Scarpitta <carmine.scarpitta@uniroma2.it> | 2023-04-15 18:11:10 +0200 |
|---|---|---|
| committer | Carmine Scarpitta <carmine.scarpitta@uniroma2.it> | 2023-09-11 17:35:02 +0200 |
| commit | f26becb27ad64f10fb60e56ab60a0f4507436ef6 (patch) | |
| tree | 8c988b75d909a4413d8fe2fb6195de17ed52e943 /lib/srv6.h | |
| parent | 164bcddab782fba52d57387799cfef5641bedbbf (diff) | |
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>
Diffstat (limited to 'lib/srv6.h')
| -rw-r--r-- | lib/srv6.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/srv6.h b/lib/srv6.h index f5a9431896..111963daa2 100644 --- a/lib/srv6.h +++ b/lib/srv6.h @@ -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, |
