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