From: Carmine Scarpitta Date: Thu, 20 Feb 2025 09:08:03 +0000 (+0100) Subject: lib: Add a function to convert SR Policy Headend Behaviors into string X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=8f7af2e42cb32fed5eadc0153d32a297b1894a18;p=mirror%2Ffrr.git lib: Add a function to convert SR Policy Headend Behaviors into string This commit adds a function to convert SR Policy Headend Behaviors into string format for printing. Signed-off-by: Carmine Scarpitta --- diff --git a/lib/srv6.h b/lib/srv6.h index 24b387ec4e..b25241adfa 100644 --- a/lib/srv6.h +++ b/lib/srv6.h @@ -345,6 +345,24 @@ struct srv6_sid_ctx { ifindex_t ifindex; }; +static inline const char *srv6_headend_behavior2str(enum srv6_headend_behavior behavior) +{ + switch (behavior) { + case SRV6_HEADEND_BEHAVIOR_H_INSERT: + return "H.Insert"; + case SRV6_HEADEND_BEHAVIOR_H_ENCAPS: + return "H.Encaps"; + case SRV6_HEADEND_BEHAVIOR_H_ENCAPS_RED: + return "H.Encaps.Red"; + case SRV6_HEADEND_BEHAVIOR_H_ENCAPS_L2: + return "H.Encaps.L2"; + case SRV6_HEADEND_BEHAVIOR_H_ENCAPS_L2_RED: + return "H.Encaps.L2.Red"; + } + + return "unknown"; +} + static inline const char *seg6_mode2str(enum seg6_mode_t mode) { switch (mode) {