github.com/sagernet/netlink@v0.0.0-20240612041022-b9a21c07ac6a/nl/seg6local_linux.go (about)

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