github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/span/span.ba.go (about) 1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT. 2 // versions: 3 // binapi-generator: v0.10.0-dev 4 // VPP: 23.10-rc0~170-g6f1548434 5 // source: core/span.api.json 6 7 // Package span contains generated bindings for API file span.api. 8 // 9 // Contents: 10 // - 1 enum 11 // - 4 messages 12 package span 13 14 import ( 15 "strconv" 16 17 interface_types "github.com/networkservicemesh/govpp/binapi/interface_types" 18 api "go.fd.io/govpp/api" 19 codec "go.fd.io/govpp/codec" 20 ) 21 22 // This is a compile-time assertion to ensure that this generated file 23 // is compatible with the GoVPP api package it is being compiled against. 24 // A compilation error at this line likely means your copy of the 25 // GoVPP api package needs to be updated. 26 const _ = api.GoVppAPIPackageIsVersion2 27 28 const ( 29 APIFile = "span" 30 APIVersion = "2.0.0" 31 VersionCrc = 0x34ee02b 32 ) 33 34 // SpanState defines enum 'span_state'. 35 type SpanState uint32 36 37 const ( 38 SPAN_STATE_API_DISABLED SpanState = 0 39 SPAN_STATE_API_RX SpanState = 1 40 SPAN_STATE_API_TX SpanState = 2 41 SPAN_STATE_API_RX_TX SpanState = 3 42 ) 43 44 var ( 45 SpanState_name = map[uint32]string{ 46 0: "SPAN_STATE_API_DISABLED", 47 1: "SPAN_STATE_API_RX", 48 2: "SPAN_STATE_API_TX", 49 3: "SPAN_STATE_API_RX_TX", 50 } 51 SpanState_value = map[string]uint32{ 52 "SPAN_STATE_API_DISABLED": 0, 53 "SPAN_STATE_API_RX": 1, 54 "SPAN_STATE_API_TX": 2, 55 "SPAN_STATE_API_RX_TX": 3, 56 } 57 ) 58 59 func (x SpanState) String() string { 60 s, ok := SpanState_name[uint32(x)] 61 if ok { 62 return s 63 } 64 return "SpanState(" + strconv.Itoa(int(x)) + ")" 65 } 66 67 // Reply to SPAN dump request 68 // - sw_if_index_from - mirrored interface 69 // - sw_if_index_to - interface where the traffic is mirrored 70 // - state - 0 = disabled, 1 = rx enabled, 2 = tx enabled, 3 tx & rx enabled 71 // - is_l2 - 0 = mirrored at hw device level, 1 = mirrored at l2 72 // 73 // SwInterfaceSpanDetails defines message 'sw_interface_span_details'. 74 type SwInterfaceSpanDetails struct { 75 SwIfIndexFrom interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index_from" json:"sw_if_index_from,omitempty"` 76 SwIfIndexTo interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index_to" json:"sw_if_index_to,omitempty"` 77 State SpanState `binapi:"span_state,name=state" json:"state,omitempty"` 78 IsL2 bool `binapi:"bool,name=is_l2" json:"is_l2,omitempty"` 79 } 80 81 func (m *SwInterfaceSpanDetails) Reset() { *m = SwInterfaceSpanDetails{} } 82 func (*SwInterfaceSpanDetails) GetMessageName() string { return "sw_interface_span_details" } 83 func (*SwInterfaceSpanDetails) GetCrcString() string { return "8a20e79f" } 84 func (*SwInterfaceSpanDetails) GetMessageType() api.MessageType { 85 return api.ReplyMessage 86 } 87 88 func (m *SwInterfaceSpanDetails) Size() (size int) { 89 if m == nil { 90 return 0 91 } 92 size += 4 // m.SwIfIndexFrom 93 size += 4 // m.SwIfIndexTo 94 size += 4 // m.State 95 size += 1 // m.IsL2 96 return size 97 } 98 func (m *SwInterfaceSpanDetails) Marshal(b []byte) ([]byte, error) { 99 if b == nil { 100 b = make([]byte, m.Size()) 101 } 102 buf := codec.NewBuffer(b) 103 buf.EncodeUint32(uint32(m.SwIfIndexFrom)) 104 buf.EncodeUint32(uint32(m.SwIfIndexTo)) 105 buf.EncodeUint32(uint32(m.State)) 106 buf.EncodeBool(m.IsL2) 107 return buf.Bytes(), nil 108 } 109 func (m *SwInterfaceSpanDetails) Unmarshal(b []byte) error { 110 buf := codec.NewBuffer(b) 111 m.SwIfIndexFrom = interface_types.InterfaceIndex(buf.DecodeUint32()) 112 m.SwIfIndexTo = interface_types.InterfaceIndex(buf.DecodeUint32()) 113 m.State = SpanState(buf.DecodeUint32()) 114 m.IsL2 = buf.DecodeBool() 115 return nil 116 } 117 118 // SPAN dump request 119 // - is_l2 - 0 = hw device level, 1 = L2 120 // 121 // SwInterfaceSpanDump defines message 'sw_interface_span_dump'. 122 type SwInterfaceSpanDump struct { 123 IsL2 bool `binapi:"bool,name=is_l2" json:"is_l2,omitempty"` 124 } 125 126 func (m *SwInterfaceSpanDump) Reset() { *m = SwInterfaceSpanDump{} } 127 func (*SwInterfaceSpanDump) GetMessageName() string { return "sw_interface_span_dump" } 128 func (*SwInterfaceSpanDump) GetCrcString() string { return "d6cf0c3d" } 129 func (*SwInterfaceSpanDump) GetMessageType() api.MessageType { 130 return api.RequestMessage 131 } 132 133 func (m *SwInterfaceSpanDump) Size() (size int) { 134 if m == nil { 135 return 0 136 } 137 size += 1 // m.IsL2 138 return size 139 } 140 func (m *SwInterfaceSpanDump) Marshal(b []byte) ([]byte, error) { 141 if b == nil { 142 b = make([]byte, m.Size()) 143 } 144 buf := codec.NewBuffer(b) 145 buf.EncodeBool(m.IsL2) 146 return buf.Bytes(), nil 147 } 148 func (m *SwInterfaceSpanDump) Unmarshal(b []byte) error { 149 buf := codec.NewBuffer(b) 150 m.IsL2 = buf.DecodeBool() 151 return nil 152 } 153 154 // Enable/Disable span to mirror traffic from one interface to another 155 // - sw_if_index_from - interface to be mirrored 156 // - sw_if_index_to - interface where the traffic is mirrored 157 // - state - 0 = disabled, 1 = rx enabled, 2 = tx enabled, 3 tx & rx enabled 158 // - is_l2 - 0 = mirror at hw device level, 1 = mirror at L2 159 // 160 // SwInterfaceSpanEnableDisable defines message 'sw_interface_span_enable_disable'. 161 type SwInterfaceSpanEnableDisable struct { 162 SwIfIndexFrom interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index_from" json:"sw_if_index_from,omitempty"` 163 SwIfIndexTo interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index_to" json:"sw_if_index_to,omitempty"` 164 State SpanState `binapi:"span_state,name=state" json:"state,omitempty"` 165 IsL2 bool `binapi:"bool,name=is_l2" json:"is_l2,omitempty"` 166 } 167 168 func (m *SwInterfaceSpanEnableDisable) Reset() { *m = SwInterfaceSpanEnableDisable{} } 169 func (*SwInterfaceSpanEnableDisable) GetMessageName() string { 170 return "sw_interface_span_enable_disable" 171 } 172 func (*SwInterfaceSpanEnableDisable) GetCrcString() string { return "23ddd96b" } 173 func (*SwInterfaceSpanEnableDisable) GetMessageType() api.MessageType { 174 return api.RequestMessage 175 } 176 177 func (m *SwInterfaceSpanEnableDisable) Size() (size int) { 178 if m == nil { 179 return 0 180 } 181 size += 4 // m.SwIfIndexFrom 182 size += 4 // m.SwIfIndexTo 183 size += 4 // m.State 184 size += 1 // m.IsL2 185 return size 186 } 187 func (m *SwInterfaceSpanEnableDisable) Marshal(b []byte) ([]byte, error) { 188 if b == nil { 189 b = make([]byte, m.Size()) 190 } 191 buf := codec.NewBuffer(b) 192 buf.EncodeUint32(uint32(m.SwIfIndexFrom)) 193 buf.EncodeUint32(uint32(m.SwIfIndexTo)) 194 buf.EncodeUint32(uint32(m.State)) 195 buf.EncodeBool(m.IsL2) 196 return buf.Bytes(), nil 197 } 198 func (m *SwInterfaceSpanEnableDisable) Unmarshal(b []byte) error { 199 buf := codec.NewBuffer(b) 200 m.SwIfIndexFrom = interface_types.InterfaceIndex(buf.DecodeUint32()) 201 m.SwIfIndexTo = interface_types.InterfaceIndex(buf.DecodeUint32()) 202 m.State = SpanState(buf.DecodeUint32()) 203 m.IsL2 = buf.DecodeBool() 204 return nil 205 } 206 207 // SwInterfaceSpanEnableDisableReply defines message 'sw_interface_span_enable_disable_reply'. 208 type SwInterfaceSpanEnableDisableReply struct { 209 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 210 } 211 212 func (m *SwInterfaceSpanEnableDisableReply) Reset() { *m = SwInterfaceSpanEnableDisableReply{} } 213 func (*SwInterfaceSpanEnableDisableReply) GetMessageName() string { 214 return "sw_interface_span_enable_disable_reply" 215 } 216 func (*SwInterfaceSpanEnableDisableReply) GetCrcString() string { return "e8d4e804" } 217 func (*SwInterfaceSpanEnableDisableReply) GetMessageType() api.MessageType { 218 return api.ReplyMessage 219 } 220 221 func (m *SwInterfaceSpanEnableDisableReply) Size() (size int) { 222 if m == nil { 223 return 0 224 } 225 size += 4 // m.Retval 226 return size 227 } 228 func (m *SwInterfaceSpanEnableDisableReply) Marshal(b []byte) ([]byte, error) { 229 if b == nil { 230 b = make([]byte, m.Size()) 231 } 232 buf := codec.NewBuffer(b) 233 buf.EncodeInt32(m.Retval) 234 return buf.Bytes(), nil 235 } 236 func (m *SwInterfaceSpanEnableDisableReply) Unmarshal(b []byte) error { 237 buf := codec.NewBuffer(b) 238 m.Retval = buf.DecodeInt32() 239 return nil 240 } 241 242 func init() { file_span_binapi_init() } 243 func file_span_binapi_init() { 244 api.RegisterMessage((*SwInterfaceSpanDetails)(nil), "sw_interface_span_details_8a20e79f") 245 api.RegisterMessage((*SwInterfaceSpanDump)(nil), "sw_interface_span_dump_d6cf0c3d") 246 api.RegisterMessage((*SwInterfaceSpanEnableDisable)(nil), "sw_interface_span_enable_disable_23ddd96b") 247 api.RegisterMessage((*SwInterfaceSpanEnableDisableReply)(nil), "sw_interface_span_enable_disable_reply_e8d4e804") 248 } 249 250 // Messages returns list of all messages in this module. 251 func AllMessages() []api.Message { 252 return []api.Message{ 253 (*SwInterfaceSpanDetails)(nil), 254 (*SwInterfaceSpanDump)(nil), 255 (*SwInterfaceSpanEnableDisable)(nil), 256 (*SwInterfaceSpanEnableDisableReply)(nil), 257 } 258 }