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