seg6local_linux.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package nl
  2. import ()
  3. // seg6local parameters
  4. const (
  5. SEG6_LOCAL_UNSPEC = iota
  6. SEG6_LOCAL_ACTION
  7. SEG6_LOCAL_SRH
  8. SEG6_LOCAL_TABLE
  9. SEG6_LOCAL_NH4
  10. SEG6_LOCAL_NH6
  11. SEG6_LOCAL_IIF
  12. SEG6_LOCAL_OIF
  13. __SEG6_LOCAL_MAX
  14. )
  15. const (
  16. SEG6_LOCAL_MAX = __SEG6_LOCAL_MAX
  17. )
  18. // seg6local actions
  19. const (
  20. SEG6_LOCAL_ACTION_END = iota + 1 // 1
  21. SEG6_LOCAL_ACTION_END_X // 2
  22. SEG6_LOCAL_ACTION_END_T // 3
  23. SEG6_LOCAL_ACTION_END_DX2 // 4
  24. SEG6_LOCAL_ACTION_END_DX6 // 5
  25. SEG6_LOCAL_ACTION_END_DX4 // 6
  26. SEG6_LOCAL_ACTION_END_DT6 // 7
  27. SEG6_LOCAL_ACTION_END_DT4 // 8
  28. SEG6_LOCAL_ACTION_END_B6 // 9
  29. SEG6_LOCAL_ACTION_END_B6_ENCAPS // 10
  30. SEG6_LOCAL_ACTION_END_BM // 11
  31. SEG6_LOCAL_ACTION_END_S // 12
  32. SEG6_LOCAL_ACTION_END_AS // 13
  33. SEG6_LOCAL_ACTION_END_AM // 14
  34. __SEG6_LOCAL_ACTION_MAX
  35. )
  36. const (
  37. SEG6_LOCAL_ACTION_MAX = __SEG6_LOCAL_ACTION_MAX - 1
  38. )
  39. // Helper functions
  40. func SEG6LocalActionString(action int) string {
  41. switch action {
  42. case SEG6_LOCAL_ACTION_END:
  43. return "End"
  44. case SEG6_LOCAL_ACTION_END_X:
  45. return "End.X"
  46. case SEG6_LOCAL_ACTION_END_T:
  47. return "End.T"
  48. case SEG6_LOCAL_ACTION_END_DX2:
  49. return "End.DX2"
  50. case SEG6_LOCAL_ACTION_END_DX6:
  51. return "End.DX6"
  52. case SEG6_LOCAL_ACTION_END_DX4:
  53. return "End.DX4"
  54. case SEG6_LOCAL_ACTION_END_DT6:
  55. return "End.DT6"
  56. case SEG6_LOCAL_ACTION_END_DT4:
  57. return "End.DT4"
  58. case SEG6_LOCAL_ACTION_END_B6:
  59. return "End.B6"
  60. case SEG6_LOCAL_ACTION_END_B6_ENCAPS:
  61. return "End.B6.Encaps"
  62. case SEG6_LOCAL_ACTION_END_BM:
  63. return "End.BM"
  64. case SEG6_LOCAL_ACTION_END_S:
  65. return "End.S"
  66. case SEG6_LOCAL_ACTION_END_AS:
  67. return "End.AS"
  68. case SEG6_LOCAL_ACTION_END_AM:
  69. return "End.AM"
  70. }
  71. return "unknown"
  72. }