diff options
| author | Hiroki Shirokura <hiroki.shirokura@linecorp.com> | 2022-01-22 11:07:40 +0000 |
|---|---|---|
| committer | Louis Scalbert <louis.scalbert@6wind.com> | 2023-04-18 10:11:43 +0200 |
| commit | 81a067cd9251b60a04bbc8133546e790044fa790 (patch) | |
| tree | a9082b7945b7da51ad54df3adb73b4013205d070 /lib/segment_routing.c | |
| parent | 7f8dddf4300911a8d125d53f87eb64598e2bbcf8 (diff) | |
lib,isisd: refactor igp-agnostic sr misc functions
SR Algorithms are independent of specific IGPs
such as IS-IS. This commit adds lib/sr to
aggregate IGP agnostic functions and constants.
Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com>
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Diffstat (limited to 'lib/segment_routing.c')
| -rw-r--r-- | lib/segment_routing.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/segment_routing.c b/lib/segment_routing.c new file mode 100644 index 0000000000..f45a64d29a --- /dev/null +++ b/lib/segment_routing.c @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/********************************************************************* + * Copyright 2022 Hiroki Shirokura, LINE Corporation + * Copyright 2022 Masakazu Asama + * Copyright 2022 6WIND S.A. + * + * segment_routing.c: Segment-Routing Library + * + * Authors + * ------- + * Hiroki Shirokura + * Masakazu Asama + * Louis Scalbert + */ + +#include "segment_routing.h" + +const char *sr_algorithm_string(uint8_t algo) +{ + switch (algo) { + case SR_ALGORITHM_SPF: + return "SPF"; + case SR_ALGORITHM_STRICT_SPF: + return "Strict SPF"; + case SR_ALGORITHM_UNSET: + return "Unset"; + default: + return algo >= SR_ALGORITHM_FLEX_MIN ? "Flex-Algo" : "Unknown"; + } +} |
