github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/gre/gre.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: plugins/gre.api.json 6 7 // Package gre contains generated bindings for API file gre.api. 8 // 9 // Contents: 10 // - 1 enum 11 // - 1 struct 12 // - 4 messages 13 package gre 14 15 import ( 16 "strconv" 17 18 interface_types "github.com/networkservicemesh/govpp/binapi/interface_types" 19 ip_types "github.com/networkservicemesh/govpp/binapi/ip_types" 20 tunnel_types "github.com/networkservicemesh/govpp/binapi/tunnel_types" 21 api "go.fd.io/govpp/api" 22 codec "go.fd.io/govpp/codec" 23 ) 24 25 // This is a compile-time assertion to ensure that this generated file 26 // is compatible with the GoVPP api package it is being compiled against. 27 // A compilation error at this line likely means your copy of the 28 // GoVPP api package needs to be updated. 29 const _ = api.GoVppAPIPackageIsVersion2 30 31 const ( 32 APIFile = "gre" 33 APIVersion = "2.1.1" 34 VersionCrc = 0x98b44dd1 35 ) 36 37 // GreTunnelType defines enum 'gre_tunnel_type'. 38 type GreTunnelType uint8 39 40 const ( 41 GRE_API_TUNNEL_TYPE_L3 GreTunnelType = 0 42 GRE_API_TUNNEL_TYPE_TEB GreTunnelType = 1 43 GRE_API_TUNNEL_TYPE_ERSPAN GreTunnelType = 2 44 ) 45 46 var ( 47 GreTunnelType_name = map[uint8]string{ 48 0: "GRE_API_TUNNEL_TYPE_L3", 49 1: "GRE_API_TUNNEL_TYPE_TEB", 50 2: "GRE_API_TUNNEL_TYPE_ERSPAN", 51 } 52 GreTunnelType_value = map[string]uint8{ 53 "GRE_API_TUNNEL_TYPE_L3": 0, 54 "GRE_API_TUNNEL_TYPE_TEB": 1, 55 "GRE_API_TUNNEL_TYPE_ERSPAN": 2, 56 } 57 ) 58 59 func (x GreTunnelType) String() string { 60 s, ok := GreTunnelType_name[uint8(x)] 61 if ok { 62 return s 63 } 64 return "GreTunnelType(" + strconv.Itoa(int(x)) + ")" 65 } 66 67 // GreTunnel defines type 'gre_tunnel'. 68 type GreTunnel struct { 69 Type GreTunnelType `binapi:"gre_tunnel_type,name=type" json:"type,omitempty"` 70 Mode tunnel_types.TunnelMode `binapi:"tunnel_mode,name=mode" json:"mode,omitempty"` 71 Flags tunnel_types.TunnelEncapDecapFlags `binapi:"tunnel_encap_decap_flags,name=flags" json:"flags,omitempty"` 72 SessionID uint16 `binapi:"u16,name=session_id" json:"session_id,omitempty"` 73 Instance uint32 `binapi:"u32,name=instance" json:"instance,omitempty"` 74 OuterTableID uint32 `binapi:"u32,name=outer_table_id" json:"outer_table_id,omitempty"` 75 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 76 Src ip_types.Address `binapi:"address,name=src" json:"src,omitempty"` 77 Dst ip_types.Address `binapi:"address,name=dst" json:"dst,omitempty"` 78 } 79 80 // Add or delete a single GRE tunnel. 81 // - is_add - add if true, delete if false. 82 // - tunnel - tunnel definition to add or delete. 83 // 84 // GreTunnelAddDel defines message 'gre_tunnel_add_del'. 85 type GreTunnelAddDel struct { 86 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` 87 Tunnel GreTunnel `binapi:"gre_tunnel,name=tunnel" json:"tunnel,omitempty"` 88 } 89 90 func (m *GreTunnelAddDel) Reset() { *m = GreTunnelAddDel{} } 91 func (*GreTunnelAddDel) GetMessageName() string { return "gre_tunnel_add_del" } 92 func (*GreTunnelAddDel) GetCrcString() string { return "a27d7f17" } 93 func (*GreTunnelAddDel) GetMessageType() api.MessageType { 94 return api.RequestMessage 95 } 96 97 func (m *GreTunnelAddDel) Size() (size int) { 98 if m == nil { 99 return 0 100 } 101 size += 1 // m.IsAdd 102 size += 1 // m.Tunnel.Type 103 size += 1 // m.Tunnel.Mode 104 size += 1 // m.Tunnel.Flags 105 size += 2 // m.Tunnel.SessionID 106 size += 4 // m.Tunnel.Instance 107 size += 4 // m.Tunnel.OuterTableID 108 size += 4 // m.Tunnel.SwIfIndex 109 size += 1 // m.Tunnel.Src.Af 110 size += 1 * 16 // m.Tunnel.Src.Un 111 size += 1 // m.Tunnel.Dst.Af 112 size += 1 * 16 // m.Tunnel.Dst.Un 113 return size 114 } 115 func (m *GreTunnelAddDel) Marshal(b []byte) ([]byte, error) { 116 if b == nil { 117 b = make([]byte, m.Size()) 118 } 119 buf := codec.NewBuffer(b) 120 buf.EncodeBool(m.IsAdd) 121 buf.EncodeUint8(uint8(m.Tunnel.Type)) 122 buf.EncodeUint8(uint8(m.Tunnel.Mode)) 123 buf.EncodeUint8(uint8(m.Tunnel.Flags)) 124 buf.EncodeUint16(m.Tunnel.SessionID) 125 buf.EncodeUint32(m.Tunnel.Instance) 126 buf.EncodeUint32(m.Tunnel.OuterTableID) 127 buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex)) 128 buf.EncodeUint8(uint8(m.Tunnel.Src.Af)) 129 buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 16) 130 buf.EncodeUint8(uint8(m.Tunnel.Dst.Af)) 131 buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 16) 132 return buf.Bytes(), nil 133 } 134 func (m *GreTunnelAddDel) Unmarshal(b []byte) error { 135 buf := codec.NewBuffer(b) 136 m.IsAdd = buf.DecodeBool() 137 m.Tunnel.Type = GreTunnelType(buf.DecodeUint8()) 138 m.Tunnel.Mode = tunnel_types.TunnelMode(buf.DecodeUint8()) 139 m.Tunnel.Flags = tunnel_types.TunnelEncapDecapFlags(buf.DecodeUint8()) 140 m.Tunnel.SessionID = buf.DecodeUint16() 141 m.Tunnel.Instance = buf.DecodeUint32() 142 m.Tunnel.OuterTableID = buf.DecodeUint32() 143 m.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 144 m.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8()) 145 copy(m.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 146 m.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8()) 147 copy(m.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 148 return nil 149 } 150 151 // Add or delete a single GRE tunnel. 152 // - retval - return code for the request. 153 // - sw_if_index - the interface corresponding to the affected tunnel. 154 // 155 // GreTunnelAddDelReply defines message 'gre_tunnel_add_del_reply'. 156 type GreTunnelAddDelReply struct { 157 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 158 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 159 } 160 161 func (m *GreTunnelAddDelReply) Reset() { *m = GreTunnelAddDelReply{} } 162 func (*GreTunnelAddDelReply) GetMessageName() string { return "gre_tunnel_add_del_reply" } 163 func (*GreTunnelAddDelReply) GetCrcString() string { return "5383d31f" } 164 func (*GreTunnelAddDelReply) GetMessageType() api.MessageType { 165 return api.ReplyMessage 166 } 167 168 func (m *GreTunnelAddDelReply) Size() (size int) { 169 if m == nil { 170 return 0 171 } 172 size += 4 // m.Retval 173 size += 4 // m.SwIfIndex 174 return size 175 } 176 func (m *GreTunnelAddDelReply) Marshal(b []byte) ([]byte, error) { 177 if b == nil { 178 b = make([]byte, m.Size()) 179 } 180 buf := codec.NewBuffer(b) 181 buf.EncodeInt32(m.Retval) 182 buf.EncodeUint32(uint32(m.SwIfIndex)) 183 return buf.Bytes(), nil 184 } 185 func (m *GreTunnelAddDelReply) Unmarshal(b []byte) error { 186 buf := codec.NewBuffer(b) 187 m.Retval = buf.DecodeInt32() 188 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 189 return nil 190 } 191 192 // Details response for one of the requested GRE tunnels. 193 // - tunnel - definition of the dumped tunnel. 194 // 195 // GreTunnelDetails defines message 'gre_tunnel_details'. 196 type GreTunnelDetails struct { 197 Tunnel GreTunnel `binapi:"gre_tunnel,name=tunnel" json:"tunnel,omitempty"` 198 } 199 200 func (m *GreTunnelDetails) Reset() { *m = GreTunnelDetails{} } 201 func (*GreTunnelDetails) GetMessageName() string { return "gre_tunnel_details" } 202 func (*GreTunnelDetails) GetCrcString() string { return "24435433" } 203 func (*GreTunnelDetails) GetMessageType() api.MessageType { 204 return api.ReplyMessage 205 } 206 207 func (m *GreTunnelDetails) Size() (size int) { 208 if m == nil { 209 return 0 210 } 211 size += 1 // m.Tunnel.Type 212 size += 1 // m.Tunnel.Mode 213 size += 1 // m.Tunnel.Flags 214 size += 2 // m.Tunnel.SessionID 215 size += 4 // m.Tunnel.Instance 216 size += 4 // m.Tunnel.OuterTableID 217 size += 4 // m.Tunnel.SwIfIndex 218 size += 1 // m.Tunnel.Src.Af 219 size += 1 * 16 // m.Tunnel.Src.Un 220 size += 1 // m.Tunnel.Dst.Af 221 size += 1 * 16 // m.Tunnel.Dst.Un 222 return size 223 } 224 func (m *GreTunnelDetails) Marshal(b []byte) ([]byte, error) { 225 if b == nil { 226 b = make([]byte, m.Size()) 227 } 228 buf := codec.NewBuffer(b) 229 buf.EncodeUint8(uint8(m.Tunnel.Type)) 230 buf.EncodeUint8(uint8(m.Tunnel.Mode)) 231 buf.EncodeUint8(uint8(m.Tunnel.Flags)) 232 buf.EncodeUint16(m.Tunnel.SessionID) 233 buf.EncodeUint32(m.Tunnel.Instance) 234 buf.EncodeUint32(m.Tunnel.OuterTableID) 235 buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex)) 236 buf.EncodeUint8(uint8(m.Tunnel.Src.Af)) 237 buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 16) 238 buf.EncodeUint8(uint8(m.Tunnel.Dst.Af)) 239 buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 16) 240 return buf.Bytes(), nil 241 } 242 func (m *GreTunnelDetails) Unmarshal(b []byte) error { 243 buf := codec.NewBuffer(b) 244 m.Tunnel.Type = GreTunnelType(buf.DecodeUint8()) 245 m.Tunnel.Mode = tunnel_types.TunnelMode(buf.DecodeUint8()) 246 m.Tunnel.Flags = tunnel_types.TunnelEncapDecapFlags(buf.DecodeUint8()) 247 m.Tunnel.SessionID = buf.DecodeUint16() 248 m.Tunnel.Instance = buf.DecodeUint32() 249 m.Tunnel.OuterTableID = buf.DecodeUint32() 250 m.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 251 m.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8()) 252 copy(m.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 253 m.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8()) 254 copy(m.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 255 return nil 256 } 257 258 // Dump details of all or just a single GRE tunnel. 259 // - sw_if_index - filter for tunnel of this interface index, ~0 for all. 260 // 261 // GreTunnelDump defines message 'gre_tunnel_dump'. 262 type GreTunnelDump struct { 263 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 264 } 265 266 func (m *GreTunnelDump) Reset() { *m = GreTunnelDump{} } 267 func (*GreTunnelDump) GetMessageName() string { return "gre_tunnel_dump" } 268 func (*GreTunnelDump) GetCrcString() string { return "f9e6675e" } 269 func (*GreTunnelDump) GetMessageType() api.MessageType { 270 return api.RequestMessage 271 } 272 273 func (m *GreTunnelDump) Size() (size int) { 274 if m == nil { 275 return 0 276 } 277 size += 4 // m.SwIfIndex 278 return size 279 } 280 func (m *GreTunnelDump) Marshal(b []byte) ([]byte, error) { 281 if b == nil { 282 b = make([]byte, m.Size()) 283 } 284 buf := codec.NewBuffer(b) 285 buf.EncodeUint32(uint32(m.SwIfIndex)) 286 return buf.Bytes(), nil 287 } 288 func (m *GreTunnelDump) Unmarshal(b []byte) error { 289 buf := codec.NewBuffer(b) 290 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 291 return nil 292 } 293 294 func init() { file_gre_binapi_init() } 295 func file_gre_binapi_init() { 296 api.RegisterMessage((*GreTunnelAddDel)(nil), "gre_tunnel_add_del_a27d7f17") 297 api.RegisterMessage((*GreTunnelAddDelReply)(nil), "gre_tunnel_add_del_reply_5383d31f") 298 api.RegisterMessage((*GreTunnelDetails)(nil), "gre_tunnel_details_24435433") 299 api.RegisterMessage((*GreTunnelDump)(nil), "gre_tunnel_dump_f9e6675e") 300 } 301 302 // Messages returns list of all messages in this module. 303 func AllMessages() []api.Message { 304 return []api.Message{ 305 (*GreTunnelAddDel)(nil), 306 (*GreTunnelAddDelReply)(nil), 307 (*GreTunnelDetails)(nil), 308 (*GreTunnelDump)(nil), 309 } 310 }