diff options
author | 2020-07-17 10:36:28 +0200 | |
---|---|---|
committer | 2020-07-17 11:43:41 +0200 | |
commit | d1f24d37bd447b64e402298bb8eb2479681facf9 (patch) | |
tree | a3fc21ba730a91d8a402c7a5bf9c614e3677c4fc /binapi | |
parent | 1548c7e12531e3d055567d761c580a1c7ff0ac40 (diff) |
Improve binapi generator
- simplified Size/Marshal/Unmarshal methods
- replace struc in unions with custom marshal/unmarshal
- fix imports in generated files
- fix mock adapter
- generate rpc service using low-level stream API (dumps generate control ping or stream msg..)
- move examples/binapi to binapi and generate all API for latest release
- add binapigen.Plugin for developing custom generator plugins
- optionally generate HTTP handlers (REST API) for RPC services
- add govpp program for browsing VPP API
Change-Id: I092e9ed2b0c17972b3476463c3d4b14dd76ed42b
Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'binapi')
291 files changed, 97117 insertions, 0 deletions
diff --git a/binapi/abf/abf.ba.go b/binapi/abf/abf.ba.go new file mode 100644 index 0000000..2cea604 --- /dev/null +++ b/binapi/abf/abf.ba.go @@ -0,0 +1,627 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/abf.api.json + +// Package abf contains generated bindings for API file abf.api. +// +// Contents: +// 2 structs +// 10 messages +// +package abf + +import ( + api "git.fd.io/govpp.git/api" + fib_types "git.fd.io/govpp.git/binapi/fib_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + _ "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "abf" + APIVersion = "1.0.0" + VersionCrc = 0x460b09b9 +) + +// AbfItfAttach defines type 'abf_itf_attach'. +type AbfItfAttach struct { + PolicyID uint32 `binapi:"u32,name=policy_id" json:"policy_id,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Priority uint32 `binapi:"u32,name=priority" json:"priority,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` +} + +// AbfPolicy defines type 'abf_policy'. +type AbfPolicy struct { + PolicyID uint32 `binapi:"u32,name=policy_id" json:"policy_id,omitempty"` + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + NPaths uint8 `binapi:"u8,name=n_paths" json:"-"` + Paths []fib_types.FibPath `binapi:"fib_path[n_paths],name=paths" json:"paths,omitempty"` +} + +// AbfItfAttachAddDel defines message 'abf_itf_attach_add_del'. +type AbfItfAttachAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Attach AbfItfAttach `binapi:"abf_itf_attach,name=attach" json:"attach,omitempty"` +} + +func (m *AbfItfAttachAddDel) Reset() { *m = AbfItfAttachAddDel{} } +func (*AbfItfAttachAddDel) GetMessageName() string { return "abf_itf_attach_add_del" } +func (*AbfItfAttachAddDel) GetCrcString() string { return "25c8621b" } +func (*AbfItfAttachAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AbfItfAttachAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Attach.PolicyID + size += 4 // m.Attach.SwIfIndex + size += 4 // m.Attach.Priority + size += 1 // m.Attach.IsIPv6 + return size +} +func (m *AbfItfAttachAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Attach.PolicyID)) + buf.EncodeUint32(uint32(m.Attach.SwIfIndex)) + buf.EncodeUint32(uint32(m.Attach.Priority)) + buf.EncodeBool(m.Attach.IsIPv6) + return buf.Bytes(), nil +} +func (m *AbfItfAttachAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Attach.PolicyID = buf.DecodeUint32() + m.Attach.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Attach.Priority = buf.DecodeUint32() + m.Attach.IsIPv6 = buf.DecodeBool() + return nil +} + +// AbfItfAttachAddDelReply defines message 'abf_itf_attach_add_del_reply'. +type AbfItfAttachAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *AbfItfAttachAddDelReply) Reset() { *m = AbfItfAttachAddDelReply{} } +func (*AbfItfAttachAddDelReply) GetMessageName() string { return "abf_itf_attach_add_del_reply" } +func (*AbfItfAttachAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*AbfItfAttachAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AbfItfAttachAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *AbfItfAttachAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *AbfItfAttachAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// AbfItfAttachDetails defines message 'abf_itf_attach_details'. +type AbfItfAttachDetails struct { + Attach AbfItfAttach `binapi:"abf_itf_attach,name=attach" json:"attach,omitempty"` +} + +func (m *AbfItfAttachDetails) Reset() { *m = AbfItfAttachDetails{} } +func (*AbfItfAttachDetails) GetMessageName() string { return "abf_itf_attach_details" } +func (*AbfItfAttachDetails) GetCrcString() string { return "7819523e" } +func (*AbfItfAttachDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AbfItfAttachDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Attach.PolicyID + size += 4 // m.Attach.SwIfIndex + size += 4 // m.Attach.Priority + size += 1 // m.Attach.IsIPv6 + return size +} +func (m *AbfItfAttachDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Attach.PolicyID)) + buf.EncodeUint32(uint32(m.Attach.SwIfIndex)) + buf.EncodeUint32(uint32(m.Attach.Priority)) + buf.EncodeBool(m.Attach.IsIPv6) + return buf.Bytes(), nil +} +func (m *AbfItfAttachDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Attach.PolicyID = buf.DecodeUint32() + m.Attach.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Attach.Priority = buf.DecodeUint32() + m.Attach.IsIPv6 = buf.DecodeBool() + return nil +} + +// AbfItfAttachDump defines message 'abf_itf_attach_dump'. +type AbfItfAttachDump struct{} + +func (m *AbfItfAttachDump) Reset() { *m = AbfItfAttachDump{} } +func (*AbfItfAttachDump) GetMessageName() string { return "abf_itf_attach_dump" } +func (*AbfItfAttachDump) GetCrcString() string { return "51077d14" } +func (*AbfItfAttachDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AbfItfAttachDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *AbfItfAttachDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *AbfItfAttachDump) Unmarshal(b []byte) error { + return nil +} + +// AbfPluginGetVersion defines message 'abf_plugin_get_version'. +type AbfPluginGetVersion struct{} + +func (m *AbfPluginGetVersion) Reset() { *m = AbfPluginGetVersion{} } +func (*AbfPluginGetVersion) GetMessageName() string { return "abf_plugin_get_version" } +func (*AbfPluginGetVersion) GetCrcString() string { return "51077d14" } +func (*AbfPluginGetVersion) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AbfPluginGetVersion) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *AbfPluginGetVersion) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *AbfPluginGetVersion) Unmarshal(b []byte) error { + return nil +} + +// AbfPluginGetVersionReply defines message 'abf_plugin_get_version_reply'. +type AbfPluginGetVersionReply struct { + Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` + Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` +} + +func (m *AbfPluginGetVersionReply) Reset() { *m = AbfPluginGetVersionReply{} } +func (*AbfPluginGetVersionReply) GetMessageName() string { return "abf_plugin_get_version_reply" } +func (*AbfPluginGetVersionReply) GetCrcString() string { return "9b32cf86" } +func (*AbfPluginGetVersionReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AbfPluginGetVersionReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Major + size += 4 // m.Minor + return size +} +func (m *AbfPluginGetVersionReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Major)) + buf.EncodeUint32(uint32(m.Minor)) + return buf.Bytes(), nil +} +func (m *AbfPluginGetVersionReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Major = buf.DecodeUint32() + m.Minor = buf.DecodeUint32() + return nil +} + +// AbfPolicyAddDel defines message 'abf_policy_add_del'. +type AbfPolicyAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Policy AbfPolicy `binapi:"abf_policy,name=policy" json:"policy,omitempty"` +} + +func (m *AbfPolicyAddDel) Reset() { *m = AbfPolicyAddDel{} } +func (*AbfPolicyAddDel) GetMessageName() string { return "abf_policy_add_del" } +func (*AbfPolicyAddDel) GetCrcString() string { return "ee66f93e" } +func (*AbfPolicyAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AbfPolicyAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Policy.PolicyID + size += 4 // m.Policy.ACLIndex + size += 1 // m.Policy.NPaths + for j2 := 0; j2 < len(m.Policy.Paths); j2++ { + var s2 fib_types.FibPath + _ = s2 + if j2 < len(m.Policy.Paths) { + s2 = m.Policy.Paths[j2] + } + size += 4 // s2.SwIfIndex + size += 4 // s2.TableID + size += 4 // s2.RpfID + size += 1 // s2.Weight + size += 1 // s2.Preference + size += 4 // s2.Type + size += 4 // s2.Flags + size += 4 // s2.Proto + size += 1 * 16 // s2.Nh.Address + size += 4 // s2.Nh.ViaLabel + size += 4 // s2.Nh.ObjID + size += 4 // s2.Nh.ClassifyTableIndex + size += 1 // s2.NLabels + for j3 := 0; j3 < 16; j3++ { + var s3 fib_types.FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + size += 1 // s3.IsUniform + size += 4 // s3.Label + size += 1 // s3.TTL + size += 1 // s3.Exp + } + } + return size +} +func (m *AbfPolicyAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Policy.PolicyID)) + buf.EncodeUint32(uint32(m.Policy.ACLIndex)) + buf.EncodeUint8(uint8(len(m.Policy.Paths))) + for j1 := 0; j1 < len(m.Policy.Paths); j1++ { + var v1 fib_types.FibPath + if j1 < len(m.Policy.Paths) { + v1 = m.Policy.Paths[j1] + } + buf.EncodeUint32(uint32(v1.SwIfIndex)) + buf.EncodeUint32(uint32(v1.TableID)) + buf.EncodeUint32(uint32(v1.RpfID)) + buf.EncodeUint8(uint8(v1.Weight)) + buf.EncodeUint8(uint8(v1.Preference)) + buf.EncodeUint32(uint32(v1.Type)) + buf.EncodeUint32(uint32(v1.Flags)) + buf.EncodeUint32(uint32(v1.Proto)) + buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v1.Nh.ViaLabel)) + buf.EncodeUint32(uint32(v1.Nh.ObjID)) + buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex)) + buf.EncodeUint8(uint8(v1.NLabels)) + for j2 := 0; j2 < 16; j2++ { + var v2 fib_types.FibMplsLabel + if j2 < len(v1.LabelStack) { + v2 = v1.LabelStack[j2] + } + buf.EncodeUint8(uint8(v2.IsUniform)) + buf.EncodeUint32(uint32(v2.Label)) + buf.EncodeUint8(uint8(v2.TTL)) + buf.EncodeUint8(uint8(v2.Exp)) + } + } + return buf.Bytes(), nil +} +func (m *AbfPolicyAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Policy.PolicyID = buf.DecodeUint32() + m.Policy.ACLIndex = buf.DecodeUint32() + m.Policy.NPaths = buf.DecodeUint8() + m.Policy.Paths = make([]fib_types.FibPath, int(m.Policy.NPaths)) + for j1 := 0; j1 < len(m.Policy.Paths); j1++ { + m.Policy.Paths[j1].SwIfIndex = buf.DecodeUint32() + m.Policy.Paths[j1].TableID = buf.DecodeUint32() + m.Policy.Paths[j1].RpfID = buf.DecodeUint32() + m.Policy.Paths[j1].Weight = buf.DecodeUint8() + m.Policy.Paths[j1].Preference = buf.DecodeUint8() + m.Policy.Paths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.Policy.Paths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.Policy.Paths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.Policy.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Policy.Paths[j1].Nh.ViaLabel = buf.DecodeUint32() + m.Policy.Paths[j1].Nh.ObjID = buf.DecodeUint32() + m.Policy.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.Policy.Paths[j1].NLabels = buf.DecodeUint8() + for j2 := 0; j2 < 16; j2++ { + m.Policy.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() + m.Policy.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32() + m.Policy.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8() + m.Policy.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8() + } + } + return nil +} + +// AbfPolicyAddDelReply defines message 'abf_policy_add_del_reply'. +type AbfPolicyAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *AbfPolicyAddDelReply) Reset() { *m = AbfPolicyAddDelReply{} } +func (*AbfPolicyAddDelReply) GetMessageName() string { return "abf_policy_add_del_reply" } +func (*AbfPolicyAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*AbfPolicyAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AbfPolicyAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *AbfPolicyAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *AbfPolicyAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// AbfPolicyDetails defines message 'abf_policy_details'. +type AbfPolicyDetails struct { + Policy AbfPolicy `binapi:"abf_policy,name=policy" json:"policy,omitempty"` +} + +func (m *AbfPolicyDetails) Reset() { *m = AbfPolicyDetails{} } +func (*AbfPolicyDetails) GetMessageName() string { return "abf_policy_details" } +func (*AbfPolicyDetails) GetCrcString() string { return "6769e504" } +func (*AbfPolicyDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AbfPolicyDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Policy.PolicyID + size += 4 // m.Policy.ACLIndex + size += 1 // m.Policy.NPaths + for j2 := 0; j2 < len(m.Policy.Paths); j2++ { + var s2 fib_types.FibPath + _ = s2 + if j2 < len(m.Policy.Paths) { + s2 = m.Policy.Paths[j2] + } + size += 4 // s2.SwIfIndex + size += 4 // s2.TableID + size += 4 // s2.RpfID + size += 1 // s2.Weight + size += 1 // s2.Preference + size += 4 // s2.Type + size += 4 // s2.Flags + size += 4 // s2.Proto + size += 1 * 16 // s2.Nh.Address + size += 4 // s2.Nh.ViaLabel + size += 4 // s2.Nh.ObjID + size += 4 // s2.Nh.ClassifyTableIndex + size += 1 // s2.NLabels + for j3 := 0; j3 < 16; j3++ { + var s3 fib_types.FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + size += 1 // s3.IsUniform + size += 4 // s3.Label + size += 1 // s3.TTL + size += 1 // s3.Exp + } + } + return size +} +func (m *AbfPolicyDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Policy.PolicyID)) + buf.EncodeUint32(uint32(m.Policy.ACLIndex)) + buf.EncodeUint8(uint8(len(m.Policy.Paths))) + for j1 := 0; j1 < len(m.Policy.Paths); j1++ { + var v1 fib_types.FibPath + if j1 < len(m.Policy.Paths) { + v1 = m.Policy.Paths[j1] + } + buf.EncodeUint32(uint32(v1.SwIfIndex)) + buf.EncodeUint32(uint32(v1.TableID)) + buf.EncodeUint32(uint32(v1.RpfID)) + buf.EncodeUint8(uint8(v1.Weight)) + buf.EncodeUint8(uint8(v1.Preference)) + buf.EncodeUint32(uint32(v1.Type)) + buf.EncodeUint32(uint32(v1.Flags)) + buf.EncodeUint32(uint32(v1.Proto)) + buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v1.Nh.ViaLabel)) + buf.EncodeUint32(uint32(v1.Nh.ObjID)) + buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex)) + buf.EncodeUint8(uint8(v1.NLabels)) + for j2 := 0; j2 < 16; j2++ { + var v2 fib_types.FibMplsLabel + if j2 < len(v1.LabelStack) { + v2 = v1.LabelStack[j2] + } + buf.EncodeUint8(uint8(v2.IsUniform)) + buf.EncodeUint32(uint32(v2.Label)) + buf.EncodeUint8(uint8(v2.TTL)) + buf.EncodeUint8(uint8(v2.Exp)) + } + } + return buf.Bytes(), nil +} +func (m *AbfPolicyDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Policy.PolicyID = buf.DecodeUint32() + m.Policy.ACLIndex = buf.DecodeUint32() + m.Policy.NPaths = buf.DecodeUint8() + m.Policy.Paths = make([]fib_types.FibPath, int(m.Policy.NPaths)) + for j1 := 0; j1 < len(m.Policy.Paths); j1++ { + m.Policy.Paths[j1].SwIfIndex = buf.DecodeUint32() + m.Policy.Paths[j1].TableID = buf.DecodeUint32() + m.Policy.Paths[j1].RpfID = buf.DecodeUint32() + m.Policy.Paths[j1].Weight = buf.DecodeUint8() + m.Policy.Paths[j1].Preference = buf.DecodeUint8() + m.Policy.Paths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.Policy.Paths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.Policy.Paths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.Policy.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Policy.Paths[j1].Nh.ViaLabel = buf.DecodeUint32() + m.Policy.Paths[j1].Nh.ObjID = buf.DecodeUint32() + m.Policy.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.Policy.Paths[j1].NLabels = buf.DecodeUint8() + for j2 := 0; j2 < 16; j2++ { + m.Policy.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() + m.Policy.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32() + m.Policy.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8() + m.Policy.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8() + } + } + return nil +} + +// AbfPolicyDump defines message 'abf_policy_dump'. +type AbfPolicyDump struct{} + +func (m *AbfPolicyDump) Reset() { *m = AbfPolicyDump{} } +func (*AbfPolicyDump) GetMessageName() string { return "abf_policy_dump" } +func (*AbfPolicyDump) GetCrcString() string { return "51077d14" } +func (*AbfPolicyDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AbfPolicyDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *AbfPolicyDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *AbfPolicyDump) Unmarshal(b []byte) error { + return nil +} + +func init() { file_abf_binapi_init() } +func file_abf_binapi_init() { + api.RegisterMessage((*AbfItfAttachAddDel)(nil), "abf_itf_attach_add_del_25c8621b") + api.RegisterMessage((*AbfItfAttachAddDelReply)(nil), "abf_itf_attach_add_del_reply_e8d4e804") + api.RegisterMessage((*AbfItfAttachDetails)(nil), "abf_itf_attach_details_7819523e") + api.RegisterMessage((*AbfItfAttachDump)(nil), "abf_itf_attach_dump_51077d14") + api.RegisterMessage((*AbfPluginGetVersion)(nil), "abf_plugin_get_version_51077d14") + api.RegisterMessage((*AbfPluginGetVersionReply)(nil), "abf_plugin_get_version_reply_9b32cf86") + api.RegisterMessage((*AbfPolicyAddDel)(nil), "abf_policy_add_del_ee66f93e") + api.RegisterMessage((*AbfPolicyAddDelReply)(nil), "abf_policy_add_del_reply_e8d4e804") + api.RegisterMessage((*AbfPolicyDetails)(nil), "abf_policy_details_6769e504") + api.RegisterMessage((*AbfPolicyDump)(nil), "abf_policy_dump_51077d14") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AbfItfAttachAddDel)(nil), + (*AbfItfAttachAddDelReply)(nil), + (*AbfItfAttachDetails)(nil), + (*AbfItfAttachDump)(nil), + (*AbfPluginGetVersion)(nil), + (*AbfPluginGetVersionReply)(nil), + (*AbfPolicyAddDel)(nil), + (*AbfPolicyAddDelReply)(nil), + (*AbfPolicyDetails)(nil), + (*AbfPolicyDump)(nil), + } +} diff --git a/binapi/abf/abf_rest.ba.go b/binapi/abf/abf_rest.ba.go new file mode 100644 index 0000000..e05e834 --- /dev/null +++ b/binapi/abf/abf_rest.ba.go @@ -0,0 +1,74 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package abf + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/abf_itf_attach_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(AbfItfAttachAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.AbfItfAttachAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/abf_plugin_get_version", func(w http.ResponseWriter, req *http.Request) { + var request = new(AbfPluginGetVersion) + reply, err := rpc.AbfPluginGetVersion(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/abf_policy_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(AbfPolicyAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.AbfPolicyAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/abf/abf_rpc.ba.go b/binapi/abf/abf_rpc.ba.go new file mode 100644 index 0000000..76a88c6 --- /dev/null +++ b/binapi/abf/abf_rpc.ba.go @@ -0,0 +1,133 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package abf + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service abf. +type RPCService interface { + AbfItfAttachAddDel(ctx context.Context, in *AbfItfAttachAddDel) (*AbfItfAttachAddDelReply, error) + AbfItfAttachDump(ctx context.Context, in *AbfItfAttachDump) (RPCService_AbfItfAttachDumpClient, error) + AbfPluginGetVersion(ctx context.Context, in *AbfPluginGetVersion) (*AbfPluginGetVersionReply, error) + AbfPolicyAddDel(ctx context.Context, in *AbfPolicyAddDel) (*AbfPolicyAddDelReply, error) + AbfPolicyDump(ctx context.Context, in *AbfPolicyDump) (RPCService_AbfPolicyDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) AbfItfAttachAddDel(ctx context.Context, in *AbfItfAttachAddDel) (*AbfItfAttachAddDelReply, error) { + out := new(AbfItfAttachAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AbfItfAttachDump(ctx context.Context, in *AbfItfAttachDump) (RPCService_AbfItfAttachDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_AbfItfAttachDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_AbfItfAttachDumpClient interface { + Recv() (*AbfItfAttachDetails, error) + api.Stream +} + +type serviceClient_AbfItfAttachDumpClient struct { + api.Stream +} + +func (c *serviceClient_AbfItfAttachDumpClient) Recv() (*AbfItfAttachDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *AbfItfAttachDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) AbfPluginGetVersion(ctx context.Context, in *AbfPluginGetVersion) (*AbfPluginGetVersionReply, error) { + out := new(AbfPluginGetVersionReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AbfPolicyAddDel(ctx context.Context, in *AbfPolicyAddDel) (*AbfPolicyAddDelReply, error) { + out := new(AbfPolicyAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AbfPolicyDump(ctx context.Context, in *AbfPolicyDump) (RPCService_AbfPolicyDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_AbfPolicyDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_AbfPolicyDumpClient interface { + Recv() (*AbfPolicyDetails, error) + api.Stream +} + +type serviceClient_AbfPolicyDumpClient struct { + api.Stream +} + +func (c *serviceClient_AbfPolicyDumpClient) Recv() (*AbfPolicyDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *AbfPolicyDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/acl/acl.ba.go b/binapi/acl/acl.ba.go new file mode 100644 index 0000000..3fac5ee --- /dev/null +++ b/binapi/acl/acl.ba.go @@ -0,0 +1,1900 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/acl.api.json + +// Package acl contains generated bindings for API file acl.api. +// +// Contents: +// 38 messages +// +package acl + +import ( + api "git.fd.io/govpp.git/api" + acl_types "git.fd.io/govpp.git/binapi/acl_types" + _ "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "acl" + APIVersion = "2.0.0" + VersionCrc = 0x68c4cb37 +) + +// ACLAddReplace defines message 'acl_add_replace'. +type ACLAddReplace struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + R []acl_types.ACLRule `binapi:"acl_rule[count],name=r" json:"r,omitempty"` +} + +func (m *ACLAddReplace) Reset() { *m = ACLAddReplace{} } +func (*ACLAddReplace) GetMessageName() string { return "acl_add_replace" } +func (*ACLAddReplace) GetCrcString() string { return "1cabdeab" } +func (*ACLAddReplace) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLAddReplace) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ACLIndex + size += 64 // m.Tag + size += 4 // m.Count + for j1 := 0; j1 < len(m.R); j1++ { + var s1 acl_types.ACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + size += 1 // s1.IsPermit + size += 1 // s1.SrcPrefix.Address.Af + size += 1 * 16 // s1.SrcPrefix.Address.Un + size += 1 // s1.SrcPrefix.Len + size += 1 // s1.DstPrefix.Address.Af + size += 1 * 16 // s1.DstPrefix.Address.Un + size += 1 // s1.DstPrefix.Len + size += 1 // s1.Proto + size += 2 // s1.SrcportOrIcmptypeFirst + size += 2 // s1.SrcportOrIcmptypeLast + size += 2 // s1.DstportOrIcmpcodeFirst + size += 2 // s1.DstportOrIcmpcodeLast + size += 1 // s1.TCPFlagsMask + size += 1 // s1.TCPFlagsValue + } + return size +} +func (m *ACLAddReplace) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ACLIndex)) + buf.EncodeString(m.Tag, 64) + buf.EncodeUint32(uint32(len(m.R))) + for j0 := 0; j0 < len(m.R); j0++ { + var v0 acl_types.ACLRule + if j0 < len(m.R) { + v0 = m.R[j0] + } + buf.EncodeUint8(uint8(v0.IsPermit)) + buf.EncodeUint8(uint8(v0.SrcPrefix.Address.Af)) + buf.EncodeBytes(v0.SrcPrefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(v0.SrcPrefix.Len)) + buf.EncodeUint8(uint8(v0.DstPrefix.Address.Af)) + buf.EncodeBytes(v0.DstPrefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(v0.DstPrefix.Len)) + buf.EncodeUint8(uint8(v0.Proto)) + buf.EncodeUint16(uint16(v0.SrcportOrIcmptypeFirst)) + buf.EncodeUint16(uint16(v0.SrcportOrIcmptypeLast)) + buf.EncodeUint16(uint16(v0.DstportOrIcmpcodeFirst)) + buf.EncodeUint16(uint16(v0.DstportOrIcmpcodeLast)) + buf.EncodeUint8(uint8(v0.TCPFlagsMask)) + buf.EncodeUint8(uint8(v0.TCPFlagsValue)) + } + return buf.Bytes(), nil +} +func (m *ACLAddReplace) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ACLIndex = buf.DecodeUint32() + m.Tag = buf.DecodeString(64) + m.Count = buf.DecodeUint32() + m.R = make([]acl_types.ACLRule, int(m.Count)) + for j0 := 0; j0 < len(m.R); j0++ { + m.R[j0].IsPermit = acl_types.ACLAction(buf.DecodeUint8()) + m.R[j0].SrcPrefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.R[j0].SrcPrefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.R[j0].SrcPrefix.Len = buf.DecodeUint8() + m.R[j0].DstPrefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.R[j0].DstPrefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.R[j0].DstPrefix.Len = buf.DecodeUint8() + m.R[j0].Proto = ip_types.IPProto(buf.DecodeUint8()) + m.R[j0].SrcportOrIcmptypeFirst = buf.DecodeUint16() + m.R[j0].SrcportOrIcmptypeLast = buf.DecodeUint16() + m.R[j0].DstportOrIcmpcodeFirst = buf.DecodeUint16() + m.R[j0].DstportOrIcmpcodeLast = buf.DecodeUint16() + m.R[j0].TCPFlagsMask = buf.DecodeUint8() + m.R[j0].TCPFlagsValue = buf.DecodeUint8() + } + return nil +} + +// ACLAddReplaceReply defines message 'acl_add_replace_reply'. +type ACLAddReplaceReply struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLAddReplaceReply) Reset() { *m = ACLAddReplaceReply{} } +func (*ACLAddReplaceReply) GetMessageName() string { return "acl_add_replace_reply" } +func (*ACLAddReplaceReply) GetCrcString() string { return "ac407b0c" } +func (*ACLAddReplaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLAddReplaceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ACLIndex + size += 4 // m.Retval + return size +} +func (m *ACLAddReplaceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ACLIndex)) + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ACLAddReplaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ACLIndex = buf.DecodeUint32() + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// ACLDel defines message 'acl_del'. +type ACLDel struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` +} + +func (m *ACLDel) Reset() { *m = ACLDel{} } +func (*ACLDel) GetMessageName() string { return "acl_del" } +func (*ACLDel) GetCrcString() string { return "ef34fea4" } +func (*ACLDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ACLIndex + return size +} +func (m *ACLDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ACLIndex)) + return buf.Bytes(), nil +} +func (m *ACLDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ACLIndex = buf.DecodeUint32() + return nil +} + +// ACLDelReply defines message 'acl_del_reply'. +type ACLDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLDelReply) Reset() { *m = ACLDelReply{} } +func (*ACLDelReply) GetMessageName() string { return "acl_del_reply" } +func (*ACLDelReply) GetCrcString() string { return "e8d4e804" } +func (*ACLDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ACLDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ACLDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// ACLDetails defines message 'acl_details'. +type ACLDetails struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + R []acl_types.ACLRule `binapi:"acl_rule[count],name=r" json:"r,omitempty"` +} + +func (m *ACLDetails) Reset() { *m = ACLDetails{} } +func (*ACLDetails) GetMessageName() string { return "acl_details" } +func (*ACLDetails) GetCrcString() string { return "7a97f21c" } +func (*ACLDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ACLIndex + size += 64 // m.Tag + size += 4 // m.Count + for j1 := 0; j1 < len(m.R); j1++ { + var s1 acl_types.ACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + size += 1 // s1.IsPermit + size += 1 // s1.SrcPrefix.Address.Af + size += 1 * 16 // s1.SrcPrefix.Address.Un + size += 1 // s1.SrcPrefix.Len + size += 1 // s1.DstPrefix.Address.Af + size += 1 * 16 // s1.DstPrefix.Address.Un + size += 1 // s1.DstPrefix.Len + size += 1 // s1.Proto + size += 2 // s1.SrcportOrIcmptypeFirst + size += 2 // s1.SrcportOrIcmptypeLast + size += 2 // s1.DstportOrIcmpcodeFirst + size += 2 // s1.DstportOrIcmpcodeLast + size += 1 // s1.TCPFlagsMask + size += 1 // s1.TCPFlagsValue + } + return size +} +func (m *ACLDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ACLIndex)) + buf.EncodeString(m.Tag, 64) + buf.EncodeUint32(uint32(len(m.R))) + for j0 := 0; j0 < len(m.R); j0++ { + var v0 acl_types.ACLRule + if j0 < len(m.R) { + v0 = m.R[j0] + } + buf.EncodeUint8(uint8(v0.IsPermit)) + buf.EncodeUint8(uint8(v0.SrcPrefix.Address.Af)) + buf.EncodeBytes(v0.SrcPrefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(v0.SrcPrefix.Len)) + buf.EncodeUint8(uint8(v0.DstPrefix.Address.Af)) + buf.EncodeBytes(v0.DstPrefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(v0.DstPrefix.Len)) + buf.EncodeUint8(uint8(v0.Proto)) + buf.EncodeUint16(uint16(v0.SrcportOrIcmptypeFirst)) + buf.EncodeUint16(uint16(v0.SrcportOrIcmptypeLast)) + buf.EncodeUint16(uint16(v0.DstportOrIcmpcodeFirst)) + buf.EncodeUint16(uint16(v0.DstportOrIcmpcodeLast)) + buf.EncodeUint8(uint8(v0.TCPFlagsMask)) + buf.EncodeUint8(uint8(v0.TCPFlagsValue)) + } + return buf.Bytes(), nil +} +func (m *ACLDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ACLIndex = buf.DecodeUint32() + m.Tag = buf.DecodeString(64) + m.Count = buf.DecodeUint32() + m.R = make([]acl_types.ACLRule, int(m.Count)) + for j0 := 0; j0 < len(m.R); j0++ { + m.R[j0].IsPermit = acl_types.ACLAction(buf.DecodeUint8()) + m.R[j0].SrcPrefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.R[j0].SrcPrefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.R[j0].SrcPrefix.Len = buf.DecodeUint8() + m.R[j0].DstPrefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.R[j0].DstPrefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.R[j0].DstPrefix.Len = buf.DecodeUint8() + m.R[j0].Proto = ip_types.IPProto(buf.DecodeUint8()) + m.R[j0].SrcportOrIcmptypeFirst = buf.DecodeUint16() + m.R[j0].SrcportOrIcmptypeLast = buf.DecodeUint16() + m.R[j0].DstportOrIcmpcodeFirst = buf.DecodeUint16() + m.R[j0].DstportOrIcmpcodeLast = buf.DecodeUint16() + m.R[j0].TCPFlagsMask = buf.DecodeUint8() + m.R[j0].TCPFlagsValue = buf.DecodeUint8() + } + return nil +} + +// ACLDump defines message 'acl_dump'. +type ACLDump struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` +} + +func (m *ACLDump) Reset() { *m = ACLDump{} } +func (*ACLDump) GetMessageName() string { return "acl_dump" } +func (*ACLDump) GetCrcString() string { return "ef34fea4" } +func (*ACLDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ACLIndex + return size +} +func (m *ACLDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ACLIndex)) + return buf.Bytes(), nil +} +func (m *ACLDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ACLIndex = buf.DecodeUint32() + return nil +} + +// ACLInterfaceAddDel defines message 'acl_interface_add_del'. +type ACLInterfaceAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IsInput bool `binapi:"bool,name=is_input" json:"is_input,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` +} + +func (m *ACLInterfaceAddDel) Reset() { *m = ACLInterfaceAddDel{} } +func (*ACLInterfaceAddDel) GetMessageName() string { return "acl_interface_add_del" } +func (*ACLInterfaceAddDel) GetCrcString() string { return "4b54bebd" } +func (*ACLInterfaceAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLInterfaceAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.IsInput + size += 4 // m.SwIfIndex + size += 4 // m.ACLIndex + return size +} +func (m *ACLInterfaceAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeBool(m.IsInput) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.ACLIndex)) + return buf.Bytes(), nil +} +func (m *ACLInterfaceAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.IsInput = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.ACLIndex = buf.DecodeUint32() + return nil +} + +// ACLInterfaceAddDelReply defines message 'acl_interface_add_del_reply'. +type ACLInterfaceAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLInterfaceAddDelReply) Reset() { *m = ACLInterfaceAddDelReply{} } +func (*ACLInterfaceAddDelReply) GetMessageName() string { return "acl_interface_add_del_reply" } +func (*ACLInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*ACLInterfaceAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLInterfaceAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ACLInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ACLInterfaceAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// ACLInterfaceEtypeWhitelistDetails defines message 'acl_interface_etype_whitelist_details'. +type ACLInterfaceEtypeWhitelistDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"-"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Whitelist []uint16 `binapi:"u16[count],name=whitelist" json:"whitelist,omitempty"` +} + +func (m *ACLInterfaceEtypeWhitelistDetails) Reset() { *m = ACLInterfaceEtypeWhitelistDetails{} } +func (*ACLInterfaceEtypeWhitelistDetails) GetMessageName() string { + return "acl_interface_etype_whitelist_details" +} +func (*ACLInterfaceEtypeWhitelistDetails) GetCrcString() string { return "cc2bfded" } +func (*ACLInterfaceEtypeWhitelistDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLInterfaceEtypeWhitelistDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Count + size += 1 // m.NInput + size += 2 * len(m.Whitelist) // m.Whitelist + return size +} +func (m *ACLInterfaceEtypeWhitelistDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(len(m.Whitelist))) + buf.EncodeUint8(uint8(m.NInput)) + for i := 0; i < len(m.Whitelist); i++ { + var x uint16 + if i < len(m.Whitelist) { + x = uint16(m.Whitelist[i]) + } + buf.EncodeUint16(uint16(x)) + } + return buf.Bytes(), nil +} +func (m *ACLInterfaceEtypeWhitelistDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Count = buf.DecodeUint8() + m.NInput = buf.DecodeUint8() + m.Whitelist = make([]uint16, m.Count) + for i := 0; i < len(m.Whitelist); i++ { + m.Whitelist[i] = buf.DecodeUint16() + } + return nil +} + +// ACLInterfaceEtypeWhitelistDump defines message 'acl_interface_etype_whitelist_dump'. +type ACLInterfaceEtypeWhitelistDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *ACLInterfaceEtypeWhitelistDump) Reset() { *m = ACLInterfaceEtypeWhitelistDump{} } +func (*ACLInterfaceEtypeWhitelistDump) GetMessageName() string { + return "acl_interface_etype_whitelist_dump" +} +func (*ACLInterfaceEtypeWhitelistDump) GetCrcString() string { return "f9e6675e" } +func (*ACLInterfaceEtypeWhitelistDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLInterfaceEtypeWhitelistDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *ACLInterfaceEtypeWhitelistDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *ACLInterfaceEtypeWhitelistDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// ACLInterfaceListDetails defines message 'acl_interface_list_details'. +type ACLInterfaceListDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"-"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` +} + +func (m *ACLInterfaceListDetails) Reset() { *m = ACLInterfaceListDetails{} } +func (*ACLInterfaceListDetails) GetMessageName() string { return "acl_interface_list_details" } +func (*ACLInterfaceListDetails) GetCrcString() string { return "e695d256" } +func (*ACLInterfaceListDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLInterfaceListDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Count + size += 1 // m.NInput + size += 4 * len(m.Acls) // m.Acls + return size +} +func (m *ACLInterfaceListDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(len(m.Acls))) + buf.EncodeUint8(uint8(m.NInput)) + for i := 0; i < len(m.Acls); i++ { + var x uint32 + if i < len(m.Acls) { + x = uint32(m.Acls[i]) + } + buf.EncodeUint32(uint32(x)) + } + return buf.Bytes(), nil +} +func (m *ACLInterfaceListDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Count = buf.DecodeUint8() + m.NInput = buf.DecodeUint8() + m.Acls = make([]uint32, m.Count) + for i := 0; i < len(m.Acls); i++ { + m.Acls[i] = buf.DecodeUint32() + } + return nil +} + +// ACLInterfaceListDump defines message 'acl_interface_list_dump'. +type ACLInterfaceListDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"` +} + +func (m *ACLInterfaceListDump) Reset() { *m = ACLInterfaceListDump{} } +func (*ACLInterfaceListDump) GetMessageName() string { return "acl_interface_list_dump" } +func (*ACLInterfaceListDump) GetCrcString() string { return "f9e6675e" } +func (*ACLInterfaceListDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLInterfaceListDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *ACLInterfaceListDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *ACLInterfaceListDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// ACLInterfaceSetACLList defines message 'acl_interface_set_acl_list'. +type ACLInterfaceSetACLList struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"-"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` +} + +func (m *ACLInterfaceSetACLList) Reset() { *m = ACLInterfaceSetACLList{} } +func (*ACLInterfaceSetACLList) GetMessageName() string { return "acl_interface_set_acl_list" } +func (*ACLInterfaceSetACLList) GetCrcString() string { return "473982bd" } +func (*ACLInterfaceSetACLList) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLInterfaceSetACLList) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Count + size += 1 // m.NInput + size += 4 * len(m.Acls) // m.Acls + return size +} +func (m *ACLInterfaceSetACLList) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(len(m.Acls))) + buf.EncodeUint8(uint8(m.NInput)) + for i := 0; i < len(m.Acls); i++ { + var x uint32 + if i < len(m.Acls) { + x = uint32(m.Acls[i]) + } + buf.EncodeUint32(uint32(x)) + } + return buf.Bytes(), nil +} +func (m *ACLInterfaceSetACLList) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Count = buf.DecodeUint8() + m.NInput = buf.DecodeUint8() + m.Acls = make([]uint32, m.Count) + for i := 0; i < len(m.Acls); i++ { + m.Acls[i] = buf.DecodeUint32() + } + return nil +} + +// ACLInterfaceSetACLListReply defines message 'acl_interface_set_acl_list_reply'. +type ACLInterfaceSetACLListReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLInterfaceSetACLListReply) Reset() { *m = ACLInterfaceSetACLListReply{} } +func (*ACLInterfaceSetACLListReply) GetMessageName() string { + return "acl_interface_set_acl_list_reply" +} +func (*ACLInterfaceSetACLListReply) GetCrcString() string { return "e8d4e804" } +func (*ACLInterfaceSetACLListReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLInterfaceSetACLListReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ACLInterfaceSetACLListReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ACLInterfaceSetACLListReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// ACLInterfaceSetEtypeWhitelist defines message 'acl_interface_set_etype_whitelist'. +type ACLInterfaceSetEtypeWhitelist struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"-"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Whitelist []uint16 `binapi:"u16[count],name=whitelist" json:"whitelist,omitempty"` +} + +func (m *ACLInterfaceSetEtypeWhitelist) Reset() { *m = ACLInterfaceSetEtypeWhitelist{} } +func (*ACLInterfaceSetEtypeWhitelist) GetMessageName() string { + return "acl_interface_set_etype_whitelist" +} +func (*ACLInterfaceSetEtypeWhitelist) GetCrcString() string { return "3f5c2d2d" } +func (*ACLInterfaceSetEtypeWhitelist) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLInterfaceSetEtypeWhitelist) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Count + size += 1 // m.NInput + size += 2 * len(m.Whitelist) // m.Whitelist + return size +} +func (m *ACLInterfaceSetEtypeWhitelist) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(len(m.Whitelist))) + buf.EncodeUint8(uint8(m.NInput)) + for i := 0; i < len(m.Whitelist); i++ { + var x uint16 + if i < len(m.Whitelist) { + x = uint16(m.Whitelist[i]) + } + buf.EncodeUint16(uint16(x)) + } + return buf.Bytes(), nil +} +func (m *ACLInterfaceSetEtypeWhitelist) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Count = buf.DecodeUint8() + m.NInput = buf.DecodeUint8() + m.Whitelist = make([]uint16, m.Count) + for i := 0; i < len(m.Whitelist); i++ { + m.Whitelist[i] = buf.DecodeUint16() + } + return nil +} + +// ACLInterfaceSetEtypeWhitelistReply defines message 'acl_interface_set_etype_whitelist_reply'. +type ACLInterfaceSetEtypeWhitelistReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLInterfaceSetEtypeWhitelistReply) Reset() { *m = ACLInterfaceSetEtypeWhitelistReply{} } +func (*ACLInterfaceSetEtypeWhitelistReply) GetMessageName() string { + return "acl_interface_set_etype_whitelist_reply" +} +func (*ACLInterfaceSetEtypeWhitelistReply) GetCrcString() string { return "e8d4e804" } +func (*ACLInterfaceSetEtypeWhitelistReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLInterfaceSetEtypeWhitelistReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ACLInterfaceSetEtypeWhitelistReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ACLInterfaceSetEtypeWhitelistReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// ACLPluginControlPing defines message 'acl_plugin_control_ping'. +type ACLPluginControlPing struct{} + +func (m *ACLPluginControlPing) Reset() { *m = ACLPluginControlPing{} } +func (*ACLPluginControlPing) GetMessageName() string { return "acl_plugin_control_ping" } +func (*ACLPluginControlPing) GetCrcString() string { return "51077d14" } +func (*ACLPluginControlPing) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLPluginControlPing) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ACLPluginControlPing) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ACLPluginControlPing) Unmarshal(b []byte) error { + return nil +} + +// ACLPluginControlPingReply defines message 'acl_plugin_control_ping_reply'. +type ACLPluginControlPingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ClientIndex uint32 `binapi:"u32,name=client_index" json:"client_index,omitempty"` + VpePID uint32 `binapi:"u32,name=vpe_pid" json:"vpe_pid,omitempty"` +} + +func (m *ACLPluginControlPingReply) Reset() { *m = ACLPluginControlPingReply{} } +func (*ACLPluginControlPingReply) GetMessageName() string { return "acl_plugin_control_ping_reply" } +func (*ACLPluginControlPingReply) GetCrcString() string { return "f6b0b8ca" } +func (*ACLPluginControlPingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLPluginControlPingReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.ClientIndex + size += 4 // m.VpePID + return size +} +func (m *ACLPluginControlPingReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.ClientIndex)) + buf.EncodeUint32(uint32(m.VpePID)) + return buf.Bytes(), nil +} +func (m *ACLPluginControlPingReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.ClientIndex = buf.DecodeUint32() + m.VpePID = buf.DecodeUint32() + return nil +} + +// ACLPluginGetConnTableMaxEntries defines message 'acl_plugin_get_conn_table_max_entries'. +type ACLPluginGetConnTableMaxEntries struct{} + +func (m *ACLPluginGetConnTableMaxEntries) Reset() { *m = ACLPluginGetConnTableMaxEntries{} } +func (*ACLPluginGetConnTableMaxEntries) GetMessageName() string { + return "acl_plugin_get_conn_table_max_entries" +} +func (*ACLPluginGetConnTableMaxEntries) GetCrcString() string { return "51077d14" } +func (*ACLPluginGetConnTableMaxEntries) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLPluginGetConnTableMaxEntries) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ACLPluginGetConnTableMaxEntries) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ACLPluginGetConnTableMaxEntries) Unmarshal(b []byte) error { + return nil +} + +// ACLPluginGetConnTableMaxEntriesReply defines message 'acl_plugin_get_conn_table_max_entries_reply'. +type ACLPluginGetConnTableMaxEntriesReply struct { + ConnTableMaxEntries uint64 `binapi:"u64,name=conn_table_max_entries" json:"conn_table_max_entries,omitempty"` +} + +func (m *ACLPluginGetConnTableMaxEntriesReply) Reset() { *m = ACLPluginGetConnTableMaxEntriesReply{} } +func (*ACLPluginGetConnTableMaxEntriesReply) GetMessageName() string { + return "acl_plugin_get_conn_table_max_entries_reply" +} +func (*ACLPluginGetConnTableMaxEntriesReply) GetCrcString() string { return "7a096d3d" } +func (*ACLPluginGetConnTableMaxEntriesReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLPluginGetConnTableMaxEntriesReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 8 // m.ConnTableMaxEntries + return size +} +func (m *ACLPluginGetConnTableMaxEntriesReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint64(uint64(m.ConnTableMaxEntries)) + return buf.Bytes(), nil +} +func (m *ACLPluginGetConnTableMaxEntriesReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ConnTableMaxEntries = buf.DecodeUint64() + return nil +} + +// ACLPluginGetVersion defines message 'acl_plugin_get_version'. +type ACLPluginGetVersion struct{} + +func (m *ACLPluginGetVersion) Reset() { *m = ACLPluginGetVersion{} } +func (*ACLPluginGetVersion) GetMessageName() string { return "acl_plugin_get_version" } +func (*ACLPluginGetVersion) GetCrcString() string { return "51077d14" } +func (*ACLPluginGetVersion) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLPluginGetVersion) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ACLPluginGetVersion) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ACLPluginGetVersion) Unmarshal(b []byte) error { + return nil +} + +// ACLPluginGetVersionReply defines message 'acl_plugin_get_version_reply'. +type ACLPluginGetVersionReply struct { + Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` + Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` +} + +func (m *ACLPluginGetVersionReply) Reset() { *m = ACLPluginGetVersionReply{} } +func (*ACLPluginGetVersionReply) GetMessageName() string { return "acl_plugin_get_version_reply" } +func (*ACLPluginGetVersionReply) GetCrcString() string { return "9b32cf86" } +func (*ACLPluginGetVersionReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLPluginGetVersionReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Major + size += 4 // m.Minor + return size +} +func (m *ACLPluginGetVersionReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Major)) + buf.EncodeUint32(uint32(m.Minor)) + return buf.Bytes(), nil +} +func (m *ACLPluginGetVersionReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Major = buf.DecodeUint32() + m.Minor = buf.DecodeUint32() + return nil +} + +// ACLStatsIntfCountersEnable defines message 'acl_stats_intf_counters_enable'. +type ACLStatsIntfCountersEnable struct { + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *ACLStatsIntfCountersEnable) Reset() { *m = ACLStatsIntfCountersEnable{} } +func (*ACLStatsIntfCountersEnable) GetMessageName() string { return "acl_stats_intf_counters_enable" } +func (*ACLStatsIntfCountersEnable) GetCrcString() string { return "b3e225d2" } +func (*ACLStatsIntfCountersEnable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLStatsIntfCountersEnable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Enable + return size +} +func (m *ACLStatsIntfCountersEnable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *ACLStatsIntfCountersEnable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Enable = buf.DecodeBool() + return nil +} + +// ACLStatsIntfCountersEnableReply defines message 'acl_stats_intf_counters_enable_reply'. +type ACLStatsIntfCountersEnableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLStatsIntfCountersEnableReply) Reset() { *m = ACLStatsIntfCountersEnableReply{} } +func (*ACLStatsIntfCountersEnableReply) GetMessageName() string { + return "acl_stats_intf_counters_enable_reply" +} +func (*ACLStatsIntfCountersEnableReply) GetCrcString() string { return "e8d4e804" } +func (*ACLStatsIntfCountersEnableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLStatsIntfCountersEnableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ACLStatsIntfCountersEnableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ACLStatsIntfCountersEnableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MacipACLAdd defines message 'macip_acl_add'. +type MacipACLAdd struct { + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + R []acl_types.MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` +} + +func (m *MacipACLAdd) Reset() { *m = MacipACLAdd{} } +func (*MacipACLAdd) GetMessageName() string { return "macip_acl_add" } +func (*MacipACLAdd) GetCrcString() string { return "d648fd0a" } +func (*MacipACLAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MacipACLAdd) Size() int { + if m == nil { + return 0 + } + var size int + size += 64 // m.Tag + size += 4 // m.Count + for j1 := 0; j1 < len(m.R); j1++ { + var s1 acl_types.MacipACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + size += 1 // s1.IsPermit + size += 1 * 6 // s1.SrcMac + size += 1 * 6 // s1.SrcMacMask + size += 1 // s1.SrcPrefix.Address.Af + size += 1 * 16 // s1.SrcPrefix.Address.Un + size += 1 // s1.SrcPrefix.Len + } + return size +} +func (m *MacipACLAdd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.Tag, 64) + buf.EncodeUint32(uint32(len(m.R))) + for j0 := 0; j0 < len(m.R); j0++ { + var v0 acl_types.MacipACLRule + if j0 < len(m.R) { + v0 = m.R[j0] + } + buf.EncodeUint8(uint8(v0.IsPermit)) + buf.EncodeBytes(v0.SrcMac[:], 6) + buf.EncodeBytes(v0.SrcMacMask[:], 6) + buf.EncodeUint8(uint8(v0.SrcPrefix.Address.Af)) + buf.EncodeBytes(v0.SrcPrefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(v0.SrcPrefix.Len)) + } + return buf.Bytes(), nil +} +func (m *MacipACLAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Tag = buf.DecodeString(64) + m.Count = buf.DecodeUint32() + m.R = make([]acl_types.MacipACLRule, int(m.Count)) + for j0 := 0; j0 < len(m.R); j0++ { + m.R[j0].IsPermit = acl_types.ACLAction(buf.DecodeUint8()) + copy(m.R[j0].SrcMac[:], buf.DecodeBytes(6)) + copy(m.R[j0].SrcMacMask[:], buf.DecodeBytes(6)) + m.R[j0].SrcPrefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.R[j0].SrcPrefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.R[j0].SrcPrefix.Len = buf.DecodeUint8() + } + return nil +} + +// MacipACLAddReplace defines message 'macip_acl_add_replace'. +type MacipACLAddReplace struct { + ACLIndex uint32 `binapi:"u32,name=acl_index,default=%!s(float64=4.294967295e+09)" json:"acl_index,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + R []acl_types.MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` +} + +func (m *MacipACLAddReplace) Reset() { *m = MacipACLAddReplace{} } +func (*MacipACLAddReplace) GetMessageName() string { return "macip_acl_add_replace" } +func (*MacipACLAddReplace) GetCrcString() string { return "e34402a7" } +func (*MacipACLAddReplace) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MacipACLAddReplace) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ACLIndex + size += 64 // m.Tag + size += 4 // m.Count + for j1 := 0; j1 < len(m.R); j1++ { + var s1 acl_types.MacipACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + size += 1 // s1.IsPermit + size += 1 * 6 // s1.SrcMac + size += 1 * 6 // s1.SrcMacMask + size += 1 // s1.SrcPrefix.Address.Af + size += 1 * 16 // s1.SrcPrefix.Address.Un + size += 1 // s1.SrcPrefix.Len + } + return size +} +func (m *MacipACLAddReplace) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ACLIndex)) + buf.EncodeString(m.Tag, 64) + buf.EncodeUint32(uint32(len(m.R))) + for j0 := 0; j0 < len(m.R); j0++ { + var v0 acl_types.MacipACLRule + if j0 < len(m.R) { + v0 = m.R[j0] + } + buf.EncodeUint8(uint8(v0.IsPermit)) + buf.EncodeBytes(v0.SrcMac[:], 6) + buf.EncodeBytes(v0.SrcMacMask[:], 6) + buf.EncodeUint8(uint8(v0.SrcPrefix.Address.Af)) + buf.EncodeBytes(v0.SrcPrefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(v0.SrcPrefix.Len)) + } + return buf.Bytes(), nil +} +func (m *MacipACLAddReplace) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ACLIndex = buf.DecodeUint32() + m.Tag = buf.DecodeString(64) + m.Count = buf.DecodeUint32() + m.R = make([]acl_types.MacipACLRule, int(m.Count)) + for j0 := 0; j0 < len(m.R); j0++ { + m.R[j0].IsPermit = acl_types.ACLAction(buf.DecodeUint8()) + copy(m.R[j0].SrcMac[:], buf.DecodeBytes(6)) + copy(m.R[j0].SrcMacMask[:], buf.DecodeBytes(6)) + m.R[j0].SrcPrefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.R[j0].SrcPrefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.R[j0].SrcPrefix.Len = buf.DecodeUint8() + } + return nil +} + +// MacipACLAddReplaceReply defines message 'macip_acl_add_replace_reply'. +type MacipACLAddReplaceReply struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MacipACLAddReplaceReply) Reset() { *m = MacipACLAddReplaceReply{} } +func (*MacipACLAddReplaceReply) GetMessageName() string { return "macip_acl_add_replace_reply" } +func (*MacipACLAddReplaceReply) GetCrcString() string { return "ac407b0c" } +func (*MacipACLAddReplaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MacipACLAddReplaceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ACLIndex + size += 4 // m.Retval + return size +} +func (m *MacipACLAddReplaceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ACLIndex)) + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MacipACLAddReplaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ACLIndex = buf.DecodeUint32() + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MacipACLAddReply defines message 'macip_acl_add_reply'. +type MacipACLAddReply struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MacipACLAddReply) Reset() { *m = MacipACLAddReply{} } +func (*MacipACLAddReply) GetMessageName() string { return "macip_acl_add_reply" } +func (*MacipACLAddReply) GetCrcString() string { return "ac407b0c" } +func (*MacipACLAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MacipACLAddReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ACLIndex + size += 4 // m.Retval + return size +} +func (m *MacipACLAddReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ACLIndex)) + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MacipACLAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ACLIndex = buf.DecodeUint32() + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MacipACLDel defines message 'macip_acl_del'. +type MacipACLDel struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` +} + +func (m *MacipACLDel) Reset() { *m = MacipACLDel{} } +func (*MacipACLDel) GetMessageName() string { return "macip_acl_del" } +func (*MacipACLDel) GetCrcString() string { return "ef34fea4" } +func (*MacipACLDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MacipACLDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ACLIndex + return size +} +func (m *MacipACLDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ACLIndex)) + return buf.Bytes(), nil +} +func (m *MacipACLDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ACLIndex = buf.DecodeUint32() + return nil +} + +// MacipACLDelReply defines message 'macip_acl_del_reply'. +type MacipACLDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MacipACLDelReply) Reset() { *m = MacipACLDelReply{} } +func (*MacipACLDelReply) GetMessageName() string { return "macip_acl_del_reply" } +func (*MacipACLDelReply) GetCrcString() string { return "e8d4e804" } +func (*MacipACLDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MacipACLDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *MacipACLDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MacipACLDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MacipACLDetails defines message 'macip_acl_details'. +type MacipACLDetails struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + R []acl_types.MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` +} + +func (m *MacipACLDetails) Reset() { *m = MacipACLDetails{} } +func (*MacipACLDetails) GetMessageName() string { return "macip_acl_details" } +func (*MacipACLDetails) GetCrcString() string { return "57c7482f" } +func (*MacipACLDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MacipACLDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ACLIndex + size += 64 // m.Tag + size += 4 // m.Count + for j1 := 0; j1 < len(m.R); j1++ { + var s1 acl_types.MacipACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + size += 1 // s1.IsPermit + size += 1 * 6 // s1.SrcMac + size += 1 * 6 // s1.SrcMacMask + size += 1 // s1.SrcPrefix.Address.Af + size += 1 * 16 // s1.SrcPrefix.Address.Un + size += 1 // s1.SrcPrefix.Len + } + return size +} +func (m *MacipACLDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ACLIndex)) + buf.EncodeString(m.Tag, 64) + buf.EncodeUint32(uint32(len(m.R))) + for j0 := 0; j0 < len(m.R); j0++ { + var v0 acl_types.MacipACLRule + if j0 < len(m.R) { + v0 = m.R[j0] + } + buf.EncodeUint8(uint8(v0.IsPermit)) + buf.EncodeBytes(v0.SrcMac[:], 6) + buf.EncodeBytes(v0.SrcMacMask[:], 6) + buf.EncodeUint8(uint8(v0.SrcPrefix.Address.Af)) + buf.EncodeBytes(v0.SrcPrefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(v0.SrcPrefix.Len)) + } + return buf.Bytes(), nil +} +func (m *MacipACLDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ACLIndex = buf.DecodeUint32() + m.Tag = buf.DecodeString(64) + m.Count = buf.DecodeUint32() + m.R = make([]acl_types.MacipACLRule, int(m.Count)) + for j0 := 0; j0 < len(m.R); j0++ { + m.R[j0].IsPermit = acl_types.ACLAction(buf.DecodeUint8()) + copy(m.R[j0].SrcMac[:], buf.DecodeBytes(6)) + copy(m.R[j0].SrcMacMask[:], buf.DecodeBytes(6)) + m.R[j0].SrcPrefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.R[j0].SrcPrefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.R[j0].SrcPrefix.Len = buf.DecodeUint8() + } + return nil +} + +// MacipACLDump defines message 'macip_acl_dump'. +type MacipACLDump struct { + ACLIndex uint32 `binapi:"u32,name=acl_index,default=%!s(float64=4.294967295e+09)" json:"acl_index,omitempty"` +} + +func (m *MacipACLDump) Reset() { *m = MacipACLDump{} } +func (*MacipACLDump) GetMessageName() string { return "macip_acl_dump" } +func (*MacipACLDump) GetCrcString() string { return "ef34fea4" } +func (*MacipACLDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MacipACLDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ACLIndex + return size +} +func (m *MacipACLDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ACLIndex)) + return buf.Bytes(), nil +} +func (m *MacipACLDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ACLIndex = buf.DecodeUint32() + return nil +} + +// MacipACLInterfaceAddDel defines message 'macip_acl_interface_add_del'. +type MacipACLInterfaceAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` +} + +func (m *MacipACLInterfaceAddDel) Reset() { *m = MacipACLInterfaceAddDel{} } +func (*MacipACLInterfaceAddDel) GetMessageName() string { return "macip_acl_interface_add_del" } +func (*MacipACLInterfaceAddDel) GetCrcString() string { return "4b8690b1" } +func (*MacipACLInterfaceAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MacipACLInterfaceAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.SwIfIndex + size += 4 // m.ACLIndex + return size +} +func (m *MacipACLInterfaceAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.ACLIndex)) + return buf.Bytes(), nil +} +func (m *MacipACLInterfaceAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.ACLIndex = buf.DecodeUint32() + return nil +} + +// MacipACLInterfaceAddDelReply defines message 'macip_acl_interface_add_del_reply'. +type MacipACLInterfaceAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MacipACLInterfaceAddDelReply) Reset() { *m = MacipACLInterfaceAddDelReply{} } +func (*MacipACLInterfaceAddDelReply) GetMessageName() string { + return "macip_acl_interface_add_del_reply" +} +func (*MacipACLInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*MacipACLInterfaceAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MacipACLInterfaceAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *MacipACLInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MacipACLInterfaceAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MacipACLInterfaceGet defines message 'macip_acl_interface_get'. +type MacipACLInterfaceGet struct{} + +func (m *MacipACLInterfaceGet) Reset() { *m = MacipACLInterfaceGet{} } +func (*MacipACLInterfaceGet) GetMessageName() string { return "macip_acl_interface_get" } +func (*MacipACLInterfaceGet) GetCrcString() string { return "51077d14" } +func (*MacipACLInterfaceGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MacipACLInterfaceGet) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MacipACLInterfaceGet) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *MacipACLInterfaceGet) Unmarshal(b []byte) error { + return nil +} + +// MacipACLInterfaceGetReply defines message 'macip_acl_interface_get_reply'. +type MacipACLInterfaceGetReply struct { + Count uint32 `binapi:"u32,name=count" json:"-"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` +} + +func (m *MacipACLInterfaceGetReply) Reset() { *m = MacipACLInterfaceGetReply{} } +func (*MacipACLInterfaceGetReply) GetMessageName() string { return "macip_acl_interface_get_reply" } +func (*MacipACLInterfaceGetReply) GetCrcString() string { return "accf9b05" } +func (*MacipACLInterfaceGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MacipACLInterfaceGetReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Count + size += 4 * len(m.Acls) // m.Acls + return size +} +func (m *MacipACLInterfaceGetReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(len(m.Acls))) + for i := 0; i < len(m.Acls); i++ { + var x uint32 + if i < len(m.Acls) { + x = uint32(m.Acls[i]) + } + buf.EncodeUint32(uint32(x)) + } + return buf.Bytes(), nil +} +func (m *MacipACLInterfaceGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Count = buf.DecodeUint32() + m.Acls = make([]uint32, m.Count) + for i := 0; i < len(m.Acls); i++ { + m.Acls[i] = buf.DecodeUint32() + } + return nil +} + +// MacipACLInterfaceListDetails defines message 'macip_acl_interface_list_details'. +type MacipACLInterfaceListDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"-"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` +} + +func (m *MacipACLInterfaceListDetails) Reset() { *m = MacipACLInterfaceListDetails{} } +func (*MacipACLInterfaceListDetails) GetMessageName() string { + return "macip_acl_interface_list_details" +} +func (*MacipACLInterfaceListDetails) GetCrcString() string { return "a0c5d56d" } +func (*MacipACLInterfaceListDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MacipACLInterfaceListDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Count + size += 4 * len(m.Acls) // m.Acls + return size +} +func (m *MacipACLInterfaceListDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(len(m.Acls))) + for i := 0; i < len(m.Acls); i++ { + var x uint32 + if i < len(m.Acls) { + x = uint32(m.Acls[i]) + } + buf.EncodeUint32(uint32(x)) + } + return buf.Bytes(), nil +} +func (m *MacipACLInterfaceListDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Count = buf.DecodeUint8() + m.Acls = make([]uint32, m.Count) + for i := 0; i < len(m.Acls); i++ { + m.Acls[i] = buf.DecodeUint32() + } + return nil +} + +// MacipACLInterfaceListDump defines message 'macip_acl_interface_list_dump'. +type MacipACLInterfaceListDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *MacipACLInterfaceListDump) Reset() { *m = MacipACLInterfaceListDump{} } +func (*MacipACLInterfaceListDump) GetMessageName() string { return "macip_acl_interface_list_dump" } +func (*MacipACLInterfaceListDump) GetCrcString() string { return "f9e6675e" } +func (*MacipACLInterfaceListDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MacipACLInterfaceListDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *MacipACLInterfaceListDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *MacipACLInterfaceListDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +func init() { file_acl_binapi_init() } +func file_acl_binapi_init() { + api.RegisterMessage((*ACLAddReplace)(nil), "acl_add_replace_1cabdeab") + api.RegisterMessage((*ACLAddReplaceReply)(nil), "acl_add_replace_reply_ac407b0c") + api.RegisterMessage((*ACLDel)(nil), "acl_del_ef34fea4") + api.RegisterMessage((*ACLDelReply)(nil), "acl_del_reply_e8d4e804") + api.RegisterMessage((*ACLDetails)(nil), "acl_details_7a97f21c") + api.RegisterMessage((*ACLDump)(nil), "acl_dump_ef34fea4") + api.RegisterMessage((*ACLInterfaceAddDel)(nil), "acl_interface_add_del_4b54bebd") + api.RegisterMessage((*ACLInterfaceAddDelReply)(nil), "acl_interface_add_del_reply_e8d4e804") + api.RegisterMessage((*ACLInterfaceEtypeWhitelistDetails)(nil), "acl_interface_etype_whitelist_details_cc2bfded") + api.RegisterMessage((*ACLInterfaceEtypeWhitelistDump)(nil), "acl_interface_etype_whitelist_dump_f9e6675e") + api.RegisterMessage((*ACLInterfaceListDetails)(nil), "acl_interface_list_details_e695d256") + api.RegisterMessage((*ACLInterfaceListDump)(nil), "acl_interface_list_dump_f9e6675e") + api.RegisterMessage((*ACLInterfaceSetACLList)(nil), "acl_interface_set_acl_list_473982bd") + api.RegisterMessage((*ACLInterfaceSetACLListReply)(nil), "acl_interface_set_acl_list_reply_e8d4e804") + api.RegisterMessage((*ACLInterfaceSetEtypeWhitelist)(nil), "acl_interface_set_etype_whitelist_3f5c2d2d") + api.RegisterMessage((*ACLInterfaceSetEtypeWhitelistReply)(nil), "acl_interface_set_etype_whitelist_reply_e8d4e804") + api.RegisterMessage((*ACLPluginControlPing)(nil), "acl_plugin_control_ping_51077d14") + api.RegisterMessage((*ACLPluginControlPingReply)(nil), "acl_plugin_control_ping_reply_f6b0b8ca") + api.RegisterMessage((*ACLPluginGetConnTableMaxEntries)(nil), "acl_plugin_get_conn_table_max_entries_51077d14") + api.RegisterMessage((*ACLPluginGetConnTableMaxEntriesReply)(nil), "acl_plugin_get_conn_table_max_entries_reply_7a096d3d") + api.RegisterMessage((*ACLPluginGetVersion)(nil), "acl_plugin_get_version_51077d14") + api.RegisterMessage((*ACLPluginGetVersionReply)(nil), "acl_plugin_get_version_reply_9b32cf86") + api.RegisterMessage((*ACLStatsIntfCountersEnable)(nil), "acl_stats_intf_counters_enable_b3e225d2") + api.RegisterMessage((*ACLStatsIntfCountersEnableReply)(nil), "acl_stats_intf_counters_enable_reply_e8d4e804") + api.RegisterMessage((*MacipACLAdd)(nil), "macip_acl_add_d648fd0a") + api.RegisterMessage((*MacipACLAddReplace)(nil), "macip_acl_add_replace_e34402a7") + api.RegisterMessage((*MacipACLAddReplaceReply)(nil), "macip_acl_add_replace_reply_ac407b0c") + api.RegisterMessage((*MacipACLAddReply)(nil), "macip_acl_add_reply_ac407b0c") + api.RegisterMessage((*MacipACLDel)(nil), "macip_acl_del_ef34fea4") + api.RegisterMessage((*MacipACLDelReply)(nil), "macip_acl_del_reply_e8d4e804") + api.RegisterMessage((*MacipACLDetails)(nil), "macip_acl_details_57c7482f") + api.RegisterMessage((*MacipACLDump)(nil), "macip_acl_dump_ef34fea4") + api.RegisterMessage((*MacipACLInterfaceAddDel)(nil), "macip_acl_interface_add_del_4b8690b1") + api.RegisterMessage((*MacipACLInterfaceAddDelReply)(nil), "macip_acl_interface_add_del_reply_e8d4e804") + api.RegisterMessage((*MacipACLInterfaceGet)(nil), "macip_acl_interface_get_51077d14") + api.RegisterMessage((*MacipACLInterfaceGetReply)(nil), "macip_acl_interface_get_reply_accf9b05") + api.RegisterMessage((*MacipACLInterfaceListDetails)(nil), "macip_acl_interface_list_details_a0c5d56d") + api.RegisterMessage((*MacipACLInterfaceListDump)(nil), "macip_acl_interface_list_dump_f9e6675e") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*ACLAddReplace)(nil), + (*ACLAddReplaceReply)(nil), + (*ACLDel)(nil), + (*ACLDelReply)(nil), + (*ACLDetails)(nil), + (*ACLDump)(nil), + (*ACLInterfaceAddDel)(nil), + (*ACLInterfaceAddDelReply)(nil), + (*ACLInterfaceEtypeWhitelistDetails)(nil), + (*ACLInterfaceEtypeWhitelistDump)(nil), + (*ACLInterfaceListDetails)(nil), + (*ACLInterfaceListDump)(nil), + (*ACLInterfaceSetACLList)(nil), + (*ACLInterfaceSetACLListReply)(nil), + (*ACLInterfaceSetEtypeWhitelist)(nil), + (*ACLInterfaceSetEtypeWhitelistReply)(nil), + (*ACLPluginControlPing)(nil), + (*ACLPluginControlPingReply)(nil), + (*ACLPluginGetConnTableMaxEntries)(nil), + (*ACLPluginGetConnTableMaxEntriesReply)(nil), + (*ACLPluginGetVersion)(nil), + (*ACLPluginGetVersionReply)(nil), + (*ACLStatsIntfCountersEnable)(nil), + (*ACLStatsIntfCountersEnableReply)(nil), + (*MacipACLAdd)(nil), + (*MacipACLAddReplace)(nil), + (*MacipACLAddReplaceReply)(nil), + (*MacipACLAddReply)(nil), + (*MacipACLDel)(nil), + (*MacipACLDelReply)(nil), + (*MacipACLDetails)(nil), + (*MacipACLDump)(nil), + (*MacipACLInterfaceAddDel)(nil), + (*MacipACLInterfaceAddDelReply)(nil), + (*MacipACLInterfaceGet)(nil), + (*MacipACLInterfaceGetReply)(nil), + (*MacipACLInterfaceListDetails)(nil), + (*MacipACLInterfaceListDump)(nil), + } +} diff --git a/binapi/acl/acl_rest.ba.go b/binapi/acl/acl_rest.ba.go new file mode 100644 index 0000000..0dd8c94 --- /dev/null +++ b/binapi/acl/acl_rest.ba.go @@ -0,0 +1,300 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package acl + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/acl_add_replace", func(w http.ResponseWriter, req *http.Request) { + var request = new(ACLAddReplace) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ACLAddReplace(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/acl_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(ACLDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ACLDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/acl_interface_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(ACLInterfaceAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ACLInterfaceAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/acl_interface_set_acl_list", func(w http.ResponseWriter, req *http.Request) { + var request = new(ACLInterfaceSetACLList) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ACLInterfaceSetACLList(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/acl_interface_set_etype_whitelist", func(w http.ResponseWriter, req *http.Request) { + var request = new(ACLInterfaceSetEtypeWhitelist) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ACLInterfaceSetEtypeWhitelist(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/acl_plugin_control_ping", func(w http.ResponseWriter, req *http.Request) { + var request = new(ACLPluginControlPing) + reply, err := rpc.ACLPluginControlPing(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/acl_plugin_get_conn_table_max_entries", func(w http.ResponseWriter, req *http.Request) { + var request = new(ACLPluginGetConnTableMaxEntries) + reply, err := rpc.ACLPluginGetConnTableMaxEntries(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/acl_plugin_get_version", func(w http.ResponseWriter, req *http.Request) { + var request = new(ACLPluginGetVersion) + reply, err := rpc.ACLPluginGetVersion(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/acl_stats_intf_counters_enable", func(w http.ResponseWriter, req *http.Request) { + var request = new(ACLStatsIntfCountersEnable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ACLStatsIntfCountersEnable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/macip_acl_add", func(w http.ResponseWriter, req *http.Request) { + var request = new(MacipACLAdd) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MacipACLAdd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/macip_acl_add_replace", func(w http.ResponseWriter, req *http.Request) { + var request = new(MacipACLAddReplace) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MacipACLAddReplace(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/macip_acl_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(MacipACLDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MacipACLDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/macip_acl_interface_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(MacipACLInterfaceAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MacipACLInterfaceAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/macip_acl_interface_get", func(w http.ResponseWriter, req *http.Request) { + var request = new(MacipACLInterfaceGet) + reply, err := rpc.MacipACLInterfaceGet(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/acl/acl_rpc.ba.go b/binapi/acl/acl_rpc.ba.go new file mode 100644 index 0000000..a69df27 --- /dev/null +++ b/binapi/acl/acl_rpc.ba.go @@ -0,0 +1,363 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package acl + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service acl. +type RPCService interface { + ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) + ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) + ACLDump(ctx context.Context, in *ACLDump) (RPCService_ACLDumpClient, error) + ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) + ACLInterfaceEtypeWhitelistDump(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_ACLInterfaceEtypeWhitelistDumpClient, error) + ACLInterfaceListDump(ctx context.Context, in *ACLInterfaceListDump) (RPCService_ACLInterfaceListDumpClient, error) + ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) + ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) + ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) + ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) + ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) + ACLStatsIntfCountersEnable(ctx context.Context, in *ACLStatsIntfCountersEnable) (*ACLStatsIntfCountersEnableReply, error) + MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) + MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) + MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) + MacipACLDump(ctx context.Context, in *MacipACLDump) (RPCService_MacipACLDumpClient, error) + MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) + MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) + MacipACLInterfaceListDump(ctx context.Context, in *MacipACLInterfaceListDump) (RPCService_MacipACLInterfaceListDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) { + out := new(ACLAddReplaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) { + out := new(ACLDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLDump(ctx context.Context, in *ACLDump) (RPCService_ACLDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_ACLDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_ACLDumpClient interface { + Recv() (*ACLDetails, error) + api.Stream +} + +type serviceClient_ACLDumpClient struct { + api.Stream +} + +func (c *serviceClient_ACLDumpClient) Recv() (*ACLDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *ACLDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) { + out := new(ACLInterfaceAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLInterfaceEtypeWhitelistDump(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_ACLInterfaceEtypeWhitelistDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_ACLInterfaceEtypeWhitelistDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_ACLInterfaceEtypeWhitelistDumpClient interface { + Recv() (*ACLInterfaceEtypeWhitelistDetails, error) + api.Stream +} + +type serviceClient_ACLInterfaceEtypeWhitelistDumpClient struct { + api.Stream +} + +func (c *serviceClient_ACLInterfaceEtypeWhitelistDumpClient) Recv() (*ACLInterfaceEtypeWhitelistDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *ACLInterfaceEtypeWhitelistDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) ACLInterfaceListDump(ctx context.Context, in *ACLInterfaceListDump) (RPCService_ACLInterfaceListDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_ACLInterfaceListDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_ACLInterfaceListDumpClient interface { + Recv() (*ACLInterfaceListDetails, error) + api.Stream +} + +type serviceClient_ACLInterfaceListDumpClient struct { + api.Stream +} + +func (c *serviceClient_ACLInterfaceListDumpClient) Recv() (*ACLInterfaceListDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *ACLInterfaceListDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) { + out := new(ACLInterfaceSetACLListReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) { + out := new(ACLInterfaceSetEtypeWhitelistReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) { + out := new(ACLPluginControlPingReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) { + out := new(ACLPluginGetConnTableMaxEntriesReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) { + out := new(ACLPluginGetVersionReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLStatsIntfCountersEnable(ctx context.Context, in *ACLStatsIntfCountersEnable) (*ACLStatsIntfCountersEnableReply, error) { + out := new(ACLStatsIntfCountersEnableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) { + out := new(MacipACLAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) { + out := new(MacipACLAddReplaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) { + out := new(MacipACLDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLDump(ctx context.Context, in *MacipACLDump) (RPCService_MacipACLDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_MacipACLDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_MacipACLDumpClient interface { + Recv() (*MacipACLDetails, error) + api.Stream +} + +type serviceClient_MacipACLDumpClient struct { + api.Stream +} + +func (c *serviceClient_MacipACLDumpClient) Recv() (*MacipACLDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *MacipACLDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) { + out := new(MacipACLInterfaceAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) { + out := new(MacipACLInterfaceGetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLInterfaceListDump(ctx context.Context, in *MacipACLInterfaceListDump) (RPCService_MacipACLInterfaceListDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_MacipACLInterfaceListDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_MacipACLInterfaceListDumpClient interface { + Recv() (*MacipACLInterfaceListDetails, error) + api.Stream +} + +type serviceClient_MacipACLInterfaceListDumpClient struct { + api.Stream +} + +func (c *serviceClient_MacipACLInterfaceListDumpClient) Recv() (*MacipACLInterfaceListDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *MacipACLInterfaceListDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/acl_types/acl_types.ba.go b/binapi/acl_types/acl_types.ba.go new file mode 100644 index 0000000..5371e22 --- /dev/null +++ b/binapi/acl_types/acl_types.ba.go @@ -0,0 +1,78 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/acl_types.api.json + +// Package acl_types contains generated bindings for API file acl_types.api. +// +// Contents: +// 1 enum +// 2 structs +// +package acl_types + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +// ACLAction defines enum 'acl_action'. +type ACLAction uint8 + +const ( + ACL_ACTION_API_DENY ACLAction = 0 + ACL_ACTION_API_PERMIT ACLAction = 1 + ACL_ACTION_API_PERMIT_REFLECT ACLAction = 2 +) + +var ( + ACLAction_name = map[uint8]string{ + 0: "ACL_ACTION_API_DENY", + 1: "ACL_ACTION_API_PERMIT", + 2: "ACL_ACTION_API_PERMIT_REFLECT", + } + ACLAction_value = map[string]uint8{ + "ACL_ACTION_API_DENY": 0, + "ACL_ACTION_API_PERMIT": 1, + "ACL_ACTION_API_PERMIT_REFLECT": 2, + } +) + +func (x ACLAction) String() string { + s, ok := ACLAction_name[uint8(x)] + if ok { + return s + } + return "ACLAction(" + strconv.Itoa(int(x)) + ")" +} + +// ACLRule defines type 'acl_rule'. +type ACLRule struct { + IsPermit ACLAction `binapi:"acl_action,name=is_permit" json:"is_permit,omitempty"` + SrcPrefix ip_types.Prefix `binapi:"prefix,name=src_prefix" json:"src_prefix,omitempty"` + DstPrefix ip_types.Prefix `binapi:"prefix,name=dst_prefix" json:"dst_prefix,omitempty"` + Proto ip_types.IPProto `binapi:"ip_proto,name=proto" json:"proto,omitempty"` + SrcportOrIcmptypeFirst uint16 `binapi:"u16,name=srcport_or_icmptype_first" json:"srcport_or_icmptype_first,omitempty"` + SrcportOrIcmptypeLast uint16 `binapi:"u16,name=srcport_or_icmptype_last" json:"srcport_or_icmptype_last,omitempty"` + DstportOrIcmpcodeFirst uint16 `binapi:"u16,name=dstport_or_icmpcode_first" json:"dstport_or_icmpcode_first,omitempty"` + DstportOrIcmpcodeLast uint16 `binapi:"u16,name=dstport_or_icmpcode_last" json:"dstport_or_icmpcode_last,omitempty"` + TCPFlagsMask uint8 `binapi:"u8,name=tcp_flags_mask" json:"tcp_flags_mask,omitempty"` + TCPFlagsValue uint8 `binapi:"u8,name=tcp_flags_value" json:"tcp_flags_value,omitempty"` +} + +// MacipACLRule defines type 'macip_acl_rule'. +type MacipACLRule struct { + IsPermit ACLAction `binapi:"acl_action,name=is_permit" json:"is_permit,omitempty"` + SrcMac ethernet_types.MacAddress `binapi:"mac_address,name=src_mac" json:"src_mac,omitempty"` + SrcMacMask ethernet_types.MacAddress `binapi:"mac_address,name=src_mac_mask" json:"src_mac_mask,omitempty"` + SrcPrefix ip_types.Prefix `binapi:"prefix,name=src_prefix" json:"src_prefix,omitempty"` +} diff --git a/binapi/af_packet/af_packet.ba.go b/binapi/af_packet/af_packet.ba.go new file mode 100644 index 0000000..646636e --- /dev/null +++ b/binapi/af_packet/af_packet.ba.go @@ -0,0 +1,361 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/af_packet.api.json + +// Package af_packet contains generated bindings for API file af_packet.api. +// +// Contents: +// 8 messages +// +package af_packet + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "af_packet" + APIVersion = "2.0.0" + VersionCrc = 0xe0b6c022 +) + +// AfPacketCreate defines message 'af_packet_create'. +type AfPacketCreate struct { + HwAddr ethernet_types.MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` + UseRandomHwAddr bool `binapi:"bool,name=use_random_hw_addr" json:"use_random_hw_addr,omitempty"` + HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"` +} + +func (m *AfPacketCreate) Reset() { *m = AfPacketCreate{} } +func (*AfPacketCreate) GetMessageName() string { return "af_packet_create" } +func (*AfPacketCreate) GetCrcString() string { return "a190415f" } +func (*AfPacketCreate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AfPacketCreate) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 6 // m.HwAddr + size += 1 // m.UseRandomHwAddr + size += 64 // m.HostIfName + return size +} +func (m *AfPacketCreate) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.HwAddr[:], 6) + buf.EncodeBool(m.UseRandomHwAddr) + buf.EncodeString(m.HostIfName, 64) + return buf.Bytes(), nil +} +func (m *AfPacketCreate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.HwAddr[:], buf.DecodeBytes(6)) + m.UseRandomHwAddr = buf.DecodeBool() + m.HostIfName = buf.DecodeString(64) + return nil +} + +// AfPacketCreateReply defines message 'af_packet_create_reply'. +type AfPacketCreateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *AfPacketCreateReply) Reset() { *m = AfPacketCreateReply{} } +func (*AfPacketCreateReply) GetMessageName() string { return "af_packet_create_reply" } +func (*AfPacketCreateReply) GetCrcString() string { return "5383d31f" } +func (*AfPacketCreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AfPacketCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *AfPacketCreateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *AfPacketCreateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// AfPacketDelete defines message 'af_packet_delete'. +type AfPacketDelete struct { + HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"` +} + +func (m *AfPacketDelete) Reset() { *m = AfPacketDelete{} } +func (*AfPacketDelete) GetMessageName() string { return "af_packet_delete" } +func (*AfPacketDelete) GetCrcString() string { return "863fa648" } +func (*AfPacketDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AfPacketDelete) Size() int { + if m == nil { + return 0 + } + var size int + size += 64 // m.HostIfName + return size +} +func (m *AfPacketDelete) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.HostIfName, 64) + return buf.Bytes(), nil +} +func (m *AfPacketDelete) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.HostIfName = buf.DecodeString(64) + return nil +} + +// AfPacketDeleteReply defines message 'af_packet_delete_reply'. +type AfPacketDeleteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *AfPacketDeleteReply) Reset() { *m = AfPacketDeleteReply{} } +func (*AfPacketDeleteReply) GetMessageName() string { return "af_packet_delete_reply" } +func (*AfPacketDeleteReply) GetCrcString() string { return "e8d4e804" } +func (*AfPacketDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AfPacketDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *AfPacketDeleteReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *AfPacketDeleteReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// AfPacketDetails defines message 'af_packet_details'. +type AfPacketDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"` +} + +func (m *AfPacketDetails) Reset() { *m = AfPacketDetails{} } +func (*AfPacketDetails) GetMessageName() string { return "af_packet_details" } +func (*AfPacketDetails) GetCrcString() string { return "58c7c042" } +func (*AfPacketDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AfPacketDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 64 // m.HostIfName + return size +} +func (m *AfPacketDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeString(m.HostIfName, 64) + return buf.Bytes(), nil +} +func (m *AfPacketDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.HostIfName = buf.DecodeString(64) + return nil +} + +// AfPacketDump defines message 'af_packet_dump'. +type AfPacketDump struct{} + +func (m *AfPacketDump) Reset() { *m = AfPacketDump{} } +func (*AfPacketDump) GetMessageName() string { return "af_packet_dump" } +func (*AfPacketDump) GetCrcString() string { return "51077d14" } +func (*AfPacketDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AfPacketDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *AfPacketDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *AfPacketDump) Unmarshal(b []byte) error { + return nil +} + +// AfPacketSetL4CksumOffload defines message 'af_packet_set_l4_cksum_offload'. +type AfPacketSetL4CksumOffload struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Set bool `binapi:"bool,name=set" json:"set,omitempty"` +} + +func (m *AfPacketSetL4CksumOffload) Reset() { *m = AfPacketSetL4CksumOffload{} } +func (*AfPacketSetL4CksumOffload) GetMessageName() string { return "af_packet_set_l4_cksum_offload" } +func (*AfPacketSetL4CksumOffload) GetCrcString() string { return "319cd5c8" } +func (*AfPacketSetL4CksumOffload) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AfPacketSetL4CksumOffload) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Set + return size +} +func (m *AfPacketSetL4CksumOffload) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.Set) + return buf.Bytes(), nil +} +func (m *AfPacketSetL4CksumOffload) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Set = buf.DecodeBool() + return nil +} + +// AfPacketSetL4CksumOffloadReply defines message 'af_packet_set_l4_cksum_offload_reply'. +type AfPacketSetL4CksumOffloadReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *AfPacketSetL4CksumOffloadReply) Reset() { *m = AfPacketSetL4CksumOffloadReply{} } +func (*AfPacketSetL4CksumOffloadReply) GetMessageName() string { + return "af_packet_set_l4_cksum_offload_reply" +} +func (*AfPacketSetL4CksumOffloadReply) GetCrcString() string { return "e8d4e804" } +func (*AfPacketSetL4CksumOffloadReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AfPacketSetL4CksumOffloadReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *AfPacketSetL4CksumOffloadReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *AfPacketSetL4CksumOffloadReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_af_packet_binapi_init() } +func file_af_packet_binapi_init() { + api.RegisterMessage((*AfPacketCreate)(nil), "af_packet_create_a190415f") + api.RegisterMessage((*AfPacketCreateReply)(nil), "af_packet_create_reply_5383d31f") + api.RegisterMessage((*AfPacketDelete)(nil), "af_packet_delete_863fa648") + api.RegisterMessage((*AfPacketDeleteReply)(nil), "af_packet_delete_reply_e8d4e804") + api.RegisterMessage((*AfPacketDetails)(nil), "af_packet_details_58c7c042") + api.RegisterMessage((*AfPacketDump)(nil), "af_packet_dump_51077d14") + api.RegisterMessage((*AfPacketSetL4CksumOffload)(nil), "af_packet_set_l4_cksum_offload_319cd5c8") + api.RegisterMessage((*AfPacketSetL4CksumOffloadReply)(nil), "af_packet_set_l4_cksum_offload_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AfPacketCreate)(nil), + (*AfPacketCreateReply)(nil), + (*AfPacketDelete)(nil), + (*AfPacketDeleteReply)(nil), + (*AfPacketDetails)(nil), + (*AfPacketDump)(nil), + (*AfPacketSetL4CksumOffload)(nil), + (*AfPacketSetL4CksumOffloadReply)(nil), + } +} diff --git a/binapi/af_packet/af_packet_rest.ba.go b/binapi/af_packet/af_packet_rest.ba.go new file mode 100644 index 0000000..e6c498c --- /dev/null +++ b/binapi/af_packet/af_packet_rest.ba.go @@ -0,0 +1,83 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package af_packet + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/af_packet_create", func(w http.ResponseWriter, req *http.Request) { + var request = new(AfPacketCreate) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.AfPacketCreate(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/af_packet_delete", func(w http.ResponseWriter, req *http.Request) { + var request = new(AfPacketDelete) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.AfPacketDelete(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/af_packet_set_l4_cksum_offload", func(w http.ResponseWriter, req *http.Request) { + var request = new(AfPacketSetL4CksumOffload) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.AfPacketSetL4CksumOffload(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/af_packet/af_packet_rpc.ba.go b/binapi/af_packet/af_packet_rpc.ba.go new file mode 100644 index 0000000..72fea67 --- /dev/null +++ b/binapi/af_packet/af_packet_rpc.ba.go @@ -0,0 +1,93 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package af_packet + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service af_packet. +type RPCService interface { + AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) + AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) + AfPacketDump(ctx context.Context, in *AfPacketDump) (RPCService_AfPacketDumpClient, error) + AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) { + out := new(AfPacketCreateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) { + out := new(AfPacketDeleteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AfPacketDump(ctx context.Context, in *AfPacketDump) (RPCService_AfPacketDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_AfPacketDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_AfPacketDumpClient interface { + Recv() (*AfPacketDetails, error) + api.Stream +} + +type serviceClient_AfPacketDumpClient struct { + api.Stream +} + +func (c *serviceClient_AfPacketDumpClient) Recv() (*AfPacketDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *AfPacketDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) { + out := new(AfPacketSetL4CksumOffloadReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/arp/arp.ba.go b/binapi/arp/arp.ba.go new file mode 100644 index 0000000..deb5180 --- /dev/null +++ b/binapi/arp/arp.ba.go @@ -0,0 +1,364 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/arp.api.json + +// Package arp contains generated bindings for API file arp.api. +// +// Contents: +// 1 struct +// 8 messages +// +package arp + +import ( + api "git.fd.io/govpp.git/api" + _ "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "arp" + APIVersion = "1.0.0" + VersionCrc = 0x79ca86f2 +) + +// ProxyArp defines type 'proxy_arp'. +type ProxyArp struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + Low ip_types.IP4Address `binapi:"ip4_address,name=low" json:"low,omitempty"` + Hi ip_types.IP4Address `binapi:"ip4_address,name=hi" json:"hi,omitempty"` +} + +// ProxyArpAddDel defines message 'proxy_arp_add_del'. +type ProxyArpAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Proxy ProxyArp `binapi:"proxy_arp,name=proxy" json:"proxy,omitempty"` +} + +func (m *ProxyArpAddDel) Reset() { *m = ProxyArpAddDel{} } +func (*ProxyArpAddDel) GetMessageName() string { return "proxy_arp_add_del" } +func (*ProxyArpAddDel) GetCrcString() string { return "85486cbd" } +func (*ProxyArpAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ProxyArpAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Proxy.TableID + size += 1 * 4 // m.Proxy.Low + size += 1 * 4 // m.Proxy.Hi + return size +} +func (m *ProxyArpAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Proxy.TableID)) + buf.EncodeBytes(m.Proxy.Low[:], 4) + buf.EncodeBytes(m.Proxy.Hi[:], 4) + return buf.Bytes(), nil +} +func (m *ProxyArpAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Proxy.TableID = buf.DecodeUint32() + copy(m.Proxy.Low[:], buf.DecodeBytes(4)) + copy(m.Proxy.Hi[:], buf.DecodeBytes(4)) + return nil +} + +// ProxyArpAddDelReply defines message 'proxy_arp_add_del_reply'. +type ProxyArpAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ProxyArpAddDelReply) Reset() { *m = ProxyArpAddDelReply{} } +func (*ProxyArpAddDelReply) GetMessageName() string { return "proxy_arp_add_del_reply" } +func (*ProxyArpAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*ProxyArpAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ProxyArpAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ProxyArpAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ProxyArpAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// ProxyArpDetails defines message 'proxy_arp_details'. +type ProxyArpDetails struct { + Proxy ProxyArp `binapi:"proxy_arp,name=proxy" json:"proxy,omitempty"` +} + +func (m *ProxyArpDetails) Reset() { *m = ProxyArpDetails{} } +func (*ProxyArpDetails) GetMessageName() string { return "proxy_arp_details" } +func (*ProxyArpDetails) GetCrcString() string { return "9228c150" } +func (*ProxyArpDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ProxyArpDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Proxy.TableID + size += 1 * 4 // m.Proxy.Low + size += 1 * 4 // m.Proxy.Hi + return size +} +func (m *ProxyArpDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Proxy.TableID)) + buf.EncodeBytes(m.Proxy.Low[:], 4) + buf.EncodeBytes(m.Proxy.Hi[:], 4) + return buf.Bytes(), nil +} +func (m *ProxyArpDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Proxy.TableID = buf.DecodeUint32() + copy(m.Proxy.Low[:], buf.DecodeBytes(4)) + copy(m.Proxy.Hi[:], buf.DecodeBytes(4)) + return nil +} + +// ProxyArpDump defines message 'proxy_arp_dump'. +type ProxyArpDump struct{} + +func (m *ProxyArpDump) Reset() { *m = ProxyArpDump{} } +func (*ProxyArpDump) GetMessageName() string { return "proxy_arp_dump" } +func (*ProxyArpDump) GetCrcString() string { return "51077d14" } +func (*ProxyArpDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ProxyArpDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ProxyArpDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ProxyArpDump) Unmarshal(b []byte) error { + return nil +} + +// ProxyArpIntfcDetails defines message 'proxy_arp_intfc_details'. +type ProxyArpIntfcDetails struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *ProxyArpIntfcDetails) Reset() { *m = ProxyArpIntfcDetails{} } +func (*ProxyArpIntfcDetails) GetMessageName() string { return "proxy_arp_intfc_details" } +func (*ProxyArpIntfcDetails) GetCrcString() string { return "f6458e5f" } +func (*ProxyArpIntfcDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ProxyArpIntfcDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *ProxyArpIntfcDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *ProxyArpIntfcDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = buf.DecodeUint32() + return nil +} + +// ProxyArpIntfcDump defines message 'proxy_arp_intfc_dump'. +type ProxyArpIntfcDump struct{} + +func (m *ProxyArpIntfcDump) Reset() { *m = ProxyArpIntfcDump{} } +func (*ProxyArpIntfcDump) GetMessageName() string { return "proxy_arp_intfc_dump" } +func (*ProxyArpIntfcDump) GetCrcString() string { return "51077d14" } +func (*ProxyArpIntfcDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ProxyArpIntfcDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ProxyArpIntfcDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ProxyArpIntfcDump) Unmarshal(b []byte) error { + return nil +} + +// ProxyArpIntfcEnableDisable defines message 'proxy_arp_intfc_enable_disable'. +type ProxyArpIntfcEnableDisable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *ProxyArpIntfcEnableDisable) Reset() { *m = ProxyArpIntfcEnableDisable{} } +func (*ProxyArpIntfcEnableDisable) GetMessageName() string { return "proxy_arp_intfc_enable_disable" } +func (*ProxyArpIntfcEnableDisable) GetCrcString() string { return "ae6cfcfb" } +func (*ProxyArpIntfcEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ProxyArpIntfcEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Enable + return size +} +func (m *ProxyArpIntfcEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *ProxyArpIntfcEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Enable = buf.DecodeBool() + return nil +} + +// ProxyArpIntfcEnableDisableReply defines message 'proxy_arp_intfc_enable_disable_reply'. +type ProxyArpIntfcEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ProxyArpIntfcEnableDisableReply) Reset() { *m = ProxyArpIntfcEnableDisableReply{} } +func (*ProxyArpIntfcEnableDisableReply) GetMessageName() string { + return "proxy_arp_intfc_enable_disable_reply" +} +func (*ProxyArpIntfcEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*ProxyArpIntfcEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ProxyArpIntfcEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ProxyArpIntfcEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ProxyArpIntfcEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_arp_binapi_init() } +func file_arp_binapi_init() { + api.RegisterMessage((*ProxyArpAddDel)(nil), "proxy_arp_add_del_85486cbd") + api.RegisterMessage((*ProxyArpAddDelReply)(nil), "proxy_arp_add_del_reply_e8d4e804") + api.RegisterMessage((*ProxyArpDetails)(nil), "proxy_arp_details_9228c150") + api.RegisterMessage((*ProxyArpDump)(nil), "proxy_arp_dump_51077d14") + api.RegisterMessage((*ProxyArpIntfcDetails)(nil), "proxy_arp_intfc_details_f6458e5f") + api.RegisterMessage((*ProxyArpIntfcDump)(nil), "proxy_arp_intfc_dump_51077d14") + api.RegisterMessage((*ProxyArpIntfcEnableDisable)(nil), "proxy_arp_intfc_enable_disable_ae6cfcfb") + api.RegisterMessage((*ProxyArpIntfcEnableDisableReply)(nil), "proxy_arp_intfc_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*ProxyArpAddDel)(nil), + (*ProxyArpAddDelReply)(nil), + (*ProxyArpDetails)(nil), + (*ProxyArpDump)(nil), + (*ProxyArpIntfcDetails)(nil), + (*ProxyArpIntfcDump)(nil), + (*ProxyArpIntfcEnableDisable)(nil), + (*ProxyArpIntfcEnableDisableReply)(nil), + } +} diff --git a/binapi/arp/arp_rest.ba.go b/binapi/arp/arp_rest.ba.go new file mode 100644 index 0000000..71a07d9 --- /dev/null +++ b/binapi/arp/arp_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package arp + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/proxy_arp_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(ProxyArpAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ProxyArpAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/proxy_arp_intfc_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(ProxyArpIntfcEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ProxyArpIntfcEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/arp/arp_rpc.ba.go b/binapi/arp/arp_rpc.ba.go new file mode 100644 index 0000000..8ccfa75 --- /dev/null +++ b/binapi/arp/arp_rpc.ba.go @@ -0,0 +1,123 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package arp + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service arp. +type RPCService interface { + ProxyArpAddDel(ctx context.Context, in *ProxyArpAddDel) (*ProxyArpAddDelReply, error) + ProxyArpDump(ctx context.Context, in *ProxyArpDump) (RPCService_ProxyArpDumpClient, error) + ProxyArpIntfcDump(ctx context.Context, in *ProxyArpIntfcDump) (RPCService_ProxyArpIntfcDumpClient, error) + ProxyArpIntfcEnableDisable(ctx context.Context, in *ProxyArpIntfcEnableDisable) (*ProxyArpIntfcEnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) ProxyArpAddDel(ctx context.Context, in *ProxyArpAddDel) (*ProxyArpAddDelReply, error) { + out := new(ProxyArpAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ProxyArpDump(ctx context.Context, in *ProxyArpDump) (RPCService_ProxyArpDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_ProxyArpDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_ProxyArpDumpClient interface { + Recv() (*ProxyArpDetails, error) + api.Stream +} + +type serviceClient_ProxyArpDumpClient struct { + api.Stream +} + +func (c *serviceClient_ProxyArpDumpClient) Recv() (*ProxyArpDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *ProxyArpDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) ProxyArpIntfcDump(ctx context.Context, in *ProxyArpIntfcDump) (RPCService_ProxyArpIntfcDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_ProxyArpIntfcDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_ProxyArpIntfcDumpClient interface { + Recv() (*ProxyArpIntfcDetails, error) + api.Stream +} + +type serviceClient_ProxyArpIntfcDumpClient struct { + api.Stream +} + +func (c *serviceClient_ProxyArpIntfcDumpClient) Recv() (*ProxyArpIntfcDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *ProxyArpIntfcDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) ProxyArpIntfcEnableDisable(ctx context.Context, in *ProxyArpIntfcEnableDisable) (*ProxyArpIntfcEnableDisableReply, error) { + out := new(ProxyArpIntfcEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/avf/avf.ba.go b/binapi/avf/avf.ba.go new file mode 100644 index 0000000..436223b --- /dev/null +++ b/binapi/avf/avf.ba.go @@ -0,0 +1,212 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/avf.api.json + +// Package avf contains generated bindings for API file avf.api. +// +// Contents: +// 4 messages +// +package avf + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "avf" + APIVersion = "1.0.0" + VersionCrc = 0xbaaa7124 +) + +// AvfCreate defines message 'avf_create'. +type AvfCreate struct { + PciAddr uint32 `binapi:"u32,name=pci_addr" json:"pci_addr,omitempty"` + EnableElog int32 `binapi:"i32,name=enable_elog" json:"enable_elog,omitempty"` + RxqNum uint16 `binapi:"u16,name=rxq_num" json:"rxq_num,omitempty"` + RxqSize uint16 `binapi:"u16,name=rxq_size" json:"rxq_size,omitempty"` + TxqSize uint16 `binapi:"u16,name=txq_size" json:"txq_size,omitempty"` +} + +func (m *AvfCreate) Reset() { *m = AvfCreate{} } +func (*AvfCreate) GetMessageName() string { return "avf_create" } +func (*AvfCreate) GetCrcString() string { return "daab8ae2" } +func (*AvfCreate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AvfCreate) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.PciAddr + size += 4 // m.EnableElog + size += 2 // m.RxqNum + size += 2 // m.RxqSize + size += 2 // m.TxqSize + return size +} +func (m *AvfCreate) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.PciAddr)) + buf.EncodeUint32(uint32(m.EnableElog)) + buf.EncodeUint16(uint16(m.RxqNum)) + buf.EncodeUint16(uint16(m.RxqSize)) + buf.EncodeUint16(uint16(m.TxqSize)) + return buf.Bytes(), nil +} +func (m *AvfCreate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PciAddr = buf.DecodeUint32() + m.EnableElog = int32(buf.DecodeUint32()) + m.RxqNum = buf.DecodeUint16() + m.RxqSize = buf.DecodeUint16() + m.TxqSize = buf.DecodeUint16() + return nil +} + +// AvfCreateReply defines message 'avf_create_reply'. +type AvfCreateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *AvfCreateReply) Reset() { *m = AvfCreateReply{} } +func (*AvfCreateReply) GetMessageName() string { return "avf_create_reply" } +func (*AvfCreateReply) GetCrcString() string { return "5383d31f" } +func (*AvfCreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AvfCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *AvfCreateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *AvfCreateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// AvfDelete defines message 'avf_delete'. +type AvfDelete struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *AvfDelete) Reset() { *m = AvfDelete{} } +func (*AvfDelete) GetMessageName() string { return "avf_delete" } +func (*AvfDelete) GetCrcString() string { return "f9e6675e" } +func (*AvfDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AvfDelete) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *AvfDelete) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *AvfDelete) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// AvfDeleteReply defines message 'avf_delete_reply'. +type AvfDeleteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *AvfDeleteReply) Reset() { *m = AvfDeleteReply{} } +func (*AvfDeleteReply) GetMessageName() string { return "avf_delete_reply" } +func (*AvfDeleteReply) GetCrcString() string { return "e8d4e804" } +func (*AvfDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AvfDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *AvfDeleteReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *AvfDeleteReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_avf_binapi_init() } +func file_avf_binapi_init() { + api.RegisterMessage((*AvfCreate)(nil), "avf_create_daab8ae2") + api.RegisterMessage((*AvfCreateReply)(nil), "avf_create_reply_5383d31f") + api.RegisterMessage((*AvfDelete)(nil), "avf_delete_f9e6675e") + api.RegisterMessage((*AvfDeleteReply)(nil), "avf_delete_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AvfCreate)(nil), + (*AvfCreateReply)(nil), + (*AvfDelete)(nil), + (*AvfDeleteReply)(nil), + } +} diff --git a/binapi/avf/avf_rest.ba.go b/binapi/avf/avf_rest.ba.go new file mode 100644 index 0000000..1a9d7f3 --- /dev/null +++ b/binapi/avf/avf_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package avf + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/avf_create", func(w http.ResponseWriter, req *http.Request) { + var request = new(AvfCreate) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.AvfCreate(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/avf_delete", func(w http.ResponseWriter, req *http.Request) { + var request = new(AvfDelete) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.AvfDelete(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/avf/avf_rpc.ba.go b/binapi/avf/avf_rpc.ba.go new file mode 100644 index 0000000..90f854e --- /dev/null +++ b/binapi/avf/avf_rpc.ba.go @@ -0,0 +1,40 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package avf + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service avf. +type RPCService interface { + AvfCreate(ctx context.Context, in *AvfCreate) (*AvfCreateReply, error) + AvfDelete(ctx context.Context, in *AvfDelete) (*AvfDeleteReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) AvfCreate(ctx context.Context, in *AvfCreate) (*AvfCreateReply, error) { + out := new(AvfCreateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AvfDelete(ctx context.Context, in *AvfDelete) (*AvfDeleteReply, error) { + out := new(AvfDeleteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/bfd/bfd.ba.go b/binapi/bfd/bfd.ba.go new file mode 100644 index 0000000..2b4f5f0 --- /dev/null +++ b/binapi/bfd/bfd.ba.go @@ -0,0 +1,1346 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/bfd.api.json + +// Package bfd contains generated bindings for API file bfd.api. +// +// Contents: +// 1 enum +// 28 messages +// +package bfd + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "bfd" + APIVersion = "2.0.0" + VersionCrc = 0xc92fd028 +) + +// BfdState defines enum 'bfd_state'. +type BfdState uint32 + +const ( + BFD_STATE_API_ADMIN_DOWN BfdState = 0 + BFD_STATE_API_DOWN BfdState = 1 + BFD_STATE_API_INIT BfdState = 2 + BFD_STATE_API_UP BfdState = 3 +) + +var ( + BfdState_name = map[uint32]string{ + 0: "BFD_STATE_API_ADMIN_DOWN", + 1: "BFD_STATE_API_DOWN", + 2: "BFD_STATE_API_INIT", + 3: "BFD_STATE_API_UP", + } + BfdState_value = map[string]uint32{ + "BFD_STATE_API_ADMIN_DOWN": 0, + "BFD_STATE_API_DOWN": 1, + "BFD_STATE_API_INIT": 2, + "BFD_STATE_API_UP": 3, + } +) + +func (x BfdState) String() string { + s, ok := BfdState_name[uint32(x)] + if ok { + return s + } + return "BfdState(" + strconv.Itoa(int(x)) + ")" +} + +// BfdAuthDelKey defines message 'bfd_auth_del_key'. +type BfdAuthDelKey struct { + ConfKeyID uint32 `binapi:"u32,name=conf_key_id" json:"conf_key_id,omitempty"` +} + +func (m *BfdAuthDelKey) Reset() { *m = BfdAuthDelKey{} } +func (*BfdAuthDelKey) GetMessageName() string { return "bfd_auth_del_key" } +func (*BfdAuthDelKey) GetCrcString() string { return "65310b22" } +func (*BfdAuthDelKey) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdAuthDelKey) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ConfKeyID + return size +} +func (m *BfdAuthDelKey) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ConfKeyID)) + return buf.Bytes(), nil +} +func (m *BfdAuthDelKey) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ConfKeyID = buf.DecodeUint32() + return nil +} + +// BfdAuthDelKeyReply defines message 'bfd_auth_del_key_reply'. +type BfdAuthDelKeyReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BfdAuthDelKeyReply) Reset() { *m = BfdAuthDelKeyReply{} } +func (*BfdAuthDelKeyReply) GetMessageName() string { return "bfd_auth_del_key_reply" } +func (*BfdAuthDelKeyReply) GetCrcString() string { return "e8d4e804" } +func (*BfdAuthDelKeyReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdAuthDelKeyReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BfdAuthDelKeyReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BfdAuthDelKeyReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BfdAuthKeysDetails defines message 'bfd_auth_keys_details'. +type BfdAuthKeysDetails struct { + ConfKeyID uint32 `binapi:"u32,name=conf_key_id" json:"conf_key_id,omitempty"` + UseCount uint32 `binapi:"u32,name=use_count" json:"use_count,omitempty"` + AuthType uint8 `binapi:"u8,name=auth_type" json:"auth_type,omitempty"` +} + +func (m *BfdAuthKeysDetails) Reset() { *m = BfdAuthKeysDetails{} } +func (*BfdAuthKeysDetails) GetMessageName() string { return "bfd_auth_keys_details" } +func (*BfdAuthKeysDetails) GetCrcString() string { return "84130e9f" } +func (*BfdAuthKeysDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdAuthKeysDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ConfKeyID + size += 4 // m.UseCount + size += 1 // m.AuthType + return size +} +func (m *BfdAuthKeysDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ConfKeyID)) + buf.EncodeUint32(uint32(m.UseCount)) + buf.EncodeUint8(uint8(m.AuthType)) + return buf.Bytes(), nil +} +func (m *BfdAuthKeysDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ConfKeyID = buf.DecodeUint32() + m.UseCount = buf.DecodeUint32() + m.AuthType = buf.DecodeUint8() + return nil +} + +// BfdAuthKeysDump defines message 'bfd_auth_keys_dump'. +type BfdAuthKeysDump struct{} + +func (m *BfdAuthKeysDump) Reset() { *m = BfdAuthKeysDump{} } +func (*BfdAuthKeysDump) GetMessageName() string { return "bfd_auth_keys_dump" } +func (*BfdAuthKeysDump) GetCrcString() string { return "51077d14" } +func (*BfdAuthKeysDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdAuthKeysDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *BfdAuthKeysDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *BfdAuthKeysDump) Unmarshal(b []byte) error { + return nil +} + +// BfdAuthSetKey defines message 'bfd_auth_set_key'. +type BfdAuthSetKey struct { + ConfKeyID uint32 `binapi:"u32,name=conf_key_id" json:"conf_key_id,omitempty"` + KeyLen uint8 `binapi:"u8,name=key_len" json:"key_len,omitempty"` + AuthType uint8 `binapi:"u8,name=auth_type" json:"auth_type,omitempty"` + Key []byte `binapi:"u8[20],name=key" json:"key,omitempty"` +} + +func (m *BfdAuthSetKey) Reset() { *m = BfdAuthSetKey{} } +func (*BfdAuthSetKey) GetMessageName() string { return "bfd_auth_set_key" } +func (*BfdAuthSetKey) GetCrcString() string { return "690b8877" } +func (*BfdAuthSetKey) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdAuthSetKey) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ConfKeyID + size += 1 // m.KeyLen + size += 1 // m.AuthType + size += 1 * 20 // m.Key + return size +} +func (m *BfdAuthSetKey) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ConfKeyID)) + buf.EncodeUint8(uint8(m.KeyLen)) + buf.EncodeUint8(uint8(m.AuthType)) + buf.EncodeBytes(m.Key[:], 20) + return buf.Bytes(), nil +} +func (m *BfdAuthSetKey) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ConfKeyID = buf.DecodeUint32() + m.KeyLen = buf.DecodeUint8() + m.AuthType = buf.DecodeUint8() + copy(m.Key[:], buf.DecodeBytes(20)) + return nil +} + +// BfdAuthSetKeyReply defines message 'bfd_auth_set_key_reply'. +type BfdAuthSetKeyReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BfdAuthSetKeyReply) Reset() { *m = BfdAuthSetKeyReply{} } +func (*BfdAuthSetKeyReply) GetMessageName() string { return "bfd_auth_set_key_reply" } +func (*BfdAuthSetKeyReply) GetCrcString() string { return "e8d4e804" } +func (*BfdAuthSetKeyReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdAuthSetKeyReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BfdAuthSetKeyReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BfdAuthSetKeyReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BfdUDPAdd defines message 'bfd_udp_add'. +type BfdUDPAdd struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + DesiredMinTx uint32 `binapi:"u32,name=desired_min_tx" json:"desired_min_tx,omitempty"` + RequiredMinRx uint32 `binapi:"u32,name=required_min_rx" json:"required_min_rx,omitempty"` + LocalAddr ip_types.Address `binapi:"address,name=local_addr" json:"local_addr,omitempty"` + PeerAddr ip_types.Address `binapi:"address,name=peer_addr" json:"peer_addr,omitempty"` + DetectMult uint8 `binapi:"u8,name=detect_mult" json:"detect_mult,omitempty"` + IsAuthenticated bool `binapi:"bool,name=is_authenticated" json:"is_authenticated,omitempty"` + BfdKeyID uint8 `binapi:"u8,name=bfd_key_id" json:"bfd_key_id,omitempty"` + ConfKeyID uint32 `binapi:"u32,name=conf_key_id" json:"conf_key_id,omitempty"` +} + +func (m *BfdUDPAdd) Reset() { *m = BfdUDPAdd{} } +func (*BfdUDPAdd) GetMessageName() string { return "bfd_udp_add" } +func (*BfdUDPAdd) GetCrcString() string { return "7a6d1185" } +func (*BfdUDPAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdUDPAdd) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.DesiredMinTx + size += 4 // m.RequiredMinRx + size += 1 // m.LocalAddr.Af + size += 1 * 16 // m.LocalAddr.Un + size += 1 // m.PeerAddr.Af + size += 1 * 16 // m.PeerAddr.Un + size += 1 // m.DetectMult + size += 1 // m.IsAuthenticated + size += 1 // m.BfdKeyID + size += 4 // m.ConfKeyID + return size +} +func (m *BfdUDPAdd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.DesiredMinTx)) + buf.EncodeUint32(uint32(m.RequiredMinRx)) + buf.EncodeUint8(uint8(m.LocalAddr.Af)) + buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.PeerAddr.Af)) + buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.DetectMult)) + buf.EncodeBool(m.IsAuthenticated) + buf.EncodeUint8(uint8(m.BfdKeyID)) + buf.EncodeUint32(uint32(m.ConfKeyID)) + return buf.Bytes(), nil +} +func (m *BfdUDPAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.DesiredMinTx = buf.DecodeUint32() + m.RequiredMinRx = buf.DecodeUint32() + m.LocalAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.LocalAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.PeerAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.PeerAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.DetectMult = buf.DecodeUint8() + m.IsAuthenticated = buf.DecodeBool() + m.BfdKeyID = buf.DecodeUint8() + m.ConfKeyID = buf.DecodeUint32() + return nil +} + +// BfdUDPAddReply defines message 'bfd_udp_add_reply'. +type BfdUDPAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BfdUDPAddReply) Reset() { *m = BfdUDPAddReply{} } +func (*BfdUDPAddReply) GetMessageName() string { return "bfd_udp_add_reply" } +func (*BfdUDPAddReply) GetCrcString() string { return "e8d4e804" } +func (*BfdUDPAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdUDPAddReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BfdUDPAddReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BfdUDPAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BfdUDPAuthActivate defines message 'bfd_udp_auth_activate'. +type BfdUDPAuthActivate struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + LocalAddr ip_types.Address `binapi:"address,name=local_addr" json:"local_addr,omitempty"` + PeerAddr ip_types.Address `binapi:"address,name=peer_addr" json:"peer_addr,omitempty"` + IsDelayed bool `binapi:"bool,name=is_delayed" json:"is_delayed,omitempty"` + BfdKeyID uint8 `binapi:"u8,name=bfd_key_id" json:"bfd_key_id,omitempty"` + ConfKeyID uint32 `binapi:"u32,name=conf_key_id" json:"conf_key_id,omitempty"` +} + +func (m *BfdUDPAuthActivate) Reset() { *m = BfdUDPAuthActivate{} } +func (*BfdUDPAuthActivate) GetMessageName() string { return "bfd_udp_auth_activate" } +func (*BfdUDPAuthActivate) GetCrcString() string { return "493ee0ec" } +func (*BfdUDPAuthActivate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdUDPAuthActivate) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.LocalAddr.Af + size += 1 * 16 // m.LocalAddr.Un + size += 1 // m.PeerAddr.Af + size += 1 * 16 // m.PeerAddr.Un + size += 1 // m.IsDelayed + size += 1 // m.BfdKeyID + size += 4 // m.ConfKeyID + return size +} +func (m *BfdUDPAuthActivate) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.LocalAddr.Af)) + buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.PeerAddr.Af)) + buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 0) + buf.EncodeBool(m.IsDelayed) + buf.EncodeUint8(uint8(m.BfdKeyID)) + buf.EncodeUint32(uint32(m.ConfKeyID)) + return buf.Bytes(), nil +} +func (m *BfdUDPAuthActivate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.LocalAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.LocalAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.PeerAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.PeerAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.IsDelayed = buf.DecodeBool() + m.BfdKeyID = buf.DecodeUint8() + m.ConfKeyID = buf.DecodeUint32() + return nil +} + +// BfdUDPAuthActivateReply defines message 'bfd_udp_auth_activate_reply'. +type BfdUDPAuthActivateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BfdUDPAuthActivateReply) Reset() { *m = BfdUDPAuthActivateReply{} } +func (*BfdUDPAuthActivateReply) GetMessageName() string { return "bfd_udp_auth_activate_reply" } +func (*BfdUDPAuthActivateReply) GetCrcString() string { return "e8d4e804" } +func (*BfdUDPAuthActivateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdUDPAuthActivateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BfdUDPAuthActivateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BfdUDPAuthActivateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BfdUDPAuthDeactivate defines message 'bfd_udp_auth_deactivate'. +type BfdUDPAuthDeactivate struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + LocalAddr ip_types.Address `binapi:"address,name=local_addr" json:"local_addr,omitempty"` + PeerAddr ip_types.Address `binapi:"address,name=peer_addr" json:"peer_addr,omitempty"` + IsDelayed bool `binapi:"bool,name=is_delayed" json:"is_delayed,omitempty"` +} + +func (m *BfdUDPAuthDeactivate) Reset() { *m = BfdUDPAuthDeactivate{} } +func (*BfdUDPAuthDeactivate) GetMessageName() string { return "bfd_udp_auth_deactivate" } +func (*BfdUDPAuthDeactivate) GetCrcString() string { return "99978c32" } +func (*BfdUDPAuthDeactivate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdUDPAuthDeactivate) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.LocalAddr.Af + size += 1 * 16 // m.LocalAddr.Un + size += 1 // m.PeerAddr.Af + size += 1 * 16 // m.PeerAddr.Un + size += 1 // m.IsDelayed + return size +} +func (m *BfdUDPAuthDeactivate) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.LocalAddr.Af)) + buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.PeerAddr.Af)) + buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 0) + buf.EncodeBool(m.IsDelayed) + return buf.Bytes(), nil +} +func (m *BfdUDPAuthDeactivate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.LocalAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.LocalAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.PeerAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.PeerAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.IsDelayed = buf.DecodeBool() + return nil +} + +// BfdUDPAuthDeactivateReply defines message 'bfd_udp_auth_deactivate_reply'. +type BfdUDPAuthDeactivateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BfdUDPAuthDeactivateReply) Reset() { *m = BfdUDPAuthDeactivateReply{} } +func (*BfdUDPAuthDeactivateReply) GetMessageName() string { return "bfd_udp_auth_deactivate_reply" } +func (*BfdUDPAuthDeactivateReply) GetCrcString() string { return "e8d4e804" } +func (*BfdUDPAuthDeactivateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdUDPAuthDeactivateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BfdUDPAuthDeactivateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BfdUDPAuthDeactivateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BfdUDPDel defines message 'bfd_udp_del'. +type BfdUDPDel struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + LocalAddr ip_types.Address `binapi:"address,name=local_addr" json:"local_addr,omitempty"` + PeerAddr ip_types.Address `binapi:"address,name=peer_addr" json:"peer_addr,omitempty"` +} + +func (m *BfdUDPDel) Reset() { *m = BfdUDPDel{} } +func (*BfdUDPDel) GetMessageName() string { return "bfd_udp_del" } +func (*BfdUDPDel) GetCrcString() string { return "8096514d" } +func (*BfdUDPDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdUDPDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.LocalAddr.Af + size += 1 * 16 // m.LocalAddr.Un + size += 1 // m.PeerAddr.Af + size += 1 * 16 // m.PeerAddr.Un + return size +} +func (m *BfdUDPDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.LocalAddr.Af)) + buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.PeerAddr.Af)) + buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *BfdUDPDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.LocalAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.LocalAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.PeerAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.PeerAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// BfdUDPDelEchoSource defines message 'bfd_udp_del_echo_source'. +type BfdUDPDelEchoSource struct{} + +func (m *BfdUDPDelEchoSource) Reset() { *m = BfdUDPDelEchoSource{} } +func (*BfdUDPDelEchoSource) GetMessageName() string { return "bfd_udp_del_echo_source" } +func (*BfdUDPDelEchoSource) GetCrcString() string { return "51077d14" } +func (*BfdUDPDelEchoSource) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdUDPDelEchoSource) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *BfdUDPDelEchoSource) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *BfdUDPDelEchoSource) Unmarshal(b []byte) error { + return nil +} + +// BfdUDPDelEchoSourceReply defines message 'bfd_udp_del_echo_source_reply'. +type BfdUDPDelEchoSourceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BfdUDPDelEchoSourceReply) Reset() { *m = BfdUDPDelEchoSourceReply{} } +func (*BfdUDPDelEchoSourceReply) GetMessageName() string { return "bfd_udp_del_echo_source_reply" } +func (*BfdUDPDelEchoSourceReply) GetCrcString() string { return "e8d4e804" } +func (*BfdUDPDelEchoSourceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdUDPDelEchoSourceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BfdUDPDelEchoSourceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BfdUDPDelEchoSourceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BfdUDPDelReply defines message 'bfd_udp_del_reply'. +type BfdUDPDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BfdUDPDelReply) Reset() { *m = BfdUDPDelReply{} } +func (*BfdUDPDelReply) GetMessageName() string { return "bfd_udp_del_reply" } +func (*BfdUDPDelReply) GetCrcString() string { return "e8d4e804" } +func (*BfdUDPDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdUDPDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BfdUDPDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BfdUDPDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BfdUDPGetEchoSource defines message 'bfd_udp_get_echo_source'. +type BfdUDPGetEchoSource struct{} + +func (m *BfdUDPGetEchoSource) Reset() { *m = BfdUDPGetEchoSource{} } +func (*BfdUDPGetEchoSource) GetMessageName() string { return "bfd_udp_get_echo_source" } +func (*BfdUDPGetEchoSource) GetCrcString() string { return "51077d14" } +func (*BfdUDPGetEchoSource) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdUDPGetEchoSource) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *BfdUDPGetEchoSource) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *BfdUDPGetEchoSource) Unmarshal(b []byte) error { + return nil +} + +// BfdUDPGetEchoSourceReply defines message 'bfd_udp_get_echo_source_reply'. +type BfdUDPGetEchoSourceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsSet bool `binapi:"bool,name=is_set" json:"is_set,omitempty"` + HaveUsableIP4 bool `binapi:"bool,name=have_usable_ip4" json:"have_usable_ip4,omitempty"` + IP4Addr ip_types.IP4Address `binapi:"ip4_address,name=ip4_addr" json:"ip4_addr,omitempty"` + HaveUsableIP6 bool `binapi:"bool,name=have_usable_ip6" json:"have_usable_ip6,omitempty"` + IP6Addr ip_types.IP6Address `binapi:"ip6_address,name=ip6_addr" json:"ip6_addr,omitempty"` +} + +func (m *BfdUDPGetEchoSourceReply) Reset() { *m = BfdUDPGetEchoSourceReply{} } +func (*BfdUDPGetEchoSourceReply) GetMessageName() string { return "bfd_udp_get_echo_source_reply" } +func (*BfdUDPGetEchoSourceReply) GetCrcString() string { return "1e00cfce" } +func (*BfdUDPGetEchoSourceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdUDPGetEchoSourceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + size += 1 // m.IsSet + size += 1 // m.HaveUsableIP4 + size += 1 * 4 // m.IP4Addr + size += 1 // m.HaveUsableIP6 + size += 1 * 16 // m.IP6Addr + return size +} +func (m *BfdUDPGetEchoSourceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsSet) + buf.EncodeBool(m.HaveUsableIP4) + buf.EncodeBytes(m.IP4Addr[:], 4) + buf.EncodeBool(m.HaveUsableIP6) + buf.EncodeBytes(m.IP6Addr[:], 16) + return buf.Bytes(), nil +} +func (m *BfdUDPGetEchoSourceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsSet = buf.DecodeBool() + m.HaveUsableIP4 = buf.DecodeBool() + copy(m.IP4Addr[:], buf.DecodeBytes(4)) + m.HaveUsableIP6 = buf.DecodeBool() + copy(m.IP6Addr[:], buf.DecodeBytes(16)) + return nil +} + +// BfdUDPMod defines message 'bfd_udp_mod'. +type BfdUDPMod struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + DesiredMinTx uint32 `binapi:"u32,name=desired_min_tx" json:"desired_min_tx,omitempty"` + RequiredMinRx uint32 `binapi:"u32,name=required_min_rx" json:"required_min_rx,omitempty"` + LocalAddr ip_types.Address `binapi:"address,name=local_addr" json:"local_addr,omitempty"` + PeerAddr ip_types.Address `binapi:"address,name=peer_addr" json:"peer_addr,omitempty"` + DetectMult uint8 `binapi:"u8,name=detect_mult" json:"detect_mult,omitempty"` +} + +func (m *BfdUDPMod) Reset() { *m = BfdUDPMod{} } +func (*BfdUDPMod) GetMessageName() string { return "bfd_udp_mod" } +func (*BfdUDPMod) GetCrcString() string { return "783a3ff6" } +func (*BfdUDPMod) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdUDPMod) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.DesiredMinTx + size += 4 // m.RequiredMinRx + size += 1 // m.LocalAddr.Af + size += 1 * 16 // m.LocalAddr.Un + size += 1 // m.PeerAddr.Af + size += 1 * 16 // m.PeerAddr.Un + size += 1 // m.DetectMult + return size +} +func (m *BfdUDPMod) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.DesiredMinTx)) + buf.EncodeUint32(uint32(m.RequiredMinRx)) + buf.EncodeUint8(uint8(m.LocalAddr.Af)) + buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.PeerAddr.Af)) + buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.DetectMult)) + return buf.Bytes(), nil +} +func (m *BfdUDPMod) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.DesiredMinTx = buf.DecodeUint32() + m.RequiredMinRx = buf.DecodeUint32() + m.LocalAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.LocalAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.PeerAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.PeerAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.DetectMult = buf.DecodeUint8() + return nil +} + +// BfdUDPModReply defines message 'bfd_udp_mod_reply'. +type BfdUDPModReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BfdUDPModReply) Reset() { *m = BfdUDPModReply{} } +func (*BfdUDPModReply) GetMessageName() string { return "bfd_udp_mod_reply" } +func (*BfdUDPModReply) GetCrcString() string { return "e8d4e804" } +func (*BfdUDPModReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdUDPModReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BfdUDPModReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BfdUDPModReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BfdUDPSessionDetails defines message 'bfd_udp_session_details'. +type BfdUDPSessionDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + LocalAddr ip_types.Address `binapi:"address,name=local_addr" json:"local_addr,omitempty"` + PeerAddr ip_types.Address `binapi:"address,name=peer_addr" json:"peer_addr,omitempty"` + State BfdState `binapi:"bfd_state,name=state" json:"state,omitempty"` + IsAuthenticated bool `binapi:"bool,name=is_authenticated" json:"is_authenticated,omitempty"` + BfdKeyID uint8 `binapi:"u8,name=bfd_key_id" json:"bfd_key_id,omitempty"` + ConfKeyID uint32 `binapi:"u32,name=conf_key_id" json:"conf_key_id,omitempty"` + RequiredMinRx uint32 `binapi:"u32,name=required_min_rx" json:"required_min_rx,omitempty"` + DesiredMinTx uint32 `binapi:"u32,name=desired_min_tx" json:"desired_min_tx,omitempty"` + DetectMult uint8 `binapi:"u8,name=detect_mult" json:"detect_mult,omitempty"` +} + +func (m *BfdUDPSessionDetails) Reset() { *m = BfdUDPSessionDetails{} } +func (*BfdUDPSessionDetails) GetMessageName() string { return "bfd_udp_session_details" } +func (*BfdUDPSessionDetails) GetCrcString() string { return "60653c02" } +func (*BfdUDPSessionDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdUDPSessionDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.LocalAddr.Af + size += 1 * 16 // m.LocalAddr.Un + size += 1 // m.PeerAddr.Af + size += 1 * 16 // m.PeerAddr.Un + size += 4 // m.State + size += 1 // m.IsAuthenticated + size += 1 // m.BfdKeyID + size += 4 // m.ConfKeyID + size += 4 // m.RequiredMinRx + size += 4 // m.DesiredMinTx + size += 1 // m.DetectMult + return size +} +func (m *BfdUDPSessionDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.LocalAddr.Af)) + buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.PeerAddr.Af)) + buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.State)) + buf.EncodeBool(m.IsAuthenticated) + buf.EncodeUint8(uint8(m.BfdKeyID)) + buf.EncodeUint32(uint32(m.ConfKeyID)) + buf.EncodeUint32(uint32(m.RequiredMinRx)) + buf.EncodeUint32(uint32(m.DesiredMinTx)) + buf.EncodeUint8(uint8(m.DetectMult)) + return buf.Bytes(), nil +} +func (m *BfdUDPSessionDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.LocalAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.LocalAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.PeerAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.PeerAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.State = BfdState(buf.DecodeUint32()) + m.IsAuthenticated = buf.DecodeBool() + m.BfdKeyID = buf.DecodeUint8() + m.ConfKeyID = buf.DecodeUint32() + m.RequiredMinRx = buf.DecodeUint32() + m.DesiredMinTx = buf.DecodeUint32() + m.DetectMult = buf.DecodeUint8() + return nil +} + +// BfdUDPSessionDump defines message 'bfd_udp_session_dump'. +type BfdUDPSessionDump struct{} + +func (m *BfdUDPSessionDump) Reset() { *m = BfdUDPSessionDump{} } +func (*BfdUDPSessionDump) GetMessageName() string { return "bfd_udp_session_dump" } +func (*BfdUDPSessionDump) GetCrcString() string { return "51077d14" } +func (*BfdUDPSessionDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdUDPSessionDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *BfdUDPSessionDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *BfdUDPSessionDump) Unmarshal(b []byte) error { + return nil +} + +// BfdUDPSessionSetFlags defines message 'bfd_udp_session_set_flags'. +type BfdUDPSessionSetFlags struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + LocalAddr ip_types.Address `binapi:"address,name=local_addr" json:"local_addr,omitempty"` + PeerAddr ip_types.Address `binapi:"address,name=peer_addr" json:"peer_addr,omitempty"` + Flags interface_types.IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` +} + +func (m *BfdUDPSessionSetFlags) Reset() { *m = BfdUDPSessionSetFlags{} } +func (*BfdUDPSessionSetFlags) GetMessageName() string { return "bfd_udp_session_set_flags" } +func (*BfdUDPSessionSetFlags) GetCrcString() string { return "cf313851" } +func (*BfdUDPSessionSetFlags) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdUDPSessionSetFlags) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.LocalAddr.Af + size += 1 * 16 // m.LocalAddr.Un + size += 1 // m.PeerAddr.Af + size += 1 * 16 // m.PeerAddr.Un + size += 4 // m.Flags + return size +} +func (m *BfdUDPSessionSetFlags) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.LocalAddr.Af)) + buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.PeerAddr.Af)) + buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.Flags)) + return buf.Bytes(), nil +} +func (m *BfdUDPSessionSetFlags) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.LocalAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.LocalAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.PeerAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.PeerAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Flags = interface_types.IfStatusFlags(buf.DecodeUint32()) + return nil +} + +// BfdUDPSessionSetFlagsReply defines message 'bfd_udp_session_set_flags_reply'. +type BfdUDPSessionSetFlagsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BfdUDPSessionSetFlagsReply) Reset() { *m = BfdUDPSessionSetFlagsReply{} } +func (*BfdUDPSessionSetFlagsReply) GetMessageName() string { return "bfd_udp_session_set_flags_reply" } +func (*BfdUDPSessionSetFlagsReply) GetCrcString() string { return "e8d4e804" } +func (*BfdUDPSessionSetFlagsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdUDPSessionSetFlagsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BfdUDPSessionSetFlagsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BfdUDPSessionSetFlagsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BfdUDPSetEchoSource defines message 'bfd_udp_set_echo_source'. +type BfdUDPSetEchoSource struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *BfdUDPSetEchoSource) Reset() { *m = BfdUDPSetEchoSource{} } +func (*BfdUDPSetEchoSource) GetMessageName() string { return "bfd_udp_set_echo_source" } +func (*BfdUDPSetEchoSource) GetCrcString() string { return "f9e6675e" } +func (*BfdUDPSetEchoSource) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdUDPSetEchoSource) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *BfdUDPSetEchoSource) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *BfdUDPSetEchoSource) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// BfdUDPSetEchoSourceReply defines message 'bfd_udp_set_echo_source_reply'. +type BfdUDPSetEchoSourceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BfdUDPSetEchoSourceReply) Reset() { *m = BfdUDPSetEchoSourceReply{} } +func (*BfdUDPSetEchoSourceReply) GetMessageName() string { return "bfd_udp_set_echo_source_reply" } +func (*BfdUDPSetEchoSourceReply) GetCrcString() string { return "e8d4e804" } +func (*BfdUDPSetEchoSourceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdUDPSetEchoSourceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BfdUDPSetEchoSourceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BfdUDPSetEchoSourceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// WantBfdEvents defines message 'want_bfd_events'. +type WantBfdEvents struct { + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` +} + +func (m *WantBfdEvents) Reset() { *m = WantBfdEvents{} } +func (*WantBfdEvents) GetMessageName() string { return "want_bfd_events" } +func (*WantBfdEvents) GetCrcString() string { return "c5e2af94" } +func (*WantBfdEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WantBfdEvents) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.EnableDisable + size += 4 // m.PID + return size +} +func (m *WantBfdEvents) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.EnableDisable) + buf.EncodeUint32(uint32(m.PID)) + return buf.Bytes(), nil +} +func (m *WantBfdEvents) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EnableDisable = buf.DecodeBool() + m.PID = buf.DecodeUint32() + return nil +} + +// WantBfdEventsReply defines message 'want_bfd_events_reply'. +type WantBfdEventsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WantBfdEventsReply) Reset() { *m = WantBfdEventsReply{} } +func (*WantBfdEventsReply) GetMessageName() string { return "want_bfd_events_reply" } +func (*WantBfdEventsReply) GetCrcString() string { return "e8d4e804" } +func (*WantBfdEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WantBfdEventsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *WantBfdEventsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *WantBfdEventsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_bfd_binapi_init() } +func file_bfd_binapi_init() { + api.RegisterMessage((*BfdAuthDelKey)(nil), "bfd_auth_del_key_65310b22") + api.RegisterMessage((*BfdAuthDelKeyReply)(nil), "bfd_auth_del_key_reply_e8d4e804") + api.RegisterMessage((*BfdAuthKeysDetails)(nil), "bfd_auth_keys_details_84130e9f") + api.RegisterMessage((*BfdAuthKeysDump)(nil), "bfd_auth_keys_dump_51077d14") + api.RegisterMessage((*BfdAuthSetKey)(nil), "bfd_auth_set_key_690b8877") + api.RegisterMessage((*BfdAuthSetKeyReply)(nil), "bfd_auth_set_key_reply_e8d4e804") + api.RegisterMessage((*BfdUDPAdd)(nil), "bfd_udp_add_7a6d1185") + api.RegisterMessage((*BfdUDPAddReply)(nil), "bfd_udp_add_reply_e8d4e804") + api.RegisterMessage((*BfdUDPAuthActivate)(nil), "bfd_udp_auth_activate_493ee0ec") + api.RegisterMessage((*BfdUDPAuthActivateReply)(nil), "bfd_udp_auth_activate_reply_e8d4e804") + api.RegisterMessage((*BfdUDPAuthDeactivate)(nil), "bfd_udp_auth_deactivate_99978c32") + api.RegisterMessage((*BfdUDPAuthDeactivateReply)(nil), "bfd_udp_auth_deactivate_reply_e8d4e804") + api.RegisterMessage((*BfdUDPDel)(nil), "bfd_udp_del_8096514d") + api.RegisterMessage((*BfdUDPDelEchoSource)(nil), "bfd_udp_del_echo_source_51077d14") + api.RegisterMessage((*BfdUDPDelEchoSourceReply)(nil), "bfd_udp_del_echo_source_reply_e8d4e804") + api.RegisterMessage((*BfdUDPDelReply)(nil), "bfd_udp_del_reply_e8d4e804") + api.RegisterMessage((*BfdUDPGetEchoSource)(nil), "bfd_udp_get_echo_source_51077d14") + api.RegisterMessage((*BfdUDPGetEchoSourceReply)(nil), "bfd_udp_get_echo_source_reply_1e00cfce") + api.RegisterMessage((*BfdUDPMod)(nil), "bfd_udp_mod_783a3ff6") + api.RegisterMessage((*BfdUDPModReply)(nil), "bfd_udp_mod_reply_e8d4e804") + api.RegisterMessage((*BfdUDPSessionDetails)(nil), "bfd_udp_session_details_60653c02") + api.RegisterMessage((*BfdUDPSessionDump)(nil), "bfd_udp_session_dump_51077d14") + api.RegisterMessage((*BfdUDPSessionSetFlags)(nil), "bfd_udp_session_set_flags_cf313851") + api.RegisterMessage((*BfdUDPSessionSetFlagsReply)(nil), "bfd_udp_session_set_flags_reply_e8d4e804") + api.RegisterMessage((*BfdUDPSetEchoSource)(nil), "bfd_udp_set_echo_source_f9e6675e") + api.RegisterMessage((*BfdUDPSetEchoSourceReply)(nil), "bfd_udp_set_echo_source_reply_e8d4e804") + api.RegisterMessage((*WantBfdEvents)(nil), "want_bfd_events_c5e2af94") + api.RegisterMessage((*WantBfdEventsReply)(nil), "want_bfd_events_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*BfdAuthDelKey)(nil), + (*BfdAuthDelKeyReply)(nil), + (*BfdAuthKeysDetails)(nil), + (*BfdAuthKeysDump)(nil), + (*BfdAuthSetKey)(nil), + (*BfdAuthSetKeyReply)(nil), + (*BfdUDPAdd)(nil), + (*BfdUDPAddReply)(nil), + (*BfdUDPAuthActivate)(nil), + (*BfdUDPAuthActivateReply)(nil), + (*BfdUDPAuthDeactivate)(nil), + (*BfdUDPAuthDeactivateReply)(nil), + (*BfdUDPDel)(nil), + (*BfdUDPDelEchoSource)(nil), + (*BfdUDPDelEchoSourceReply)(nil), + (*BfdUDPDelReply)(nil), + (*BfdUDPGetEchoSource)(nil), + (*BfdUDPGetEchoSourceReply)(nil), + (*BfdUDPMod)(nil), + (*BfdUDPModReply)(nil), + (*BfdUDPSessionDetails)(nil), + (*BfdUDPSessionDump)(nil), + (*BfdUDPSessionSetFlags)(nil), + (*BfdUDPSessionSetFlagsReply)(nil), + (*BfdUDPSetEchoSource)(nil), + (*BfdUDPSetEchoSourceReply)(nil), + (*WantBfdEvents)(nil), + (*WantBfdEventsReply)(nil), + } +} diff --git a/binapi/bfd/bfd_rest.ba.go b/binapi/bfd/bfd_rest.ba.go new file mode 100644 index 0000000..2f25f8b --- /dev/null +++ b/binapi/bfd/bfd_rest.ba.go @@ -0,0 +1,272 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package bfd + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/bfd_auth_del_key", func(w http.ResponseWriter, req *http.Request) { + var request = new(BfdAuthDelKey) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BfdAuthDelKey(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bfd_auth_set_key", func(w http.ResponseWriter, req *http.Request) { + var request = new(BfdAuthSetKey) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BfdAuthSetKey(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bfd_udp_add", func(w http.ResponseWriter, req *http.Request) { + var request = new(BfdUDPAdd) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BfdUDPAdd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bfd_udp_auth_activate", func(w http.ResponseWriter, req *http.Request) { + var request = new(BfdUDPAuthActivate) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BfdUDPAuthActivate(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bfd_udp_auth_deactivate", func(w http.ResponseWriter, req *http.Request) { + var request = new(BfdUDPAuthDeactivate) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BfdUDPAuthDeactivate(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bfd_udp_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(BfdUDPDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BfdUDPDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bfd_udp_del_echo_source", func(w http.ResponseWriter, req *http.Request) { + var request = new(BfdUDPDelEchoSource) + reply, err := rpc.BfdUDPDelEchoSource(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bfd_udp_get_echo_source", func(w http.ResponseWriter, req *http.Request) { + var request = new(BfdUDPGetEchoSource) + reply, err := rpc.BfdUDPGetEchoSource(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bfd_udp_mod", func(w http.ResponseWriter, req *http.Request) { + var request = new(BfdUDPMod) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BfdUDPMod(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bfd_udp_session_set_flags", func(w http.ResponseWriter, req *http.Request) { + var request = new(BfdUDPSessionSetFlags) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BfdUDPSessionSetFlags(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bfd_udp_set_echo_source", func(w http.ResponseWriter, req *http.Request) { + var request = new(BfdUDPSetEchoSource) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BfdUDPSetEchoSource(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/want_bfd_events", func(w http.ResponseWriter, req *http.Request) { + var request = new(WantBfdEvents) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.WantBfdEvents(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/bfd/bfd_rpc.ba.go b/binapi/bfd/bfd_rpc.ba.go new file mode 100644 index 0000000..78cbd3a --- /dev/null +++ b/binapi/bfd/bfd_rpc.ba.go @@ -0,0 +1,223 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package bfd + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service bfd. +type RPCService interface { + BfdAuthDelKey(ctx context.Context, in *BfdAuthDelKey) (*BfdAuthDelKeyReply, error) + BfdAuthKeysDump(ctx context.Context, in *BfdAuthKeysDump) (RPCService_BfdAuthKeysDumpClient, error) + BfdAuthSetKey(ctx context.Context, in *BfdAuthSetKey) (*BfdAuthSetKeyReply, error) + BfdUDPAdd(ctx context.Context, in *BfdUDPAdd) (*BfdUDPAddReply, error) + BfdUDPAuthActivate(ctx context.Context, in *BfdUDPAuthActivate) (*BfdUDPAuthActivateReply, error) + BfdUDPAuthDeactivate(ctx context.Context, in *BfdUDPAuthDeactivate) (*BfdUDPAuthDeactivateReply, error) + BfdUDPDel(ctx context.Context, in *BfdUDPDel) (*BfdUDPDelReply, error) + BfdUDPDelEchoSource(ctx context.Context, in *BfdUDPDelEchoSource) (*BfdUDPDelEchoSourceReply, error) + BfdUDPGetEchoSource(ctx context.Context, in *BfdUDPGetEchoSource) (*BfdUDPGetEchoSourceReply, error) + BfdUDPMod(ctx context.Context, in *BfdUDPMod) (*BfdUDPModReply, error) + BfdUDPSessionDump(ctx context.Context, in *BfdUDPSessionDump) (RPCService_BfdUDPSessionDumpClient, error) + BfdUDPSessionSetFlags(ctx context.Context, in *BfdUDPSessionSetFlags) (*BfdUDPSessionSetFlagsReply, error) + BfdUDPSetEchoSource(ctx context.Context, in *BfdUDPSetEchoSource) (*BfdUDPSetEchoSourceReply, error) + WantBfdEvents(ctx context.Context, in *WantBfdEvents) (*WantBfdEventsReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) BfdAuthDelKey(ctx context.Context, in *BfdAuthDelKey) (*BfdAuthDelKeyReply, error) { + out := new(BfdAuthDelKeyReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdAuthKeysDump(ctx context.Context, in *BfdAuthKeysDump) (RPCService_BfdAuthKeysDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_BfdAuthKeysDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_BfdAuthKeysDumpClient interface { + Recv() (*BfdAuthKeysDetails, error) + api.Stream +} + +type serviceClient_BfdAuthKeysDumpClient struct { + api.Stream +} + +func (c *serviceClient_BfdAuthKeysDumpClient) Recv() (*BfdAuthKeysDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *BfdAuthKeysDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) BfdAuthSetKey(ctx context.Context, in *BfdAuthSetKey) (*BfdAuthSetKeyReply, error) { + out := new(BfdAuthSetKeyReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPAdd(ctx context.Context, in *BfdUDPAdd) (*BfdUDPAddReply, error) { + out := new(BfdUDPAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPAuthActivate(ctx context.Context, in *BfdUDPAuthActivate) (*BfdUDPAuthActivateReply, error) { + out := new(BfdUDPAuthActivateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPAuthDeactivate(ctx context.Context, in *BfdUDPAuthDeactivate) (*BfdUDPAuthDeactivateReply, error) { + out := new(BfdUDPAuthDeactivateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPDel(ctx context.Context, in *BfdUDPDel) (*BfdUDPDelReply, error) { + out := new(BfdUDPDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPDelEchoSource(ctx context.Context, in *BfdUDPDelEchoSource) (*BfdUDPDelEchoSourceReply, error) { + out := new(BfdUDPDelEchoSourceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPGetEchoSource(ctx context.Context, in *BfdUDPGetEchoSource) (*BfdUDPGetEchoSourceReply, error) { + out := new(BfdUDPGetEchoSourceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPMod(ctx context.Context, in *BfdUDPMod) (*BfdUDPModReply, error) { + out := new(BfdUDPModReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPSessionDump(ctx context.Context, in *BfdUDPSessionDump) (RPCService_BfdUDPSessionDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_BfdUDPSessionDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_BfdUDPSessionDumpClient interface { + Recv() (*BfdUDPSessionDetails, error) + api.Stream +} + +type serviceClient_BfdUDPSessionDumpClient struct { + api.Stream +} + +func (c *serviceClient_BfdUDPSessionDumpClient) Recv() (*BfdUDPSessionDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *BfdUDPSessionDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) BfdUDPSessionSetFlags(ctx context.Context, in *BfdUDPSessionSetFlags) (*BfdUDPSessionSetFlagsReply, error) { + out := new(BfdUDPSessionSetFlagsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPSetEchoSource(ctx context.Context, in *BfdUDPSetEchoSource) (*BfdUDPSetEchoSourceReply, error) { + out := new(BfdUDPSetEchoSourceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantBfdEvents(ctx context.Context, in *WantBfdEvents) (*WantBfdEventsReply, error) { + out := new(WantBfdEventsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/bier/bier.ba.go b/binapi/bier/bier.ba.go new file mode 100644 index 0000000..456e25c --- /dev/null +++ b/binapi/bier/bier.ba.go @@ -0,0 +1,1343 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/bier.api.json + +// Package bier contains generated bindings for API file bier.api. +// +// Contents: +// 2 structs +// 22 messages +// +package bier + +import ( + api "git.fd.io/govpp.git/api" + fib_types "git.fd.io/govpp.git/binapi/fib_types" + _ "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "bier" + APIVersion = "1.2.1" + VersionCrc = 0x9196a2d4 +) + +// BierRoute defines type 'bier_route'. +type BierRoute struct { + BrBp uint32 `binapi:"u32,name=br_bp" json:"br_bp,omitempty"` + BrTblID BierTableID `binapi:"bier_table_id,name=br_tbl_id" json:"br_tbl_id,omitempty"` + BrNPaths uint8 `binapi:"u8,name=br_n_paths" json:"-"` + BrPaths []fib_types.FibPath `binapi:"fib_path[br_n_paths],name=br_paths" json:"br_paths,omitempty"` +} + +// BierTableID defines type 'bier_table_id'. +type BierTableID struct { + BtSet uint8 `binapi:"u8,name=bt_set" json:"bt_set,omitempty"` + BtSubDomain uint8 `binapi:"u8,name=bt_sub_domain" json:"bt_sub_domain,omitempty"` + BtHdrLenID uint8 `binapi:"u8,name=bt_hdr_len_id" json:"bt_hdr_len_id,omitempty"` +} + +// BierDispEntryAddDel defines message 'bier_disp_entry_add_del'. +type BierDispEntryAddDel struct { + BdeBp uint16 `binapi:"u16,name=bde_bp" json:"bde_bp,omitempty"` + BdeTblID uint32 `binapi:"u32,name=bde_tbl_id" json:"bde_tbl_id,omitempty"` + BdeIsAdd bool `binapi:"bool,name=bde_is_add" json:"bde_is_add,omitempty"` + BdePayloadProto uint8 `binapi:"u8,name=bde_payload_proto" json:"bde_payload_proto,omitempty"` + BdeNPaths uint8 `binapi:"u8,name=bde_n_paths" json:"-"` + BdePaths []fib_types.FibPath `binapi:"fib_path[bde_n_paths],name=bde_paths" json:"bde_paths,omitempty"` +} + +func (m *BierDispEntryAddDel) Reset() { *m = BierDispEntryAddDel{} } +func (*BierDispEntryAddDel) GetMessageName() string { return "bier_disp_entry_add_del" } +func (*BierDispEntryAddDel) GetCrcString() string { return "648323eb" } +func (*BierDispEntryAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BierDispEntryAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 2 // m.BdeBp + size += 4 // m.BdeTblID + size += 1 // m.BdeIsAdd + size += 1 // m.BdePayloadProto + size += 1 // m.BdeNPaths + for j1 := 0; j1 < len(m.BdePaths); j1++ { + var s1 fib_types.FibPath + _ = s1 + if j1 < len(m.BdePaths) { + s1 = m.BdePaths[j1] + } + size += 4 // s1.SwIfIndex + size += 4 // s1.TableID + size += 4 // s1.RpfID + size += 1 // s1.Weight + size += 1 // s1.Preference + size += 4 // s1.Type + size += 4 // s1.Flags + size += 4 // s1.Proto + size += 1 * 16 // s1.Nh.Address + size += 4 // s1.Nh.ViaLabel + size += 4 // s1.Nh.ObjID + size += 4 // s1.Nh.ClassifyTableIndex + size += 1 // s1.NLabels + for j2 := 0; j2 < 16; j2++ { + var s2 fib_types.FibMplsLabel + _ = s2 + if j2 < len(s1.LabelStack) { + s2 = s1.LabelStack[j2] + } + size += 1 // s2.IsUniform + size += 4 // s2.Label + size += 1 // s2.TTL + size += 1 // s2.Exp + } + } + return size +} +func (m *BierDispEntryAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint16(uint16(m.BdeBp)) + buf.EncodeUint32(uint32(m.BdeTblID)) + buf.EncodeBool(m.BdeIsAdd) + buf.EncodeUint8(uint8(m.BdePayloadProto)) + buf.EncodeUint8(uint8(len(m.BdePaths))) + for j0 := 0; j0 < len(m.BdePaths); j0++ { + var v0 fib_types.FibPath + if j0 < len(m.BdePaths) { + v0 = m.BdePaths[j0] + } + buf.EncodeUint32(uint32(v0.SwIfIndex)) + buf.EncodeUint32(uint32(v0.TableID)) + buf.EncodeUint32(uint32(v0.RpfID)) + buf.EncodeUint8(uint8(v0.Weight)) + buf.EncodeUint8(uint8(v0.Preference)) + buf.EncodeUint32(uint32(v0.Type)) + buf.EncodeUint32(uint32(v0.Flags)) + buf.EncodeUint32(uint32(v0.Proto)) + buf.EncodeBytes(v0.Nh.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v0.Nh.ViaLabel)) + buf.EncodeUint32(uint32(v0.Nh.ObjID)) + buf.EncodeUint32(uint32(v0.Nh.ClassifyTableIndex)) + buf.EncodeUint8(uint8(v0.NLabels)) + for j1 := 0; j1 < 16; j1++ { + var v1 fib_types.FibMplsLabel + if j1 < len(v0.LabelStack) { + v1 = v0.LabelStack[j1] + } + buf.EncodeUint8(uint8(v1.IsUniform)) + buf.EncodeUint32(uint32(v1.Label)) + buf.EncodeUint8(uint8(v1.TTL)) + buf.EncodeUint8(uint8(v1.Exp)) + } + } + return buf.Bytes(), nil +} +func (m *BierDispEntryAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BdeBp = buf.DecodeUint16() + m.BdeTblID = buf.DecodeUint32() + m.BdeIsAdd = buf.DecodeBool() + m.BdePayloadProto = buf.DecodeUint8() + m.BdeNPaths = buf.DecodeUint8() + m.BdePaths = make([]fib_types.FibPath, int(m.BdeNPaths)) + for j0 := 0; j0 < len(m.BdePaths); j0++ { + m.BdePaths[j0].SwIfIndex = buf.DecodeUint32() + m.BdePaths[j0].TableID = buf.DecodeUint32() + m.BdePaths[j0].RpfID = buf.DecodeUint32() + m.BdePaths[j0].Weight = buf.DecodeUint8() + m.BdePaths[j0].Preference = buf.DecodeUint8() + m.BdePaths[j0].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.BdePaths[j0].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.BdePaths[j0].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.BdePaths[j0].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.BdePaths[j0].Nh.ViaLabel = buf.DecodeUint32() + m.BdePaths[j0].Nh.ObjID = buf.DecodeUint32() + m.BdePaths[j0].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.BdePaths[j0].NLabels = buf.DecodeUint8() + for j1 := 0; j1 < 16; j1++ { + m.BdePaths[j0].LabelStack[j1].IsUniform = buf.DecodeUint8() + m.BdePaths[j0].LabelStack[j1].Label = buf.DecodeUint32() + m.BdePaths[j0].LabelStack[j1].TTL = buf.DecodeUint8() + m.BdePaths[j0].LabelStack[j1].Exp = buf.DecodeUint8() + } + } + return nil +} + +// BierDispEntryAddDelReply defines message 'bier_disp_entry_add_del_reply'. +type BierDispEntryAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BierDispEntryAddDelReply) Reset() { *m = BierDispEntryAddDelReply{} } +func (*BierDispEntryAddDelReply) GetMessageName() string { return "bier_disp_entry_add_del_reply" } +func (*BierDispEntryAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*BierDispEntryAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BierDispEntryAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BierDispEntryAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BierDispEntryAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BierDispEntryDetails defines message 'bier_disp_entry_details'. +type BierDispEntryDetails struct { + BdeBp uint16 `binapi:"u16,name=bde_bp" json:"bde_bp,omitempty"` + BdeTblID uint32 `binapi:"u32,name=bde_tbl_id" json:"bde_tbl_id,omitempty"` + BdeIsAdd bool `binapi:"bool,name=bde_is_add" json:"bde_is_add,omitempty"` + BdePayloadProto uint8 `binapi:"u8,name=bde_payload_proto" json:"bde_payload_proto,omitempty"` + BdeNPaths uint8 `binapi:"u8,name=bde_n_paths" json:"-"` + BdePaths []fib_types.FibPath `binapi:"fib_path[bde_n_paths],name=bde_paths" json:"bde_paths,omitempty"` +} + +func (m *BierDispEntryDetails) Reset() { *m = BierDispEntryDetails{} } +func (*BierDispEntryDetails) GetMessageName() string { return "bier_disp_entry_details" } +func (*BierDispEntryDetails) GetCrcString() string { return "e5b039a9" } +func (*BierDispEntryDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BierDispEntryDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 2 // m.BdeBp + size += 4 // m.BdeTblID + size += 1 // m.BdeIsAdd + size += 1 // m.BdePayloadProto + size += 1 // m.BdeNPaths + for j1 := 0; j1 < len(m.BdePaths); j1++ { + var s1 fib_types.FibPath + _ = s1 + if j1 < len(m.BdePaths) { + s1 = m.BdePaths[j1] + } + size += 4 // s1.SwIfIndex + size += 4 // s1.TableID + size += 4 // s1.RpfID + size += 1 // s1.Weight + size += 1 // s1.Preference + size += 4 // s1.Type + size += 4 // s1.Flags + size += 4 // s1.Proto + size += 1 * 16 // s1.Nh.Address + size += 4 // s1.Nh.ViaLabel + size += 4 // s1.Nh.ObjID + size += 4 // s1.Nh.ClassifyTableIndex + size += 1 // s1.NLabels + for j2 := 0; j2 < 16; j2++ { + var s2 fib_types.FibMplsLabel + _ = s2 + if j2 < len(s1.LabelStack) { + s2 = s1.LabelStack[j2] + } + size += 1 // s2.IsUniform + size += 4 // s2.Label + size += 1 // s2.TTL + size += 1 // s2.Exp + } + } + return size +} +func (m *BierDispEntryDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint16(uint16(m.BdeBp)) + buf.EncodeUint32(uint32(m.BdeTblID)) + buf.EncodeBool(m.BdeIsAdd) + buf.EncodeUint8(uint8(m.BdePayloadProto)) + buf.EncodeUint8(uint8(len(m.BdePaths))) + for j0 := 0; j0 < len(m.BdePaths); j0++ { + var v0 fib_types.FibPath + if j0 < len(m.BdePaths) { + v0 = m.BdePaths[j0] + } + buf.EncodeUint32(uint32(v0.SwIfIndex)) + buf.EncodeUint32(uint32(v0.TableID)) + buf.EncodeUint32(uint32(v0.RpfID)) + buf.EncodeUint8(uint8(v0.Weight)) + buf.EncodeUint8(uint8(v0.Preference)) + buf.EncodeUint32(uint32(v0.Type)) + buf.EncodeUint32(uint32(v0.Flags)) + buf.EncodeUint32(uint32(v0.Proto)) + buf.EncodeBytes(v0.Nh.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v0.Nh.ViaLabel)) + buf.EncodeUint32(uint32(v0.Nh.ObjID)) + buf.EncodeUint32(uint32(v0.Nh.ClassifyTableIndex)) + buf.EncodeUint8(uint8(v0.NLabels)) + for j1 := 0; j1 < 16; j1++ { + var v1 fib_types.FibMplsLabel + if j1 < len(v0.LabelStack) { + v1 = v0.LabelStack[j1] + } + buf.EncodeUint8(uint8(v1.IsUniform)) + buf.EncodeUint32(uint32(v1.Label)) + buf.EncodeUint8(uint8(v1.TTL)) + buf.EncodeUint8(uint8(v1.Exp)) + } + } + return buf.Bytes(), nil +} +func (m *BierDispEntryDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BdeBp = buf.DecodeUint16() + m.BdeTblID = buf.DecodeUint32() + m.BdeIsAdd = buf.DecodeBool() + m.BdePayloadProto = buf.DecodeUint8() + m.BdeNPaths = buf.DecodeUint8() + m.BdePaths = make([]fib_types.FibPath, int(m.BdeNPaths)) + for j0 := 0; j0 < len(m.BdePaths); j0++ { + m.BdePaths[j0].SwIfIndex = buf.DecodeUint32() + m.BdePaths[j0].TableID = buf.DecodeUint32() + m.BdePaths[j0].RpfID = buf.DecodeUint32() + m.BdePaths[j0].Weight = buf.DecodeUint8() + m.BdePaths[j0].Preference = buf.DecodeUint8() + m.BdePaths[j0].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.BdePaths[j0].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.BdePaths[j0].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.BdePaths[j0].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.BdePaths[j0].Nh.ViaLabel = buf.DecodeUint32() + m.BdePaths[j0].Nh.ObjID = buf.DecodeUint32() + m.BdePaths[j0].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.BdePaths[j0].NLabels = buf.DecodeUint8() + for j1 := 0; j1 < 16; j1++ { + m.BdePaths[j0].LabelStack[j1].IsUniform = buf.DecodeUint8() + m.BdePaths[j0].LabelStack[j1].Label = buf.DecodeUint32() + m.BdePaths[j0].LabelStack[j1].TTL = buf.DecodeUint8() + m.BdePaths[j0].LabelStack[j1].Exp = buf.DecodeUint8() + } + } + return nil +} + +// BierDispEntryDump defines message 'bier_disp_entry_dump'. +type BierDispEntryDump struct { + BdeTblID uint32 `binapi:"u32,name=bde_tbl_id" json:"bde_tbl_id,omitempty"` +} + +func (m *BierDispEntryDump) Reset() { *m = BierDispEntryDump{} } +func (*BierDispEntryDump) GetMessageName() string { return "bier_disp_entry_dump" } +func (*BierDispEntryDump) GetCrcString() string { return "b5fa54ad" } +func (*BierDispEntryDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BierDispEntryDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.BdeTblID + return size +} +func (m *BierDispEntryDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.BdeTblID)) + return buf.Bytes(), nil +} +func (m *BierDispEntryDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BdeTblID = buf.DecodeUint32() + return nil +} + +// BierDispTableAddDel defines message 'bier_disp_table_add_del'. +type BierDispTableAddDel struct { + BdtTblID uint32 `binapi:"u32,name=bdt_tbl_id" json:"bdt_tbl_id,omitempty"` + BdtIsAdd bool `binapi:"bool,name=bdt_is_add" json:"bdt_is_add,omitempty"` +} + +func (m *BierDispTableAddDel) Reset() { *m = BierDispTableAddDel{} } +func (*BierDispTableAddDel) GetMessageName() string { return "bier_disp_table_add_del" } +func (*BierDispTableAddDel) GetCrcString() string { return "889657ac" } +func (*BierDispTableAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BierDispTableAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.BdtTblID + size += 1 // m.BdtIsAdd + return size +} +func (m *BierDispTableAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.BdtTblID)) + buf.EncodeBool(m.BdtIsAdd) + return buf.Bytes(), nil +} +func (m *BierDispTableAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BdtTblID = buf.DecodeUint32() + m.BdtIsAdd = buf.DecodeBool() + return nil +} + +// BierDispTableAddDelReply defines message 'bier_disp_table_add_del_reply'. +type BierDispTableAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BierDispTableAddDelReply) Reset() { *m = BierDispTableAddDelReply{} } +func (*BierDispTableAddDelReply) GetMessageName() string { return "bier_disp_table_add_del_reply" } +func (*BierDispTableAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*BierDispTableAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BierDispTableAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BierDispTableAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BierDispTableAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BierDispTableDetails defines message 'bier_disp_table_details'. +type BierDispTableDetails struct { + BdtTblID uint32 `binapi:"u32,name=bdt_tbl_id" json:"bdt_tbl_id,omitempty"` +} + +func (m *BierDispTableDetails) Reset() { *m = BierDispTableDetails{} } +func (*BierDispTableDetails) GetMessageName() string { return "bier_disp_table_details" } +func (*BierDispTableDetails) GetCrcString() string { return "d27942c0" } +func (*BierDispTableDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BierDispTableDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.BdtTblID + return size +} +func (m *BierDispTableDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.BdtTblID)) + return buf.Bytes(), nil +} +func (m *BierDispTableDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BdtTblID = buf.DecodeUint32() + return nil +} + +// BierDispTableDump defines message 'bier_disp_table_dump'. +type BierDispTableDump struct{} + +func (m *BierDispTableDump) Reset() { *m = BierDispTableDump{} } +func (*BierDispTableDump) GetMessageName() string { return "bier_disp_table_dump" } +func (*BierDispTableDump) GetCrcString() string { return "51077d14" } +func (*BierDispTableDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BierDispTableDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *BierDispTableDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *BierDispTableDump) Unmarshal(b []byte) error { + return nil +} + +// BierImpAdd defines message 'bier_imp_add'. +type BierImpAdd struct { + BiTblID BierTableID `binapi:"bier_table_id,name=bi_tbl_id" json:"bi_tbl_id,omitempty"` + BiSrc uint16 `binapi:"u16,name=bi_src" json:"bi_src,omitempty"` + BiNBytes uint8 `binapi:"u8,name=bi_n_bytes" json:"-"` + BiBytes []byte `binapi:"u8[bi_n_bytes],name=bi_bytes" json:"bi_bytes,omitempty"` +} + +func (m *BierImpAdd) Reset() { *m = BierImpAdd{} } +func (*BierImpAdd) GetMessageName() string { return "bier_imp_add" } +func (*BierImpAdd) GetCrcString() string { return "3856dc3d" } +func (*BierImpAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BierImpAdd) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.BiTblID.BtSet + size += 1 // m.BiTblID.BtSubDomain + size += 1 // m.BiTblID.BtHdrLenID + size += 2 // m.BiSrc + size += 1 // m.BiNBytes + size += 1 * len(m.BiBytes) // m.BiBytes + return size +} +func (m *BierImpAdd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.BiTblID.BtSet)) + buf.EncodeUint8(uint8(m.BiTblID.BtSubDomain)) + buf.EncodeUint8(uint8(m.BiTblID.BtHdrLenID)) + buf.EncodeUint16(uint16(m.BiSrc)) + buf.EncodeUint8(uint8(len(m.BiBytes))) + buf.EncodeBytes(m.BiBytes[:], 0) + return buf.Bytes(), nil +} +func (m *BierImpAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BiTblID.BtSet = buf.DecodeUint8() + m.BiTblID.BtSubDomain = buf.DecodeUint8() + m.BiTblID.BtHdrLenID = buf.DecodeUint8() + m.BiSrc = buf.DecodeUint16() + m.BiNBytes = buf.DecodeUint8() + copy(m.BiBytes[:], buf.DecodeBytes(0)) + return nil +} + +// BierImpAddReply defines message 'bier_imp_add_reply'. +type BierImpAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + BiIndex uint32 `binapi:"u32,name=bi_index" json:"bi_index,omitempty"` +} + +func (m *BierImpAddReply) Reset() { *m = BierImpAddReply{} } +func (*BierImpAddReply) GetMessageName() string { return "bier_imp_add_reply" } +func (*BierImpAddReply) GetCrcString() string { return "d49c5793" } +func (*BierImpAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BierImpAddReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.BiIndex + return size +} +func (m *BierImpAddReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.BiIndex)) + return buf.Bytes(), nil +} +func (m *BierImpAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.BiIndex = buf.DecodeUint32() + return nil +} + +// BierImpDel defines message 'bier_imp_del'. +type BierImpDel struct { + BiIndex uint32 `binapi:"u32,name=bi_index" json:"bi_index,omitempty"` +} + +func (m *BierImpDel) Reset() { *m = BierImpDel{} } +func (*BierImpDel) GetMessageName() string { return "bier_imp_del" } +func (*BierImpDel) GetCrcString() string { return "7d45edf6" } +func (*BierImpDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BierImpDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.BiIndex + return size +} +func (m *BierImpDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.BiIndex)) + return buf.Bytes(), nil +} +func (m *BierImpDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BiIndex = buf.DecodeUint32() + return nil +} + +// BierImpDelReply defines message 'bier_imp_del_reply'. +type BierImpDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BierImpDelReply) Reset() { *m = BierImpDelReply{} } +func (*BierImpDelReply) GetMessageName() string { return "bier_imp_del_reply" } +func (*BierImpDelReply) GetCrcString() string { return "e8d4e804" } +func (*BierImpDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BierImpDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BierImpDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BierImpDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BierImpDetails defines message 'bier_imp_details'. +type BierImpDetails struct { + BiTblID BierTableID `binapi:"bier_table_id,name=bi_tbl_id" json:"bi_tbl_id,omitempty"` + BiSrc uint16 `binapi:"u16,name=bi_src" json:"bi_src,omitempty"` + BiNBytes uint8 `binapi:"u8,name=bi_n_bytes" json:"-"` + BiBytes []byte `binapi:"u8[bi_n_bytes],name=bi_bytes" json:"bi_bytes,omitempty"` +} + +func (m *BierImpDetails) Reset() { *m = BierImpDetails{} } +func (*BierImpDetails) GetMessageName() string { return "bier_imp_details" } +func (*BierImpDetails) GetCrcString() string { return "b76192df" } +func (*BierImpDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BierImpDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.BiTblID.BtSet + size += 1 // m.BiTblID.BtSubDomain + size += 1 // m.BiTblID.BtHdrLenID + size += 2 // m.BiSrc + size += 1 // m.BiNBytes + size += 1 * len(m.BiBytes) // m.BiBytes + return size +} +func (m *BierImpDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.BiTblID.BtSet)) + buf.EncodeUint8(uint8(m.BiTblID.BtSubDomain)) + buf.EncodeUint8(uint8(m.BiTblID.BtHdrLenID)) + buf.EncodeUint16(uint16(m.BiSrc)) + buf.EncodeUint8(uint8(len(m.BiBytes))) + buf.EncodeBytes(m.BiBytes[:], 0) + return buf.Bytes(), nil +} +func (m *BierImpDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BiTblID.BtSet = buf.DecodeUint8() + m.BiTblID.BtSubDomain = buf.DecodeUint8() + m.BiTblID.BtHdrLenID = buf.DecodeUint8() + m.BiSrc = buf.DecodeUint16() + m.BiNBytes = buf.DecodeUint8() + copy(m.BiBytes[:], buf.DecodeBytes(0)) + return nil +} + +// BierImpDump defines message 'bier_imp_dump'. +type BierImpDump struct{} + +func (m *BierImpDump) Reset() { *m = BierImpDump{} } +func (*BierImpDump) GetMessageName() string { return "bier_imp_dump" } +func (*BierImpDump) GetCrcString() string { return "51077d14" } +func (*BierImpDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BierImpDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *BierImpDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *BierImpDump) Unmarshal(b []byte) error { + return nil +} + +// BierRouteAddDel defines message 'bier_route_add_del'. +type BierRouteAddDel struct { + BrIsAdd bool `binapi:"bool,name=br_is_add" json:"br_is_add,omitempty"` + BrIsReplace bool `binapi:"bool,name=br_is_replace" json:"br_is_replace,omitempty"` + BrRoute BierRoute `binapi:"bier_route,name=br_route" json:"br_route,omitempty"` +} + +func (m *BierRouteAddDel) Reset() { *m = BierRouteAddDel{} } +func (*BierRouteAddDel) GetMessageName() string { return "bier_route_add_del" } +func (*BierRouteAddDel) GetCrcString() string { return "f29edca0" } +func (*BierRouteAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BierRouteAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.BrIsAdd + size += 1 // m.BrIsReplace + size += 4 // m.BrRoute.BrBp + size += 1 // m.BrRoute.BrTblID.BtSet + size += 1 // m.BrRoute.BrTblID.BtSubDomain + size += 1 // m.BrRoute.BrTblID.BtHdrLenID + size += 1 // m.BrRoute.BrNPaths + for j2 := 0; j2 < len(m.BrRoute.BrPaths); j2++ { + var s2 fib_types.FibPath + _ = s2 + if j2 < len(m.BrRoute.BrPaths) { + s2 = m.BrRoute.BrPaths[j2] + } + size += 4 // s2.SwIfIndex + size += 4 // s2.TableID + size += 4 // s2.RpfID + size += 1 // s2.Weight + size += 1 // s2.Preference + size += 4 // s2.Type + size += 4 // s2.Flags + size += 4 // s2.Proto + size += 1 * 16 // s2.Nh.Address + size += 4 // s2.Nh.ViaLabel + size += 4 // s2.Nh.ObjID + size += 4 // s2.Nh.ClassifyTableIndex + size += 1 // s2.NLabels + for j3 := 0; j3 < 16; j3++ { + var s3 fib_types.FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + size += 1 // s3.IsUniform + size += 4 // s3.Label + size += 1 // s3.TTL + size += 1 // s3.Exp + } + } + return size +} +func (m *BierRouteAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.BrIsAdd) + buf.EncodeBool(m.BrIsReplace) + buf.EncodeUint32(uint32(m.BrRoute.BrBp)) + buf.EncodeUint8(uint8(m.BrRoute.BrTblID.BtSet)) + buf.EncodeUint8(uint8(m.BrRoute.BrTblID.BtSubDomain)) + buf.EncodeUint8(uint8(m.BrRoute.BrTblID.BtHdrLenID)) + buf.EncodeUint8(uint8(len(m.BrRoute.BrPaths))) + for j1 := 0; j1 < len(m.BrRoute.BrPaths); j1++ { + var v1 fib_types.FibPath + if j1 < len(m.BrRoute.BrPaths) { + v1 = m.BrRoute.BrPaths[j1] + } + buf.EncodeUint32(uint32(v1.SwIfIndex)) + buf.EncodeUint32(uint32(v1.TableID)) + buf.EncodeUint32(uint32(v1.RpfID)) + buf.EncodeUint8(uint8(v1.Weight)) + buf.EncodeUint8(uint8(v1.Preference)) + buf.EncodeUint32(uint32(v1.Type)) + buf.EncodeUint32(uint32(v1.Flags)) + buf.EncodeUint32(uint32(v1.Proto)) + buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v1.Nh.ViaLabel)) + buf.EncodeUint32(uint32(v1.Nh.ObjID)) + buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex)) + buf.EncodeUint8(uint8(v1.NLabels)) + for j2 := 0; j2 < 16; j2++ { + var v2 fib_types.FibMplsLabel + if j2 < len(v1.LabelStack) { + v2 = v1.LabelStack[j2] + } + buf.EncodeUint8(uint8(v2.IsUniform)) + buf.EncodeUint32(uint32(v2.Label)) + buf.EncodeUint8(uint8(v2.TTL)) + buf.EncodeUint8(uint8(v2.Exp)) + } + } + return buf.Bytes(), nil +} +func (m *BierRouteAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BrIsAdd = buf.DecodeBool() + m.BrIsReplace = buf.DecodeBool() + m.BrRoute.BrBp = buf.DecodeUint32() + m.BrRoute.BrTblID.BtSet = buf.DecodeUint8() + m.BrRoute.BrTblID.BtSubDomain = buf.DecodeUint8() + m.BrRoute.BrTblID.BtHdrLenID = buf.DecodeUint8() + m.BrRoute.BrNPaths = buf.DecodeUint8() + m.BrRoute.BrPaths = make([]fib_types.FibPath, int(m.BrRoute.BrNPaths)) + for j1 := 0; j1 < len(m.BrRoute.BrPaths); j1++ { + m.BrRoute.BrPaths[j1].SwIfIndex = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].TableID = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].RpfID = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].Weight = buf.DecodeUint8() + m.BrRoute.BrPaths[j1].Preference = buf.DecodeUint8() + m.BrRoute.BrPaths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.BrRoute.BrPaths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.BrRoute.BrPaths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.BrRoute.BrPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.BrRoute.BrPaths[j1].Nh.ViaLabel = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].Nh.ObjID = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].NLabels = buf.DecodeUint8() + for j2 := 0; j2 < 16; j2++ { + m.BrRoute.BrPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() + m.BrRoute.BrPaths[j1].LabelStack[j2].Label = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8() + m.BrRoute.BrPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8() + } + } + return nil +} + +// BierRouteAddDelReply defines message 'bier_route_add_del_reply'. +type BierRouteAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BierRouteAddDelReply) Reset() { *m = BierRouteAddDelReply{} } +func (*BierRouteAddDelReply) GetMessageName() string { return "bier_route_add_del_reply" } +func (*BierRouteAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*BierRouteAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BierRouteAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BierRouteAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BierRouteAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BierRouteDetails defines message 'bier_route_details'. +type BierRouteDetails struct { + BrRoute BierRoute `binapi:"bier_route,name=br_route" json:"br_route,omitempty"` +} + +func (m *BierRouteDetails) Reset() { *m = BierRouteDetails{} } +func (*BierRouteDetails) GetMessageName() string { return "bier_route_details" } +func (*BierRouteDetails) GetCrcString() string { return "39ee6a56" } +func (*BierRouteDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BierRouteDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.BrRoute.BrBp + size += 1 // m.BrRoute.BrTblID.BtSet + size += 1 // m.BrRoute.BrTblID.BtSubDomain + size += 1 // m.BrRoute.BrTblID.BtHdrLenID + size += 1 // m.BrRoute.BrNPaths + for j2 := 0; j2 < len(m.BrRoute.BrPaths); j2++ { + var s2 fib_types.FibPath + _ = s2 + if j2 < len(m.BrRoute.BrPaths) { + s2 = m.BrRoute.BrPaths[j2] + } + size += 4 // s2.SwIfIndex + size += 4 // s2.TableID + size += 4 // s2.RpfID + size += 1 // s2.Weight + size += 1 // s2.Preference + size += 4 // s2.Type + size += 4 // s2.Flags + size += 4 // s2.Proto + size += 1 * 16 // s2.Nh.Address + size += 4 // s2.Nh.ViaLabel + size += 4 // s2.Nh.ObjID + size += 4 // s2.Nh.ClassifyTableIndex + size += 1 // s2.NLabels + for j3 := 0; j3 < 16; j3++ { + var s3 fib_types.FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + size += 1 // s3.IsUniform + size += 4 // s3.Label + size += 1 // s3.TTL + size += 1 // s3.Exp + } + } + return size +} +func (m *BierRouteDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.BrRoute.BrBp)) + buf.EncodeUint8(uint8(m.BrRoute.BrTblID.BtSet)) + buf.EncodeUint8(uint8(m.BrRoute.BrTblID.BtSubDomain)) + buf.EncodeUint8(uint8(m.BrRoute.BrTblID.BtHdrLenID)) + buf.EncodeUint8(uint8(len(m.BrRoute.BrPaths))) + for j1 := 0; j1 < len(m.BrRoute.BrPaths); j1++ { + var v1 fib_types.FibPath + if j1 < len(m.BrRoute.BrPaths) { + v1 = m.BrRoute.BrPaths[j1] + } + buf.EncodeUint32(uint32(v1.SwIfIndex)) + buf.EncodeUint32(uint32(v1.TableID)) + buf.EncodeUint32(uint32(v1.RpfID)) + buf.EncodeUint8(uint8(v1.Weight)) + buf.EncodeUint8(uint8(v1.Preference)) + buf.EncodeUint32(uint32(v1.Type)) + buf.EncodeUint32(uint32(v1.Flags)) + buf.EncodeUint32(uint32(v1.Proto)) + buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v1.Nh.ViaLabel)) + buf.EncodeUint32(uint32(v1.Nh.ObjID)) + buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex)) + buf.EncodeUint8(uint8(v1.NLabels)) + for j2 := 0; j2 < 16; j2++ { + var v2 fib_types.FibMplsLabel + if j2 < len(v1.LabelStack) { + v2 = v1.LabelStack[j2] + } + buf.EncodeUint8(uint8(v2.IsUniform)) + buf.EncodeUint32(uint32(v2.Label)) + buf.EncodeUint8(uint8(v2.TTL)) + buf.EncodeUint8(uint8(v2.Exp)) + } + } + return buf.Bytes(), nil +} +func (m *BierRouteDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BrRoute.BrBp = buf.DecodeUint32() + m.BrRoute.BrTblID.BtSet = buf.DecodeUint8() + m.BrRoute.BrTblID.BtSubDomain = buf.DecodeUint8() + m.BrRoute.BrTblID.BtHdrLenID = buf.DecodeUint8() + m.BrRoute.BrNPaths = buf.DecodeUint8() + m.BrRoute.BrPaths = make([]fib_types.FibPath, int(m.BrRoute.BrNPaths)) + for j1 := 0; j1 < len(m.BrRoute.BrPaths); j1++ { + m.BrRoute.BrPaths[j1].SwIfIndex = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].TableID = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].RpfID = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].Weight = buf.DecodeUint8() + m.BrRoute.BrPaths[j1].Preference = buf.DecodeUint8() + m.BrRoute.BrPaths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.BrRoute.BrPaths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.BrRoute.BrPaths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.BrRoute.BrPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.BrRoute.BrPaths[j1].Nh.ViaLabel = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].Nh.ObjID = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].NLabels = buf.DecodeUint8() + for j2 := 0; j2 < 16; j2++ { + m.BrRoute.BrPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() + m.BrRoute.BrPaths[j1].LabelStack[j2].Label = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8() + m.BrRoute.BrPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8() + } + } + return nil +} + +// BierRouteDump defines message 'bier_route_dump'. +type BierRouteDump struct { + BrTblID BierTableID `binapi:"bier_table_id,name=br_tbl_id" json:"br_tbl_id,omitempty"` +} + +func (m *BierRouteDump) Reset() { *m = BierRouteDump{} } +func (*BierRouteDump) GetMessageName() string { return "bier_route_dump" } +func (*BierRouteDump) GetCrcString() string { return "38339846" } +func (*BierRouteDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BierRouteDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.BrTblID.BtSet + size += 1 // m.BrTblID.BtSubDomain + size += 1 // m.BrTblID.BtHdrLenID + return size +} +func (m *BierRouteDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.BrTblID.BtSet)) + buf.EncodeUint8(uint8(m.BrTblID.BtSubDomain)) + buf.EncodeUint8(uint8(m.BrTblID.BtHdrLenID)) + return buf.Bytes(), nil +} +func (m *BierRouteDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BrTblID.BtSet = buf.DecodeUint8() + m.BrTblID.BtSubDomain = buf.DecodeUint8() + m.BrTblID.BtHdrLenID = buf.DecodeUint8() + return nil +} + +// BierTableAddDel defines message 'bier_table_add_del'. +type BierTableAddDel struct { + BtTblID BierTableID `binapi:"bier_table_id,name=bt_tbl_id" json:"bt_tbl_id,omitempty"` + BtLabel uint32 `binapi:"u32,name=bt_label" json:"bt_label,omitempty"` + BtIsAdd bool `binapi:"bool,name=bt_is_add" json:"bt_is_add,omitempty"` +} + +func (m *BierTableAddDel) Reset() { *m = BierTableAddDel{} } +func (*BierTableAddDel) GetMessageName() string { return "bier_table_add_del" } +func (*BierTableAddDel) GetCrcString() string { return "35e59209" } +func (*BierTableAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BierTableAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.BtTblID.BtSet + size += 1 // m.BtTblID.BtSubDomain + size += 1 // m.BtTblID.BtHdrLenID + size += 4 // m.BtLabel + size += 1 // m.BtIsAdd + return size +} +func (m *BierTableAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.BtTblID.BtSet)) + buf.EncodeUint8(uint8(m.BtTblID.BtSubDomain)) + buf.EncodeUint8(uint8(m.BtTblID.BtHdrLenID)) + buf.EncodeUint32(uint32(m.BtLabel)) + buf.EncodeBool(m.BtIsAdd) + return buf.Bytes(), nil +} +func (m *BierTableAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BtTblID.BtSet = buf.DecodeUint8() + m.BtTblID.BtSubDomain = buf.DecodeUint8() + m.BtTblID.BtHdrLenID = buf.DecodeUint8() + m.BtLabel = buf.DecodeUint32() + m.BtIsAdd = buf.DecodeBool() + return nil +} + +// BierTableAddDelReply defines message 'bier_table_add_del_reply'. +type BierTableAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BierTableAddDelReply) Reset() { *m = BierTableAddDelReply{} } +func (*BierTableAddDelReply) GetMessageName() string { return "bier_table_add_del_reply" } +func (*BierTableAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*BierTableAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BierTableAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BierTableAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BierTableAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BierTableDetails defines message 'bier_table_details'. +type BierTableDetails struct { + BtLabel uint32 `binapi:"u32,name=bt_label" json:"bt_label,omitempty"` + BtTblID BierTableID `binapi:"bier_table_id,name=bt_tbl_id" json:"bt_tbl_id,omitempty"` +} + +func (m *BierTableDetails) Reset() { *m = BierTableDetails{} } +func (*BierTableDetails) GetMessageName() string { return "bier_table_details" } +func (*BierTableDetails) GetCrcString() string { return "fc44a9dd" } +func (*BierTableDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BierTableDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.BtLabel + size += 1 // m.BtTblID.BtSet + size += 1 // m.BtTblID.BtSubDomain + size += 1 // m.BtTblID.BtHdrLenID + return size +} +func (m *BierTableDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.BtLabel)) + buf.EncodeUint8(uint8(m.BtTblID.BtSet)) + buf.EncodeUint8(uint8(m.BtTblID.BtSubDomain)) + buf.EncodeUint8(uint8(m.BtTblID.BtHdrLenID)) + return buf.Bytes(), nil +} +func (m *BierTableDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BtLabel = buf.DecodeUint32() + m.BtTblID.BtSet = buf.DecodeUint8() + m.BtTblID.BtSubDomain = buf.DecodeUint8() + m.BtTblID.BtHdrLenID = buf.DecodeUint8() + return nil +} + +// BierTableDump defines message 'bier_table_dump'. +type BierTableDump struct{} + +func (m *BierTableDump) Reset() { *m = BierTableDump{} } +func (*BierTableDump) GetMessageName() string { return "bier_table_dump" } +func (*BierTableDump) GetCrcString() string { return "51077d14" } +func (*BierTableDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BierTableDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *BierTableDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *BierTableDump) Unmarshal(b []byte) error { + return nil +} + +func init() { file_bier_binapi_init() } +func file_bier_binapi_init() { + api.RegisterMessage((*BierDispEntryAddDel)(nil), "bier_disp_entry_add_del_648323eb") + api.RegisterMessage((*BierDispEntryAddDelReply)(nil), "bier_disp_entry_add_del_reply_e8d4e804") + api.RegisterMessage((*BierDispEntryDetails)(nil), "bier_disp_entry_details_e5b039a9") + api.RegisterMessage((*BierDispEntryDump)(nil), "bier_disp_entry_dump_b5fa54ad") + api.RegisterMessage((*BierDispTableAddDel)(nil), "bier_disp_table_add_del_889657ac") + api.RegisterMessage((*BierDispTableAddDelReply)(nil), "bier_disp_table_add_del_reply_e8d4e804") + api.RegisterMessage((*BierDispTableDetails)(nil), "bier_disp_table_details_d27942c0") + api.RegisterMessage((*BierDispTableDump)(nil), "bier_disp_table_dump_51077d14") + api.RegisterMessage((*BierImpAdd)(nil), "bier_imp_add_3856dc3d") + api.RegisterMessage((*BierImpAddReply)(nil), "bier_imp_add_reply_d49c5793") + api.RegisterMessage((*BierImpDel)(nil), "bier_imp_del_7d45edf6") + api.RegisterMessage((*BierImpDelReply)(nil), "bier_imp_del_reply_e8d4e804") + api.RegisterMessage((*BierImpDetails)(nil), "bier_imp_details_b76192df") + api.RegisterMessage((*BierImpDump)(nil), "bier_imp_dump_51077d14") + api.RegisterMessage((*BierRouteAddDel)(nil), "bier_route_add_del_f29edca0") + api.RegisterMessage((*BierRouteAddDelReply)(nil), "bier_route_add_del_reply_e8d4e804") + api.RegisterMessage((*BierRouteDetails)(nil), "bier_route_details_39ee6a56") + api.RegisterMessage((*BierRouteDump)(nil), "bier_route_dump_38339846") + api.RegisterMessage((*BierTableAddDel)(nil), "bier_table_add_del_35e59209") + api.RegisterMessage((*BierTableAddDelReply)(nil), "bier_table_add_del_reply_e8d4e804") + api.RegisterMessage((*BierTableDetails)(nil), "bier_table_details_fc44a9dd") + api.RegisterMessage((*BierTableDump)(nil), "bier_table_dump_51077d14") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*BierDispEntryAddDel)(nil), + (*BierDispEntryAddDelReply)(nil), + (*BierDispEntryDetails)(nil), + (*BierDispEntryDump)(nil), + (*BierDispTableAddDel)(nil), + (*BierDispTableAddDelReply)(nil), + (*BierDispTableDetails)(nil), + (*BierDispTableDump)(nil), + (*BierImpAdd)(nil), + (*BierImpAddReply)(nil), + (*BierImpDel)(nil), + (*BierImpDelReply)(nil), + (*BierImpDetails)(nil), + (*BierImpDump)(nil), + (*BierRouteAddDel)(nil), + (*BierRouteAddDelReply)(nil), + (*BierRouteDetails)(nil), + (*BierRouteDump)(nil), + (*BierTableAddDel)(nil), + (*BierTableAddDelReply)(nil), + (*BierTableDetails)(nil), + (*BierTableDump)(nil), + } +} diff --git a/binapi/bier/bier_rest.ba.go b/binapi/bier/bier_rest.ba.go new file mode 100644 index 0000000..f65f8f3 --- /dev/null +++ b/binapi/bier/bier_rest.ba.go @@ -0,0 +1,152 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package bier + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/bier_disp_entry_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(BierDispEntryAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BierDispEntryAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bier_disp_table_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(BierDispTableAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BierDispTableAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bier_imp_add", func(w http.ResponseWriter, req *http.Request) { + var request = new(BierImpAdd) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BierImpAdd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bier_imp_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(BierImpDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BierImpDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bier_route_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(BierRouteAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BierRouteAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bier_table_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(BierTableAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BierTableAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/bier/bier_rpc.ba.go b/binapi/bier/bier_rpc.ba.go new file mode 100644 index 0000000..c744153 --- /dev/null +++ b/binapi/bier/bier_rpc.ba.go @@ -0,0 +1,283 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package bier + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service bier. +type RPCService interface { + BierDispEntryAddDel(ctx context.Context, in *BierDispEntryAddDel) (*BierDispEntryAddDelReply, error) + BierDispEntryDump(ctx context.Context, in *BierDispEntryDump) (RPCService_BierDispEntryDumpClient, error) + BierDispTableAddDel(ctx context.Context, in *BierDispTableAddDel) (*BierDispTableAddDelReply, error) + BierDispTableDump(ctx context.Context, in *BierDispTableDump) (RPCService_BierDispTableDumpClient, error) + BierImpAdd(ctx context.Context, in *BierImpAdd) (*BierImpAddReply, error) + BierImpDel(ctx context.Context, in *BierImpDel) (*BierImpDelReply, error) + BierImpDump(ctx context.Context, in *BierImpDump) (RPCService_BierImpDumpClient, error) + BierRouteAddDel(ctx context.Context, in *BierRouteAddDel) (*BierRouteAddDelReply, error) + BierRouteDump(ctx context.Context, in *BierRouteDump) (RPCService_BierRouteDumpClient, error) + BierTableAddDel(ctx context.Context, in *BierTableAddDel) (*BierTableAddDelReply, error) + BierTableDump(ctx context.Context, in *BierTableDump) (RPCService_BierTableDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) BierDispEntryAddDel(ctx context.Context, in *BierDispEntryAddDel) (*BierDispEntryAddDelReply, error) { + out := new(BierDispEntryAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BierDispEntryDump(ctx context.Context, in *BierDispEntryDump) (RPCService_BierDispEntryDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_BierDispEntryDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_BierDispEntryDumpClient interface { + Recv() (*BierDispEntryDetails, error) + api.Stream +} + +type serviceClient_BierDispEntryDumpClient struct { + api.Stream +} + +func (c *serviceClient_BierDispEntryDumpClient) Recv() (*BierDispEntryDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *BierDispEntryDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) BierDispTableAddDel(ctx context.Context, in *BierDispTableAddDel) (*BierDispTableAddDelReply, error) { + out := new(BierDispTableAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BierDispTableDump(ctx context.Context, in *BierDispTableDump) (RPCService_BierDispTableDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_BierDispTableDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_BierDispTableDumpClient interface { + Recv() (*BierDispTableDetails, error) + api.Stream +} + +type serviceClient_BierDispTableDumpClient struct { + api.Stream +} + +func (c *serviceClient_BierDispTableDumpClient) Recv() (*BierDispTableDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *BierDispTableDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) BierImpAdd(ctx context.Context, in *BierImpAdd) (*BierImpAddReply, error) { + out := new(BierImpAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BierImpDel(ctx context.Context, in *BierImpDel) (*BierImpDelReply, error) { + out := new(BierImpDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BierImpDump(ctx context.Context, in *BierImpDump) (RPCService_BierImpDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_BierImpDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_BierImpDumpClient interface { + Recv() (*BierImpDetails, error) + api.Stream +} + +type serviceClient_BierImpDumpClient struct { + api.Stream +} + +func (c *serviceClient_BierImpDumpClient) Recv() (*BierImpDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *BierImpDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) BierRouteAddDel(ctx context.Context, in *BierRouteAddDel) (*BierRouteAddDelReply, error) { + out := new(BierRouteAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BierRouteDump(ctx context.Context, in *BierRouteDump) (RPCService_BierRouteDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_BierRouteDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_BierRouteDumpClient interface { + Recv() (*BierRouteDetails, error) + api.Stream +} + +type serviceClient_BierRouteDumpClient struct { + api.Stream +} + +func (c *serviceClient_BierRouteDumpClient) Recv() (*BierRouteDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *BierRouteDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) BierTableAddDel(ctx context.Context, in *BierTableAddDel) (*BierTableAddDelReply, error) { + out := new(BierTableAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BierTableDump(ctx context.Context, in *BierTableDump) (RPCService_BierTableDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_BierTableDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_BierTableDumpClient interface { + Recv() (*BierTableDetails, error) + api.Stream +} + +type serviceClient_BierTableDumpClient struct { + api.Stream +} + +func (c *serviceClient_BierTableDumpClient) Recv() (*BierTableDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *BierTableDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/bond/bond.ba.go b/binapi/bond/bond.ba.go new file mode 100644 index 0000000..378a8f3 --- /dev/null +++ b/binapi/bond/bond.ba.go @@ -0,0 +1,734 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/bond.api.json + +// Package bond contains generated bindings for API file bond.api. +// +// Contents: +// 2 enums +// 14 messages +// +package bond + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "bond" + APIVersion = "2.0.0" + VersionCrc = 0xa65a4a1e +) + +// BondLbAlgo defines enum 'bond_lb_algo'. +type BondLbAlgo uint32 + +const ( + BOND_API_LB_ALGO_L2 BondLbAlgo = 0 + BOND_API_LB_ALGO_L34 BondLbAlgo = 1 + BOND_API_LB_ALGO_L23 BondLbAlgo = 2 + BOND_API_LB_ALGO_RR BondLbAlgo = 3 + BOND_API_LB_ALGO_BC BondLbAlgo = 4 + BOND_API_LB_ALGO_AB BondLbAlgo = 5 +) + +var ( + BondLbAlgo_name = map[uint32]string{ + 0: "BOND_API_LB_ALGO_L2", + 1: "BOND_API_LB_ALGO_L34", + 2: "BOND_API_LB_ALGO_L23", + 3: "BOND_API_LB_ALGO_RR", + 4: "BOND_API_LB_ALGO_BC", + 5: "BOND_API_LB_ALGO_AB", + } + BondLbAlgo_value = map[string]uint32{ + "BOND_API_LB_ALGO_L2": 0, + "BOND_API_LB_ALGO_L34": 1, + "BOND_API_LB_ALGO_L23": 2, + "BOND_API_LB_ALGO_RR": 3, + "BOND_API_LB_ALGO_BC": 4, + "BOND_API_LB_ALGO_AB": 5, + } +) + +func (x BondLbAlgo) String() string { + s, ok := BondLbAlgo_name[uint32(x)] + if ok { + return s + } + return "BondLbAlgo(" + strconv.Itoa(int(x)) + ")" +} + +// BondMode defines enum 'bond_mode'. +type BondMode uint32 + +const ( + BOND_API_MODE_ROUND_ROBIN BondMode = 1 + BOND_API_MODE_ACTIVE_BACKUP BondMode = 2 + BOND_API_MODE_XOR BondMode = 3 + BOND_API_MODE_BROADCAST BondMode = 4 + BOND_API_MODE_LACP BondMode = 5 +) + +var ( + BondMode_name = map[uint32]string{ + 1: "BOND_API_MODE_ROUND_ROBIN", + 2: "BOND_API_MODE_ACTIVE_BACKUP", + 3: "BOND_API_MODE_XOR", + 4: "BOND_API_MODE_BROADCAST", + 5: "BOND_API_MODE_LACP", + } + BondMode_value = map[string]uint32{ + "BOND_API_MODE_ROUND_ROBIN": 1, + "BOND_API_MODE_ACTIVE_BACKUP": 2, + "BOND_API_MODE_XOR": 3, + "BOND_API_MODE_BROADCAST": 4, + "BOND_API_MODE_LACP": 5, + } +) + +func (x BondMode) String() string { + s, ok := BondMode_name[uint32(x)] + if ok { + return s + } + return "BondMode(" + strconv.Itoa(int(x)) + ")" +} + +// BondCreate defines message 'bond_create'. +type BondCreate struct { + ID uint32 `binapi:"u32,name=id,default=%!s(float64=4.294967295e+09)" json:"id,omitempty"` + UseCustomMac bool `binapi:"bool,name=use_custom_mac" json:"use_custom_mac,omitempty"` + MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` + Mode BondMode `binapi:"bond_mode,name=mode" json:"mode,omitempty"` + Lb BondLbAlgo `binapi:"bond_lb_algo,name=lb" json:"lb,omitempty"` + NumaOnly bool `binapi:"bool,name=numa_only" json:"numa_only,omitempty"` +} + +func (m *BondCreate) Reset() { *m = BondCreate{} } +func (*BondCreate) GetMessageName() string { return "bond_create" } +func (*BondCreate) GetCrcString() string { return "48883c7e" } +func (*BondCreate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BondCreate) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ID + size += 1 // m.UseCustomMac + size += 1 * 6 // m.MacAddress + size += 4 // m.Mode + size += 4 // m.Lb + size += 1 // m.NumaOnly + return size +} +func (m *BondCreate) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ID)) + buf.EncodeBool(m.UseCustomMac) + buf.EncodeBytes(m.MacAddress[:], 6) + buf.EncodeUint32(uint32(m.Mode)) + buf.EncodeUint32(uint32(m.Lb)) + buf.EncodeBool(m.NumaOnly) + return buf.Bytes(), nil +} +func (m *BondCreate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ID = buf.DecodeUint32() + m.UseCustomMac = buf.DecodeBool() + copy(m.MacAddress[:], buf.DecodeBytes(6)) + m.Mode = BondMode(buf.DecodeUint32()) + m.Lb = BondLbAlgo(buf.DecodeUint32()) + m.NumaOnly = buf.DecodeBool() + return nil +} + +// BondCreateReply defines message 'bond_create_reply'. +type BondCreateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *BondCreateReply) Reset() { *m = BondCreateReply{} } +func (*BondCreateReply) GetMessageName() string { return "bond_create_reply" } +func (*BondCreateReply) GetCrcString() string { return "5383d31f" } +func (*BondCreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BondCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *BondCreateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *BondCreateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// BondDelete defines message 'bond_delete'. +type BondDelete struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *BondDelete) Reset() { *m = BondDelete{} } +func (*BondDelete) GetMessageName() string { return "bond_delete" } +func (*BondDelete) GetCrcString() string { return "f9e6675e" } +func (*BondDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BondDelete) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *BondDelete) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *BondDelete) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// BondDeleteReply defines message 'bond_delete_reply'. +type BondDeleteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BondDeleteReply) Reset() { *m = BondDeleteReply{} } +func (*BondDeleteReply) GetMessageName() string { return "bond_delete_reply" } +func (*BondDeleteReply) GetCrcString() string { return "e8d4e804" } +func (*BondDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BondDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BondDeleteReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BondDeleteReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BondDetachSlave defines message 'bond_detach_slave'. +type BondDetachSlave struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *BondDetachSlave) Reset() { *m = BondDetachSlave{} } +func (*BondDetachSlave) GetMessageName() string { return "bond_detach_slave" } +func (*BondDetachSlave) GetCrcString() string { return "f9e6675e" } +func (*BondDetachSlave) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BondDetachSlave) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *BondDetachSlave) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *BondDetachSlave) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// BondDetachSlaveReply defines message 'bond_detach_slave_reply'. +type BondDetachSlaveReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BondDetachSlaveReply) Reset() { *m = BondDetachSlaveReply{} } +func (*BondDetachSlaveReply) GetMessageName() string { return "bond_detach_slave_reply" } +func (*BondDetachSlaveReply) GetCrcString() string { return "e8d4e804" } +func (*BondDetachSlaveReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BondDetachSlaveReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BondDetachSlaveReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BondDetachSlaveReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BondEnslave defines message 'bond_enslave'. +type BondEnslave struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + BondSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=bond_sw_if_index" json:"bond_sw_if_index,omitempty"` + IsPassive bool `binapi:"bool,name=is_passive" json:"is_passive,omitempty"` + IsLongTimeout bool `binapi:"bool,name=is_long_timeout" json:"is_long_timeout,omitempty"` +} + +func (m *BondEnslave) Reset() { *m = BondEnslave{} } +func (*BondEnslave) GetMessageName() string { return "bond_enslave" } +func (*BondEnslave) GetCrcString() string { return "076ecfa7" } +func (*BondEnslave) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BondEnslave) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.BondSwIfIndex + size += 1 // m.IsPassive + size += 1 // m.IsLongTimeout + return size +} +func (m *BondEnslave) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.BondSwIfIndex)) + buf.EncodeBool(m.IsPassive) + buf.EncodeBool(m.IsLongTimeout) + return buf.Bytes(), nil +} +func (m *BondEnslave) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.BondSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsPassive = buf.DecodeBool() + m.IsLongTimeout = buf.DecodeBool() + return nil +} + +// BondEnslaveReply defines message 'bond_enslave_reply'. +type BondEnslaveReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BondEnslaveReply) Reset() { *m = BondEnslaveReply{} } +func (*BondEnslaveReply) GetMessageName() string { return "bond_enslave_reply" } +func (*BondEnslaveReply) GetCrcString() string { return "e8d4e804" } +func (*BondEnslaveReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BondEnslaveReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BondEnslaveReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BondEnslaveReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceBondDetails defines message 'sw_interface_bond_details'. +type SwInterfaceBondDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` + Mode BondMode `binapi:"bond_mode,name=mode" json:"mode,omitempty"` + Lb BondLbAlgo `binapi:"bond_lb_algo,name=lb" json:"lb,omitempty"` + NumaOnly bool `binapi:"bool,name=numa_only" json:"numa_only,omitempty"` + ActiveSlaves uint32 `binapi:"u32,name=active_slaves" json:"active_slaves,omitempty"` + Slaves uint32 `binapi:"u32,name=slaves" json:"slaves,omitempty"` + InterfaceName string `binapi:"string[64],name=interface_name" json:"interface_name,omitempty"` +} + +func (m *SwInterfaceBondDetails) Reset() { *m = SwInterfaceBondDetails{} } +func (*SwInterfaceBondDetails) GetMessageName() string { return "sw_interface_bond_details" } +func (*SwInterfaceBondDetails) GetCrcString() string { return "f5ef2106" } +func (*SwInterfaceBondDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceBondDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.ID + size += 4 // m.Mode + size += 4 // m.Lb + size += 1 // m.NumaOnly + size += 4 // m.ActiveSlaves + size += 4 // m.Slaves + size += 64 // m.InterfaceName + return size +} +func (m *SwInterfaceBondDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.ID)) + buf.EncodeUint32(uint32(m.Mode)) + buf.EncodeUint32(uint32(m.Lb)) + buf.EncodeBool(m.NumaOnly) + buf.EncodeUint32(uint32(m.ActiveSlaves)) + buf.EncodeUint32(uint32(m.Slaves)) + buf.EncodeString(m.InterfaceName, 64) + return buf.Bytes(), nil +} +func (m *SwInterfaceBondDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.ID = buf.DecodeUint32() + m.Mode = BondMode(buf.DecodeUint32()) + m.Lb = BondLbAlgo(buf.DecodeUint32()) + m.NumaOnly = buf.DecodeBool() + m.ActiveSlaves = buf.DecodeUint32() + m.Slaves = buf.DecodeUint32() + m.InterfaceName = buf.DecodeString(64) + return nil +} + +// SwInterfaceBondDump defines message 'sw_interface_bond_dump'. +type SwInterfaceBondDump struct{} + +func (m *SwInterfaceBondDump) Reset() { *m = SwInterfaceBondDump{} } +func (*SwInterfaceBondDump) GetMessageName() string { return "sw_interface_bond_dump" } +func (*SwInterfaceBondDump) GetCrcString() string { return "51077d14" } +func (*SwInterfaceBondDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceBondDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SwInterfaceBondDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *SwInterfaceBondDump) Unmarshal(b []byte) error { + return nil +} + +// SwInterfaceSetBondWeight defines message 'sw_interface_set_bond_weight'. +type SwInterfaceSetBondWeight struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` +} + +func (m *SwInterfaceSetBondWeight) Reset() { *m = SwInterfaceSetBondWeight{} } +func (*SwInterfaceSetBondWeight) GetMessageName() string { return "sw_interface_set_bond_weight" } +func (*SwInterfaceSetBondWeight) GetCrcString() string { return "deb510a0" } +func (*SwInterfaceSetBondWeight) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetBondWeight) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.Weight + return size +} +func (m *SwInterfaceSetBondWeight) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.Weight)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetBondWeight) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Weight = buf.DecodeUint32() + return nil +} + +// SwInterfaceSetBondWeightReply defines message 'sw_interface_set_bond_weight_reply'. +type SwInterfaceSetBondWeightReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetBondWeightReply) Reset() { *m = SwInterfaceSetBondWeightReply{} } +func (*SwInterfaceSetBondWeightReply) GetMessageName() string { + return "sw_interface_set_bond_weight_reply" +} +func (*SwInterfaceSetBondWeightReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetBondWeightReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetBondWeightReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetBondWeightReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetBondWeightReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceSlaveDetails defines message 'sw_interface_slave_details'. +type SwInterfaceSlaveDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + InterfaceName string `binapi:"string[64],name=interface_name" json:"interface_name,omitempty"` + IsPassive bool `binapi:"bool,name=is_passive" json:"is_passive,omitempty"` + IsLongTimeout bool `binapi:"bool,name=is_long_timeout" json:"is_long_timeout,omitempty"` + IsLocalNuma bool `binapi:"bool,name=is_local_numa" json:"is_local_numa,omitempty"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` +} + +func (m *SwInterfaceSlaveDetails) Reset() { *m = SwInterfaceSlaveDetails{} } +func (*SwInterfaceSlaveDetails) GetMessageName() string { return "sw_interface_slave_details" } +func (*SwInterfaceSlaveDetails) GetCrcString() string { return "3c4a0e23" } +func (*SwInterfaceSlaveDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSlaveDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 64 // m.InterfaceName + size += 1 // m.IsPassive + size += 1 // m.IsLongTimeout + size += 1 // m.IsLocalNuma + size += 4 // m.Weight + return size +} +func (m *SwInterfaceSlaveDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeString(m.InterfaceName, 64) + buf.EncodeBool(m.IsPassive) + buf.EncodeBool(m.IsLongTimeout) + buf.EncodeBool(m.IsLocalNuma) + buf.EncodeUint32(uint32(m.Weight)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSlaveDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.InterfaceName = buf.DecodeString(64) + m.IsPassive = buf.DecodeBool() + m.IsLongTimeout = buf.DecodeBool() + m.IsLocalNuma = buf.DecodeBool() + m.Weight = buf.DecodeUint32() + return nil +} + +// SwInterfaceSlaveDump defines message 'sw_interface_slave_dump'. +type SwInterfaceSlaveDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *SwInterfaceSlaveDump) Reset() { *m = SwInterfaceSlaveDump{} } +func (*SwInterfaceSlaveDump) GetMessageName() string { return "sw_interface_slave_dump" } +func (*SwInterfaceSlaveDump) GetCrcString() string { return "f9e6675e" } +func (*SwInterfaceSlaveDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSlaveDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *SwInterfaceSlaveDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSlaveDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +func init() { file_bond_binapi_init() } +func file_bond_binapi_init() { + api.RegisterMessage((*BondCreate)(nil), "bond_create_48883c7e") + api.RegisterMessage((*BondCreateReply)(nil), "bond_create_reply_5383d31f") + api.RegisterMessage((*BondDelete)(nil), "bond_delete_f9e6675e") + api.RegisterMessage((*BondDeleteReply)(nil), "bond_delete_reply_e8d4e804") + api.RegisterMessage((*BondDetachSlave)(nil), "bond_detach_slave_f9e6675e") + api.RegisterMessage((*BondDetachSlaveReply)(nil), "bond_detach_slave_reply_e8d4e804") + api.RegisterMessage((*BondEnslave)(nil), "bond_enslave_076ecfa7") + api.RegisterMessage((*BondEnslaveReply)(nil), "bond_enslave_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceBondDetails)(nil), "sw_interface_bond_details_f5ef2106") + api.RegisterMessage((*SwInterfaceBondDump)(nil), "sw_interface_bond_dump_51077d14") + api.RegisterMessage((*SwInterfaceSetBondWeight)(nil), "sw_interface_set_bond_weight_deb510a0") + api.RegisterMessage((*SwInterfaceSetBondWeightReply)(nil), "sw_interface_set_bond_weight_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSlaveDetails)(nil), "sw_interface_slave_details_3c4a0e23") + api.RegisterMessage((*SwInterfaceSlaveDump)(nil), "sw_interface_slave_dump_f9e6675e") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*BondCreate)(nil), + (*BondCreateReply)(nil), + (*BondDelete)(nil), + (*BondDeleteReply)(nil), + (*BondDetachSlave)(nil), + (*BondDetachSlaveReply)(nil), + (*BondEnslave)(nil), + (*BondEnslaveReply)(nil), + (*SwInterfaceBondDetails)(nil), + (*SwInterfaceBondDump)(nil), + (*SwInterfaceSetBondWeight)(nil), + (*SwInterfaceSetBondWeightReply)(nil), + (*SwInterfaceSlaveDetails)(nil), + (*SwInterfaceSlaveDump)(nil), + } +} diff --git a/binapi/bond/bond_rest.ba.go b/binapi/bond/bond_rest.ba.go new file mode 100644 index 0000000..c1893d5 --- /dev/null +++ b/binapi/bond/bond_rest.ba.go @@ -0,0 +1,129 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package bond + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/bond_create", func(w http.ResponseWriter, req *http.Request) { + var request = new(BondCreate) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BondCreate(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bond_delete", func(w http.ResponseWriter, req *http.Request) { + var request = new(BondDelete) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BondDelete(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bond_detach_slave", func(w http.ResponseWriter, req *http.Request) { + var request = new(BondDetachSlave) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BondDetachSlave(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bond_enslave", func(w http.ResponseWriter, req *http.Request) { + var request = new(BondEnslave) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BondEnslave(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_set_bond_weight", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceSetBondWeight) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceSetBondWeight(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/bond/bond_rpc.ba.go b/binapi/bond/bond_rpc.ba.go new file mode 100644 index 0000000..5e60f84 --- /dev/null +++ b/binapi/bond/bond_rpc.ba.go @@ -0,0 +1,153 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package bond + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service bond. +type RPCService interface { + BondCreate(ctx context.Context, in *BondCreate) (*BondCreateReply, error) + BondDelete(ctx context.Context, in *BondDelete) (*BondDeleteReply, error) + BondDetachSlave(ctx context.Context, in *BondDetachSlave) (*BondDetachSlaveReply, error) + BondEnslave(ctx context.Context, in *BondEnslave) (*BondEnslaveReply, error) + SwInterfaceBondDump(ctx context.Context, in *SwInterfaceBondDump) (RPCService_SwInterfaceBondDumpClient, error) + SwInterfaceSetBondWeight(ctx context.Context, in *SwInterfaceSetBondWeight) (*SwInterfaceSetBondWeightReply, error) + SwInterfaceSlaveDump(ctx context.Context, in *SwInterfaceSlaveDump) (RPCService_SwInterfaceSlaveDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) BondCreate(ctx context.Context, in *BondCreate) (*BondCreateReply, error) { + out := new(BondCreateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BondDelete(ctx context.Context, in *BondDelete) (*BondDeleteReply, error) { + out := new(BondDeleteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BondDetachSlave(ctx context.Context, in *BondDetachSlave) (*BondDetachSlaveReply, error) { + out := new(BondDetachSlaveReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BondEnslave(ctx context.Context, in *BondEnslave) (*BondEnslaveReply, error) { + out := new(BondEnslaveReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceBondDump(ctx context.Context, in *SwInterfaceBondDump) (RPCService_SwInterfaceBondDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SwInterfaceBondDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_SwInterfaceBondDumpClient interface { + Recv() (*SwInterfaceBondDetails, error) + api.Stream +} + +type serviceClient_SwInterfaceBondDumpClient struct { + api.Stream +} + +func (c *serviceClient_SwInterfaceBondDumpClient) Recv() (*SwInterfaceBondDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SwInterfaceBondDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) SwInterfaceSetBondWeight(ctx context.Context, in *SwInterfaceSetBondWeight) (*SwInterfaceSetBondWeightReply, error) { + out := new(SwInterfaceSetBondWeightReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSlaveDump(ctx context.Context, in *SwInterfaceSlaveDump) (RPCService_SwInterfaceSlaveDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SwInterfaceSlaveDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_SwInterfaceSlaveDumpClient interface { + Recv() (*SwInterfaceSlaveDetails, error) + api.Stream +} + +type serviceClient_SwInterfaceSlaveDumpClient struct { + api.Stream +} + +func (c *serviceClient_SwInterfaceSlaveDumpClient) Recv() (*SwInterfaceSlaveDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SwInterfaceSlaveDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/builtinurl/builtinurl.ba.go b/binapi/builtinurl/builtinurl.ba.go new file mode 100644 index 0000000..bfc593f --- /dev/null +++ b/binapi/builtinurl/builtinurl.ba.go @@ -0,0 +1,109 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/builtinurl.api.json + +// Package builtinurl contains generated bindings for API file builtinurl.api. +// +// Contents: +// 2 messages +// +package builtinurl + +import ( + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "builtinurl" + APIVersion = "1.0.0" + VersionCrc = 0x25045d63 +) + +// BuiltinurlEnable defines message 'builtinurl_enable'. +type BuiltinurlEnable struct{} + +func (m *BuiltinurlEnable) Reset() { *m = BuiltinurlEnable{} } +func (*BuiltinurlEnable) GetMessageName() string { return "builtinurl_enable" } +func (*BuiltinurlEnable) GetCrcString() string { return "51077d14" } +func (*BuiltinurlEnable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BuiltinurlEnable) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *BuiltinurlEnable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *BuiltinurlEnable) Unmarshal(b []byte) error { + return nil +} + +// BuiltinurlEnableReply defines message 'builtinurl_enable_reply'. +type BuiltinurlEnableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BuiltinurlEnableReply) Reset() { *m = BuiltinurlEnableReply{} } +func (*BuiltinurlEnableReply) GetMessageName() string { return "builtinurl_enable_reply" } +func (*BuiltinurlEnableReply) GetCrcString() string { return "e8d4e804" } +func (*BuiltinurlEnableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BuiltinurlEnableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BuiltinurlEnableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BuiltinurlEnableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_builtinurl_binapi_init() } +func file_builtinurl_binapi_init() { + api.RegisterMessage((*BuiltinurlEnable)(nil), "builtinurl_enable_51077d14") + api.RegisterMessage((*BuiltinurlEnableReply)(nil), "builtinurl_enable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*BuiltinurlEnable)(nil), + (*BuiltinurlEnableReply)(nil), + } +} diff --git a/binapi/builtinurl/builtinurl_rest.ba.go b/binapi/builtinurl/builtinurl_rest.ba.go new file mode 100644 index 0000000..a4373f1 --- /dev/null +++ b/binapi/builtinurl/builtinurl_rest.ba.go @@ -0,0 +1,27 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package builtinurl + +import ( + "encoding/json" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/builtinurl_enable", func(w http.ResponseWriter, req *http.Request) { + var request = new(BuiltinurlEnable) + reply, err := rpc.BuiltinurlEnable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/builtinurl/builtinurl_rpc.ba.go b/binapi/builtinurl/builtinurl_rpc.ba.go new file mode 100644 index 0000000..6857de2 --- /dev/null +++ b/binapi/builtinurl/builtinurl_rpc.ba.go @@ -0,0 +1,30 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package builtinurl + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service builtinurl. +type RPCService interface { + BuiltinurlEnable(ctx context.Context, in *BuiltinurlEnable) (*BuiltinurlEnableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) BuiltinurlEnable(ctx context.Context, in *BuiltinurlEnable) (*BuiltinurlEnableReply, error) { + out := new(BuiltinurlEnableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/cdp/cdp.ba.go b/binapi/cdp/cdp.ba.go new file mode 100644 index 0000000..afd8c46 --- /dev/null +++ b/binapi/cdp/cdp.ba.go @@ -0,0 +1,115 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/cdp.api.json + +// Package cdp contains generated bindings for API file cdp.api. +// +// Contents: +// 2 messages +// +package cdp + +import ( + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "cdp" + APIVersion = "1.0.0" + VersionCrc = 0x8cfa825e +) + +// CdpEnableDisable defines message 'cdp_enable_disable'. +type CdpEnableDisable struct { + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` +} + +func (m *CdpEnableDisable) Reset() { *m = CdpEnableDisable{} } +func (*CdpEnableDisable) GetMessageName() string { return "cdp_enable_disable" } +func (*CdpEnableDisable) GetCrcString() string { return "2e7b47df" } +func (*CdpEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CdpEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.EnableDisable + return size +} +func (m *CdpEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.EnableDisable) + return buf.Bytes(), nil +} +func (m *CdpEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EnableDisable = buf.DecodeBool() + return nil +} + +// CdpEnableDisableReply defines message 'cdp_enable_disable_reply'. +type CdpEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *CdpEnableDisableReply) Reset() { *m = CdpEnableDisableReply{} } +func (*CdpEnableDisableReply) GetMessageName() string { return "cdp_enable_disable_reply" } +func (*CdpEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*CdpEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CdpEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *CdpEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *CdpEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_cdp_binapi_init() } +func file_cdp_binapi_init() { + api.RegisterMessage((*CdpEnableDisable)(nil), "cdp_enable_disable_2e7b47df") + api.RegisterMessage((*CdpEnableDisableReply)(nil), "cdp_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*CdpEnableDisable)(nil), + (*CdpEnableDisableReply)(nil), + } +} diff --git a/binapi/cdp/cdp_rest.ba.go b/binapi/cdp/cdp_rest.ba.go new file mode 100644 index 0000000..b414757 --- /dev/null +++ b/binapi/cdp/cdp_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package cdp + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/cdp_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(CdpEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.CdpEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/cdp/cdp_rpc.ba.go b/binapi/cdp/cdp_rpc.ba.go new file mode 100644 index 0000000..a910833 --- /dev/null +++ b/binapi/cdp/cdp_rpc.ba.go @@ -0,0 +1,30 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package cdp + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service cdp. +type RPCService interface { + CdpEnableDisable(ctx context.Context, in *CdpEnableDisable) (*CdpEnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) CdpEnableDisable(ctx context.Context, in *CdpEnableDisable) (*CdpEnableDisableReply, error) { + out := new(CdpEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/classify/classify.ba.go b/binapi/classify/classify.ba.go new file mode 100644 index 0000000..f1696aa --- /dev/null +++ b/binapi/classify/classify.ba.go @@ -0,0 +1,1487 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/classify.api.json + +// Package classify contains generated bindings for API file classify.api. +// +// Contents: +// 3 enums +// 28 messages +// +package classify + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "classify" + APIVersion = "3.0.0" + VersionCrc = 0x1298bdec +) + +// ClassifyAction defines enum 'classify_action'. +type ClassifyAction uint8 + +const ( + CLASSIFY_API_ACTION_NONE ClassifyAction = 0 + CLASSIFY_API_ACTION_SET_IP4_FIB_INDEX ClassifyAction = 1 + CLASSIFY_API_ACTION_SET_IP6_FIB_INDEX ClassifyAction = 2 + CLASSIFY_API_ACTION_SET_METADATA ClassifyAction = 3 +) + +var ( + ClassifyAction_name = map[uint8]string{ + 0: "CLASSIFY_API_ACTION_NONE", + 1: "CLASSIFY_API_ACTION_SET_IP4_FIB_INDEX", + 2: "CLASSIFY_API_ACTION_SET_IP6_FIB_INDEX", + 3: "CLASSIFY_API_ACTION_SET_METADATA", + } + ClassifyAction_value = map[string]uint8{ + "CLASSIFY_API_ACTION_NONE": 0, + "CLASSIFY_API_ACTION_SET_IP4_FIB_INDEX": 1, + "CLASSIFY_API_ACTION_SET_IP6_FIB_INDEX": 2, + "CLASSIFY_API_ACTION_SET_METADATA": 3, + } +) + +func (x ClassifyAction) String() string { + s, ok := ClassifyAction_name[uint8(x)] + if ok { + return s + } + return "ClassifyAction(" + strconv.Itoa(int(x)) + ")" +} + +// FlowClassifyTable defines enum 'flow_classify_table'. +type FlowClassifyTable uint8 + +const ( + FLOW_CLASSIFY_API_TABLE_IP4 FlowClassifyTable = 1 + FLOW_CLASSIFY_API_TABLE_IP6 FlowClassifyTable = 2 +) + +var ( + FlowClassifyTable_name = map[uint8]string{ + 1: "FLOW_CLASSIFY_API_TABLE_IP4", + 2: "FLOW_CLASSIFY_API_TABLE_IP6", + } + FlowClassifyTable_value = map[string]uint8{ + "FLOW_CLASSIFY_API_TABLE_IP4": 1, + "FLOW_CLASSIFY_API_TABLE_IP6": 2, + } +) + +func (x FlowClassifyTable) String() string { + s, ok := FlowClassifyTable_name[uint8(x)] + if ok { + return s + } + return "FlowClassifyTable(" + strconv.Itoa(int(x)) + ")" +} + +// PolicerClassifyTable defines enum 'policer_classify_table'. +type PolicerClassifyTable uint8 + +const ( + POLICER_CLASSIFY_API_TABLE_IP4 PolicerClassifyTable = 1 + POLICER_CLASSIFY_API_TABLE_IP6 PolicerClassifyTable = 2 + POLICER_CLASSIFY_API_TABLE_L2 PolicerClassifyTable = 3 +) + +var ( + PolicerClassifyTable_name = map[uint8]string{ + 1: "POLICER_CLASSIFY_API_TABLE_IP4", + 2: "POLICER_CLASSIFY_API_TABLE_IP6", + 3: "POLICER_CLASSIFY_API_TABLE_L2", + } + PolicerClassifyTable_value = map[string]uint8{ + "POLICER_CLASSIFY_API_TABLE_IP4": 1, + "POLICER_CLASSIFY_API_TABLE_IP6": 2, + "POLICER_CLASSIFY_API_TABLE_L2": 3, + } +) + +func (x PolicerClassifyTable) String() string { + s, ok := PolicerClassifyTable_name[uint8(x)] + if ok { + return s + } + return "PolicerClassifyTable(" + strconv.Itoa(int(x)) + ")" +} + +// ClassifyAddDelSession defines message 'classify_add_del_session'. +type ClassifyAddDelSession struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + TableIndex uint32 `binapi:"u32,name=table_index" json:"table_index,omitempty"` + HitNextIndex uint32 `binapi:"u32,name=hit_next_index,default=%!s(float64=4.294967295e+09)" json:"hit_next_index,omitempty"` + OpaqueIndex uint32 `binapi:"u32,name=opaque_index,default=%!s(float64=4.294967295e+09)" json:"opaque_index,omitempty"` + Advance int32 `binapi:"i32,name=advance,default=%!s(float64=0)" json:"advance,omitempty"` + Action ClassifyAction `binapi:"classify_action,name=action,default=%!s(float64=0)" json:"action,omitempty"` + Metadata uint32 `binapi:"u32,name=metadata,default=%!s(float64=0)" json:"metadata,omitempty"` + MatchLen uint32 `binapi:"u32,name=match_len" json:"-"` + Match []byte `binapi:"u8[match_len],name=match" json:"match,omitempty"` +} + +func (m *ClassifyAddDelSession) Reset() { *m = ClassifyAddDelSession{} } +func (*ClassifyAddDelSession) GetMessageName() string { return "classify_add_del_session" } +func (*ClassifyAddDelSession) GetCrcString() string { return "f20879f0" } +func (*ClassifyAddDelSession) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ClassifyAddDelSession) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.TableIndex + size += 4 // m.HitNextIndex + size += 4 // m.OpaqueIndex + size += 4 // m.Advance + size += 1 // m.Action + size += 4 // m.Metadata + size += 4 // m.MatchLen + size += 1 * len(m.Match) // m.Match + return size +} +func (m *ClassifyAddDelSession) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.TableIndex)) + buf.EncodeUint32(uint32(m.HitNextIndex)) + buf.EncodeUint32(uint32(m.OpaqueIndex)) + buf.EncodeUint32(uint32(m.Advance)) + buf.EncodeUint8(uint8(m.Action)) + buf.EncodeUint32(uint32(m.Metadata)) + buf.EncodeUint32(uint32(len(m.Match))) + buf.EncodeBytes(m.Match[:], 0) + return buf.Bytes(), nil +} +func (m *ClassifyAddDelSession) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.TableIndex = buf.DecodeUint32() + m.HitNextIndex = buf.DecodeUint32() + m.OpaqueIndex = buf.DecodeUint32() + m.Advance = int32(buf.DecodeUint32()) + m.Action = ClassifyAction(buf.DecodeUint8()) + m.Metadata = buf.DecodeUint32() + m.MatchLen = buf.DecodeUint32() + copy(m.Match[:], buf.DecodeBytes(0)) + return nil +} + +// ClassifyAddDelSessionReply defines message 'classify_add_del_session_reply'. +type ClassifyAddDelSessionReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ClassifyAddDelSessionReply) Reset() { *m = ClassifyAddDelSessionReply{} } +func (*ClassifyAddDelSessionReply) GetMessageName() string { return "classify_add_del_session_reply" } +func (*ClassifyAddDelSessionReply) GetCrcString() string { return "e8d4e804" } +func (*ClassifyAddDelSessionReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ClassifyAddDelSessionReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ClassifyAddDelSessionReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ClassifyAddDelSessionReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// ClassifyAddDelTable defines message 'classify_add_del_table'. +type ClassifyAddDelTable struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + DelChain bool `binapi:"bool,name=del_chain" json:"del_chain,omitempty"` + TableIndex uint32 `binapi:"u32,name=table_index,default=%!s(float64=4.294967295e+09)" json:"table_index,omitempty"` + Nbuckets uint32 `binapi:"u32,name=nbuckets,default=%!s(float64=2)" json:"nbuckets,omitempty"` + MemorySize uint32 `binapi:"u32,name=memory_size,default=%!s(float64=2.097152e+06)" json:"memory_size,omitempty"` + SkipNVectors uint32 `binapi:"u32,name=skip_n_vectors,default=%!s(float64=0)" json:"skip_n_vectors,omitempty"` + MatchNVectors uint32 `binapi:"u32,name=match_n_vectors,default=%!s(float64=1)" json:"match_n_vectors,omitempty"` + NextTableIndex uint32 `binapi:"u32,name=next_table_index,default=%!s(float64=4.294967295e+09)" json:"next_table_index,omitempty"` + MissNextIndex uint32 `binapi:"u32,name=miss_next_index,default=%!s(float64=4.294967295e+09)" json:"miss_next_index,omitempty"` + CurrentDataFlag uint8 `binapi:"u8,name=current_data_flag,default=%!s(float64=0)" json:"current_data_flag,omitempty"` + CurrentDataOffset int16 `binapi:"i16,name=current_data_offset,default=%!s(float64=0)" json:"current_data_offset,omitempty"` + MaskLen uint32 `binapi:"u32,name=mask_len" json:"-"` + Mask []byte `binapi:"u8[mask_len],name=mask" json:"mask,omitempty"` +} + +func (m *ClassifyAddDelTable) Reset() { *m = ClassifyAddDelTable{} } +func (*ClassifyAddDelTable) GetMessageName() string { return "classify_add_del_table" } +func (*ClassifyAddDelTable) GetCrcString() string { return "6849e39e" } +func (*ClassifyAddDelTable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ClassifyAddDelTable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.DelChain + size += 4 // m.TableIndex + size += 4 // m.Nbuckets + size += 4 // m.MemorySize + size += 4 // m.SkipNVectors + size += 4 // m.MatchNVectors + size += 4 // m.NextTableIndex + size += 4 // m.MissNextIndex + size += 1 // m.CurrentDataFlag + size += 2 // m.CurrentDataOffset + size += 4 // m.MaskLen + size += 1 * len(m.Mask) // m.Mask + return size +} +func (m *ClassifyAddDelTable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeBool(m.DelChain) + buf.EncodeUint32(uint32(m.TableIndex)) + buf.EncodeUint32(uint32(m.Nbuckets)) + buf.EncodeUint32(uint32(m.MemorySize)) + buf.EncodeUint32(uint32(m.SkipNVectors)) + buf.EncodeUint32(uint32(m.MatchNVectors)) + buf.EncodeUint32(uint32(m.NextTableIndex)) + buf.EncodeUint32(uint32(m.MissNextIndex)) + buf.EncodeUint8(uint8(m.CurrentDataFlag)) + buf.EncodeUint16(uint16(m.CurrentDataOffset)) + buf.EncodeUint32(uint32(len(m.Mask))) + buf.EncodeBytes(m.Mask[:], 0) + return buf.Bytes(), nil +} +func (m *ClassifyAddDelTable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.DelChain = buf.DecodeBool() + m.TableIndex = buf.DecodeUint32() + m.Nbuckets = buf.DecodeUint32() + m.MemorySize = buf.DecodeUint32() + m.SkipNVectors = buf.DecodeUint32() + m.MatchNVectors = buf.DecodeUint32() + m.NextTableIndex = buf.DecodeUint32() + m.MissNextIndex = buf.DecodeUint32() + m.CurrentDataFlag = buf.DecodeUint8() + m.CurrentDataOffset = int16(buf.DecodeUint16()) + m.MaskLen = buf.DecodeUint32() + copy(m.Mask[:], buf.DecodeBytes(0)) + return nil +} + +// ClassifyAddDelTableReply defines message 'classify_add_del_table_reply'. +type ClassifyAddDelTableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + NewTableIndex uint32 `binapi:"u32,name=new_table_index" json:"new_table_index,omitempty"` + SkipNVectors uint32 `binapi:"u32,name=skip_n_vectors" json:"skip_n_vectors,omitempty"` + MatchNVectors uint32 `binapi:"u32,name=match_n_vectors" json:"match_n_vectors,omitempty"` +} + +func (m *ClassifyAddDelTableReply) Reset() { *m = ClassifyAddDelTableReply{} } +func (*ClassifyAddDelTableReply) GetMessageName() string { return "classify_add_del_table_reply" } +func (*ClassifyAddDelTableReply) GetCrcString() string { return "05486349" } +func (*ClassifyAddDelTableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ClassifyAddDelTableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.NewTableIndex + size += 4 // m.SkipNVectors + size += 4 // m.MatchNVectors + return size +} +func (m *ClassifyAddDelTableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.NewTableIndex)) + buf.EncodeUint32(uint32(m.SkipNVectors)) + buf.EncodeUint32(uint32(m.MatchNVectors)) + return buf.Bytes(), nil +} +func (m *ClassifyAddDelTableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.NewTableIndex = buf.DecodeUint32() + m.SkipNVectors = buf.DecodeUint32() + m.MatchNVectors = buf.DecodeUint32() + return nil +} + +// ClassifySessionDetails defines message 'classify_session_details'. +type ClassifySessionDetails struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + HitNextIndex uint32 `binapi:"u32,name=hit_next_index" json:"hit_next_index,omitempty"` + Advance int32 `binapi:"i32,name=advance" json:"advance,omitempty"` + OpaqueIndex uint32 `binapi:"u32,name=opaque_index" json:"opaque_index,omitempty"` + MatchLength uint32 `binapi:"u32,name=match_length" json:"-"` + Match []byte `binapi:"u8[match_length],name=match" json:"match,omitempty"` +} + +func (m *ClassifySessionDetails) Reset() { *m = ClassifySessionDetails{} } +func (*ClassifySessionDetails) GetMessageName() string { return "classify_session_details" } +func (*ClassifySessionDetails) GetCrcString() string { return "60e3ef94" } +func (*ClassifySessionDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ClassifySessionDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.TableID + size += 4 // m.HitNextIndex + size += 4 // m.Advance + size += 4 // m.OpaqueIndex + size += 4 // m.MatchLength + size += 1 * len(m.Match) // m.Match + return size +} +func (m *ClassifySessionDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.TableID)) + buf.EncodeUint32(uint32(m.HitNextIndex)) + buf.EncodeUint32(uint32(m.Advance)) + buf.EncodeUint32(uint32(m.OpaqueIndex)) + buf.EncodeUint32(uint32(len(m.Match))) + buf.EncodeBytes(m.Match[:], 0) + return buf.Bytes(), nil +} +func (m *ClassifySessionDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.TableID = buf.DecodeUint32() + m.HitNextIndex = buf.DecodeUint32() + m.Advance = int32(buf.DecodeUint32()) + m.OpaqueIndex = buf.DecodeUint32() + m.MatchLength = buf.DecodeUint32() + copy(m.Match[:], buf.DecodeBytes(0)) + return nil +} + +// ClassifySessionDump defines message 'classify_session_dump'. +type ClassifySessionDump struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` +} + +func (m *ClassifySessionDump) Reset() { *m = ClassifySessionDump{} } +func (*ClassifySessionDump) GetMessageName() string { return "classify_session_dump" } +func (*ClassifySessionDump) GetCrcString() string { return "0cca2cd9" } +func (*ClassifySessionDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ClassifySessionDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.TableID + return size +} +func (m *ClassifySessionDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.TableID)) + return buf.Bytes(), nil +} +func (m *ClassifySessionDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.TableID = buf.DecodeUint32() + return nil +} + +// ClassifySetInterfaceIPTable defines message 'classify_set_interface_ip_table'. +type ClassifySetInterfaceIPTable struct { + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + TableIndex uint32 `binapi:"u32,name=table_index" json:"table_index,omitempty"` +} + +func (m *ClassifySetInterfaceIPTable) Reset() { *m = ClassifySetInterfaceIPTable{} } +func (*ClassifySetInterfaceIPTable) GetMessageName() string { return "classify_set_interface_ip_table" } +func (*ClassifySetInterfaceIPTable) GetCrcString() string { return "e0b097c7" } +func (*ClassifySetInterfaceIPTable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ClassifySetInterfaceIPTable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsIPv6 + size += 4 // m.SwIfIndex + size += 4 // m.TableIndex + return size +} +func (m *ClassifySetInterfaceIPTable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsIPv6) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.TableIndex)) + return buf.Bytes(), nil +} +func (m *ClassifySetInterfaceIPTable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsIPv6 = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.TableIndex = buf.DecodeUint32() + return nil +} + +// ClassifySetInterfaceIPTableReply defines message 'classify_set_interface_ip_table_reply'. +type ClassifySetInterfaceIPTableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ClassifySetInterfaceIPTableReply) Reset() { *m = ClassifySetInterfaceIPTableReply{} } +func (*ClassifySetInterfaceIPTableReply) GetMessageName() string { + return "classify_set_interface_ip_table_reply" +} +func (*ClassifySetInterfaceIPTableReply) GetCrcString() string { return "e8d4e804" } +func (*ClassifySetInterfaceIPTableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ClassifySetInterfaceIPTableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ClassifySetInterfaceIPTableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ClassifySetInterfaceIPTableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// ClassifySetInterfaceL2Tables defines message 'classify_set_interface_l2_tables'. +type ClassifySetInterfaceL2Tables struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IP4TableIndex uint32 `binapi:"u32,name=ip4_table_index" json:"ip4_table_index,omitempty"` + IP6TableIndex uint32 `binapi:"u32,name=ip6_table_index" json:"ip6_table_index,omitempty"` + OtherTableIndex uint32 `binapi:"u32,name=other_table_index" json:"other_table_index,omitempty"` + IsInput bool `binapi:"bool,name=is_input" json:"is_input,omitempty"` +} + +func (m *ClassifySetInterfaceL2Tables) Reset() { *m = ClassifySetInterfaceL2Tables{} } +func (*ClassifySetInterfaceL2Tables) GetMessageName() string { + return "classify_set_interface_l2_tables" +} +func (*ClassifySetInterfaceL2Tables) GetCrcString() string { return "5a6ddf65" } +func (*ClassifySetInterfaceL2Tables) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ClassifySetInterfaceL2Tables) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.IP4TableIndex + size += 4 // m.IP6TableIndex + size += 4 // m.OtherTableIndex + size += 1 // m.IsInput + return size +} +func (m *ClassifySetInterfaceL2Tables) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.IP4TableIndex)) + buf.EncodeUint32(uint32(m.IP6TableIndex)) + buf.EncodeUint32(uint32(m.OtherTableIndex)) + buf.EncodeBool(m.IsInput) + return buf.Bytes(), nil +} +func (m *ClassifySetInterfaceL2Tables) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IP4TableIndex = buf.DecodeUint32() + m.IP6TableIndex = buf.DecodeUint32() + m.OtherTableIndex = buf.DecodeUint32() + m.IsInput = buf.DecodeBool() + return nil +} + +// ClassifySetInterfaceL2TablesReply defines message 'classify_set_interface_l2_tables_reply'. +type ClassifySetInterfaceL2TablesReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ClassifySetInterfaceL2TablesReply) Reset() { *m = ClassifySetInterfaceL2TablesReply{} } +func (*ClassifySetInterfaceL2TablesReply) GetMessageName() string { + return "classify_set_interface_l2_tables_reply" +} +func (*ClassifySetInterfaceL2TablesReply) GetCrcString() string { return "e8d4e804" } +func (*ClassifySetInterfaceL2TablesReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ClassifySetInterfaceL2TablesReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ClassifySetInterfaceL2TablesReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ClassifySetInterfaceL2TablesReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// ClassifyTableByInterface defines message 'classify_table_by_interface'. +type ClassifyTableByInterface struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *ClassifyTableByInterface) Reset() { *m = ClassifyTableByInterface{} } +func (*ClassifyTableByInterface) GetMessageName() string { return "classify_table_by_interface" } +func (*ClassifyTableByInterface) GetCrcString() string { return "f9e6675e" } +func (*ClassifyTableByInterface) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ClassifyTableByInterface) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *ClassifyTableByInterface) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *ClassifyTableByInterface) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// ClassifyTableByInterfaceReply defines message 'classify_table_by_interface_reply'. +type ClassifyTableByInterfaceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + L2TableID uint32 `binapi:"u32,name=l2_table_id" json:"l2_table_id,omitempty"` + IP4TableID uint32 `binapi:"u32,name=ip4_table_id" json:"ip4_table_id,omitempty"` + IP6TableID uint32 `binapi:"u32,name=ip6_table_id" json:"ip6_table_id,omitempty"` +} + +func (m *ClassifyTableByInterfaceReply) Reset() { *m = ClassifyTableByInterfaceReply{} } +func (*ClassifyTableByInterfaceReply) GetMessageName() string { + return "classify_table_by_interface_reply" +} +func (*ClassifyTableByInterfaceReply) GetCrcString() string { return "ed4197db" } +func (*ClassifyTableByInterfaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ClassifyTableByInterfaceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + size += 4 // m.L2TableID + size += 4 // m.IP4TableID + size += 4 // m.IP6TableID + return size +} +func (m *ClassifyTableByInterfaceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.L2TableID)) + buf.EncodeUint32(uint32(m.IP4TableID)) + buf.EncodeUint32(uint32(m.IP6TableID)) + return buf.Bytes(), nil +} +func (m *ClassifyTableByInterfaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.L2TableID = buf.DecodeUint32() + m.IP4TableID = buf.DecodeUint32() + m.IP6TableID = buf.DecodeUint32() + return nil +} + +// ClassifyTableIds defines message 'classify_table_ids'. +type ClassifyTableIds struct{} + +func (m *ClassifyTableIds) Reset() { *m = ClassifyTableIds{} } +func (*ClassifyTableIds) GetMessageName() string { return "classify_table_ids" } +func (*ClassifyTableIds) GetCrcString() string { return "51077d14" } +func (*ClassifyTableIds) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ClassifyTableIds) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ClassifyTableIds) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ClassifyTableIds) Unmarshal(b []byte) error { + return nil +} + +// ClassifyTableIdsReply defines message 'classify_table_ids_reply'. +type ClassifyTableIdsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + Ids []uint32 `binapi:"u32[count],name=ids" json:"ids,omitempty"` +} + +func (m *ClassifyTableIdsReply) Reset() { *m = ClassifyTableIdsReply{} } +func (*ClassifyTableIdsReply) GetMessageName() string { return "classify_table_ids_reply" } +func (*ClassifyTableIdsReply) GetCrcString() string { return "d1d20e1d" } +func (*ClassifyTableIdsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ClassifyTableIdsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.Count + size += 4 * len(m.Ids) // m.Ids + return size +} +func (m *ClassifyTableIdsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(len(m.Ids))) + for i := 0; i < len(m.Ids); i++ { + var x uint32 + if i < len(m.Ids) { + x = uint32(m.Ids[i]) + } + buf.EncodeUint32(uint32(x)) + } + return buf.Bytes(), nil +} +func (m *ClassifyTableIdsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Count = buf.DecodeUint32() + m.Ids = make([]uint32, m.Count) + for i := 0; i < len(m.Ids); i++ { + m.Ids[i] = buf.DecodeUint32() + } + return nil +} + +// ClassifyTableInfo defines message 'classify_table_info'. +type ClassifyTableInfo struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` +} + +func (m *ClassifyTableInfo) Reset() { *m = ClassifyTableInfo{} } +func (*ClassifyTableInfo) GetMessageName() string { return "classify_table_info" } +func (*ClassifyTableInfo) GetCrcString() string { return "0cca2cd9" } +func (*ClassifyTableInfo) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ClassifyTableInfo) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.TableID + return size +} +func (m *ClassifyTableInfo) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.TableID)) + return buf.Bytes(), nil +} +func (m *ClassifyTableInfo) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.TableID = buf.DecodeUint32() + return nil +} + +// ClassifyTableInfoReply defines message 'classify_table_info_reply'. +type ClassifyTableInfoReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + Nbuckets uint32 `binapi:"u32,name=nbuckets" json:"nbuckets,omitempty"` + MatchNVectors uint32 `binapi:"u32,name=match_n_vectors" json:"match_n_vectors,omitempty"` + SkipNVectors uint32 `binapi:"u32,name=skip_n_vectors" json:"skip_n_vectors,omitempty"` + ActiveSessions uint32 `binapi:"u32,name=active_sessions" json:"active_sessions,omitempty"` + NextTableIndex uint32 `binapi:"u32,name=next_table_index" json:"next_table_index,omitempty"` + MissNextIndex uint32 `binapi:"u32,name=miss_next_index" json:"miss_next_index,omitempty"` + MaskLength uint32 `binapi:"u32,name=mask_length" json:"-"` + Mask []byte `binapi:"u8[mask_length],name=mask" json:"mask,omitempty"` +} + +func (m *ClassifyTableInfoReply) Reset() { *m = ClassifyTableInfoReply{} } +func (*ClassifyTableInfoReply) GetMessageName() string { return "classify_table_info_reply" } +func (*ClassifyTableInfoReply) GetCrcString() string { return "4a573c0e" } +func (*ClassifyTableInfoReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ClassifyTableInfoReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.TableID + size += 4 // m.Nbuckets + size += 4 // m.MatchNVectors + size += 4 // m.SkipNVectors + size += 4 // m.ActiveSessions + size += 4 // m.NextTableIndex + size += 4 // m.MissNextIndex + size += 4 // m.MaskLength + size += 1 * len(m.Mask) // m.Mask + return size +} +func (m *ClassifyTableInfoReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.TableID)) + buf.EncodeUint32(uint32(m.Nbuckets)) + buf.EncodeUint32(uint32(m.MatchNVectors)) + buf.EncodeUint32(uint32(m.SkipNVectors)) + buf.EncodeUint32(uint32(m.ActiveSessions)) + buf.EncodeUint32(uint32(m.NextTableIndex)) + buf.EncodeUint32(uint32(m.MissNextIndex)) + buf.EncodeUint32(uint32(len(m.Mask))) + buf.EncodeBytes(m.Mask[:], 0) + return buf.Bytes(), nil +} +func (m *ClassifyTableInfoReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.TableID = buf.DecodeUint32() + m.Nbuckets = buf.DecodeUint32() + m.MatchNVectors = buf.DecodeUint32() + m.SkipNVectors = buf.DecodeUint32() + m.ActiveSessions = buf.DecodeUint32() + m.NextTableIndex = buf.DecodeUint32() + m.MissNextIndex = buf.DecodeUint32() + m.MaskLength = buf.DecodeUint32() + copy(m.Mask[:], buf.DecodeBytes(0)) + return nil +} + +// FlowClassifyDetails defines message 'flow_classify_details'. +type FlowClassifyDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + TableIndex uint32 `binapi:"u32,name=table_index" json:"table_index,omitempty"` +} + +func (m *FlowClassifyDetails) Reset() { *m = FlowClassifyDetails{} } +func (*FlowClassifyDetails) GetMessageName() string { return "flow_classify_details" } +func (*FlowClassifyDetails) GetCrcString() string { return "dfd08765" } +func (*FlowClassifyDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *FlowClassifyDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.TableIndex + return size +} +func (m *FlowClassifyDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.TableIndex)) + return buf.Bytes(), nil +} +func (m *FlowClassifyDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.TableIndex = buf.DecodeUint32() + return nil +} + +// FlowClassifyDump defines message 'flow_classify_dump'. +type FlowClassifyDump struct { + Type FlowClassifyTable `binapi:"flow_classify_table,name=type" json:"type,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *FlowClassifyDump) Reset() { *m = FlowClassifyDump{} } +func (*FlowClassifyDump) GetMessageName() string { return "flow_classify_dump" } +func (*FlowClassifyDump) GetCrcString() string { return "8a6ad43d" } +func (*FlowClassifyDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *FlowClassifyDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Type + size += 4 // m.SwIfIndex + return size +} +func (m *FlowClassifyDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Type)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *FlowClassifyDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Type = FlowClassifyTable(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// FlowClassifySetInterface defines message 'flow_classify_set_interface'. +type FlowClassifySetInterface struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IP4TableIndex uint32 `binapi:"u32,name=ip4_table_index" json:"ip4_table_index,omitempty"` + IP6TableIndex uint32 `binapi:"u32,name=ip6_table_index" json:"ip6_table_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *FlowClassifySetInterface) Reset() { *m = FlowClassifySetInterface{} } +func (*FlowClassifySetInterface) GetMessageName() string { return "flow_classify_set_interface" } +func (*FlowClassifySetInterface) GetCrcString() string { return "b6192f1c" } +func (*FlowClassifySetInterface) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *FlowClassifySetInterface) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.IP4TableIndex + size += 4 // m.IP6TableIndex + size += 1 // m.IsAdd + return size +} +func (m *FlowClassifySetInterface) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.IP4TableIndex)) + buf.EncodeUint32(uint32(m.IP6TableIndex)) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *FlowClassifySetInterface) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IP4TableIndex = buf.DecodeUint32() + m.IP6TableIndex = buf.DecodeUint32() + m.IsAdd = buf.DecodeBool() + return nil +} + +// FlowClassifySetInterfaceReply defines message 'flow_classify_set_interface_reply'. +type FlowClassifySetInterfaceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *FlowClassifySetInterfaceReply) Reset() { *m = FlowClassifySetInterfaceReply{} } +func (*FlowClassifySetInterfaceReply) GetMessageName() string { + return "flow_classify_set_interface_reply" +} +func (*FlowClassifySetInterfaceReply) GetCrcString() string { return "e8d4e804" } +func (*FlowClassifySetInterfaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *FlowClassifySetInterfaceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *FlowClassifySetInterfaceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *FlowClassifySetInterfaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// InputACLSetInterface defines message 'input_acl_set_interface'. +type InputACLSetInterface struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IP4TableIndex uint32 `binapi:"u32,name=ip4_table_index" json:"ip4_table_index,omitempty"` + IP6TableIndex uint32 `binapi:"u32,name=ip6_table_index" json:"ip6_table_index,omitempty"` + L2TableIndex uint32 `binapi:"u32,name=l2_table_index" json:"l2_table_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *InputACLSetInterface) Reset() { *m = InputACLSetInterface{} } +func (*InputACLSetInterface) GetMessageName() string { return "input_acl_set_interface" } +func (*InputACLSetInterface) GetCrcString() string { return "de7ad708" } +func (*InputACLSetInterface) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *InputACLSetInterface) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.IP4TableIndex + size += 4 // m.IP6TableIndex + size += 4 // m.L2TableIndex + size += 1 // m.IsAdd + return size +} +func (m *InputACLSetInterface) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.IP4TableIndex)) + buf.EncodeUint32(uint32(m.IP6TableIndex)) + buf.EncodeUint32(uint32(m.L2TableIndex)) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *InputACLSetInterface) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IP4TableIndex = buf.DecodeUint32() + m.IP6TableIndex = buf.DecodeUint32() + m.L2TableIndex = buf.DecodeUint32() + m.IsAdd = buf.DecodeBool() + return nil +} + +// InputACLSetInterfaceReply defines message 'input_acl_set_interface_reply'. +type InputACLSetInterfaceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *InputACLSetInterfaceReply) Reset() { *m = InputACLSetInterfaceReply{} } +func (*InputACLSetInterfaceReply) GetMessageName() string { return "input_acl_set_interface_reply" } +func (*InputACLSetInterfaceReply) GetCrcString() string { return "e8d4e804" } +func (*InputACLSetInterfaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *InputACLSetInterfaceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *InputACLSetInterfaceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *InputACLSetInterfaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OutputACLSetInterface defines message 'output_acl_set_interface'. +type OutputACLSetInterface struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IP4TableIndex uint32 `binapi:"u32,name=ip4_table_index" json:"ip4_table_index,omitempty"` + IP6TableIndex uint32 `binapi:"u32,name=ip6_table_index" json:"ip6_table_index,omitempty"` + L2TableIndex uint32 `binapi:"u32,name=l2_table_index" json:"l2_table_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *OutputACLSetInterface) Reset() { *m = OutputACLSetInterface{} } +func (*OutputACLSetInterface) GetMessageName() string { return "output_acl_set_interface" } +func (*OutputACLSetInterface) GetCrcString() string { return "de7ad708" } +func (*OutputACLSetInterface) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OutputACLSetInterface) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.IP4TableIndex + size += 4 // m.IP6TableIndex + size += 4 // m.L2TableIndex + size += 1 // m.IsAdd + return size +} +func (m *OutputACLSetInterface) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.IP4TableIndex)) + buf.EncodeUint32(uint32(m.IP6TableIndex)) + buf.EncodeUint32(uint32(m.L2TableIndex)) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *OutputACLSetInterface) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IP4TableIndex = buf.DecodeUint32() + m.IP6TableIndex = buf.DecodeUint32() + m.L2TableIndex = buf.DecodeUint32() + m.IsAdd = buf.DecodeBool() + return nil +} + +// OutputACLSetInterfaceReply defines message 'output_acl_set_interface_reply'. +type OutputACLSetInterfaceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OutputACLSetInterfaceReply) Reset() { *m = OutputACLSetInterfaceReply{} } +func (*OutputACLSetInterfaceReply) GetMessageName() string { return "output_acl_set_interface_reply" } +func (*OutputACLSetInterfaceReply) GetCrcString() string { return "e8d4e804" } +func (*OutputACLSetInterfaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OutputACLSetInterfaceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OutputACLSetInterfaceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OutputACLSetInterfaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// PolicerClassifyDetails defines message 'policer_classify_details'. +type PolicerClassifyDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + TableIndex uint32 `binapi:"u32,name=table_index" json:"table_index,omitempty"` +} + +func (m *PolicerClassifyDetails) Reset() { *m = PolicerClassifyDetails{} } +func (*PolicerClassifyDetails) GetMessageName() string { return "policer_classify_details" } +func (*PolicerClassifyDetails) GetCrcString() string { return "dfd08765" } +func (*PolicerClassifyDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PolicerClassifyDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.TableIndex + return size +} +func (m *PolicerClassifyDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.TableIndex)) + return buf.Bytes(), nil +} +func (m *PolicerClassifyDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.TableIndex = buf.DecodeUint32() + return nil +} + +// PolicerClassifyDump defines message 'policer_classify_dump'. +type PolicerClassifyDump struct { + Type PolicerClassifyTable `binapi:"policer_classify_table,name=type" json:"type,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *PolicerClassifyDump) Reset() { *m = PolicerClassifyDump{} } +func (*PolicerClassifyDump) GetMessageName() string { return "policer_classify_dump" } +func (*PolicerClassifyDump) GetCrcString() string { return "6bfe6603" } +func (*PolicerClassifyDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PolicerClassifyDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Type + size += 4 // m.SwIfIndex + return size +} +func (m *PolicerClassifyDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Type)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *PolicerClassifyDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Type = PolicerClassifyTable(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// PolicerClassifySetInterface defines message 'policer_classify_set_interface'. +type PolicerClassifySetInterface struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IP4TableIndex uint32 `binapi:"u32,name=ip4_table_index" json:"ip4_table_index,omitempty"` + IP6TableIndex uint32 `binapi:"u32,name=ip6_table_index" json:"ip6_table_index,omitempty"` + L2TableIndex uint32 `binapi:"u32,name=l2_table_index" json:"l2_table_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *PolicerClassifySetInterface) Reset() { *m = PolicerClassifySetInterface{} } +func (*PolicerClassifySetInterface) GetMessageName() string { return "policer_classify_set_interface" } +func (*PolicerClassifySetInterface) GetCrcString() string { return "de7ad708" } +func (*PolicerClassifySetInterface) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PolicerClassifySetInterface) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.IP4TableIndex + size += 4 // m.IP6TableIndex + size += 4 // m.L2TableIndex + size += 1 // m.IsAdd + return size +} +func (m *PolicerClassifySetInterface) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.IP4TableIndex)) + buf.EncodeUint32(uint32(m.IP6TableIndex)) + buf.EncodeUint32(uint32(m.L2TableIndex)) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *PolicerClassifySetInterface) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IP4TableIndex = buf.DecodeUint32() + m.IP6TableIndex = buf.DecodeUint32() + m.L2TableIndex = buf.DecodeUint32() + m.IsAdd = buf.DecodeBool() + return nil +} + +// PolicerClassifySetInterfaceReply defines message 'policer_classify_set_interface_reply'. +type PolicerClassifySetInterfaceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *PolicerClassifySetInterfaceReply) Reset() { *m = PolicerClassifySetInterfaceReply{} } +func (*PolicerClassifySetInterfaceReply) GetMessageName() string { + return "policer_classify_set_interface_reply" +} +func (*PolicerClassifySetInterfaceReply) GetCrcString() string { return "e8d4e804" } +func (*PolicerClassifySetInterfaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PolicerClassifySetInterfaceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *PolicerClassifySetInterfaceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *PolicerClassifySetInterfaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_classify_binapi_init() } +func file_classify_binapi_init() { + api.RegisterMessage((*ClassifyAddDelSession)(nil), "classify_add_del_session_f20879f0") + api.RegisterMessage((*ClassifyAddDelSessionReply)(nil), "classify_add_del_session_reply_e8d4e804") + api.RegisterMessage((*ClassifyAddDelTable)(nil), "classify_add_del_table_6849e39e") + api.RegisterMessage((*ClassifyAddDelTableReply)(nil), "classify_add_del_table_reply_05486349") + api.RegisterMessage((*ClassifySessionDetails)(nil), "classify_session_details_60e3ef94") + api.RegisterMessage((*ClassifySessionDump)(nil), "classify_session_dump_0cca2cd9") + api.RegisterMessage((*ClassifySetInterfaceIPTable)(nil), "classify_set_interface_ip_table_e0b097c7") + api.RegisterMessage((*ClassifySetInterfaceIPTableReply)(nil), "classify_set_interface_ip_table_reply_e8d4e804") + api.RegisterMessage((*ClassifySetInterfaceL2Tables)(nil), "classify_set_interface_l2_tables_5a6ddf65") + api.RegisterMessage((*ClassifySetInterfaceL2TablesReply)(nil), "classify_set_interface_l2_tables_reply_e8d4e804") + api.RegisterMessage((*ClassifyTableByInterface)(nil), "classify_table_by_interface_f9e6675e") + api.RegisterMessage((*ClassifyTableByInterfaceReply)(nil), "classify_table_by_interface_reply_ed4197db") + api.RegisterMessage((*ClassifyTableIds)(nil), "classify_table_ids_51077d14") + api.RegisterMessage((*ClassifyTableIdsReply)(nil), "classify_table_ids_reply_d1d20e1d") + api.RegisterMessage((*ClassifyTableInfo)(nil), "classify_table_info_0cca2cd9") + api.RegisterMessage((*ClassifyTableInfoReply)(nil), "classify_table_info_reply_4a573c0e") + api.RegisterMessage((*FlowClassifyDetails)(nil), "flow_classify_details_dfd08765") + api.RegisterMessage((*FlowClassifyDump)(nil), "flow_classify_dump_8a6ad43d") + api.RegisterMessage((*FlowClassifySetInterface)(nil), "flow_classify_set_interface_b6192f1c") + api.RegisterMessage((*FlowClassifySetInterfaceReply)(nil), "flow_classify_set_interface_reply_e8d4e804") + api.RegisterMessage((*InputACLSetInterface)(nil), "input_acl_set_interface_de7ad708") + api.RegisterMessage((*InputACLSetInterfaceReply)(nil), "input_acl_set_interface_reply_e8d4e804") + api.RegisterMessage((*OutputACLSetInterface)(nil), "output_acl_set_interface_de7ad708") + api.RegisterMessage((*OutputACLSetInterfaceReply)(nil), "output_acl_set_interface_reply_e8d4e804") + api.RegisterMessage((*PolicerClassifyDetails)(nil), "policer_classify_details_dfd08765") + api.RegisterMessage((*PolicerClassifyDump)(nil), "policer_classify_dump_6bfe6603") + api.RegisterMessage((*PolicerClassifySetInterface)(nil), "policer_classify_set_interface_de7ad708") + api.RegisterMessage((*PolicerClassifySetInterfaceReply)(nil), "policer_classify_set_interface_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*ClassifyAddDelSession)(nil), + (*ClassifyAddDelSessionReply)(nil), + (*ClassifyAddDelTable)(nil), + (*ClassifyAddDelTableReply)(nil), + (*ClassifySessionDetails)(nil), + (*ClassifySessionDump)(nil), + (*ClassifySetInterfaceIPTable)(nil), + (*ClassifySetInterfaceIPTableReply)(nil), + (*ClassifySetInterfaceL2Tables)(nil), + (*ClassifySetInterfaceL2TablesReply)(nil), + (*ClassifyTableByInterface)(nil), + (*ClassifyTableByInterfaceReply)(nil), + (*ClassifyTableIds)(nil), + (*ClassifyTableIdsReply)(nil), + (*ClassifyTableInfo)(nil), + (*ClassifyTableInfoReply)(nil), + (*FlowClassifyDetails)(nil), + (*FlowClassifyDump)(nil), + (*FlowClassifySetInterface)(nil), + (*FlowClassifySetInterfaceReply)(nil), + (*InputACLSetInterface)(nil), + (*InputACLSetInterfaceReply)(nil), + (*OutputACLSetInterface)(nil), + (*OutputACLSetInterfaceReply)(nil), + (*PolicerClassifyDetails)(nil), + (*PolicerClassifyDump)(nil), + (*PolicerClassifySetInterface)(nil), + (*PolicerClassifySetInterfaceReply)(nil), + } +} diff --git a/binapi/classify/classify_rest.ba.go b/binapi/classify/classify_rest.ba.go new file mode 100644 index 0000000..f50fefd --- /dev/null +++ b/binapi/classify/classify_rest.ba.go @@ -0,0 +1,258 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package classify + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/classify_add_del_session", func(w http.ResponseWriter, req *http.Request) { + var request = new(ClassifyAddDelSession) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ClassifyAddDelSession(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/classify_add_del_table", func(w http.ResponseWriter, req *http.Request) { + var request = new(ClassifyAddDelTable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ClassifyAddDelTable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/classify_set_interface_ip_table", func(w http.ResponseWriter, req *http.Request) { + var request = new(ClassifySetInterfaceIPTable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ClassifySetInterfaceIPTable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/classify_set_interface_l2_tables", func(w http.ResponseWriter, req *http.Request) { + var request = new(ClassifySetInterfaceL2Tables) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ClassifySetInterfaceL2Tables(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/classify_table_by_interface", func(w http.ResponseWriter, req *http.Request) { + var request = new(ClassifyTableByInterface) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ClassifyTableByInterface(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/classify_table_ids", func(w http.ResponseWriter, req *http.Request) { + var request = new(ClassifyTableIds) + reply, err := rpc.ClassifyTableIds(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/classify_table_info", func(w http.ResponseWriter, req *http.Request) { + var request = new(ClassifyTableInfo) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ClassifyTableInfo(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/flow_classify_set_interface", func(w http.ResponseWriter, req *http.Request) { + var request = new(FlowClassifySetInterface) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.FlowClassifySetInterface(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/input_acl_set_interface", func(w http.ResponseWriter, req *http.Request) { + var request = new(InputACLSetInterface) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.InputACLSetInterface(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/output_acl_set_interface", func(w http.ResponseWriter, req *http.Request) { + var request = new(OutputACLSetInterface) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OutputACLSetInterface(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/policer_classify_set_interface", func(w http.ResponseWriter, req *http.Request) { + var request = new(PolicerClassifySetInterface) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.PolicerClassifySetInterface(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/classify/classify_rpc.ba.go b/binapi/classify/classify_rpc.ba.go new file mode 100644 index 0000000..8893db8 --- /dev/null +++ b/binapi/classify/classify_rpc.ba.go @@ -0,0 +1,253 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package classify + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service classify. +type RPCService interface { + ClassifyAddDelSession(ctx context.Context, in *ClassifyAddDelSession) (*ClassifyAddDelSessionReply, error) + ClassifyAddDelTable(ctx context.Context, in *ClassifyAddDelTable) (*ClassifyAddDelTableReply, error) + ClassifySessionDump(ctx context.Context, in *ClassifySessionDump) (RPCService_ClassifySessionDumpClient, error) + ClassifySetInterfaceIPTable(ctx context.Context, in *ClassifySetInterfaceIPTable) (*ClassifySetInterfaceIPTableReply, error) + ClassifySetInterfaceL2Tables(ctx context.Context, in *ClassifySetInterfaceL2Tables) (*ClassifySetInterfaceL2TablesReply, error) + ClassifyTableByInterface(ctx context.Context, in *ClassifyTableByInterface) (*ClassifyTableByInterfaceReply, error) + ClassifyTableIds(ctx context.Context, in *ClassifyTableIds) (*ClassifyTableIdsReply, error) + ClassifyTableInfo(ctx context.Context, in *ClassifyTableInfo) (*ClassifyTableInfoReply, error) + FlowClassifyDump(ctx context.Context, in *FlowClassifyDump) (RPCService_FlowClassifyDumpClient, error) + FlowClassifySetInterface(ctx context.Context, in *FlowClassifySetInterface) (*FlowClassifySetInterfaceReply, error) + InputACLSetInterface(ctx context.Context, in *InputACLSetInterface) (*InputACLSetInterfaceReply, error) + OutputACLSetInterface(ctx context.Context, in *OutputACLSetInterface) (*OutputACLSetInterfaceReply, error) + PolicerClassifyDump(ctx context.Context, in *PolicerClassifyDump) (RPCService_PolicerClassifyDumpClient, error) + PolicerClassifySetInterface(ctx context.Context, in *PolicerClassifySetInterface) (*PolicerClassifySetInterfaceReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) ClassifyAddDelSession(ctx context.Context, in *ClassifyAddDelSession) (*ClassifyAddDelSessionReply, error) { + out := new(ClassifyAddDelSessionReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ClassifyAddDelTable(ctx context.Context, in *ClassifyAddDelTable) (*ClassifyAddDelTableReply, error) { + out := new(ClassifyAddDelTableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ClassifySessionDump(ctx context.Context, in *ClassifySessionDump) (RPCService_ClassifySessionDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_ClassifySessionDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_ClassifySessionDumpClient interface { + Recv() (*ClassifySessionDetails, error) + api.Stream +} + +type serviceClient_ClassifySessionDumpClient struct { + api.Stream +} + +func (c *serviceClient_ClassifySessionDumpClient) Recv() (*ClassifySessionDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *ClassifySessionDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) ClassifySetInterfaceIPTable(ctx context.Context, in *ClassifySetInterfaceIPTable) (*ClassifySetInterfaceIPTableReply, error) { + out := new(ClassifySetInterfaceIPTableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ClassifySetInterfaceL2Tables(ctx context.Context, in *ClassifySetInterfaceL2Tables) (*ClassifySetInterfaceL2TablesReply, error) { + out := new(ClassifySetInterfaceL2TablesReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ClassifyTableByInterface(ctx context.Context, in *ClassifyTableByInterface) (*ClassifyTableByInterfaceReply, error) { + out := new(ClassifyTableByInterfaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ClassifyTableIds(ctx context.Context, in *ClassifyTableIds) (*ClassifyTableIdsReply, error) { + out := new(ClassifyTableIdsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ClassifyTableInfo(ctx context.Context, in *ClassifyTableInfo) (*ClassifyTableInfoReply, error) { + out := new(ClassifyTableInfoReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) FlowClassifyDump(ctx context.Context, in *FlowClassifyDump) (RPCService_FlowClassifyDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_FlowClassifyDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_FlowClassifyDumpClient interface { + Recv() (*FlowClassifyDetails, error) + api.Stream +} + +type serviceClient_FlowClassifyDumpClient struct { + api.Stream +} + +func (c *serviceClient_FlowClassifyDumpClient) Recv() (*FlowClassifyDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *FlowClassifyDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) FlowClassifySetInterface(ctx context.Context, in *FlowClassifySetInterface) (*FlowClassifySetInterfaceReply, error) { + out := new(FlowClassifySetInterfaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) InputACLSetInterface(ctx context.Context, in *InputACLSetInterface) (*InputACLSetInterfaceReply, error) { + out := new(InputACLSetInterfaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OutputACLSetInterface(ctx context.Context, in *OutputACLSetInterface) (*OutputACLSetInterfaceReply, error) { + out := new(OutputACLSetInterfaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) PolicerClassifyDump(ctx context.Context, in *PolicerClassifyDump) (RPCService_PolicerClassifyDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_PolicerClassifyDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_PolicerClassifyDumpClient interface { + Recv() (*PolicerClassifyDetails, error) + api.Stream +} + +type serviceClient_PolicerClassifyDumpClient struct { + api.Stream +} + +func (c *serviceClient_PolicerClassifyDumpClient) Recv() (*PolicerClassifyDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *PolicerClassifyDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) PolicerClassifySetInterface(ctx context.Context, in *PolicerClassifySetInterface) (*PolicerClassifySetInterfaceReply, error) { + out := new(PolicerClassifySetInterfaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/cop/cop.ba.go b/binapi/cop/cop.ba.go new file mode 100644 index 0000000..a252c9a --- /dev/null +++ b/binapi/cop/cop.ba.go @@ -0,0 +1,216 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/cop.api.json + +// Package cop contains generated bindings for API file cop.api. +// +// Contents: +// 4 messages +// +package cop + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "cop" + APIVersion = "1.0.1" + VersionCrc = 0xfd7e767d +) + +// CopInterfaceEnableDisable defines message 'cop_interface_enable_disable'. +type CopInterfaceEnableDisable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` +} + +func (m *CopInterfaceEnableDisable) Reset() { *m = CopInterfaceEnableDisable{} } +func (*CopInterfaceEnableDisable) GetMessageName() string { return "cop_interface_enable_disable" } +func (*CopInterfaceEnableDisable) GetCrcString() string { return "5501adee" } +func (*CopInterfaceEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CopInterfaceEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.EnableDisable + return size +} +func (m *CopInterfaceEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.EnableDisable) + return buf.Bytes(), nil +} +func (m *CopInterfaceEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.EnableDisable = buf.DecodeBool() + return nil +} + +// CopInterfaceEnableDisableReply defines message 'cop_interface_enable_disable_reply'. +type CopInterfaceEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *CopInterfaceEnableDisableReply) Reset() { *m = CopInterfaceEnableDisableReply{} } +func (*CopInterfaceEnableDisableReply) GetMessageName() string { + return "cop_interface_enable_disable_reply" +} +func (*CopInterfaceEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*CopInterfaceEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CopInterfaceEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *CopInterfaceEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *CopInterfaceEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// CopWhitelistEnableDisable defines message 'cop_whitelist_enable_disable'. +type CopWhitelistEnableDisable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + FibID uint32 `binapi:"u32,name=fib_id" json:"fib_id,omitempty"` + IP4 bool `binapi:"bool,name=ip4" json:"ip4,omitempty"` + IP6 bool `binapi:"bool,name=ip6" json:"ip6,omitempty"` + DefaultCop bool `binapi:"bool,name=default_cop" json:"default_cop,omitempty"` +} + +func (m *CopWhitelistEnableDisable) Reset() { *m = CopWhitelistEnableDisable{} } +func (*CopWhitelistEnableDisable) GetMessageName() string { return "cop_whitelist_enable_disable" } +func (*CopWhitelistEnableDisable) GetCrcString() string { return "debe13ea" } +func (*CopWhitelistEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CopWhitelistEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.FibID + size += 1 // m.IP4 + size += 1 // m.IP6 + size += 1 // m.DefaultCop + return size +} +func (m *CopWhitelistEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.FibID)) + buf.EncodeBool(m.IP4) + buf.EncodeBool(m.IP6) + buf.EncodeBool(m.DefaultCop) + return buf.Bytes(), nil +} +func (m *CopWhitelistEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.FibID = buf.DecodeUint32() + m.IP4 = buf.DecodeBool() + m.IP6 = buf.DecodeBool() + m.DefaultCop = buf.DecodeBool() + return nil +} + +// CopWhitelistEnableDisableReply defines message 'cop_whitelist_enable_disable_reply'. +type CopWhitelistEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *CopWhitelistEnableDisableReply) Reset() { *m = CopWhitelistEnableDisableReply{} } +func (*CopWhitelistEnableDisableReply) GetMessageName() string { + return "cop_whitelist_enable_disable_reply" +} +func (*CopWhitelistEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*CopWhitelistEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CopWhitelistEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *CopWhitelistEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *CopWhitelistEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_cop_binapi_init() } +func file_cop_binapi_init() { + api.RegisterMessage((*CopInterfaceEnableDisable)(nil), "cop_interface_enable_disable_5501adee") + api.RegisterMessage((*CopInterfaceEnableDisableReply)(nil), "cop_interface_enable_disable_reply_e8d4e804") + api.RegisterMessage((*CopWhitelistEnableDisable)(nil), "cop_whitelist_enable_disable_debe13ea") + api.RegisterMessage((*CopWhitelistEnableDisableReply)(nil), "cop_whitelist_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*CopInterfaceEnableDisable)(nil), + (*CopInterfaceEnableDisableReply)(nil), + (*CopWhitelistEnableDisable)(nil), + (*CopWhitelistEnableDisableReply)(nil), + } +} diff --git a/binapi/cop/cop_rest.ba.go b/binapi/cop/cop_rest.ba.go new file mode 100644 index 0000000..d9ed487 --- /dev/null +++ b/binapi/cop/cop_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package cop + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/cop_interface_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(CopInterfaceEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.CopInterfaceEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/cop_whitelist_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(CopWhitelistEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.CopWhitelistEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/cop/cop_rpc.ba.go b/binapi/cop/cop_rpc.ba.go new file mode 100644 index 0000000..9f6f84e --- /dev/null +++ b/binapi/cop/cop_rpc.ba.go @@ -0,0 +1,40 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package cop + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service cop. +type RPCService interface { + CopInterfaceEnableDisable(ctx context.Context, in *CopInterfaceEnableDisable) (*CopInterfaceEnableDisableReply, error) + CopWhitelistEnableDisable(ctx context.Context, in *CopWhitelistEnableDisable) (*CopWhitelistEnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) CopInterfaceEnableDisable(ctx context.Context, in *CopInterfaceEnableDisable) (*CopInterfaceEnableDisableReply, error) { + out := new(CopInterfaceEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CopWhitelistEnableDisable(ctx context.Context, in *CopWhitelistEnableDisable) (*CopWhitelistEnableDisableReply, error) { + out := new(CopWhitelistEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/ct6/ct6.ba.go b/binapi/ct6/ct6.ba.go new file mode 100644 index 0000000..fbcc0bc --- /dev/null +++ b/binapi/ct6/ct6.ba.go @@ -0,0 +1,124 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/ct6.api.json + +// Package ct6 contains generated bindings for API file ct6.api. +// +// Contents: +// 2 messages +// +package ct6 + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "ct6" + APIVersion = "1.0.0" + VersionCrc = 0xd9691434 +) + +// Ct6EnableDisable defines message 'ct6_enable_disable'. +type Ct6EnableDisable struct { + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` + IsInside bool `binapi:"bool,name=is_inside" json:"is_inside,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Ct6EnableDisable) Reset() { *m = Ct6EnableDisable{} } +func (*Ct6EnableDisable) GetMessageName() string { return "ct6_enable_disable" } +func (*Ct6EnableDisable) GetCrcString() string { return "5d02ac02" } +func (*Ct6EnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ct6EnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.EnableDisable + size += 1 // m.IsInside + size += 4 // m.SwIfIndex + return size +} +func (m *Ct6EnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.EnableDisable) + buf.EncodeBool(m.IsInside) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Ct6EnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EnableDisable = buf.DecodeBool() + m.IsInside = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Ct6EnableDisableReply defines message 'ct6_enable_disable_reply'. +type Ct6EnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Ct6EnableDisableReply) Reset() { *m = Ct6EnableDisableReply{} } +func (*Ct6EnableDisableReply) GetMessageName() string { return "ct6_enable_disable_reply" } +func (*Ct6EnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*Ct6EnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ct6EnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Ct6EnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Ct6EnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_ct6_binapi_init() } +func file_ct6_binapi_init() { + api.RegisterMessage((*Ct6EnableDisable)(nil), "ct6_enable_disable_5d02ac02") + api.RegisterMessage((*Ct6EnableDisableReply)(nil), "ct6_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*Ct6EnableDisable)(nil), + (*Ct6EnableDisableReply)(nil), + } +} diff --git a/binapi/ct6/ct6_rest.ba.go b/binapi/ct6/ct6_rest.ba.go new file mode 100644 index 0000000..a3ffcde --- /dev/null +++ b/binapi/ct6/ct6_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ct6 + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/ct6_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(Ct6EnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Ct6EnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/ct6/ct6_rpc.ba.go b/binapi/ct6/ct6_rpc.ba.go new file mode 100644 index 0000000..888fd32 --- /dev/null +++ b/binapi/ct6/ct6_rpc.ba.go @@ -0,0 +1,30 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ct6 + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service ct6. +type RPCService interface { + Ct6EnableDisable(ctx context.Context, in *Ct6EnableDisable) (*Ct6EnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) Ct6EnableDisable(ctx context.Context, in *Ct6EnableDisable) (*Ct6EnableDisableReply, error) { + out := new(Ct6EnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/dhcp/dhcp.ba.go b/binapi/dhcp/dhcp.ba.go new file mode 100644 index 0000000..cb18b48 --- /dev/null +++ b/binapi/dhcp/dhcp.ba.go @@ -0,0 +1,1845 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/dhcp.api.json + +// Package dhcp contains generated bindings for API file dhcp.api. +// +// Contents: +// 3 enums +// 6 structs +// 29 messages +// +package dhcp + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "dhcp" + APIVersion = "3.0.1" + VersionCrc = 0x96274cae +) + +// DHCPClientState defines enum 'dhcp_client_state'. +type DHCPClientState uint32 + +const ( + DHCP_CLIENT_STATE_API_DISCOVER DHCPClientState = 1 + DHCP_CLIENT_STATE_API_REQUEST DHCPClientState = 2 + DHCP_CLIENT_STATE_API_BOUND DHCPClientState = 3 +) + +var ( + DHCPClientState_name = map[uint32]string{ + 1: "DHCP_CLIENT_STATE_API_DISCOVER", + 2: "DHCP_CLIENT_STATE_API_REQUEST", + 3: "DHCP_CLIENT_STATE_API_BOUND", + } + DHCPClientState_value = map[string]uint32{ + "DHCP_CLIENT_STATE_API_DISCOVER": 1, + "DHCP_CLIENT_STATE_API_REQUEST": 2, + "DHCP_CLIENT_STATE_API_BOUND": 3, + } +) + +func (x DHCPClientState) String() string { + s, ok := DHCPClientState_name[uint32(x)] + if ok { + return s + } + return "DHCPClientState(" + strconv.Itoa(int(x)) + ")" +} + +// Dhcpv6MsgType defines enum 'dhcpv6_msg_type'. +type Dhcpv6MsgType uint32 + +const ( + DHCPV6_MSG_API_SOLICIT Dhcpv6MsgType = 1 + DHCPV6_MSG_API_ADVERTISE Dhcpv6MsgType = 2 + DHCPV6_MSG_API_REQUEST Dhcpv6MsgType = 3 + DHCPV6_MSG_API_CONFIRM Dhcpv6MsgType = 4 + DHCPV6_MSG_API_RENEW Dhcpv6MsgType = 5 + DHCPV6_MSG_API_REBIND Dhcpv6MsgType = 6 + DHCPV6_MSG_API_REPLY Dhcpv6MsgType = 7 + DHCPV6_MSG_API_RELEASE Dhcpv6MsgType = 8 + DHCPV6_MSG_API_DECLINE Dhcpv6MsgType = 9 + DHCPV6_MSG_API_RECONFIGURE Dhcpv6MsgType = 10 + DHCPV6_MSG_API_INFORMATION_REQUEST Dhcpv6MsgType = 11 + DHCPV6_MSG_API_RELAY_FORW Dhcpv6MsgType = 12 + DHCPV6_MSG_API_RELAY_REPL Dhcpv6MsgType = 13 +) + +var ( + Dhcpv6MsgType_name = map[uint32]string{ + 1: "DHCPV6_MSG_API_SOLICIT", + 2: "DHCPV6_MSG_API_ADVERTISE", + 3: "DHCPV6_MSG_API_REQUEST", + 4: "DHCPV6_MSG_API_CONFIRM", + 5: "DHCPV6_MSG_API_RENEW", + 6: "DHCPV6_MSG_API_REBIND", + 7: "DHCPV6_MSG_API_REPLY", + 8: "DHCPV6_MSG_API_RELEASE", + 9: "DHCPV6_MSG_API_DECLINE", + 10: "DHCPV6_MSG_API_RECONFIGURE", + 11: "DHCPV6_MSG_API_INFORMATION_REQUEST", + 12: "DHCPV6_MSG_API_RELAY_FORW", + 13: "DHCPV6_MSG_API_RELAY_REPL", + } + Dhcpv6MsgType_value = map[string]uint32{ + "DHCPV6_MSG_API_SOLICIT": 1, + "DHCPV6_MSG_API_ADVERTISE": 2, + "DHCPV6_MSG_API_REQUEST": 3, + "DHCPV6_MSG_API_CONFIRM": 4, + "DHCPV6_MSG_API_RENEW": 5, + "DHCPV6_MSG_API_REBIND": 6, + "DHCPV6_MSG_API_REPLY": 7, + "DHCPV6_MSG_API_RELEASE": 8, + "DHCPV6_MSG_API_DECLINE": 9, + "DHCPV6_MSG_API_RECONFIGURE": 10, + "DHCPV6_MSG_API_INFORMATION_REQUEST": 11, + "DHCPV6_MSG_API_RELAY_FORW": 12, + "DHCPV6_MSG_API_RELAY_REPL": 13, + } +) + +func (x Dhcpv6MsgType) String() string { + s, ok := Dhcpv6MsgType_name[uint32(x)] + if ok { + return s + } + return "Dhcpv6MsgType(" + strconv.Itoa(int(x)) + ")" +} + +// VssType defines enum 'vss_type'. +type VssType uint32 + +const ( + VSS_TYPE_API_ASCII VssType = 0 + VSS_TYPE_API_VPN_ID VssType = 1 + VSS_TYPE_API_INVALID VssType = 123 + VSS_TYPE_API_DEFAULT VssType = 255 +) + +var ( + VssType_name = map[uint32]string{ + 0: "VSS_TYPE_API_ASCII", + 1: "VSS_TYPE_API_VPN_ID", + 123: "VSS_TYPE_API_INVALID", + 255: "VSS_TYPE_API_DEFAULT", + } + VssType_value = map[string]uint32{ + "VSS_TYPE_API_ASCII": 0, + "VSS_TYPE_API_VPN_ID": 1, + "VSS_TYPE_API_INVALID": 123, + "VSS_TYPE_API_DEFAULT": 255, + } +) + +func (x VssType) String() string { + s, ok := VssType_name[uint32(x)] + if ok { + return s + } + return "VssType(" + strconv.Itoa(int(x)) + ")" +} + +// DHCP6AddressInfo defines type 'dhcp6_address_info'. +type DHCP6AddressInfo struct { + Address ip_types.IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"` + ValidTime uint32 `binapi:"u32,name=valid_time" json:"valid_time,omitempty"` + PreferredTime uint32 `binapi:"u32,name=preferred_time" json:"preferred_time,omitempty"` +} + +// DHCP6PdPrefixInfo defines type 'dhcp6_pd_prefix_info'. +type DHCP6PdPrefixInfo struct { + Prefix ip_types.IP6Prefix `binapi:"ip6_prefix,name=prefix" json:"prefix,omitempty"` + ValidTime uint32 `binapi:"u32,name=valid_time" json:"valid_time,omitempty"` + PreferredTime uint32 `binapi:"u32,name=preferred_time" json:"preferred_time,omitempty"` +} + +// DHCPClient defines type 'dhcp_client'. +type DHCPClient struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Hostname string `binapi:"string[64],name=hostname" json:"hostname,omitempty"` + ID []byte `binapi:"u8[64],name=id" json:"id,omitempty"` + WantDHCPEvent bool `binapi:"bool,name=want_dhcp_event" json:"want_dhcp_event,omitempty"` + SetBroadcastFlag bool `binapi:"bool,name=set_broadcast_flag" json:"set_broadcast_flag,omitempty"` + Dscp ip_types.IPDscp `binapi:"ip_dscp,name=dscp" json:"dscp,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` +} + +// DHCPLease defines type 'dhcp_lease'. +type DHCPLease struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + State DHCPClientState `binapi:"dhcp_client_state,name=state" json:"state,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + Hostname string `binapi:"string[64],name=hostname" json:"hostname,omitempty"` + MaskWidth uint8 `binapi:"u8,name=mask_width" json:"mask_width,omitempty"` + HostAddress ip_types.Address `binapi:"address,name=host_address" json:"host_address,omitempty"` + RouterAddress ip_types.Address `binapi:"address,name=router_address" json:"router_address,omitempty"` + HostMac ethernet_types.MacAddress `binapi:"mac_address,name=host_mac" json:"host_mac,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"-"` + DomainServer []DomainServer `binapi:"domain_server[count],name=domain_server" json:"domain_server,omitempty"` +} + +// DHCPServer defines type 'dhcp_server'. +type DHCPServer struct { + ServerVrfID uint32 `binapi:"u32,name=server_vrf_id" json:"server_vrf_id,omitempty"` + DHCPServer ip_types.Address `binapi:"address,name=dhcp_server" json:"dhcp_server,omitempty"` +} + +// DomainServer defines type 'domain_server'. +type DomainServer struct { + Address ip_types.Address `binapi:"address,name=address" json:"address,omitempty"` +} + +// DHCP6ClientsEnableDisable defines message 'dhcp6_clients_enable_disable'. +type DHCP6ClientsEnableDisable struct { + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *DHCP6ClientsEnableDisable) Reset() { *m = DHCP6ClientsEnableDisable{} } +func (*DHCP6ClientsEnableDisable) GetMessageName() string { return "dhcp6_clients_enable_disable" } +func (*DHCP6ClientsEnableDisable) GetCrcString() string { return "b3e225d2" } +func (*DHCP6ClientsEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCP6ClientsEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Enable + return size +} +func (m *DHCP6ClientsEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *DHCP6ClientsEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Enable = buf.DecodeBool() + return nil +} + +// DHCP6ClientsEnableDisableReply defines message 'dhcp6_clients_enable_disable_reply'. +type DHCP6ClientsEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DHCP6ClientsEnableDisableReply) Reset() { *m = DHCP6ClientsEnableDisableReply{} } +func (*DHCP6ClientsEnableDisableReply) GetMessageName() string { + return "dhcp6_clients_enable_disable_reply" +} +func (*DHCP6ClientsEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*DHCP6ClientsEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCP6ClientsEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DHCP6ClientsEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DHCP6ClientsEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// DHCP6DuidLlSet defines message 'dhcp6_duid_ll_set'. +type DHCP6DuidLlSet struct { + DuidLl []byte `binapi:"u8[10],name=duid_ll" json:"duid_ll,omitempty"` +} + +func (m *DHCP6DuidLlSet) Reset() { *m = DHCP6DuidLlSet{} } +func (*DHCP6DuidLlSet) GetMessageName() string { return "dhcp6_duid_ll_set" } +func (*DHCP6DuidLlSet) GetCrcString() string { return "0f6ca323" } +func (*DHCP6DuidLlSet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCP6DuidLlSet) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 10 // m.DuidLl + return size +} +func (m *DHCP6DuidLlSet) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.DuidLl[:], 10) + return buf.Bytes(), nil +} +func (m *DHCP6DuidLlSet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.DuidLl[:], buf.DecodeBytes(10)) + return nil +} + +// DHCP6DuidLlSetReply defines message 'dhcp6_duid_ll_set_reply'. +type DHCP6DuidLlSetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DHCP6DuidLlSetReply) Reset() { *m = DHCP6DuidLlSetReply{} } +func (*DHCP6DuidLlSetReply) GetMessageName() string { return "dhcp6_duid_ll_set_reply" } +func (*DHCP6DuidLlSetReply) GetCrcString() string { return "e8d4e804" } +func (*DHCP6DuidLlSetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCP6DuidLlSetReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DHCP6DuidLlSetReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DHCP6DuidLlSetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// DHCP6PdReplyEvent defines message 'dhcp6_pd_reply_event'. +type DHCP6PdReplyEvent struct { + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + ServerIndex uint32 `binapi:"u32,name=server_index" json:"server_index,omitempty"` + MsgType Dhcpv6MsgType `binapi:"dhcpv6_msg_type,name=msg_type" json:"msg_type,omitempty"` + T1 uint32 `binapi:"u32,name=T1" json:"T1,omitempty"` + T2 uint32 `binapi:"u32,name=T2" json:"T2,omitempty"` + InnerStatusCode uint16 `binapi:"u16,name=inner_status_code" json:"inner_status_code,omitempty"` + StatusCode uint16 `binapi:"u16,name=status_code" json:"status_code,omitempty"` + Preference uint8 `binapi:"u8,name=preference" json:"preference,omitempty"` + NPrefixes uint32 `binapi:"u32,name=n_prefixes" json:"-"` + Prefixes []DHCP6PdPrefixInfo `binapi:"dhcp6_pd_prefix_info[n_prefixes],name=prefixes" json:"prefixes,omitempty"` +} + +func (m *DHCP6PdReplyEvent) Reset() { *m = DHCP6PdReplyEvent{} } +func (*DHCP6PdReplyEvent) GetMessageName() string { return "dhcp6_pd_reply_event" } +func (*DHCP6PdReplyEvent) GetCrcString() string { return "cb3e462b" } +func (*DHCP6PdReplyEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +func (m *DHCP6PdReplyEvent) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.PID + size += 4 // m.SwIfIndex + size += 4 // m.ServerIndex + size += 4 // m.MsgType + size += 4 // m.T1 + size += 4 // m.T2 + size += 2 // m.InnerStatusCode + size += 2 // m.StatusCode + size += 1 // m.Preference + size += 4 // m.NPrefixes + for j1 := 0; j1 < len(m.Prefixes); j1++ { + var s1 DHCP6PdPrefixInfo + _ = s1 + if j1 < len(m.Prefixes) { + s1 = m.Prefixes[j1] + } + size += 1 * 16 // s1.Prefix.Address + size += 1 // s1.Prefix.Len + size += 4 // s1.ValidTime + size += 4 // s1.PreferredTime + } + return size +} +func (m *DHCP6PdReplyEvent) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.PID)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.ServerIndex)) + buf.EncodeUint32(uint32(m.MsgType)) + buf.EncodeUint32(uint32(m.T1)) + buf.EncodeUint32(uint32(m.T2)) + buf.EncodeUint16(uint16(m.InnerStatusCode)) + buf.EncodeUint16(uint16(m.StatusCode)) + buf.EncodeUint8(uint8(m.Preference)) + buf.EncodeUint32(uint32(len(m.Prefixes))) + for j0 := 0; j0 < len(m.Prefixes); j0++ { + var v0 DHCP6PdPrefixInfo + if j0 < len(m.Prefixes) { + v0 = m.Prefixes[j0] + } + buf.EncodeBytes(v0.Prefix.Address[:], 16) + buf.EncodeUint8(uint8(v0.Prefix.Len)) + buf.EncodeUint32(uint32(v0.ValidTime)) + buf.EncodeUint32(uint32(v0.PreferredTime)) + } + return buf.Bytes(), nil +} +func (m *DHCP6PdReplyEvent) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PID = buf.DecodeUint32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.ServerIndex = buf.DecodeUint32() + m.MsgType = Dhcpv6MsgType(buf.DecodeUint32()) + m.T1 = buf.DecodeUint32() + m.T2 = buf.DecodeUint32() + m.InnerStatusCode = buf.DecodeUint16() + m.StatusCode = buf.DecodeUint16() + m.Preference = buf.DecodeUint8() + m.NPrefixes = buf.DecodeUint32() + m.Prefixes = make([]DHCP6PdPrefixInfo, int(m.NPrefixes)) + for j0 := 0; j0 < len(m.Prefixes); j0++ { + copy(m.Prefixes[j0].Prefix.Address[:], buf.DecodeBytes(16)) + m.Prefixes[j0].Prefix.Len = buf.DecodeUint8() + m.Prefixes[j0].ValidTime = buf.DecodeUint32() + m.Prefixes[j0].PreferredTime = buf.DecodeUint32() + } + return nil +} + +// DHCP6PdSendClientMessage defines message 'dhcp6_pd_send_client_message'. +type DHCP6PdSendClientMessage struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + ServerIndex uint32 `binapi:"u32,name=server_index" json:"server_index,omitempty"` + Irt uint32 `binapi:"u32,name=irt" json:"irt,omitempty"` + Mrt uint32 `binapi:"u32,name=mrt" json:"mrt,omitempty"` + Mrc uint32 `binapi:"u32,name=mrc" json:"mrc,omitempty"` + Mrd uint32 `binapi:"u32,name=mrd" json:"mrd,omitempty"` + Stop bool `binapi:"bool,name=stop" json:"stop,omitempty"` + MsgType Dhcpv6MsgType `binapi:"dhcpv6_msg_type,name=msg_type" json:"msg_type,omitempty"` + T1 uint32 `binapi:"u32,name=T1" json:"T1,omitempty"` + T2 uint32 `binapi:"u32,name=T2" json:"T2,omitempty"` + NPrefixes uint32 `binapi:"u32,name=n_prefixes" json:"-"` + Prefixes []DHCP6PdPrefixInfo `binapi:"dhcp6_pd_prefix_info[n_prefixes],name=prefixes" json:"prefixes,omitempty"` +} + +func (m *DHCP6PdSendClientMessage) Reset() { *m = DHCP6PdSendClientMessage{} } +func (*DHCP6PdSendClientMessage) GetMessageName() string { return "dhcp6_pd_send_client_message" } +func (*DHCP6PdSendClientMessage) GetCrcString() string { return "064badb8" } +func (*DHCP6PdSendClientMessage) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCP6PdSendClientMessage) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.ServerIndex + size += 4 // m.Irt + size += 4 // m.Mrt + size += 4 // m.Mrc + size += 4 // m.Mrd + size += 1 // m.Stop + size += 4 // m.MsgType + size += 4 // m.T1 + size += 4 // m.T2 + size += 4 // m.NPrefixes + for j1 := 0; j1 < len(m.Prefixes); j1++ { + var s1 DHCP6PdPrefixInfo + _ = s1 + if j1 < len(m.Prefixes) { + s1 = m.Prefixes[j1] + } + size += 1 * 16 // s1.Prefix.Address + size += 1 // s1.Prefix.Len + size += 4 // s1.ValidTime + size += 4 // s1.PreferredTime + } + return size +} +func (m *DHCP6PdSendClientMessage) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.ServerIndex)) + buf.EncodeUint32(uint32(m.Irt)) + buf.EncodeUint32(uint32(m.Mrt)) + buf.EncodeUint32(uint32(m.Mrc)) + buf.EncodeUint32(uint32(m.Mrd)) + buf.EncodeBool(m.Stop) + buf.EncodeUint32(uint32(m.MsgType)) + buf.EncodeUint32(uint32(m.T1)) + buf.EncodeUint32(uint32(m.T2)) + buf.EncodeUint32(uint32(len(m.Prefixes))) + for j0 := 0; j0 < len(m.Prefixes); j0++ { + var v0 DHCP6PdPrefixInfo + if j0 < len(m.Prefixes) { + v0 = m.Prefixes[j0] + } + buf.EncodeBytes(v0.Prefix.Address[:], 16) + buf.EncodeUint8(uint8(v0.Prefix.Len)) + buf.EncodeUint32(uint32(v0.ValidTime)) + buf.EncodeUint32(uint32(v0.PreferredTime)) + } + return buf.Bytes(), nil +} +func (m *DHCP6PdSendClientMessage) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.ServerIndex = buf.DecodeUint32() + m.Irt = buf.DecodeUint32() + m.Mrt = buf.DecodeUint32() + m.Mrc = buf.DecodeUint32() + m.Mrd = buf.DecodeUint32() + m.Stop = buf.DecodeBool() + m.MsgType = Dhcpv6MsgType(buf.DecodeUint32()) + m.T1 = buf.DecodeUint32() + m.T2 = buf.DecodeUint32() + m.NPrefixes = buf.DecodeUint32() + m.Prefixes = make([]DHCP6PdPrefixInfo, int(m.NPrefixes)) + for j0 := 0; j0 < len(m.Prefixes); j0++ { + copy(m.Prefixes[j0].Prefix.Address[:], buf.DecodeBytes(16)) + m.Prefixes[j0].Prefix.Len = buf.DecodeUint8() + m.Prefixes[j0].ValidTime = buf.DecodeUint32() + m.Prefixes[j0].PreferredTime = buf.DecodeUint32() + } + return nil +} + +// DHCP6PdSendClientMessageReply defines message 'dhcp6_pd_send_client_message_reply'. +type DHCP6PdSendClientMessageReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DHCP6PdSendClientMessageReply) Reset() { *m = DHCP6PdSendClientMessageReply{} } +func (*DHCP6PdSendClientMessageReply) GetMessageName() string { + return "dhcp6_pd_send_client_message_reply" +} +func (*DHCP6PdSendClientMessageReply) GetCrcString() string { return "e8d4e804" } +func (*DHCP6PdSendClientMessageReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCP6PdSendClientMessageReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DHCP6PdSendClientMessageReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DHCP6PdSendClientMessageReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// DHCP6ReplyEvent defines message 'dhcp6_reply_event'. +type DHCP6ReplyEvent struct { + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + ServerIndex uint32 `binapi:"u32,name=server_index" json:"server_index,omitempty"` + MsgType Dhcpv6MsgType `binapi:"dhcpv6_msg_type,name=msg_type" json:"msg_type,omitempty"` + T1 uint32 `binapi:"u32,name=T1" json:"T1,omitempty"` + T2 uint32 `binapi:"u32,name=T2" json:"T2,omitempty"` + InnerStatusCode uint16 `binapi:"u16,name=inner_status_code" json:"inner_status_code,omitempty"` + StatusCode uint16 `binapi:"u16,name=status_code" json:"status_code,omitempty"` + Preference uint8 `binapi:"u8,name=preference" json:"preference,omitempty"` + NAddresses uint32 `binapi:"u32,name=n_addresses" json:"-"` + Addresses []DHCP6AddressInfo `binapi:"dhcp6_address_info[n_addresses],name=addresses" json:"addresses,omitempty"` +} + +func (m *DHCP6ReplyEvent) Reset() { *m = DHCP6ReplyEvent{} } +func (*DHCP6ReplyEvent) GetMessageName() string { return "dhcp6_reply_event" } +func (*DHCP6ReplyEvent) GetCrcString() string { return "9f3af9e5" } +func (*DHCP6ReplyEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +func (m *DHCP6ReplyEvent) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.PID + size += 4 // m.SwIfIndex + size += 4 // m.ServerIndex + size += 4 // m.MsgType + size += 4 // m.T1 + size += 4 // m.T2 + size += 2 // m.InnerStatusCode + size += 2 // m.StatusCode + size += 1 // m.Preference + size += 4 // m.NAddresses + for j1 := 0; j1 < len(m.Addresses); j1++ { + var s1 DHCP6AddressInfo + _ = s1 + if j1 < len(m.Addresses) { + s1 = m.Addresses[j1] + } + size += 1 * 16 // s1.Address + size += 4 // s1.ValidTime + size += 4 // s1.PreferredTime + } + return size +} +func (m *DHCP6ReplyEvent) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.PID)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.ServerIndex)) + buf.EncodeUint32(uint32(m.MsgType)) + buf.EncodeUint32(uint32(m.T1)) + buf.EncodeUint32(uint32(m.T2)) + buf.EncodeUint16(uint16(m.InnerStatusCode)) + buf.EncodeUint16(uint16(m.StatusCode)) + buf.EncodeUint8(uint8(m.Preference)) + buf.EncodeUint32(uint32(len(m.Addresses))) + for j0 := 0; j0 < len(m.Addresses); j0++ { + var v0 DHCP6AddressInfo + if j0 < len(m.Addresses) { + v0 = m.Addresses[j0] + } + buf.EncodeBytes(v0.Address[:], 16) + buf.EncodeUint32(uint32(v0.ValidTime)) + buf.EncodeUint32(uint32(v0.PreferredTime)) + } + return buf.Bytes(), nil +} +func (m *DHCP6ReplyEvent) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PID = buf.DecodeUint32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.ServerIndex = buf.DecodeUint32() + m.MsgType = Dhcpv6MsgType(buf.DecodeUint32()) + m.T1 = buf.DecodeUint32() + m.T2 = buf.DecodeUint32() + m.InnerStatusCode = buf.DecodeUint16() + m.StatusCode = buf.DecodeUint16() + m.Preference = buf.DecodeUint8() + m.NAddresses = buf.DecodeUint32() + m.Addresses = make([]DHCP6AddressInfo, int(m.NAddresses)) + for j0 := 0; j0 < len(m.Addresses); j0++ { + copy(m.Addresses[j0].Address[:], buf.DecodeBytes(16)) + m.Addresses[j0].ValidTime = buf.DecodeUint32() + m.Addresses[j0].PreferredTime = buf.DecodeUint32() + } + return nil +} + +// DHCP6SendClientMessage defines message 'dhcp6_send_client_message'. +type DHCP6SendClientMessage struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + ServerIndex uint32 `binapi:"u32,name=server_index" json:"server_index,omitempty"` + Irt uint32 `binapi:"u32,name=irt" json:"irt,omitempty"` + Mrt uint32 `binapi:"u32,name=mrt" json:"mrt,omitempty"` + Mrc uint32 `binapi:"u32,name=mrc" json:"mrc,omitempty"` + Mrd uint32 `binapi:"u32,name=mrd" json:"mrd,omitempty"` + Stop bool `binapi:"bool,name=stop" json:"stop,omitempty"` + MsgType Dhcpv6MsgType `binapi:"dhcpv6_msg_type,name=msg_type" json:"msg_type,omitempty"` + T1 uint32 `binapi:"u32,name=T1" json:"T1,omitempty"` + T2 uint32 `binapi:"u32,name=T2" json:"T2,omitempty"` + NAddresses uint32 `binapi:"u32,name=n_addresses" json:"-"` + Addresses []DHCP6AddressInfo `binapi:"dhcp6_address_info[n_addresses],name=addresses" json:"addresses,omitempty"` +} + +func (m *DHCP6SendClientMessage) Reset() { *m = DHCP6SendClientMessage{} } +func (*DHCP6SendClientMessage) GetMessageName() string { return "dhcp6_send_client_message" } +func (*DHCP6SendClientMessage) GetCrcString() string { return "f6f14ef0" } +func (*DHCP6SendClientMessage) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCP6SendClientMessage) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.ServerIndex + size += 4 // m.Irt + size += 4 // m.Mrt + size += 4 // m.Mrc + size += 4 // m.Mrd + size += 1 // m.Stop + size += 4 // m.MsgType + size += 4 // m.T1 + size += 4 // m.T2 + size += 4 // m.NAddresses + for j1 := 0; j1 < len(m.Addresses); j1++ { + var s1 DHCP6AddressInfo + _ = s1 + if j1 < len(m.Addresses) { + s1 = m.Addresses[j1] + } + size += 1 * 16 // s1.Address + size += 4 // s1.ValidTime + size += 4 // s1.PreferredTime + } + return size +} +func (m *DHCP6SendClientMessage) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.ServerIndex)) + buf.EncodeUint32(uint32(m.Irt)) + buf.EncodeUint32(uint32(m.Mrt)) + buf.EncodeUint32(uint32(m.Mrc)) + buf.EncodeUint32(uint32(m.Mrd)) + buf.EncodeBool(m.Stop) + buf.EncodeUint32(uint32(m.MsgType)) + buf.EncodeUint32(uint32(m.T1)) + buf.EncodeUint32(uint32(m.T2)) + buf.EncodeUint32(uint32(len(m.Addresses))) + for j0 := 0; j0 < len(m.Addresses); j0++ { + var v0 DHCP6AddressInfo + if j0 < len(m.Addresses) { + v0 = m.Addresses[j0] + } + buf.EncodeBytes(v0.Address[:], 16) + buf.EncodeUint32(uint32(v0.ValidTime)) + buf.EncodeUint32(uint32(v0.PreferredTime)) + } + return buf.Bytes(), nil +} +func (m *DHCP6SendClientMessage) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.ServerIndex = buf.DecodeUint32() + m.Irt = buf.DecodeUint32() + m.Mrt = buf.DecodeUint32() + m.Mrc = buf.DecodeUint32() + m.Mrd = buf.DecodeUint32() + m.Stop = buf.DecodeBool() + m.MsgType = Dhcpv6MsgType(buf.DecodeUint32()) + m.T1 = buf.DecodeUint32() + m.T2 = buf.DecodeUint32() + m.NAddresses = buf.DecodeUint32() + m.Addresses = make([]DHCP6AddressInfo, int(m.NAddresses)) + for j0 := 0; j0 < len(m.Addresses); j0++ { + copy(m.Addresses[j0].Address[:], buf.DecodeBytes(16)) + m.Addresses[j0].ValidTime = buf.DecodeUint32() + m.Addresses[j0].PreferredTime = buf.DecodeUint32() + } + return nil +} + +// DHCP6SendClientMessageReply defines message 'dhcp6_send_client_message_reply'. +type DHCP6SendClientMessageReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DHCP6SendClientMessageReply) Reset() { *m = DHCP6SendClientMessageReply{} } +func (*DHCP6SendClientMessageReply) GetMessageName() string { return "dhcp6_send_client_message_reply" } +func (*DHCP6SendClientMessageReply) GetCrcString() string { return "e8d4e804" } +func (*DHCP6SendClientMessageReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCP6SendClientMessageReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DHCP6SendClientMessageReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DHCP6SendClientMessageReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// DHCPClientConfig defines message 'dhcp_client_config'. +type DHCPClientConfig struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Client DHCPClient `binapi:"dhcp_client,name=client" json:"client,omitempty"` +} + +func (m *DHCPClientConfig) Reset() { *m = DHCPClientConfig{} } +func (*DHCPClientConfig) GetMessageName() string { return "dhcp_client_config" } +func (*DHCPClientConfig) GetCrcString() string { return "959b80a3" } +func (*DHCPClientConfig) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCPClientConfig) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Client.SwIfIndex + size += 64 // m.Client.Hostname + size += 1 * 64 // m.Client.ID + size += 1 // m.Client.WantDHCPEvent + size += 1 // m.Client.SetBroadcastFlag + size += 1 // m.Client.Dscp + size += 4 // m.Client.PID + return size +} +func (m *DHCPClientConfig) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Client.SwIfIndex)) + buf.EncodeString(m.Client.Hostname, 64) + buf.EncodeBytes(m.Client.ID[:], 64) + buf.EncodeBool(m.Client.WantDHCPEvent) + buf.EncodeBool(m.Client.SetBroadcastFlag) + buf.EncodeUint8(uint8(m.Client.Dscp)) + buf.EncodeUint32(uint32(m.Client.PID)) + return buf.Bytes(), nil +} +func (m *DHCPClientConfig) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Client.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Client.Hostname = buf.DecodeString(64) + copy(m.Client.ID[:], buf.DecodeBytes(64)) + m.Client.WantDHCPEvent = buf.DecodeBool() + m.Client.SetBroadcastFlag = buf.DecodeBool() + m.Client.Dscp = ip_types.IPDscp(buf.DecodeUint8()) + m.Client.PID = buf.DecodeUint32() + return nil +} + +// DHCPClientConfigReply defines message 'dhcp_client_config_reply'. +type DHCPClientConfigReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DHCPClientConfigReply) Reset() { *m = DHCPClientConfigReply{} } +func (*DHCPClientConfigReply) GetMessageName() string { return "dhcp_client_config_reply" } +func (*DHCPClientConfigReply) GetCrcString() string { return "e8d4e804" } +func (*DHCPClientConfigReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCPClientConfigReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DHCPClientConfigReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DHCPClientConfigReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// DHCPClientDetails defines message 'dhcp_client_details'. +type DHCPClientDetails struct { + Client DHCPClient `binapi:"dhcp_client,name=client" json:"client,omitempty"` + Lease DHCPLease `binapi:"dhcp_lease,name=lease" json:"lease,omitempty"` +} + +func (m *DHCPClientDetails) Reset() { *m = DHCPClientDetails{} } +func (*DHCPClientDetails) GetMessageName() string { return "dhcp_client_details" } +func (*DHCPClientDetails) GetCrcString() string { return "acd82f5a" } +func (*DHCPClientDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCPClientDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Client.SwIfIndex + size += 64 // m.Client.Hostname + size += 1 * 64 // m.Client.ID + size += 1 // m.Client.WantDHCPEvent + size += 1 // m.Client.SetBroadcastFlag + size += 1 // m.Client.Dscp + size += 4 // m.Client.PID + size += 4 // m.Lease.SwIfIndex + size += 4 // m.Lease.State + size += 1 // m.Lease.IsIPv6 + size += 64 // m.Lease.Hostname + size += 1 // m.Lease.MaskWidth + size += 1 // m.Lease.HostAddress.Af + size += 1 * 16 // m.Lease.HostAddress.Un + size += 1 // m.Lease.RouterAddress.Af + size += 1 * 16 // m.Lease.RouterAddress.Un + size += 1 * 6 // m.Lease.HostMac + size += 1 // m.Lease.Count + for j2 := 0; j2 < len(m.Lease.DomainServer); j2++ { + var s2 DomainServer + _ = s2 + if j2 < len(m.Lease.DomainServer) { + s2 = m.Lease.DomainServer[j2] + } + size += 1 // s2.Address.Af + size += 1 * 16 // s2.Address.Un + } + return size +} +func (m *DHCPClientDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Client.SwIfIndex)) + buf.EncodeString(m.Client.Hostname, 64) + buf.EncodeBytes(m.Client.ID[:], 64) + buf.EncodeBool(m.Client.WantDHCPEvent) + buf.EncodeBool(m.Client.SetBroadcastFlag) + buf.EncodeUint8(uint8(m.Client.Dscp)) + buf.EncodeUint32(uint32(m.Client.PID)) + buf.EncodeUint32(uint32(m.Lease.SwIfIndex)) + buf.EncodeUint32(uint32(m.Lease.State)) + buf.EncodeBool(m.Lease.IsIPv6) + buf.EncodeString(m.Lease.Hostname, 64) + buf.EncodeUint8(uint8(m.Lease.MaskWidth)) + buf.EncodeUint8(uint8(m.Lease.HostAddress.Af)) + buf.EncodeBytes(m.Lease.HostAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Lease.RouterAddress.Af)) + buf.EncodeBytes(m.Lease.RouterAddress.Un.XXX_UnionData[:], 0) + buf.EncodeBytes(m.Lease.HostMac[:], 6) + buf.EncodeUint8(uint8(len(m.Lease.DomainServer))) + for j1 := 0; j1 < len(m.Lease.DomainServer); j1++ { + var v1 DomainServer + if j1 < len(m.Lease.DomainServer) { + v1 = m.Lease.DomainServer[j1] + } + buf.EncodeUint8(uint8(v1.Address.Af)) + buf.EncodeBytes(v1.Address.Un.XXX_UnionData[:], 0) + } + return buf.Bytes(), nil +} +func (m *DHCPClientDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Client.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Client.Hostname = buf.DecodeString(64) + copy(m.Client.ID[:], buf.DecodeBytes(64)) + m.Client.WantDHCPEvent = buf.DecodeBool() + m.Client.SetBroadcastFlag = buf.DecodeBool() + m.Client.Dscp = ip_types.IPDscp(buf.DecodeUint8()) + m.Client.PID = buf.DecodeUint32() + m.Lease.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Lease.State = DHCPClientState(buf.DecodeUint32()) + m.Lease.IsIPv6 = buf.DecodeBool() + m.Lease.Hostname = buf.DecodeString(64) + m.Lease.MaskWidth = buf.DecodeUint8() + m.Lease.HostAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Lease.HostAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Lease.RouterAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Lease.RouterAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + copy(m.Lease.HostMac[:], buf.DecodeBytes(6)) + m.Lease.Count = buf.DecodeUint8() + m.Lease.DomainServer = make([]DomainServer, int(m.Lease.Count)) + for j1 := 0; j1 < len(m.Lease.DomainServer); j1++ { + m.Lease.DomainServer[j1].Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Lease.DomainServer[j1].Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + } + return nil +} + +// DHCPClientDump defines message 'dhcp_client_dump'. +type DHCPClientDump struct{} + +func (m *DHCPClientDump) Reset() { *m = DHCPClientDump{} } +func (*DHCPClientDump) GetMessageName() string { return "dhcp_client_dump" } +func (*DHCPClientDump) GetCrcString() string { return "51077d14" } +func (*DHCPClientDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCPClientDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *DHCPClientDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *DHCPClientDump) Unmarshal(b []byte) error { + return nil +} + +// DHCPComplEvent defines message 'dhcp_compl_event'. +type DHCPComplEvent struct { + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + Lease DHCPLease `binapi:"dhcp_lease,name=lease" json:"lease,omitempty"` +} + +func (m *DHCPComplEvent) Reset() { *m = DHCPComplEvent{} } +func (*DHCPComplEvent) GetMessageName() string { return "dhcp_compl_event" } +func (*DHCPComplEvent) GetCrcString() string { return "e908fd1d" } +func (*DHCPComplEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +func (m *DHCPComplEvent) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.PID + size += 4 // m.Lease.SwIfIndex + size += 4 // m.Lease.State + size += 1 // m.Lease.IsIPv6 + size += 64 // m.Lease.Hostname + size += 1 // m.Lease.MaskWidth + size += 1 // m.Lease.HostAddress.Af + size += 1 * 16 // m.Lease.HostAddress.Un + size += 1 // m.Lease.RouterAddress.Af + size += 1 * 16 // m.Lease.RouterAddress.Un + size += 1 * 6 // m.Lease.HostMac + size += 1 // m.Lease.Count + for j2 := 0; j2 < len(m.Lease.DomainServer); j2++ { + var s2 DomainServer + _ = s2 + if j2 < len(m.Lease.DomainServer) { + s2 = m.Lease.DomainServer[j2] + } + size += 1 // s2.Address.Af + size += 1 * 16 // s2.Address.Un + } + return size +} +func (m *DHCPComplEvent) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.PID)) + buf.EncodeUint32(uint32(m.Lease.SwIfIndex)) + buf.EncodeUint32(uint32(m.Lease.State)) + buf.EncodeBool(m.Lease.IsIPv6) + buf.EncodeString(m.Lease.Hostname, 64) + buf.EncodeUint8(uint8(m.Lease.MaskWidth)) + buf.EncodeUint8(uint8(m.Lease.HostAddress.Af)) + buf.EncodeBytes(m.Lease.HostAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Lease.RouterAddress.Af)) + buf.EncodeBytes(m.Lease.RouterAddress.Un.XXX_UnionData[:], 0) + buf.EncodeBytes(m.Lease.HostMac[:], 6) + buf.EncodeUint8(uint8(len(m.Lease.DomainServer))) + for j1 := 0; j1 < len(m.Lease.DomainServer); j1++ { + var v1 DomainServer + if j1 < len(m.Lease.DomainServer) { + v1 = m.Lease.DomainServer[j1] + } + buf.EncodeUint8(uint8(v1.Address.Af)) + buf.EncodeBytes(v1.Address.Un.XXX_UnionData[:], 0) + } + return buf.Bytes(), nil +} +func (m *DHCPComplEvent) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PID = buf.DecodeUint32() + m.Lease.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Lease.State = DHCPClientState(buf.DecodeUint32()) + m.Lease.IsIPv6 = buf.DecodeBool() + m.Lease.Hostname = buf.DecodeString(64) + m.Lease.MaskWidth = buf.DecodeUint8() + m.Lease.HostAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Lease.HostAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Lease.RouterAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Lease.RouterAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + copy(m.Lease.HostMac[:], buf.DecodeBytes(6)) + m.Lease.Count = buf.DecodeUint8() + m.Lease.DomainServer = make([]DomainServer, int(m.Lease.Count)) + for j1 := 0; j1 < len(m.Lease.DomainServer); j1++ { + m.Lease.DomainServer[j1].Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Lease.DomainServer[j1].Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + } + return nil +} + +// DHCPPluginControlPing defines message 'dhcp_plugin_control_ping'. +type DHCPPluginControlPing struct{} + +func (m *DHCPPluginControlPing) Reset() { *m = DHCPPluginControlPing{} } +func (*DHCPPluginControlPing) GetMessageName() string { return "dhcp_plugin_control_ping" } +func (*DHCPPluginControlPing) GetCrcString() string { return "51077d14" } +func (*DHCPPluginControlPing) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCPPluginControlPing) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *DHCPPluginControlPing) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *DHCPPluginControlPing) Unmarshal(b []byte) error { + return nil +} + +// DHCPPluginControlPingReply defines message 'dhcp_plugin_control_ping_reply'. +type DHCPPluginControlPingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ClientIndex uint32 `binapi:"u32,name=client_index" json:"client_index,omitempty"` + VpePID uint32 `binapi:"u32,name=vpe_pid" json:"vpe_pid,omitempty"` +} + +func (m *DHCPPluginControlPingReply) Reset() { *m = DHCPPluginControlPingReply{} } +func (*DHCPPluginControlPingReply) GetMessageName() string { return "dhcp_plugin_control_ping_reply" } +func (*DHCPPluginControlPingReply) GetCrcString() string { return "f6b0b8ca" } +func (*DHCPPluginControlPingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCPPluginControlPingReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.ClientIndex + size += 4 // m.VpePID + return size +} +func (m *DHCPPluginControlPingReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.ClientIndex)) + buf.EncodeUint32(uint32(m.VpePID)) + return buf.Bytes(), nil +} +func (m *DHCPPluginControlPingReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.ClientIndex = buf.DecodeUint32() + m.VpePID = buf.DecodeUint32() + return nil +} + +// DHCPPluginGetVersion defines message 'dhcp_plugin_get_version'. +type DHCPPluginGetVersion struct{} + +func (m *DHCPPluginGetVersion) Reset() { *m = DHCPPluginGetVersion{} } +func (*DHCPPluginGetVersion) GetMessageName() string { return "dhcp_plugin_get_version" } +func (*DHCPPluginGetVersion) GetCrcString() string { return "51077d14" } +func (*DHCPPluginGetVersion) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCPPluginGetVersion) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *DHCPPluginGetVersion) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *DHCPPluginGetVersion) Unmarshal(b []byte) error { + return nil +} + +// DHCPPluginGetVersionReply defines message 'dhcp_plugin_get_version_reply'. +type DHCPPluginGetVersionReply struct { + Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` + Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` +} + +func (m *DHCPPluginGetVersionReply) Reset() { *m = DHCPPluginGetVersionReply{} } +func (*DHCPPluginGetVersionReply) GetMessageName() string { return "dhcp_plugin_get_version_reply" } +func (*DHCPPluginGetVersionReply) GetCrcString() string { return "9b32cf86" } +func (*DHCPPluginGetVersionReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCPPluginGetVersionReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Major + size += 4 // m.Minor + return size +} +func (m *DHCPPluginGetVersionReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Major)) + buf.EncodeUint32(uint32(m.Minor)) + return buf.Bytes(), nil +} +func (m *DHCPPluginGetVersionReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Major = buf.DecodeUint32() + m.Minor = buf.DecodeUint32() + return nil +} + +// DHCPProxyConfig defines message 'dhcp_proxy_config'. +type DHCPProxyConfig struct { + RxVrfID uint32 `binapi:"u32,name=rx_vrf_id" json:"rx_vrf_id,omitempty"` + ServerVrfID uint32 `binapi:"u32,name=server_vrf_id" json:"server_vrf_id,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + DHCPServer ip_types.Address `binapi:"address,name=dhcp_server" json:"dhcp_server,omitempty"` + DHCPSrcAddress ip_types.Address `binapi:"address,name=dhcp_src_address" json:"dhcp_src_address,omitempty"` +} + +func (m *DHCPProxyConfig) Reset() { *m = DHCPProxyConfig{} } +func (*DHCPProxyConfig) GetMessageName() string { return "dhcp_proxy_config" } +func (*DHCPProxyConfig) GetCrcString() string { return "6767230e" } +func (*DHCPProxyConfig) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCPProxyConfig) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.RxVrfID + size += 4 // m.ServerVrfID + size += 1 // m.IsAdd + size += 1 // m.DHCPServer.Af + size += 1 * 16 // m.DHCPServer.Un + size += 1 // m.DHCPSrcAddress.Af + size += 1 * 16 // m.DHCPSrcAddress.Un + return size +} +func (m *DHCPProxyConfig) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.RxVrfID)) + buf.EncodeUint32(uint32(m.ServerVrfID)) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.DHCPServer.Af)) + buf.EncodeBytes(m.DHCPServer.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.DHCPSrcAddress.Af)) + buf.EncodeBytes(m.DHCPSrcAddress.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *DHCPProxyConfig) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.RxVrfID = buf.DecodeUint32() + m.ServerVrfID = buf.DecodeUint32() + m.IsAdd = buf.DecodeBool() + m.DHCPServer.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.DHCPServer.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.DHCPSrcAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.DHCPSrcAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// DHCPProxyConfigReply defines message 'dhcp_proxy_config_reply'. +type DHCPProxyConfigReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DHCPProxyConfigReply) Reset() { *m = DHCPProxyConfigReply{} } +func (*DHCPProxyConfigReply) GetMessageName() string { return "dhcp_proxy_config_reply" } +func (*DHCPProxyConfigReply) GetCrcString() string { return "e8d4e804" } +func (*DHCPProxyConfigReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCPProxyConfigReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DHCPProxyConfigReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DHCPProxyConfigReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// DHCPProxyDetails defines message 'dhcp_proxy_details'. +type DHCPProxyDetails struct { + RxVrfID uint32 `binapi:"u32,name=rx_vrf_id" json:"rx_vrf_id,omitempty"` + VssOui uint32 `binapi:"u32,name=vss_oui" json:"vss_oui,omitempty"` + VssFibID uint32 `binapi:"u32,name=vss_fib_id" json:"vss_fib_id,omitempty"` + VssType VssType `binapi:"vss_type,name=vss_type" json:"vss_type,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + VssVPNAsciiID string `binapi:"string[129],name=vss_vpn_ascii_id" json:"vss_vpn_ascii_id,omitempty"` + DHCPSrcAddress ip_types.Address `binapi:"address,name=dhcp_src_address" json:"dhcp_src_address,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"-"` + Servers []DHCPServer `binapi:"dhcp_server[count],name=servers" json:"servers,omitempty"` +} + +func (m *DHCPProxyDetails) Reset() { *m = DHCPProxyDetails{} } +func (*DHCPProxyDetails) GetMessageName() string { return "dhcp_proxy_details" } +func (*DHCPProxyDetails) GetCrcString() string { return "ce16f044" } +func (*DHCPProxyDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCPProxyDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.RxVrfID + size += 4 // m.VssOui + size += 4 // m.VssFibID + size += 4 // m.VssType + size += 1 // m.IsIPv6 + size += 129 // m.VssVPNAsciiID + size += 1 // m.DHCPSrcAddress.Af + size += 1 * 16 // m.DHCPSrcAddress.Un + size += 1 // m.Count + for j1 := 0; j1 < len(m.Servers); j1++ { + var s1 DHCPServer + _ = s1 + if j1 < len(m.Servers) { + s1 = m.Servers[j1] + } + size += 4 // s1.ServerVrfID + size += 1 // s1.DHCPServer.Af + size += 1 * 16 // s1.DHCPServer.Un + } + return size +} +func (m *DHCPProxyDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.RxVrfID)) + buf.EncodeUint32(uint32(m.VssOui)) + buf.EncodeUint32(uint32(m.VssFibID)) + buf.EncodeUint32(uint32(m.VssType)) + buf.EncodeBool(m.IsIPv6) + buf.EncodeString(m.VssVPNAsciiID, 129) + buf.EncodeUint8(uint8(m.DHCPSrcAddress.Af)) + buf.EncodeBytes(m.DHCPSrcAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(len(m.Servers))) + for j0 := 0; j0 < len(m.Servers); j0++ { + var v0 DHCPServer + if j0 < len(m.Servers) { + v0 = m.Servers[j0] + } + buf.EncodeUint32(uint32(v0.ServerVrfID)) + buf.EncodeUint8(uint8(v0.DHCPServer.Af)) + buf.EncodeBytes(v0.DHCPServer.Un.XXX_UnionData[:], 0) + } + return buf.Bytes(), nil +} +func (m *DHCPProxyDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.RxVrfID = buf.DecodeUint32() + m.VssOui = buf.DecodeUint32() + m.VssFibID = buf.DecodeUint32() + m.VssType = VssType(buf.DecodeUint32()) + m.IsIPv6 = buf.DecodeBool() + m.VssVPNAsciiID = buf.DecodeString(129) + m.DHCPSrcAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.DHCPSrcAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Count = buf.DecodeUint8() + m.Servers = make([]DHCPServer, int(m.Count)) + for j0 := 0; j0 < len(m.Servers); j0++ { + m.Servers[j0].ServerVrfID = buf.DecodeUint32() + m.Servers[j0].DHCPServer.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Servers[j0].DHCPServer.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + } + return nil +} + +// DHCPProxyDump defines message 'dhcp_proxy_dump'. +type DHCPProxyDump struct { + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` +} + +func (m *DHCPProxyDump) Reset() { *m = DHCPProxyDump{} } +func (*DHCPProxyDump) GetMessageName() string { return "dhcp_proxy_dump" } +func (*DHCPProxyDump) GetCrcString() string { return "5c5b063f" } +func (*DHCPProxyDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCPProxyDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsIP6 + return size +} +func (m *DHCPProxyDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsIP6) + return buf.Bytes(), nil +} +func (m *DHCPProxyDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsIP6 = buf.DecodeBool() + return nil +} + +// DHCPProxySetVss defines message 'dhcp_proxy_set_vss'. +type DHCPProxySetVss struct { + TblID uint32 `binapi:"u32,name=tbl_id" json:"tbl_id,omitempty"` + VssType VssType `binapi:"vss_type,name=vss_type" json:"vss_type,omitempty"` + VPNAsciiID string `binapi:"string[129],name=vpn_ascii_id" json:"vpn_ascii_id,omitempty"` + Oui uint32 `binapi:"u32,name=oui" json:"oui,omitempty"` + VPNIndex uint32 `binapi:"u32,name=vpn_index" json:"vpn_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *DHCPProxySetVss) Reset() { *m = DHCPProxySetVss{} } +func (*DHCPProxySetVss) GetMessageName() string { return "dhcp_proxy_set_vss" } +func (*DHCPProxySetVss) GetCrcString() string { return "50537301" } +func (*DHCPProxySetVss) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCPProxySetVss) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.TblID + size += 4 // m.VssType + size += 129 // m.VPNAsciiID + size += 4 // m.Oui + size += 4 // m.VPNIndex + size += 1 // m.IsIPv6 + size += 1 // m.IsAdd + return size +} +func (m *DHCPProxySetVss) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.TblID)) + buf.EncodeUint32(uint32(m.VssType)) + buf.EncodeString(m.VPNAsciiID, 129) + buf.EncodeUint32(uint32(m.Oui)) + buf.EncodeUint32(uint32(m.VPNIndex)) + buf.EncodeBool(m.IsIPv6) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *DHCPProxySetVss) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.TblID = buf.DecodeUint32() + m.VssType = VssType(buf.DecodeUint32()) + m.VPNAsciiID = buf.DecodeString(129) + m.Oui = buf.DecodeUint32() + m.VPNIndex = buf.DecodeUint32() + m.IsIPv6 = buf.DecodeBool() + m.IsAdd = buf.DecodeBool() + return nil +} + +// DHCPProxySetVssReply defines message 'dhcp_proxy_set_vss_reply'. +type DHCPProxySetVssReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DHCPProxySetVssReply) Reset() { *m = DHCPProxySetVssReply{} } +func (*DHCPProxySetVssReply) GetMessageName() string { return "dhcp_proxy_set_vss_reply" } +func (*DHCPProxySetVssReply) GetCrcString() string { return "e8d4e804" } +func (*DHCPProxySetVssReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCPProxySetVssReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DHCPProxySetVssReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DHCPProxySetVssReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// WantDHCP6PdReplyEvents defines message 'want_dhcp6_pd_reply_events'. +type WantDHCP6PdReplyEvents struct { + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` +} + +func (m *WantDHCP6PdReplyEvents) Reset() { *m = WantDHCP6PdReplyEvents{} } +func (*WantDHCP6PdReplyEvents) GetMessageName() string { return "want_dhcp6_pd_reply_events" } +func (*WantDHCP6PdReplyEvents) GetCrcString() string { return "c5e2af94" } +func (*WantDHCP6PdReplyEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WantDHCP6PdReplyEvents) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.EnableDisable + size += 4 // m.PID + return size +} +func (m *WantDHCP6PdReplyEvents) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.EnableDisable) + buf.EncodeUint32(uint32(m.PID)) + return buf.Bytes(), nil +} +func (m *WantDHCP6PdReplyEvents) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EnableDisable = buf.DecodeBool() + m.PID = buf.DecodeUint32() + return nil +} + +// WantDHCP6PdReplyEventsReply defines message 'want_dhcp6_pd_reply_events_reply'. +type WantDHCP6PdReplyEventsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WantDHCP6PdReplyEventsReply) Reset() { *m = WantDHCP6PdReplyEventsReply{} } +func (*WantDHCP6PdReplyEventsReply) GetMessageName() string { + return "want_dhcp6_pd_reply_events_reply" +} +func (*WantDHCP6PdReplyEventsReply) GetCrcString() string { return "e8d4e804" } +func (*WantDHCP6PdReplyEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WantDHCP6PdReplyEventsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *WantDHCP6PdReplyEventsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *WantDHCP6PdReplyEventsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// WantDHCP6ReplyEvents defines message 'want_dhcp6_reply_events'. +type WantDHCP6ReplyEvents struct { + EnableDisable uint8 `binapi:"u8,name=enable_disable" json:"enable_disable,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` +} + +func (m *WantDHCP6ReplyEvents) Reset() { *m = WantDHCP6ReplyEvents{} } +func (*WantDHCP6ReplyEvents) GetMessageName() string { return "want_dhcp6_reply_events" } +func (*WantDHCP6ReplyEvents) GetCrcString() string { return "05b454b5" } +func (*WantDHCP6ReplyEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WantDHCP6ReplyEvents) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.EnableDisable + size += 4 // m.PID + return size +} +func (m *WantDHCP6ReplyEvents) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.EnableDisable)) + buf.EncodeUint32(uint32(m.PID)) + return buf.Bytes(), nil +} +func (m *WantDHCP6ReplyEvents) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EnableDisable = buf.DecodeUint8() + m.PID = buf.DecodeUint32() + return nil +} + +// WantDHCP6ReplyEventsReply defines message 'want_dhcp6_reply_events_reply'. +type WantDHCP6ReplyEventsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WantDHCP6ReplyEventsReply) Reset() { *m = WantDHCP6ReplyEventsReply{} } +func (*WantDHCP6ReplyEventsReply) GetMessageName() string { return "want_dhcp6_reply_events_reply" } +func (*WantDHCP6ReplyEventsReply) GetCrcString() string { return "e8d4e804" } +func (*WantDHCP6ReplyEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WantDHCP6ReplyEventsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *WantDHCP6ReplyEventsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *WantDHCP6ReplyEventsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_dhcp_binapi_init() } +func file_dhcp_binapi_init() { + api.RegisterMessage((*DHCP6ClientsEnableDisable)(nil), "dhcp6_clients_enable_disable_b3e225d2") + api.RegisterMessage((*DHCP6ClientsEnableDisableReply)(nil), "dhcp6_clients_enable_disable_reply_e8d4e804") + api.RegisterMessage((*DHCP6DuidLlSet)(nil), "dhcp6_duid_ll_set_0f6ca323") + api.RegisterMessage((*DHCP6DuidLlSetReply)(nil), "dhcp6_duid_ll_set_reply_e8d4e804") + api.RegisterMessage((*DHCP6PdReplyEvent)(nil), "dhcp6_pd_reply_event_cb3e462b") + api.RegisterMessage((*DHCP6PdSendClientMessage)(nil), "dhcp6_pd_send_client_message_064badb8") + api.RegisterMessage((*DHCP6PdSendClientMessageReply)(nil), "dhcp6_pd_send_client_message_reply_e8d4e804") + api.RegisterMessage((*DHCP6ReplyEvent)(nil), "dhcp6_reply_event_9f3af9e5") + api.RegisterMessage((*DHCP6SendClientMessage)(nil), "dhcp6_send_client_message_f6f14ef0") + api.RegisterMessage((*DHCP6SendClientMessageReply)(nil), "dhcp6_send_client_message_reply_e8d4e804") + api.RegisterMessage((*DHCPClientConfig)(nil), "dhcp_client_config_959b80a3") + api.RegisterMessage((*DHCPClientConfigReply)(nil), "dhcp_client_config_reply_e8d4e804") + api.RegisterMessage((*DHCPClientDetails)(nil), "dhcp_client_details_acd82f5a") + api.RegisterMessage((*DHCPClientDump)(nil), "dhcp_client_dump_51077d14") + api.RegisterMessage((*DHCPComplEvent)(nil), "dhcp_compl_event_e908fd1d") + api.RegisterMessage((*DHCPPluginControlPing)(nil), "dhcp_plugin_control_ping_51077d14") + api.RegisterMessage((*DHCPPluginControlPingReply)(nil), "dhcp_plugin_control_ping_reply_f6b0b8ca") + api.RegisterMessage((*DHCPPluginGetVersion)(nil), "dhcp_plugin_get_version_51077d14") + api.RegisterMessage((*DHCPPluginGetVersionReply)(nil), "dhcp_plugin_get_version_reply_9b32cf86") + api.RegisterMessage((*DHCPProxyConfig)(nil), "dhcp_proxy_config_6767230e") + api.RegisterMessage((*DHCPProxyConfigReply)(nil), "dhcp_proxy_config_reply_e8d4e804") + api.RegisterMessage((*DHCPProxyDetails)(nil), "dhcp_proxy_details_ce16f044") + api.RegisterMessage((*DHCPProxyDump)(nil), "dhcp_proxy_dump_5c5b063f") + api.RegisterMessage((*DHCPProxySetVss)(nil), "dhcp_proxy_set_vss_50537301") + api.RegisterMessage((*DHCPProxySetVssReply)(nil), "dhcp_proxy_set_vss_reply_e8d4e804") + api.RegisterMessage((*WantDHCP6PdReplyEvents)(nil), "want_dhcp6_pd_reply_events_c5e2af94") + api.RegisterMessage((*WantDHCP6PdReplyEventsReply)(nil), "want_dhcp6_pd_reply_events_reply_e8d4e804") + api.RegisterMessage((*WantDHCP6ReplyEvents)(nil), "want_dhcp6_reply_events_05b454b5") + api.RegisterMessage((*WantDHCP6ReplyEventsReply)(nil), "want_dhcp6_reply_events_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*DHCP6ClientsEnableDisable)(nil), + (*DHCP6ClientsEnableDisableReply)(nil), + (*DHCP6DuidLlSet)(nil), + (*DHCP6DuidLlSetReply)(nil), + (*DHCP6PdReplyEvent)(nil), + (*DHCP6PdSendClientMessage)(nil), + (*DHCP6PdSendClientMessageReply)(nil), + (*DHCP6ReplyEvent)(nil), + (*DHCP6SendClientMessage)(nil), + (*DHCP6SendClientMessageReply)(nil), + (*DHCPClientConfig)(nil), + (*DHCPClientConfigReply)(nil), + (*DHCPClientDetails)(nil), + (*DHCPClientDump)(nil), + (*DHCPComplEvent)(nil), + (*DHCPPluginControlPing)(nil), + (*DHCPPluginControlPingReply)(nil), + (*DHCPPluginGetVersion)(nil), + (*DHCPPluginGetVersionReply)(nil), + (*DHCPProxyConfig)(nil), + (*DHCPProxyConfigReply)(nil), + (*DHCPProxyDetails)(nil), + (*DHCPProxyDump)(nil), + (*DHCPProxySetVss)(nil), + (*DHCPProxySetVssReply)(nil), + (*WantDHCP6PdReplyEvents)(nil), + (*WantDHCP6PdReplyEventsReply)(nil), + (*WantDHCP6ReplyEvents)(nil), + (*WantDHCP6ReplyEventsReply)(nil), + } +} diff --git a/binapi/dhcp/dhcp_rest.ba.go b/binapi/dhcp/dhcp_rest.ba.go new file mode 100644 index 0000000..4a4d9d1 --- /dev/null +++ b/binapi/dhcp/dhcp_rest.ba.go @@ -0,0 +1,249 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package dhcp + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/dhcp6_clients_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(DHCP6ClientsEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DHCP6ClientsEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dhcp6_duid_ll_set", func(w http.ResponseWriter, req *http.Request) { + var request = new(DHCP6DuidLlSet) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DHCP6DuidLlSet(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dhcp6_pd_send_client_message", func(w http.ResponseWriter, req *http.Request) { + var request = new(DHCP6PdSendClientMessage) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DHCP6PdSendClientMessage(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dhcp6_send_client_message", func(w http.ResponseWriter, req *http.Request) { + var request = new(DHCP6SendClientMessage) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DHCP6SendClientMessage(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dhcp_client_config", func(w http.ResponseWriter, req *http.Request) { + var request = new(DHCPClientConfig) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DHCPClientConfig(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dhcp_plugin_control_ping", func(w http.ResponseWriter, req *http.Request) { + var request = new(DHCPPluginControlPing) + reply, err := rpc.DHCPPluginControlPing(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dhcp_plugin_get_version", func(w http.ResponseWriter, req *http.Request) { + var request = new(DHCPPluginGetVersion) + reply, err := rpc.DHCPPluginGetVersion(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dhcp_proxy_config", func(w http.ResponseWriter, req *http.Request) { + var request = new(DHCPProxyConfig) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DHCPProxyConfig(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dhcp_proxy_set_vss", func(w http.ResponseWriter, req *http.Request) { + var request = new(DHCPProxySetVss) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DHCPProxySetVss(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/want_dhcp6_pd_reply_events", func(w http.ResponseWriter, req *http.Request) { + var request = new(WantDHCP6PdReplyEvents) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.WantDHCP6PdReplyEvents(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/want_dhcp6_reply_events", func(w http.ResponseWriter, req *http.Request) { + var request = new(WantDHCP6ReplyEvents) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.WantDHCP6ReplyEvents(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/dhcp/dhcp_rpc.ba.go b/binapi/dhcp/dhcp_rpc.ba.go new file mode 100644 index 0000000..379bb9b --- /dev/null +++ b/binapi/dhcp/dhcp_rpc.ba.go @@ -0,0 +1,213 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package dhcp + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service dhcp. +type RPCService interface { + DHCP6ClientsEnableDisable(ctx context.Context, in *DHCP6ClientsEnableDisable) (*DHCP6ClientsEnableDisableReply, error) + DHCP6DuidLlSet(ctx context.Context, in *DHCP6DuidLlSet) (*DHCP6DuidLlSetReply, error) + DHCP6PdSendClientMessage(ctx context.Context, in *DHCP6PdSendClientMessage) (*DHCP6PdSendClientMessageReply, error) + DHCP6SendClientMessage(ctx context.Context, in *DHCP6SendClientMessage) (*DHCP6SendClientMessageReply, error) + DHCPClientConfig(ctx context.Context, in *DHCPClientConfig) (*DHCPClientConfigReply, error) + DHCPClientDump(ctx context.Context, in *DHCPClientDump) (RPCService_DHCPClientDumpClient, error) + DHCPPluginControlPing(ctx context.Context, in *DHCPPluginControlPing) (*DHCPPluginControlPingReply, error) + DHCPPluginGetVersion(ctx context.Context, in *DHCPPluginGetVersion) (*DHCPPluginGetVersionReply, error) + DHCPProxyConfig(ctx context.Context, in *DHCPProxyConfig) (*DHCPProxyConfigReply, error) + DHCPProxyDump(ctx context.Context, in *DHCPProxyDump) (RPCService_DHCPProxyDumpClient, error) + DHCPProxySetVss(ctx context.Context, in *DHCPProxySetVss) (*DHCPProxySetVssReply, error) + WantDHCP6PdReplyEvents(ctx context.Context, in *WantDHCP6PdReplyEvents) (*WantDHCP6PdReplyEventsReply, error) + WantDHCP6ReplyEvents(ctx context.Context, in *WantDHCP6ReplyEvents) (*WantDHCP6ReplyEventsReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) DHCP6ClientsEnableDisable(ctx context.Context, in *DHCP6ClientsEnableDisable) (*DHCP6ClientsEnableDisableReply, error) { + out := new(DHCP6ClientsEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCP6DuidLlSet(ctx context.Context, in *DHCP6DuidLlSet) (*DHCP6DuidLlSetReply, error) { + out := new(DHCP6DuidLlSetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCP6PdSendClientMessage(ctx context.Context, in *DHCP6PdSendClientMessage) (*DHCP6PdSendClientMessageReply, error) { + out := new(DHCP6PdSendClientMessageReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCP6SendClientMessage(ctx context.Context, in *DHCP6SendClientMessage) (*DHCP6SendClientMessageReply, error) { + out := new(DHCP6SendClientMessageReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCPClientConfig(ctx context.Context, in *DHCPClientConfig) (*DHCPClientConfigReply, error) { + out := new(DHCPClientConfigReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCPClientDump(ctx context.Context, in *DHCPClientDump) (RPCService_DHCPClientDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_DHCPClientDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_DHCPClientDumpClient interface { + Recv() (*DHCPClientDetails, error) + api.Stream +} + +type serviceClient_DHCPClientDumpClient struct { + api.Stream +} + +func (c *serviceClient_DHCPClientDumpClient) Recv() (*DHCPClientDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *DHCPClientDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) DHCPPluginControlPing(ctx context.Context, in *DHCPPluginControlPing) (*DHCPPluginControlPingReply, error) { + out := new(DHCPPluginControlPingReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCPPluginGetVersion(ctx context.Context, in *DHCPPluginGetVersion) (*DHCPPluginGetVersionReply, error) { + out := new(DHCPPluginGetVersionReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCPProxyConfig(ctx context.Context, in *DHCPProxyConfig) (*DHCPProxyConfigReply, error) { + out := new(DHCPProxyConfigReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCPProxyDump(ctx context.Context, in *DHCPProxyDump) (RPCService_DHCPProxyDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_DHCPProxyDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_DHCPProxyDumpClient interface { + Recv() (*DHCPProxyDetails, error) + api.Stream +} + +type serviceClient_DHCPProxyDumpClient struct { + api.Stream +} + +func (c *serviceClient_DHCPProxyDumpClient) Recv() (*DHCPProxyDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *DHCPProxyDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) DHCPProxySetVss(ctx context.Context, in *DHCPProxySetVss) (*DHCPProxySetVssReply, error) { + out := new(DHCPProxySetVssReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantDHCP6PdReplyEvents(ctx context.Context, in *WantDHCP6PdReplyEvents) (*WantDHCP6PdReplyEventsReply, error) { + out := new(WantDHCP6PdReplyEventsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantDHCP6ReplyEvents(ctx context.Context, in *WantDHCP6ReplyEvents) (*WantDHCP6ReplyEventsReply, error) { + out := new(WantDHCP6ReplyEventsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp.ba.go b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp.ba.go new file mode 100644 index 0000000..41ea756 --- /dev/null +++ b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp.ba.go @@ -0,0 +1,122 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/dhcp6_ia_na_client_cp.api.json + +// Package dhcp6_ia_na_client_cp contains generated bindings for API file dhcp6_ia_na_client_cp.api. +// +// Contents: +// 2 messages +// +package dhcp6_ia_na_client_cp + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "dhcp6_ia_na_client_cp" + APIVersion = "1.0.1" + VersionCrc = 0x7c918b8 +) + +// DHCP6ClientEnableDisable defines message 'dhcp6_client_enable_disable'. +type DHCP6ClientEnableDisable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *DHCP6ClientEnableDisable) Reset() { *m = DHCP6ClientEnableDisable{} } +func (*DHCP6ClientEnableDisable) GetMessageName() string { return "dhcp6_client_enable_disable" } +func (*DHCP6ClientEnableDisable) GetCrcString() string { return "ae6cfcfb" } +func (*DHCP6ClientEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCP6ClientEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Enable + return size +} +func (m *DHCP6ClientEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *DHCP6ClientEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Enable = buf.DecodeBool() + return nil +} + +// DHCP6ClientEnableDisableReply defines message 'dhcp6_client_enable_disable_reply'. +type DHCP6ClientEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DHCP6ClientEnableDisableReply) Reset() { *m = DHCP6ClientEnableDisableReply{} } +func (*DHCP6ClientEnableDisableReply) GetMessageName() string { + return "dhcp6_client_enable_disable_reply" +} +func (*DHCP6ClientEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*DHCP6ClientEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCP6ClientEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DHCP6ClientEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DHCP6ClientEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_dhcp6_ia_na_client_cp_binapi_init() } +func file_dhcp6_ia_na_client_cp_binapi_init() { + api.RegisterMessage((*DHCP6ClientEnableDisable)(nil), "dhcp6_client_enable_disable_ae6cfcfb") + api.RegisterMessage((*DHCP6ClientEnableDisableReply)(nil), "dhcp6_client_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*DHCP6ClientEnableDisable)(nil), + (*DHCP6ClientEnableDisableReply)(nil), + } +} diff --git a/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rest.ba.go b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rest.ba.go new file mode 100644 index 0000000..0fd5ce2 --- /dev/null +++ b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package dhcp6_ia_na_client_cp + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/dhcp6_client_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(DHCP6ClientEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DHCP6ClientEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rpc.ba.go b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rpc.ba.go new file mode 100644 index 0000000..b975236 --- /dev/null +++ b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rpc.ba.go @@ -0,0 +1,30 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package dhcp6_ia_na_client_cp + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service dhcp6_ia_na_client_cp. +type RPCService interface { + DHCP6ClientEnableDisable(ctx context.Context, in *DHCP6ClientEnableDisable) (*DHCP6ClientEnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) DHCP6ClientEnableDisable(ctx context.Context, in *DHCP6ClientEnableDisable) (*DHCP6ClientEnableDisableReply, error) { + out := new(DHCP6ClientEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp.ba.go b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp.ba.go new file mode 100644 index 0000000..73e7fad --- /dev/null +++ b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp.ba.go @@ -0,0 +1,222 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/dhcp6_pd_client_cp.api.json + +// Package dhcp6_pd_client_cp contains generated bindings for API file dhcp6_pd_client_cp.api. +// +// Contents: +// 4 messages +// +package dhcp6_pd_client_cp + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "dhcp6_pd_client_cp" + APIVersion = "2.0.0" + VersionCrc = 0x96f41948 +) + +// DHCP6PdClientEnableDisable defines message 'dhcp6_pd_client_enable_disable'. +type DHCP6PdClientEnableDisable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + PrefixGroup string `binapi:"string[64],name=prefix_group" json:"prefix_group,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *DHCP6PdClientEnableDisable) Reset() { *m = DHCP6PdClientEnableDisable{} } +func (*DHCP6PdClientEnableDisable) GetMessageName() string { return "dhcp6_pd_client_enable_disable" } +func (*DHCP6PdClientEnableDisable) GetCrcString() string { return "a75a0772" } +func (*DHCP6PdClientEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCP6PdClientEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 64 // m.PrefixGroup + size += 1 // m.Enable + return size +} +func (m *DHCP6PdClientEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeString(m.PrefixGroup, 64) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *DHCP6PdClientEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.PrefixGroup = buf.DecodeString(64) + m.Enable = buf.DecodeBool() + return nil +} + +// DHCP6PdClientEnableDisableReply defines message 'dhcp6_pd_client_enable_disable_reply'. +type DHCP6PdClientEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DHCP6PdClientEnableDisableReply) Reset() { *m = DHCP6PdClientEnableDisableReply{} } +func (*DHCP6PdClientEnableDisableReply) GetMessageName() string { + return "dhcp6_pd_client_enable_disable_reply" +} +func (*DHCP6PdClientEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*DHCP6PdClientEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCP6PdClientEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DHCP6PdClientEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DHCP6PdClientEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IP6AddDelAddressUsingPrefix defines message 'ip6_add_del_address_using_prefix'. +type IP6AddDelAddressUsingPrefix struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + PrefixGroup string `binapi:"string[64],name=prefix_group" json:"prefix_group,omitempty"` + AddressWithPrefix ip_types.IP6AddressWithPrefix `binapi:"ip6_address_with_prefix,name=address_with_prefix" json:"address_with_prefix,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *IP6AddDelAddressUsingPrefix) Reset() { *m = IP6AddDelAddressUsingPrefix{} } +func (*IP6AddDelAddressUsingPrefix) GetMessageName() string { + return "ip6_add_del_address_using_prefix" +} +func (*IP6AddDelAddressUsingPrefix) GetCrcString() string { return "9b3d11e0" } +func (*IP6AddDelAddressUsingPrefix) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IP6AddDelAddressUsingPrefix) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 64 // m.PrefixGroup + size += 1 * 16 // m.AddressWithPrefix.Address + size += 1 // m.AddressWithPrefix.Len + size += 1 // m.IsAdd + return size +} +func (m *IP6AddDelAddressUsingPrefix) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeString(m.PrefixGroup, 64) + buf.EncodeBytes(m.AddressWithPrefix.Address[:], 16) + buf.EncodeUint8(uint8(m.AddressWithPrefix.Len)) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *IP6AddDelAddressUsingPrefix) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.PrefixGroup = buf.DecodeString(64) + copy(m.AddressWithPrefix.Address[:], buf.DecodeBytes(16)) + m.AddressWithPrefix.Len = buf.DecodeUint8() + m.IsAdd = buf.DecodeBool() + return nil +} + +// IP6AddDelAddressUsingPrefixReply defines message 'ip6_add_del_address_using_prefix_reply'. +type IP6AddDelAddressUsingPrefixReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IP6AddDelAddressUsingPrefixReply) Reset() { *m = IP6AddDelAddressUsingPrefixReply{} } +func (*IP6AddDelAddressUsingPrefixReply) GetMessageName() string { + return "ip6_add_del_address_using_prefix_reply" +} +func (*IP6AddDelAddressUsingPrefixReply) GetCrcString() string { return "e8d4e804" } +func (*IP6AddDelAddressUsingPrefixReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IP6AddDelAddressUsingPrefixReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IP6AddDelAddressUsingPrefixReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IP6AddDelAddressUsingPrefixReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_dhcp6_pd_client_cp_binapi_init() } +func file_dhcp6_pd_client_cp_binapi_init() { + api.RegisterMessage((*DHCP6PdClientEnableDisable)(nil), "dhcp6_pd_client_enable_disable_a75a0772") + api.RegisterMessage((*DHCP6PdClientEnableDisableReply)(nil), "dhcp6_pd_client_enable_disable_reply_e8d4e804") + api.RegisterMessage((*IP6AddDelAddressUsingPrefix)(nil), "ip6_add_del_address_using_prefix_9b3d11e0") + api.RegisterMessage((*IP6AddDelAddressUsingPrefixReply)(nil), "ip6_add_del_address_using_prefix_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*DHCP6PdClientEnableDisable)(nil), + (*DHCP6PdClientEnableDisableReply)(nil), + (*IP6AddDelAddressUsingPrefix)(nil), + (*IP6AddDelAddressUsingPrefixReply)(nil), + } +} diff --git a/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rest.ba.go b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rest.ba.go new file mode 100644 index 0000000..fa76aa8 --- /dev/null +++ b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package dhcp6_pd_client_cp + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/dhcp6_pd_client_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(DHCP6PdClientEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DHCP6PdClientEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ip6_add_del_address_using_prefix", func(w http.ResponseWriter, req *http.Request) { + var request = new(IP6AddDelAddressUsingPrefix) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IP6AddDelAddressUsingPrefix(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rpc.ba.go b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rpc.ba.go new file mode 100644 index 0000000..7199e5a --- /dev/null +++ b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rpc.ba.go @@ -0,0 +1,40 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package dhcp6_pd_client_cp + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service dhcp6_pd_client_cp. +type RPCService interface { + DHCP6PdClientEnableDisable(ctx context.Context, in *DHCP6PdClientEnableDisable) (*DHCP6PdClientEnableDisableReply, error) + IP6AddDelAddressUsingPrefix(ctx context.Context, in *IP6AddDelAddressUsingPrefix) (*IP6AddDelAddressUsingPrefixReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) DHCP6PdClientEnableDisable(ctx context.Context, in *DHCP6PdClientEnableDisable) (*DHCP6PdClientEnableDisableReply, error) { + out := new(DHCP6PdClientEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IP6AddDelAddressUsingPrefix(ctx context.Context, in *IP6AddDelAddressUsingPrefix) (*IP6AddDelAddressUsingPrefixReply, error) { + out := new(IP6AddDelAddressUsingPrefixReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/dns/dns.ba.go b/binapi/dns/dns.ba.go new file mode 100644 index 0000000..25c8ddf --- /dev/null +++ b/binapi/dns/dns.ba.go @@ -0,0 +1,375 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/dns.api.json + +// Package dns contains generated bindings for API file dns.api. +// +// Contents: +// 8 messages +// +package dns + +import ( + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "dns" + APIVersion = "1.0.0" + VersionCrc = 0x269575cd +) + +// DNSEnableDisable defines message 'dns_enable_disable'. +type DNSEnableDisable struct { + Enable uint8 `binapi:"u8,name=enable" json:"enable,omitempty"` +} + +func (m *DNSEnableDisable) Reset() { *m = DNSEnableDisable{} } +func (*DNSEnableDisable) GetMessageName() string { return "dns_enable_disable" } +func (*DNSEnableDisable) GetCrcString() string { return "8050327d" } +func (*DNSEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DNSEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Enable + return size +} +func (m *DNSEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Enable)) + return buf.Bytes(), nil +} +func (m *DNSEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Enable = buf.DecodeUint8() + return nil +} + +// DNSEnableDisableReply defines message 'dns_enable_disable_reply'. +type DNSEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DNSEnableDisableReply) Reset() { *m = DNSEnableDisableReply{} } +func (*DNSEnableDisableReply) GetMessageName() string { return "dns_enable_disable_reply" } +func (*DNSEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*DNSEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DNSEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DNSEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DNSEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// DNSNameServerAddDel defines message 'dns_name_server_add_del'. +type DNSNameServerAddDel struct { + IsIP6 uint8 `binapi:"u8,name=is_ip6" json:"is_ip6,omitempty"` + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` + ServerAddress []byte `binapi:"u8[16],name=server_address" json:"server_address,omitempty"` +} + +func (m *DNSNameServerAddDel) Reset() { *m = DNSNameServerAddDel{} } +func (*DNSNameServerAddDel) GetMessageName() string { return "dns_name_server_add_del" } +func (*DNSNameServerAddDel) GetCrcString() string { return "3bb05d8c" } +func (*DNSNameServerAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DNSNameServerAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsIP6 + size += 1 // m.IsAdd + size += 1 * 16 // m.ServerAddress + return size +} +func (m *DNSNameServerAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.IsIP6)) + buf.EncodeUint8(uint8(m.IsAdd)) + buf.EncodeBytes(m.ServerAddress[:], 16) + return buf.Bytes(), nil +} +func (m *DNSNameServerAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsIP6 = buf.DecodeUint8() + m.IsAdd = buf.DecodeUint8() + copy(m.ServerAddress[:], buf.DecodeBytes(16)) + return nil +} + +// DNSNameServerAddDelReply defines message 'dns_name_server_add_del_reply'. +type DNSNameServerAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DNSNameServerAddDelReply) Reset() { *m = DNSNameServerAddDelReply{} } +func (*DNSNameServerAddDelReply) GetMessageName() string { return "dns_name_server_add_del_reply" } +func (*DNSNameServerAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*DNSNameServerAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DNSNameServerAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DNSNameServerAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DNSNameServerAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// DNSResolveIP defines message 'dns_resolve_ip'. +type DNSResolveIP struct { + IsIP6 uint8 `binapi:"u8,name=is_ip6" json:"is_ip6,omitempty"` + Address []byte `binapi:"u8[16],name=address" json:"address,omitempty"` +} + +func (m *DNSResolveIP) Reset() { *m = DNSResolveIP{} } +func (*DNSResolveIP) GetMessageName() string { return "dns_resolve_ip" } +func (*DNSResolveIP) GetCrcString() string { return "ae96a1a3" } +func (*DNSResolveIP) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DNSResolveIP) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsIP6 + size += 1 * 16 // m.Address + return size +} +func (m *DNSResolveIP) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.IsIP6)) + buf.EncodeBytes(m.Address[:], 16) + return buf.Bytes(), nil +} +func (m *DNSResolveIP) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsIP6 = buf.DecodeUint8() + copy(m.Address[:], buf.DecodeBytes(16)) + return nil +} + +// DNSResolveIPReply defines message 'dns_resolve_ip_reply'. +type DNSResolveIPReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Name []byte `binapi:"u8[256],name=name" json:"name,omitempty"` +} + +func (m *DNSResolveIPReply) Reset() { *m = DNSResolveIPReply{} } +func (*DNSResolveIPReply) GetMessageName() string { return "dns_resolve_ip_reply" } +func (*DNSResolveIPReply) GetCrcString() string { return "49ed78d6" } +func (*DNSResolveIPReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DNSResolveIPReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 * 256 // m.Name + return size +} +func (m *DNSResolveIPReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBytes(m.Name[:], 256) + return buf.Bytes(), nil +} +func (m *DNSResolveIPReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + copy(m.Name[:], buf.DecodeBytes(256)) + return nil +} + +// DNSResolveName defines message 'dns_resolve_name'. +type DNSResolveName struct { + Name []byte `binapi:"u8[256],name=name" json:"name,omitempty"` +} + +func (m *DNSResolveName) Reset() { *m = DNSResolveName{} } +func (*DNSResolveName) GetMessageName() string { return "dns_resolve_name" } +func (*DNSResolveName) GetCrcString() string { return "c6566676" } +func (*DNSResolveName) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DNSResolveName) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 256 // m.Name + return size +} +func (m *DNSResolveName) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.Name[:], 256) + return buf.Bytes(), nil +} +func (m *DNSResolveName) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.Name[:], buf.DecodeBytes(256)) + return nil +} + +// DNSResolveNameReply defines message 'dns_resolve_name_reply'. +type DNSResolveNameReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IP4Set uint8 `binapi:"u8,name=ip4_set" json:"ip4_set,omitempty"` + IP6Set uint8 `binapi:"u8,name=ip6_set" json:"ip6_set,omitempty"` + IP4Address []byte `binapi:"u8[4],name=ip4_address" json:"ip4_address,omitempty"` + IP6Address []byte `binapi:"u8[16],name=ip6_address" json:"ip6_address,omitempty"` +} + +func (m *DNSResolveNameReply) Reset() { *m = DNSResolveNameReply{} } +func (*DNSResolveNameReply) GetMessageName() string { return "dns_resolve_name_reply" } +func (*DNSResolveNameReply) GetCrcString() string { return "c2d758c3" } +func (*DNSResolveNameReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DNSResolveNameReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.IP4Set + size += 1 // m.IP6Set + size += 1 * 4 // m.IP4Address + size += 1 * 16 // m.IP6Address + return size +} +func (m *DNSResolveNameReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint8(uint8(m.IP4Set)) + buf.EncodeUint8(uint8(m.IP6Set)) + buf.EncodeBytes(m.IP4Address[:], 4) + buf.EncodeBytes(m.IP6Address[:], 16) + return buf.Bytes(), nil +} +func (m *DNSResolveNameReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.IP4Set = buf.DecodeUint8() + m.IP6Set = buf.DecodeUint8() + copy(m.IP4Address[:], buf.DecodeBytes(4)) + copy(m.IP6Address[:], buf.DecodeBytes(16)) + return nil +} + +func init() { file_dns_binapi_init() } +func file_dns_binapi_init() { + api.RegisterMessage((*DNSEnableDisable)(nil), "dns_enable_disable_8050327d") + api.RegisterMessage((*DNSEnableDisableReply)(nil), "dns_enable_disable_reply_e8d4e804") + api.RegisterMessage((*DNSNameServerAddDel)(nil), "dns_name_server_add_del_3bb05d8c") + api.RegisterMessage((*DNSNameServerAddDelReply)(nil), "dns_name_server_add_del_reply_e8d4e804") + api.RegisterMessage((*DNSResolveIP)(nil), "dns_resolve_ip_ae96a1a3") + api.RegisterMessage((*DNSResolveIPReply)(nil), "dns_resolve_ip_reply_49ed78d6") + api.RegisterMessage((*DNSResolveName)(nil), "dns_resolve_name_c6566676") + api.RegisterMessage((*DNSResolveNameReply)(nil), "dns_resolve_name_reply_c2d758c3") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*DNSEnableDisable)(nil), + (*DNSEnableDisableReply)(nil), + (*DNSNameServerAddDel)(nil), + (*DNSNameServerAddDelReply)(nil), + (*DNSResolveIP)(nil), + (*DNSResolveIPReply)(nil), + (*DNSResolveName)(nil), + (*DNSResolveNameReply)(nil), + } +} diff --git a/binapi/dns/dns_rest.ba.go b/binapi/dns/dns_rest.ba.go new file mode 100644 index 0000000..e67d971 --- /dev/null +++ b/binapi/dns/dns_rest.ba.go @@ -0,0 +1,106 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package dns + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/dns_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(DNSEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DNSEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dns_name_server_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(DNSNameServerAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DNSNameServerAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dns_resolve_ip", func(w http.ResponseWriter, req *http.Request) { + var request = new(DNSResolveIP) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DNSResolveIP(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dns_resolve_name", func(w http.ResponseWriter, req *http.Request) { + var request = new(DNSResolveName) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DNSResolveName(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/dns/dns_rpc.ba.go b/binapi/dns/dns_rpc.ba.go new file mode 100644 index 0000000..57760ab --- /dev/null +++ b/binapi/dns/dns_rpc.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package dns + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service dns. +type RPCService interface { + DNSEnableDisable(ctx context.Context, in *DNSEnableDisable) (*DNSEnableDisableReply, error) + DNSNameServerAddDel(ctx context.Context, in *DNSNameServerAddDel) (*DNSNameServerAddDelReply, error) + DNSResolveIP(ctx context.Context, in *DNSResolveIP) (*DNSResolveIPReply, error) + DNSResolveName(ctx context.Context, in *DNSResolveName) (*DNSResolveNameReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) DNSEnableDisable(ctx context.Context, in *DNSEnableDisable) (*DNSEnableDisableReply, error) { + out := new(DNSEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DNSNameServerAddDel(ctx context.Context, in *DNSNameServerAddDel) (*DNSNameServerAddDelReply, error) { + out := new(DNSNameServerAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DNSResolveIP(ctx context.Context, in *DNSResolveIP) (*DNSResolveIPReply, error) { + out := new(DNSResolveIPReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DNSResolveName(ctx context.Context, in *DNSResolveName) (*DNSResolveNameReply, error) { + out := new(DNSResolveNameReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/dslite/dslite.ba.go b/binapi/dslite/dslite.ba.go new file mode 100644 index 0000000..b7aff21 --- /dev/null +++ b/binapi/dslite/dslite.ba.go @@ -0,0 +1,513 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/dslite.api.json + +// Package dslite contains generated bindings for API file dslite.api. +// +// Contents: +// 12 messages +// +package dslite + +import ( + api "git.fd.io/govpp.git/api" + _ "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "dslite" + APIVersion = "1.0.0" + VersionCrc = 0xb62715c5 +) + +// DsliteAddDelPoolAddrRange defines message 'dslite_add_del_pool_addr_range'. +type DsliteAddDelPoolAddrRange struct { + StartAddr ip_types.IP4Address `binapi:"ip4_address,name=start_addr" json:"start_addr,omitempty"` + EndAddr ip_types.IP4Address `binapi:"ip4_address,name=end_addr" json:"end_addr,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *DsliteAddDelPoolAddrRange) Reset() { *m = DsliteAddDelPoolAddrRange{} } +func (*DsliteAddDelPoolAddrRange) GetMessageName() string { return "dslite_add_del_pool_addr_range" } +func (*DsliteAddDelPoolAddrRange) GetCrcString() string { return "c448457a" } +func (*DsliteAddDelPoolAddrRange) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DsliteAddDelPoolAddrRange) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.StartAddr + size += 1 * 4 // m.EndAddr + size += 1 // m.IsAdd + return size +} +func (m *DsliteAddDelPoolAddrRange) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.StartAddr[:], 4) + buf.EncodeBytes(m.EndAddr[:], 4) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *DsliteAddDelPoolAddrRange) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.StartAddr[:], buf.DecodeBytes(4)) + copy(m.EndAddr[:], buf.DecodeBytes(4)) + m.IsAdd = buf.DecodeBool() + return nil +} + +// DsliteAddDelPoolAddrRangeReply defines message 'dslite_add_del_pool_addr_range_reply'. +type DsliteAddDelPoolAddrRangeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DsliteAddDelPoolAddrRangeReply) Reset() { *m = DsliteAddDelPoolAddrRangeReply{} } +func (*DsliteAddDelPoolAddrRangeReply) GetMessageName() string { + return "dslite_add_del_pool_addr_range_reply" +} +func (*DsliteAddDelPoolAddrRangeReply) GetCrcString() string { return "e8d4e804" } +func (*DsliteAddDelPoolAddrRangeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DsliteAddDelPoolAddrRangeReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DsliteAddDelPoolAddrRangeReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DsliteAddDelPoolAddrRangeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// DsliteAddressDetails defines message 'dslite_address_details'. +type DsliteAddressDetails struct { + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` +} + +func (m *DsliteAddressDetails) Reset() { *m = DsliteAddressDetails{} } +func (*DsliteAddressDetails) GetMessageName() string { return "dslite_address_details" } +func (*DsliteAddressDetails) GetCrcString() string { return "ec26d648" } +func (*DsliteAddressDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DsliteAddressDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.IPAddress + return size +} +func (m *DsliteAddressDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.IPAddress[:], 4) + return buf.Bytes(), nil +} +func (m *DsliteAddressDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IPAddress[:], buf.DecodeBytes(4)) + return nil +} + +// DsliteAddressDump defines message 'dslite_address_dump'. +type DsliteAddressDump struct{} + +func (m *DsliteAddressDump) Reset() { *m = DsliteAddressDump{} } +func (*DsliteAddressDump) GetMessageName() string { return "dslite_address_dump" } +func (*DsliteAddressDump) GetCrcString() string { return "51077d14" } +func (*DsliteAddressDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DsliteAddressDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *DsliteAddressDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *DsliteAddressDump) Unmarshal(b []byte) error { + return nil +} + +// DsliteGetAftrAddr defines message 'dslite_get_aftr_addr'. +type DsliteGetAftrAddr struct{} + +func (m *DsliteGetAftrAddr) Reset() { *m = DsliteGetAftrAddr{} } +func (*DsliteGetAftrAddr) GetMessageName() string { return "dslite_get_aftr_addr" } +func (*DsliteGetAftrAddr) GetCrcString() string { return "51077d14" } +func (*DsliteGetAftrAddr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DsliteGetAftrAddr) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *DsliteGetAftrAddr) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *DsliteGetAftrAddr) Unmarshal(b []byte) error { + return nil +} + +// DsliteGetAftrAddrReply defines message 'dslite_get_aftr_addr_reply'. +type DsliteGetAftrAddrReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IP4Addr ip_types.IP4Address `binapi:"ip4_address,name=ip4_addr" json:"ip4_addr,omitempty"` + IP6Addr ip_types.IP6Address `binapi:"ip6_address,name=ip6_addr" json:"ip6_addr,omitempty"` +} + +func (m *DsliteGetAftrAddrReply) Reset() { *m = DsliteGetAftrAddrReply{} } +func (*DsliteGetAftrAddrReply) GetMessageName() string { return "dslite_get_aftr_addr_reply" } +func (*DsliteGetAftrAddrReply) GetCrcString() string { return "38e30db1" } +func (*DsliteGetAftrAddrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DsliteGetAftrAddrReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 * 4 // m.IP4Addr + size += 1 * 16 // m.IP6Addr + return size +} +func (m *DsliteGetAftrAddrReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBytes(m.IP4Addr[:], 4) + buf.EncodeBytes(m.IP6Addr[:], 16) + return buf.Bytes(), nil +} +func (m *DsliteGetAftrAddrReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + copy(m.IP4Addr[:], buf.DecodeBytes(4)) + copy(m.IP6Addr[:], buf.DecodeBytes(16)) + return nil +} + +// DsliteGetB4Addr defines message 'dslite_get_b4_addr'. +type DsliteGetB4Addr struct{} + +func (m *DsliteGetB4Addr) Reset() { *m = DsliteGetB4Addr{} } +func (*DsliteGetB4Addr) GetMessageName() string { return "dslite_get_b4_addr" } +func (*DsliteGetB4Addr) GetCrcString() string { return "51077d14" } +func (*DsliteGetB4Addr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DsliteGetB4Addr) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *DsliteGetB4Addr) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *DsliteGetB4Addr) Unmarshal(b []byte) error { + return nil +} + +// DsliteGetB4AddrReply defines message 'dslite_get_b4_addr_reply'. +type DsliteGetB4AddrReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IP4Addr ip_types.IP4Address `binapi:"ip4_address,name=ip4_addr" json:"ip4_addr,omitempty"` + IP6Addr ip_types.IP6Address `binapi:"ip6_address,name=ip6_addr" json:"ip6_addr,omitempty"` +} + +func (m *DsliteGetB4AddrReply) Reset() { *m = DsliteGetB4AddrReply{} } +func (*DsliteGetB4AddrReply) GetMessageName() string { return "dslite_get_b4_addr_reply" } +func (*DsliteGetB4AddrReply) GetCrcString() string { return "38e30db1" } +func (*DsliteGetB4AddrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DsliteGetB4AddrReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 * 4 // m.IP4Addr + size += 1 * 16 // m.IP6Addr + return size +} +func (m *DsliteGetB4AddrReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBytes(m.IP4Addr[:], 4) + buf.EncodeBytes(m.IP6Addr[:], 16) + return buf.Bytes(), nil +} +func (m *DsliteGetB4AddrReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + copy(m.IP4Addr[:], buf.DecodeBytes(4)) + copy(m.IP6Addr[:], buf.DecodeBytes(16)) + return nil +} + +// DsliteSetAftrAddr defines message 'dslite_set_aftr_addr'. +type DsliteSetAftrAddr struct { + IP4Addr ip_types.IP4Address `binapi:"ip4_address,name=ip4_addr" json:"ip4_addr,omitempty"` + IP6Addr ip_types.IP6Address `binapi:"ip6_address,name=ip6_addr" json:"ip6_addr,omitempty"` +} + +func (m *DsliteSetAftrAddr) Reset() { *m = DsliteSetAftrAddr{} } +func (*DsliteSetAftrAddr) GetMessageName() string { return "dslite_set_aftr_addr" } +func (*DsliteSetAftrAddr) GetCrcString() string { return "1e955f8d" } +func (*DsliteSetAftrAddr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DsliteSetAftrAddr) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.IP4Addr + size += 1 * 16 // m.IP6Addr + return size +} +func (m *DsliteSetAftrAddr) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.IP4Addr[:], 4) + buf.EncodeBytes(m.IP6Addr[:], 16) + return buf.Bytes(), nil +} +func (m *DsliteSetAftrAddr) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IP4Addr[:], buf.DecodeBytes(4)) + copy(m.IP6Addr[:], buf.DecodeBytes(16)) + return nil +} + +// DsliteSetAftrAddrReply defines message 'dslite_set_aftr_addr_reply'. +type DsliteSetAftrAddrReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DsliteSetAftrAddrReply) Reset() { *m = DsliteSetAftrAddrReply{} } +func (*DsliteSetAftrAddrReply) GetMessageName() string { return "dslite_set_aftr_addr_reply" } +func (*DsliteSetAftrAddrReply) GetCrcString() string { return "e8d4e804" } +func (*DsliteSetAftrAddrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DsliteSetAftrAddrReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DsliteSetAftrAddrReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DsliteSetAftrAddrReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// DsliteSetB4Addr defines message 'dslite_set_b4_addr'. +type DsliteSetB4Addr struct { + IP4Addr ip_types.IP4Address `binapi:"ip4_address,name=ip4_addr" json:"ip4_addr,omitempty"` + IP6Addr ip_types.IP6Address `binapi:"ip6_address,name=ip6_addr" json:"ip6_addr,omitempty"` +} + +func (m *DsliteSetB4Addr) Reset() { *m = DsliteSetB4Addr{} } +func (*DsliteSetB4Addr) GetMessageName() string { return "dslite_set_b4_addr" } +func (*DsliteSetB4Addr) GetCrcString() string { return "1e955f8d" } +func (*DsliteSetB4Addr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DsliteSetB4Addr) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.IP4Addr + size += 1 * 16 // m.IP6Addr + return size +} +func (m *DsliteSetB4Addr) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.IP4Addr[:], 4) + buf.EncodeBytes(m.IP6Addr[:], 16) + return buf.Bytes(), nil +} +func (m *DsliteSetB4Addr) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IP4Addr[:], buf.DecodeBytes(4)) + copy(m.IP6Addr[:], buf.DecodeBytes(16)) + return nil +} + +// DsliteSetB4AddrReply defines message 'dslite_set_b4_addr_reply'. +type DsliteSetB4AddrReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DsliteSetB4AddrReply) Reset() { *m = DsliteSetB4AddrReply{} } +func (*DsliteSetB4AddrReply) GetMessageName() string { return "dslite_set_b4_addr_reply" } +func (*DsliteSetB4AddrReply) GetCrcString() string { return "e8d4e804" } +func (*DsliteSetB4AddrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DsliteSetB4AddrReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DsliteSetB4AddrReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DsliteSetB4AddrReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_dslite_binapi_init() } +func file_dslite_binapi_init() { + api.RegisterMessage((*DsliteAddDelPoolAddrRange)(nil), "dslite_add_del_pool_addr_range_c448457a") + api.RegisterMessage((*DsliteAddDelPoolAddrRangeReply)(nil), "dslite_add_del_pool_addr_range_reply_e8d4e804") + api.RegisterMessage((*DsliteAddressDetails)(nil), "dslite_address_details_ec26d648") + api.RegisterMessage((*DsliteAddressDump)(nil), "dslite_address_dump_51077d14") + api.RegisterMessage((*DsliteGetAftrAddr)(nil), "dslite_get_aftr_addr_51077d14") + api.RegisterMessage((*DsliteGetAftrAddrReply)(nil), "dslite_get_aftr_addr_reply_38e30db1") + api.RegisterMessage((*DsliteGetB4Addr)(nil), "dslite_get_b4_addr_51077d14") + api.RegisterMessage((*DsliteGetB4AddrReply)(nil), "dslite_get_b4_addr_reply_38e30db1") + api.RegisterMessage((*DsliteSetAftrAddr)(nil), "dslite_set_aftr_addr_1e955f8d") + api.RegisterMessage((*DsliteSetAftrAddrReply)(nil), "dslite_set_aftr_addr_reply_e8d4e804") + api.RegisterMessage((*DsliteSetB4Addr)(nil), "dslite_set_b4_addr_1e955f8d") + api.RegisterMessage((*DsliteSetB4AddrReply)(nil), "dslite_set_b4_addr_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*DsliteAddDelPoolAddrRange)(nil), + (*DsliteAddDelPoolAddrRangeReply)(nil), + (*DsliteAddressDetails)(nil), + (*DsliteAddressDump)(nil), + (*DsliteGetAftrAddr)(nil), + (*DsliteGetAftrAddrReply)(nil), + (*DsliteGetB4Addr)(nil), + (*DsliteGetB4AddrReply)(nil), + (*DsliteSetAftrAddr)(nil), + (*DsliteSetAftrAddrReply)(nil), + (*DsliteSetB4Addr)(nil), + (*DsliteSetB4AddrReply)(nil), + } +} diff --git a/binapi/dslite/dslite_rest.ba.go b/binapi/dslite/dslite_rest.ba.go new file mode 100644 index 0000000..eba86b0 --- /dev/null +++ b/binapi/dslite/dslite_rest.ba.go @@ -0,0 +1,111 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package dslite + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/dslite_add_del_pool_addr_range", func(w http.ResponseWriter, req *http.Request) { + var request = new(DsliteAddDelPoolAddrRange) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DsliteAddDelPoolAddrRange(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dslite_get_aftr_addr", func(w http.ResponseWriter, req *http.Request) { + var request = new(DsliteGetAftrAddr) + reply, err := rpc.DsliteGetAftrAddr(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dslite_get_b4_addr", func(w http.ResponseWriter, req *http.Request) { + var request = new(DsliteGetB4Addr) + reply, err := rpc.DsliteGetB4Addr(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dslite_set_aftr_addr", func(w http.ResponseWriter, req *http.Request) { + var request = new(DsliteSetAftrAddr) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DsliteSetAftrAddr(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dslite_set_b4_addr", func(w http.ResponseWriter, req *http.Request) { + var request = new(DsliteSetB4Addr) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DsliteSetB4Addr(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/dslite/dslite_rpc.ba.go b/binapi/dslite/dslite_rpc.ba.go new file mode 100644 index 0000000..7f6e90e --- /dev/null +++ b/binapi/dslite/dslite_rpc.ba.go @@ -0,0 +1,113 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package dslite + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service dslite. +type RPCService interface { + DsliteAddDelPoolAddrRange(ctx context.Context, in *DsliteAddDelPoolAddrRange) (*DsliteAddDelPoolAddrRangeReply, error) + DsliteAddressDump(ctx context.Context, in *DsliteAddressDump) (RPCService_DsliteAddressDumpClient, error) + DsliteGetAftrAddr(ctx context.Context, in *DsliteGetAftrAddr) (*DsliteGetAftrAddrReply, error) + DsliteGetB4Addr(ctx context.Context, in *DsliteGetB4Addr) (*DsliteGetB4AddrReply, error) + DsliteSetAftrAddr(ctx context.Context, in *DsliteSetAftrAddr) (*DsliteSetAftrAddrReply, error) + DsliteSetB4Addr(ctx context.Context, in *DsliteSetB4Addr) (*DsliteSetB4AddrReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) DsliteAddDelPoolAddrRange(ctx context.Context, in *DsliteAddDelPoolAddrRange) (*DsliteAddDelPoolAddrRangeReply, error) { + out := new(DsliteAddDelPoolAddrRangeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DsliteAddressDump(ctx context.Context, in *DsliteAddressDump) (RPCService_DsliteAddressDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_DsliteAddressDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_DsliteAddressDumpClient interface { + Recv() (*DsliteAddressDetails, error) + api.Stream +} + +type serviceClient_DsliteAddressDumpClient struct { + api.Stream +} + +func (c *serviceClient_DsliteAddressDumpClient) Recv() (*DsliteAddressDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *DsliteAddressDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) DsliteGetAftrAddr(ctx context.Context, in *DsliteGetAftrAddr) (*DsliteGetAftrAddrReply, error) { + out := new(DsliteGetAftrAddrReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DsliteGetB4Addr(ctx context.Context, in *DsliteGetB4Addr) (*DsliteGetB4AddrReply, error) { + out := new(DsliteGetB4AddrReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DsliteSetAftrAddr(ctx context.Context, in *DsliteSetAftrAddr) (*DsliteSetAftrAddrReply, error) { + out := new(DsliteSetAftrAddrReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DsliteSetB4Addr(ctx context.Context, in *DsliteSetB4Addr) (*DsliteSetB4AddrReply, error) { + out := new(DsliteSetB4AddrReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/ethernet_types/ethernet_types.ba.go b/binapi/ethernet_types/ethernet_types.ba.go new file mode 100644 index 0000000..b54b1ef --- /dev/null +++ b/binapi/ethernet_types/ethernet_types.ba.go @@ -0,0 +1,53 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/ethernet_types.api.json + +// Package ethernet_types contains generated bindings for API file ethernet_types.api. +// +// Contents: +// 1 alias +// +package ethernet_types + +import ( + api "git.fd.io/govpp.git/api" + "net" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +// MacAddress defines alias 'mac_address'. +type MacAddress [6]uint8 + +func ParseMacAddress(s string) (MacAddress, error) { + var macaddr MacAddress + mac, err := net.ParseMAC(s) + if err != nil { + return macaddr, err + } + copy(macaddr[:], mac[:]) + return macaddr, nil +} +func (x MacAddress) ToMAC() net.HardwareAddr { + return net.HardwareAddr(x[:]) +} +func (x MacAddress) String() string { + return x.ToMAC().String() +} +func (x *MacAddress) MarshalText() ([]byte, error) { + return []byte(x.String()), nil +} +func (x *MacAddress) UnmarshalText(text []byte) error { + mac, err := ParseMacAddress(string(text)) + if err != nil { + return err + } + *x = mac + return nil +} diff --git a/binapi/feature/feature.ba.go b/binapi/feature/feature.ba.go new file mode 100644 index 0000000..4d16ce8 --- /dev/null +++ b/binapi/feature/feature.ba.go @@ -0,0 +1,128 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/feature.api.json + +// Package feature contains generated bindings for API file feature.api. +// +// Contents: +// 2 messages +// +package feature + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "feature" + APIVersion = "1.0.2" + VersionCrc = 0x8dd9f8ab +) + +// FeatureEnableDisable defines message 'feature_enable_disable'. +type FeatureEnableDisable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` + ArcName string `binapi:"string[64],name=arc_name" json:"arc_name,omitempty"` + FeatureName string `binapi:"string[64],name=feature_name" json:"feature_name,omitempty"` +} + +func (m *FeatureEnableDisable) Reset() { *m = FeatureEnableDisable{} } +func (*FeatureEnableDisable) GetMessageName() string { return "feature_enable_disable" } +func (*FeatureEnableDisable) GetCrcString() string { return "7531c862" } +func (*FeatureEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *FeatureEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Enable + size += 64 // m.ArcName + size += 64 // m.FeatureName + return size +} +func (m *FeatureEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.Enable) + buf.EncodeString(m.ArcName, 64) + buf.EncodeString(m.FeatureName, 64) + return buf.Bytes(), nil +} +func (m *FeatureEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Enable = buf.DecodeBool() + m.ArcName = buf.DecodeString(64) + m.FeatureName = buf.DecodeString(64) + return nil +} + +// FeatureEnableDisableReply defines message 'feature_enable_disable_reply'. +type FeatureEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *FeatureEnableDisableReply) Reset() { *m = FeatureEnableDisableReply{} } +func (*FeatureEnableDisableReply) GetMessageName() string { return "feature_enable_disable_reply" } +func (*FeatureEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*FeatureEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *FeatureEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *FeatureEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *FeatureEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_feature_binapi_init() } +func file_feature_binapi_init() { + api.RegisterMessage((*FeatureEnableDisable)(nil), "feature_enable_disable_7531c862") + api.RegisterMessage((*FeatureEnableDisableReply)(nil), "feature_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*FeatureEnableDisable)(nil), + (*FeatureEnableDisableReply)(nil), + } +} diff --git a/binapi/feature/feature_rest.ba.go b/binapi/feature/feature_rest.ba.go new file mode 100644 index 0000000..a1b0604 --- /dev/null +++ b/binapi/feature/feature_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package feature + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/feature_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(FeatureEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.FeatureEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/feature/feature_rpc.ba.go b/binapi/feature/feature_rpc.ba.go new file mode 100644 index 0000000..cd91188 --- /dev/null +++ b/binapi/feature/feature_rpc.ba.go @@ -0,0 +1,30 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package feature + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service feature. +type RPCService interface { + FeatureEnableDisable(ctx context.Context, in *FeatureEnableDisable) (*FeatureEnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) FeatureEnableDisable(ctx context.Context, in *FeatureEnableDisable) (*FeatureEnableDisableReply, error) { + out := new(FeatureEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/fib_types/fib_types.ba.go b/binapi/fib_types/fib_types.ba.go new file mode 100644 index 0000000..eb67597 --- /dev/null +++ b/binapi/fib_types/fib_types.ba.go @@ -0,0 +1,198 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/fib_types.api.json + +// Package fib_types contains generated bindings for API file fib_types.api. +// +// Contents: +// 3 enums +// 3 structs +// +package fib_types + +import ( + api "git.fd.io/govpp.git/api" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +// FibPathFlags defines enum 'fib_path_flags'. +type FibPathFlags uint32 + +const ( + FIB_API_PATH_FLAG_NONE FibPathFlags = 0 + FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED FibPathFlags = 1 + FIB_API_PATH_FLAG_RESOLVE_VIA_HOST FibPathFlags = 2 + FIB_API_PATH_FLAG_POP_PW_CW FibPathFlags = 4 +) + +var ( + FibPathFlags_name = map[uint32]string{ + 0: "FIB_API_PATH_FLAG_NONE", + 1: "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED", + 2: "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST", + 4: "FIB_API_PATH_FLAG_POP_PW_CW", + } + FibPathFlags_value = map[string]uint32{ + "FIB_API_PATH_FLAG_NONE": 0, + "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED": 1, + "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST": 2, + "FIB_API_PATH_FLAG_POP_PW_CW": 4, + } +) + +func (x FibPathFlags) String() string { + s, ok := FibPathFlags_name[uint32(x)] + if ok { + return s + } + str := func(n uint32) string { + s, ok := FibPathFlags_name[uint32(n)] + if ok { + return s + } + return "FibPathFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint32(0); i <= 32; i++ { + val := uint32(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint32(x)) + } + return s +} + +// FibPathNhProto defines enum 'fib_path_nh_proto'. +type FibPathNhProto uint32 + +const ( + FIB_API_PATH_NH_PROTO_IP4 FibPathNhProto = 0 + FIB_API_PATH_NH_PROTO_IP6 FibPathNhProto = 1 + FIB_API_PATH_NH_PROTO_MPLS FibPathNhProto = 2 + FIB_API_PATH_NH_PROTO_ETHERNET FibPathNhProto = 3 + FIB_API_PATH_NH_PROTO_BIER FibPathNhProto = 4 +) + +var ( + FibPathNhProto_name = map[uint32]string{ + 0: "FIB_API_PATH_NH_PROTO_IP4", + 1: "FIB_API_PATH_NH_PROTO_IP6", + 2: "FIB_API_PATH_NH_PROTO_MPLS", + 3: "FIB_API_PATH_NH_PROTO_ETHERNET", + 4: "FIB_API_PATH_NH_PROTO_BIER", + } + FibPathNhProto_value = map[string]uint32{ + "FIB_API_PATH_NH_PROTO_IP4": 0, + "FIB_API_PATH_NH_PROTO_IP6": 1, + "FIB_API_PATH_NH_PROTO_MPLS": 2, + "FIB_API_PATH_NH_PROTO_ETHERNET": 3, + "FIB_API_PATH_NH_PROTO_BIER": 4, + } +) + +func (x FibPathNhProto) String() string { + s, ok := FibPathNhProto_name[uint32(x)] + if ok { + return s + } + return "FibPathNhProto(" + strconv.Itoa(int(x)) + ")" +} + +// FibPathType defines enum 'fib_path_type'. +type FibPathType uint32 + +const ( + FIB_API_PATH_TYPE_NORMAL FibPathType = 0 + FIB_API_PATH_TYPE_LOCAL FibPathType = 1 + FIB_API_PATH_TYPE_DROP FibPathType = 2 + FIB_API_PATH_TYPE_UDP_ENCAP FibPathType = 3 + FIB_API_PATH_TYPE_BIER_IMP FibPathType = 4 + FIB_API_PATH_TYPE_ICMP_UNREACH FibPathType = 5 + FIB_API_PATH_TYPE_ICMP_PROHIBIT FibPathType = 6 + FIB_API_PATH_TYPE_SOURCE_LOOKUP FibPathType = 7 + FIB_API_PATH_TYPE_DVR FibPathType = 8 + FIB_API_PATH_TYPE_INTERFACE_RX FibPathType = 9 + FIB_API_PATH_TYPE_CLASSIFY FibPathType = 10 +) + +var ( + FibPathType_name = map[uint32]string{ + 0: "FIB_API_PATH_TYPE_NORMAL", + 1: "FIB_API_PATH_TYPE_LOCAL", + 2: "FIB_API_PATH_TYPE_DROP", + 3: "FIB_API_PATH_TYPE_UDP_ENCAP", + 4: "FIB_API_PATH_TYPE_BIER_IMP", + 5: "FIB_API_PATH_TYPE_ICMP_UNREACH", + 6: "FIB_API_PATH_TYPE_ICMP_PROHIBIT", + 7: "FIB_API_PATH_TYPE_SOURCE_LOOKUP", + 8: "FIB_API_PATH_TYPE_DVR", + 9: "FIB_API_PATH_TYPE_INTERFACE_RX", + 10: "FIB_API_PATH_TYPE_CLASSIFY", + } + FibPathType_value = map[string]uint32{ + "FIB_API_PATH_TYPE_NORMAL": 0, + "FIB_API_PATH_TYPE_LOCAL": 1, + "FIB_API_PATH_TYPE_DROP": 2, + "FIB_API_PATH_TYPE_UDP_ENCAP": 3, + "FIB_API_PATH_TYPE_BIER_IMP": 4, + "FIB_API_PATH_TYPE_ICMP_UNREACH": 5, + "FIB_API_PATH_TYPE_ICMP_PROHIBIT": 6, + "FIB_API_PATH_TYPE_SOURCE_LOOKUP": 7, + "FIB_API_PATH_TYPE_DVR": 8, + "FIB_API_PATH_TYPE_INTERFACE_RX": 9, + "FIB_API_PATH_TYPE_CLASSIFY": 10, + } +) + +func (x FibPathType) String() string { + s, ok := FibPathType_name[uint32(x)] + if ok { + return s + } + return "FibPathType(" + strconv.Itoa(int(x)) + ")" +} + +// FibMplsLabel defines type 'fib_mpls_label'. +type FibMplsLabel struct { + IsUniform uint8 `binapi:"u8,name=is_uniform" json:"is_uniform,omitempty"` + Label uint32 `binapi:"u32,name=label" json:"label,omitempty"` + TTL uint8 `binapi:"u8,name=ttl" json:"ttl,omitempty"` + Exp uint8 `binapi:"u8,name=exp" json:"exp,omitempty"` +} + +// FibPath defines type 'fib_path'. +type FibPath struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + RpfID uint32 `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"` + Weight uint8 `binapi:"u8,name=weight" json:"weight,omitempty"` + Preference uint8 `binapi:"u8,name=preference" json:"preference,omitempty"` + Type FibPathType `binapi:"fib_path_type,name=type" json:"type,omitempty"` + Flags FibPathFlags `binapi:"fib_path_flags,name=flags" json:"flags,omitempty"` + Proto FibPathNhProto `binapi:"fib_path_nh_proto,name=proto" json:"proto,omitempty"` + Nh FibPathNh `binapi:"fib_path_nh,name=nh" json:"nh,omitempty"` + NLabels uint8 `binapi:"u8,name=n_labels" json:"n_labels,omitempty"` + LabelStack [16]FibMplsLabel `binapi:"fib_mpls_label[16],name=label_stack" json:"label_stack,omitempty"` +} + +// FibPathNh defines type 'fib_path_nh'. +type FibPathNh struct { + Address ip_types.AddressUnion `binapi:"address_union,name=address" json:"address,omitempty"` + ViaLabel uint32 `binapi:"u32,name=via_label" json:"via_label,omitempty"` + ObjID uint32 `binapi:"u32,name=obj_id" json:"obj_id,omitempty"` + ClassifyTableIndex uint32 `binapi:"u32,name=classify_table_index" json:"classify_table_index,omitempty"` +} diff --git a/binapi/flowprobe/flowprobe.ba.go b/binapi/flowprobe/flowprobe.ba.go new file mode 100644 index 0000000..c7073f2 --- /dev/null +++ b/binapi/flowprobe/flowprobe.ba.go @@ -0,0 +1,310 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/flowprobe.api.json + +// Package flowprobe contains generated bindings for API file flowprobe.api. +// +// Contents: +// 2 enums +// 4 messages +// +package flowprobe + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "flowprobe" + APIVersion = "1.0.0" + VersionCrc = 0xe904179b +) + +// FlowprobeRecordFlags defines enum 'flowprobe_record_flags'. +type FlowprobeRecordFlags uint8 + +const ( + FLOWPROBE_RECORD_FLAG_L2 FlowprobeRecordFlags = 1 + FLOWPROBE_RECORD_FLAG_L3 FlowprobeRecordFlags = 2 + FLOWPROBE_RECORD_FLAG_L4 FlowprobeRecordFlags = 4 +) + +var ( + FlowprobeRecordFlags_name = map[uint8]string{ + 1: "FLOWPROBE_RECORD_FLAG_L2", + 2: "FLOWPROBE_RECORD_FLAG_L3", + 4: "FLOWPROBE_RECORD_FLAG_L4", + } + FlowprobeRecordFlags_value = map[string]uint8{ + "FLOWPROBE_RECORD_FLAG_L2": 1, + "FLOWPROBE_RECORD_FLAG_L3": 2, + "FLOWPROBE_RECORD_FLAG_L4": 4, + } +) + +func (x FlowprobeRecordFlags) String() string { + s, ok := FlowprobeRecordFlags_name[uint8(x)] + if ok { + return s + } + str := func(n uint8) string { + s, ok := FlowprobeRecordFlags_name[uint8(n)] + if ok { + return s + } + return "FlowprobeRecordFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint8(0); i <= 8; i++ { + val := uint8(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint8(x)) + } + return s +} + +// FlowprobeWhichFlags defines enum 'flowprobe_which_flags'. +type FlowprobeWhichFlags uint8 + +const ( + FLOWPROBE_WHICH_FLAG_IP4 FlowprobeWhichFlags = 1 + FLOWPROBE_WHICH_FLAG_L2 FlowprobeWhichFlags = 2 + FLOWPROBE_WHICH_FLAG_IP6 FlowprobeWhichFlags = 4 +) + +var ( + FlowprobeWhichFlags_name = map[uint8]string{ + 1: "FLOWPROBE_WHICH_FLAG_IP4", + 2: "FLOWPROBE_WHICH_FLAG_L2", + 4: "FLOWPROBE_WHICH_FLAG_IP6", + } + FlowprobeWhichFlags_value = map[string]uint8{ + "FLOWPROBE_WHICH_FLAG_IP4": 1, + "FLOWPROBE_WHICH_FLAG_L2": 2, + "FLOWPROBE_WHICH_FLAG_IP6": 4, + } +) + +func (x FlowprobeWhichFlags) String() string { + s, ok := FlowprobeWhichFlags_name[uint8(x)] + if ok { + return s + } + str := func(n uint8) string { + s, ok := FlowprobeWhichFlags_name[uint8(n)] + if ok { + return s + } + return "FlowprobeWhichFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint8(0); i <= 8; i++ { + val := uint8(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint8(x)) + } + return s +} + +// FlowprobeParams defines message 'flowprobe_params'. +type FlowprobeParams struct { + RecordFlags FlowprobeRecordFlags `binapi:"flowprobe_record_flags,name=record_flags" json:"record_flags,omitempty"` + ActiveTimer uint32 `binapi:"u32,name=active_timer" json:"active_timer,omitempty"` + PassiveTimer uint32 `binapi:"u32,name=passive_timer" json:"passive_timer,omitempty"` +} + +func (m *FlowprobeParams) Reset() { *m = FlowprobeParams{} } +func (*FlowprobeParams) GetMessageName() string { return "flowprobe_params" } +func (*FlowprobeParams) GetCrcString() string { return "baa46c09" } +func (*FlowprobeParams) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *FlowprobeParams) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.RecordFlags + size += 4 // m.ActiveTimer + size += 4 // m.PassiveTimer + return size +} +func (m *FlowprobeParams) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.RecordFlags)) + buf.EncodeUint32(uint32(m.ActiveTimer)) + buf.EncodeUint32(uint32(m.PassiveTimer)) + return buf.Bytes(), nil +} +func (m *FlowprobeParams) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.RecordFlags = FlowprobeRecordFlags(buf.DecodeUint8()) + m.ActiveTimer = buf.DecodeUint32() + m.PassiveTimer = buf.DecodeUint32() + return nil +} + +// FlowprobeParamsReply defines message 'flowprobe_params_reply'. +type FlowprobeParamsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *FlowprobeParamsReply) Reset() { *m = FlowprobeParamsReply{} } +func (*FlowprobeParamsReply) GetMessageName() string { return "flowprobe_params_reply" } +func (*FlowprobeParamsReply) GetCrcString() string { return "e8d4e804" } +func (*FlowprobeParamsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *FlowprobeParamsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *FlowprobeParamsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *FlowprobeParamsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// FlowprobeTxInterfaceAddDel defines message 'flowprobe_tx_interface_add_del'. +type FlowprobeTxInterfaceAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Which FlowprobeWhichFlags `binapi:"flowprobe_which_flags,name=which" json:"which,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *FlowprobeTxInterfaceAddDel) Reset() { *m = FlowprobeTxInterfaceAddDel{} } +func (*FlowprobeTxInterfaceAddDel) GetMessageName() string { return "flowprobe_tx_interface_add_del" } +func (*FlowprobeTxInterfaceAddDel) GetCrcString() string { return "b782c976" } +func (*FlowprobeTxInterfaceAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *FlowprobeTxInterfaceAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.Which + size += 4 // m.SwIfIndex + return size +} +func (m *FlowprobeTxInterfaceAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.Which)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *FlowprobeTxInterfaceAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Which = FlowprobeWhichFlags(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// FlowprobeTxInterfaceAddDelReply defines message 'flowprobe_tx_interface_add_del_reply'. +type FlowprobeTxInterfaceAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *FlowprobeTxInterfaceAddDelReply) Reset() { *m = FlowprobeTxInterfaceAddDelReply{} } +func (*FlowprobeTxInterfaceAddDelReply) GetMessageName() string { + return "flowprobe_tx_interface_add_del_reply" +} +func (*FlowprobeTxInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*FlowprobeTxInterfaceAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *FlowprobeTxInterfaceAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *FlowprobeTxInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *FlowprobeTxInterfaceAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_flowprobe_binapi_init() } +func file_flowprobe_binapi_init() { + api.RegisterMessage((*FlowprobeParams)(nil), "flowprobe_params_baa46c09") + api.RegisterMessage((*FlowprobeParamsReply)(nil), "flowprobe_params_reply_e8d4e804") + api.RegisterMessage((*FlowprobeTxInterfaceAddDel)(nil), "flowprobe_tx_interface_add_del_b782c976") + api.RegisterMessage((*FlowprobeTxInterfaceAddDelReply)(nil), "flowprobe_tx_interface_add_del_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*FlowprobeParams)(nil), + (*FlowprobeParamsReply)(nil), + (*FlowprobeTxInterfaceAddDel)(nil), + (*FlowprobeTxInterfaceAddDelReply)(nil), + } +} diff --git a/binapi/flowprobe/flowprobe_rest.ba.go b/binapi/flowprobe/flowprobe_rest.ba.go new file mode 100644 index 0000000..3de76b9 --- /dev/null +++ b/binapi/flowprobe/flowprobe_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package flowprobe + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/flowprobe_params", func(w http.ResponseWriter, req *http.Request) { + var request = new(FlowprobeParams) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.FlowprobeParams(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/flowprobe_tx_interface_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(FlowprobeTxInterfaceAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.FlowprobeTxInterfaceAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/flowprobe/flowprobe_rpc.ba.go b/binapi/flowprobe/flowprobe_rpc.ba.go new file mode 100644 index 0000000..42c6887 --- /dev/null +++ b/binapi/flowprobe/flowprobe_rpc.ba.go @@ -0,0 +1,40 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package flowprobe + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service flowprobe. +type RPCService interface { + FlowprobeParams(ctx context.Context, in *FlowprobeParams) (*FlowprobeParamsReply, error) + FlowprobeTxInterfaceAddDel(ctx context.Context, in *FlowprobeTxInterfaceAddDel) (*FlowprobeTxInterfaceAddDelReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) FlowprobeParams(ctx context.Context, in *FlowprobeParams) (*FlowprobeParamsReply, error) { + out := new(FlowprobeParamsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) FlowprobeTxInterfaceAddDel(ctx context.Context, in *FlowprobeTxInterfaceAddDel) (*FlowprobeTxInterfaceAddDelReply, error) { + out := new(FlowprobeTxInterfaceAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/gbp/gbp.ba.go b/binapi/gbp/gbp.ba.go new file mode 100644 index 0000000..5baa4f5 --- /dev/null +++ b/binapi/gbp/gbp.ba.go @@ -0,0 +1,2681 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/gbp.api.json + +// Package gbp contains generated bindings for API file gbp.api. +// +// Contents: +// 1 alias +// 7 enums +// 14 structs +// 48 messages +// +package gbp + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "gbp" + APIVersion = "2.0.0" + VersionCrc = 0xa084c6b0 +) + +// GbpBridgeDomainFlags defines enum 'gbp_bridge_domain_flags'. +type GbpBridgeDomainFlags uint32 + +const ( + GBP_BD_API_FLAG_NONE GbpBridgeDomainFlags = 0 + GBP_BD_API_FLAG_DO_NOT_LEARN GbpBridgeDomainFlags = 1 + GBP_BD_API_FLAG_UU_FWD_DROP GbpBridgeDomainFlags = 2 + GBP_BD_API_FLAG_MCAST_DROP GbpBridgeDomainFlags = 4 + GBP_BD_API_FLAG_UCAST_ARP GbpBridgeDomainFlags = 8 +) + +var ( + GbpBridgeDomainFlags_name = map[uint32]string{ + 0: "GBP_BD_API_FLAG_NONE", + 1: "GBP_BD_API_FLAG_DO_NOT_LEARN", + 2: "GBP_BD_API_FLAG_UU_FWD_DROP", + 4: "GBP_BD_API_FLAG_MCAST_DROP", + 8: "GBP_BD_API_FLAG_UCAST_ARP", + } + GbpBridgeDomainFlags_value = map[string]uint32{ + "GBP_BD_API_FLAG_NONE": 0, + "GBP_BD_API_FLAG_DO_NOT_LEARN": 1, + "GBP_BD_API_FLAG_UU_FWD_DROP": 2, + "GBP_BD_API_FLAG_MCAST_DROP": 4, + "GBP_BD_API_FLAG_UCAST_ARP": 8, + } +) + +func (x GbpBridgeDomainFlags) String() string { + s, ok := GbpBridgeDomainFlags_name[uint32(x)] + if ok { + return s + } + str := func(n uint32) string { + s, ok := GbpBridgeDomainFlags_name[uint32(n)] + if ok { + return s + } + return "GbpBridgeDomainFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint32(0); i <= 32; i++ { + val := uint32(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint32(x)) + } + return s +} + +// GbpEndpointFlags defines enum 'gbp_endpoint_flags'. +type GbpEndpointFlags uint32 + +const ( + GBP_API_ENDPOINT_FLAG_NONE GbpEndpointFlags = 0 + GBP_API_ENDPOINT_FLAG_BOUNCE GbpEndpointFlags = 1 + GBP_API_ENDPOINT_FLAG_REMOTE GbpEndpointFlags = 2 + GBP_API_ENDPOINT_FLAG_LEARNT GbpEndpointFlags = 4 + GBP_API_ENDPOINT_FLAG_EXTERNAL GbpEndpointFlags = 8 +) + +var ( + GbpEndpointFlags_name = map[uint32]string{ + 0: "GBP_API_ENDPOINT_FLAG_NONE", + 1: "GBP_API_ENDPOINT_FLAG_BOUNCE", + 2: "GBP_API_ENDPOINT_FLAG_REMOTE", + 4: "GBP_API_ENDPOINT_FLAG_LEARNT", + 8: "GBP_API_ENDPOINT_FLAG_EXTERNAL", + } + GbpEndpointFlags_value = map[string]uint32{ + "GBP_API_ENDPOINT_FLAG_NONE": 0, + "GBP_API_ENDPOINT_FLAG_BOUNCE": 1, + "GBP_API_ENDPOINT_FLAG_REMOTE": 2, + "GBP_API_ENDPOINT_FLAG_LEARNT": 4, + "GBP_API_ENDPOINT_FLAG_EXTERNAL": 8, + } +) + +func (x GbpEndpointFlags) String() string { + s, ok := GbpEndpointFlags_name[uint32(x)] + if ok { + return s + } + str := func(n uint32) string { + s, ok := GbpEndpointFlags_name[uint32(n)] + if ok { + return s + } + return "GbpEndpointFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint32(0); i <= 32; i++ { + val := uint32(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint32(x)) + } + return s +} + +// GbpExtItfFlags defines enum 'gbp_ext_itf_flags'. +type GbpExtItfFlags uint32 + +const ( + GBP_API_EXT_ITF_F_NONE GbpExtItfFlags = 0 + GBP_API_EXT_ITF_F_ANON GbpExtItfFlags = 1 +) + +var ( + GbpExtItfFlags_name = map[uint32]string{ + 0: "GBP_API_EXT_ITF_F_NONE", + 1: "GBP_API_EXT_ITF_F_ANON", + } + GbpExtItfFlags_value = map[string]uint32{ + "GBP_API_EXT_ITF_F_NONE": 0, + "GBP_API_EXT_ITF_F_ANON": 1, + } +) + +func (x GbpExtItfFlags) String() string { + s, ok := GbpExtItfFlags_name[uint32(x)] + if ok { + return s + } + str := func(n uint32) string { + s, ok := GbpExtItfFlags_name[uint32(n)] + if ok { + return s + } + return "GbpExtItfFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint32(0); i <= 32; i++ { + val := uint32(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint32(x)) + } + return s +} + +// GbpHashMode defines enum 'gbp_hash_mode'. +type GbpHashMode uint32 + +const ( + GBP_API_HASH_MODE_SRC_IP GbpHashMode = 1 + GBP_API_HASH_MODE_DST_IP GbpHashMode = 2 + GBP_API_HASH_MODE_SYMMETRIC GbpHashMode = 3 +) + +var ( + GbpHashMode_name = map[uint32]string{ + 1: "GBP_API_HASH_MODE_SRC_IP", + 2: "GBP_API_HASH_MODE_DST_IP", + 3: "GBP_API_HASH_MODE_SYMMETRIC", + } + GbpHashMode_value = map[string]uint32{ + "GBP_API_HASH_MODE_SRC_IP": 1, + "GBP_API_HASH_MODE_DST_IP": 2, + "GBP_API_HASH_MODE_SYMMETRIC": 3, + } +) + +func (x GbpHashMode) String() string { + s, ok := GbpHashMode_name[uint32(x)] + if ok { + return s + } + return "GbpHashMode(" + strconv.Itoa(int(x)) + ")" +} + +// GbpRuleAction defines enum 'gbp_rule_action'. +type GbpRuleAction uint32 + +const ( + GBP_API_RULE_PERMIT GbpRuleAction = 1 + GBP_API_RULE_DENY GbpRuleAction = 2 + GBP_API_RULE_REDIRECT GbpRuleAction = 3 +) + +var ( + GbpRuleAction_name = map[uint32]string{ + 1: "GBP_API_RULE_PERMIT", + 2: "GBP_API_RULE_DENY", + 3: "GBP_API_RULE_REDIRECT", + } + GbpRuleAction_value = map[string]uint32{ + "GBP_API_RULE_PERMIT": 1, + "GBP_API_RULE_DENY": 2, + "GBP_API_RULE_REDIRECT": 3, + } +) + +func (x GbpRuleAction) String() string { + s, ok := GbpRuleAction_name[uint32(x)] + if ok { + return s + } + return "GbpRuleAction(" + strconv.Itoa(int(x)) + ")" +} + +// GbpSubnetType defines enum 'gbp_subnet_type'. +type GbpSubnetType uint32 + +const ( + GBP_API_SUBNET_TRANSPORT GbpSubnetType = 1 + GBP_API_SUBNET_STITCHED_INTERNAL GbpSubnetType = 2 + GBP_API_SUBNET_STITCHED_EXTERNAL GbpSubnetType = 3 + GBP_API_SUBNET_L3_OUT GbpSubnetType = 4 + GBP_API_SUBNET_ANON_L3_OUT GbpSubnetType = 5 +) + +var ( + GbpSubnetType_name = map[uint32]string{ + 1: "GBP_API_SUBNET_TRANSPORT", + 2: "GBP_API_SUBNET_STITCHED_INTERNAL", + 3: "GBP_API_SUBNET_STITCHED_EXTERNAL", + 4: "GBP_API_SUBNET_L3_OUT", + 5: "GBP_API_SUBNET_ANON_L3_OUT", + } + GbpSubnetType_value = map[string]uint32{ + "GBP_API_SUBNET_TRANSPORT": 1, + "GBP_API_SUBNET_STITCHED_INTERNAL": 2, + "GBP_API_SUBNET_STITCHED_EXTERNAL": 3, + "GBP_API_SUBNET_L3_OUT": 4, + "GBP_API_SUBNET_ANON_L3_OUT": 5, + } +) + +func (x GbpSubnetType) String() string { + s, ok := GbpSubnetType_name[uint32(x)] + if ok { + return s + } + return "GbpSubnetType(" + strconv.Itoa(int(x)) + ")" +} + +// GbpVxlanTunnelMode defines enum 'gbp_vxlan_tunnel_mode'. +type GbpVxlanTunnelMode uint32 + +const ( + GBP_VXLAN_TUNNEL_MODE_L2 GbpVxlanTunnelMode = 1 + GBP_VXLAN_TUNNEL_MODE_L3 GbpVxlanTunnelMode = 2 +) + +var ( + GbpVxlanTunnelMode_name = map[uint32]string{ + 1: "GBP_VXLAN_TUNNEL_MODE_L2", + 2: "GBP_VXLAN_TUNNEL_MODE_L3", + } + GbpVxlanTunnelMode_value = map[string]uint32{ + "GBP_VXLAN_TUNNEL_MODE_L2": 1, + "GBP_VXLAN_TUNNEL_MODE_L3": 2, + } +) + +func (x GbpVxlanTunnelMode) String() string { + s, ok := GbpVxlanTunnelMode_name[uint32(x)] + if ok { + return s + } + return "GbpVxlanTunnelMode(" + strconv.Itoa(int(x)) + ")" +} + +// GbpScope defines alias 'gbp_scope'. +type GbpScope uint16 + +// GbpBridgeDomain defines type 'gbp_bridge_domain'. +type GbpBridgeDomain struct { + BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` + RdID uint32 `binapi:"u32,name=rd_id" json:"rd_id,omitempty"` + Flags GbpBridgeDomainFlags `binapi:"gbp_bridge_domain_flags,name=flags" json:"flags,omitempty"` + BviSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=bvi_sw_if_index" json:"bvi_sw_if_index,omitempty"` + UuFwdSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=uu_fwd_sw_if_index" json:"uu_fwd_sw_if_index,omitempty"` + BmFloodSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=bm_flood_sw_if_index" json:"bm_flood_sw_if_index,omitempty"` +} + +// GbpContract defines type 'gbp_contract'. +type GbpContract struct { + Scope GbpScope `binapi:"gbp_scope,name=scope" json:"scope,omitempty"` + Sclass uint16 `binapi:"u16,name=sclass" json:"sclass,omitempty"` + Dclass uint16 `binapi:"u16,name=dclass" json:"dclass,omitempty"` + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + NEtherTypes uint8 `binapi:"u8,name=n_ether_types" json:"n_ether_types,omitempty"` + AllowedEthertypes []uint16 `binapi:"u16[16],name=allowed_ethertypes" json:"allowed_ethertypes,omitempty"` + NRules uint8 `binapi:"u8,name=n_rules" json:"-"` + Rules []GbpRule `binapi:"gbp_rule[n_rules],name=rules" json:"rules,omitempty"` +} + +// GbpEndpoint defines type 'gbp_endpoint'. +type GbpEndpoint struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Sclass uint16 `binapi:"u16,name=sclass" json:"sclass,omitempty"` + Flags GbpEndpointFlags `binapi:"gbp_endpoint_flags,name=flags" json:"flags,omitempty"` + Mac ethernet_types.MacAddress `binapi:"mac_address,name=mac" json:"mac,omitempty"` + Tun GbpEndpointTun `binapi:"gbp_endpoint_tun,name=tun" json:"tun,omitempty"` + NIps uint8 `binapi:"u8,name=n_ips" json:"-"` + Ips []ip_types.Address `binapi:"address[n_ips],name=ips" json:"ips,omitempty"` +} + +// GbpEndpointGroup defines type 'gbp_endpoint_group'. +type GbpEndpointGroup struct { + Vnid uint32 `binapi:"u32,name=vnid" json:"vnid,omitempty"` + Sclass uint16 `binapi:"u16,name=sclass" json:"sclass,omitempty"` + BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` + RdID uint32 `binapi:"u32,name=rd_id" json:"rd_id,omitempty"` + UplinkSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=uplink_sw_if_index" json:"uplink_sw_if_index,omitempty"` + Retention GbpEndpointRetention `binapi:"gbp_endpoint_retention,name=retention" json:"retention,omitempty"` +} + +// GbpEndpointRetention defines type 'gbp_endpoint_retention'. +type GbpEndpointRetention struct { + RemoteEpTimeout uint32 `binapi:"u32,name=remote_ep_timeout" json:"remote_ep_timeout,omitempty"` +} + +// GbpEndpointTun defines type 'gbp_endpoint_tun'. +type GbpEndpointTun struct { + Src ip_types.Address `binapi:"address,name=src" json:"src,omitempty"` + Dst ip_types.Address `binapi:"address,name=dst" json:"dst,omitempty"` +} + +// GbpExtItf defines type 'gbp_ext_itf'. +type GbpExtItf struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` + RdID uint32 `binapi:"u32,name=rd_id" json:"rd_id,omitempty"` + Flags GbpExtItfFlags `binapi:"gbp_ext_itf_flags,name=flags" json:"flags,omitempty"` +} + +// GbpNextHop defines type 'gbp_next_hop'. +type GbpNextHop struct { + IP ip_types.Address `binapi:"address,name=ip" json:"ip,omitempty"` + Mac ethernet_types.MacAddress `binapi:"mac_address,name=mac" json:"mac,omitempty"` + BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` + RdID uint32 `binapi:"u32,name=rd_id" json:"rd_id,omitempty"` +} + +// GbpNextHopSet defines type 'gbp_next_hop_set'. +type GbpNextHopSet struct { + HashMode GbpHashMode `binapi:"gbp_hash_mode,name=hash_mode" json:"hash_mode,omitempty"` + NNhs uint8 `binapi:"u8,name=n_nhs" json:"n_nhs,omitempty"` + Nhs [8]GbpNextHop `binapi:"gbp_next_hop[8],name=nhs" json:"nhs,omitempty"` +} + +// GbpRecirc defines type 'gbp_recirc'. +type GbpRecirc struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Sclass uint16 `binapi:"u16,name=sclass" json:"sclass,omitempty"` + IsExt bool `binapi:"bool,name=is_ext" json:"is_ext,omitempty"` +} + +// GbpRouteDomain defines type 'gbp_route_domain'. +type GbpRouteDomain struct { + RdID uint32 `binapi:"u32,name=rd_id" json:"rd_id,omitempty"` + IP4TableID uint32 `binapi:"u32,name=ip4_table_id" json:"ip4_table_id,omitempty"` + IP6TableID uint32 `binapi:"u32,name=ip6_table_id" json:"ip6_table_id,omitempty"` + IP4UuSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=ip4_uu_sw_if_index" json:"ip4_uu_sw_if_index,omitempty"` + IP6UuSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=ip6_uu_sw_if_index" json:"ip6_uu_sw_if_index,omitempty"` + Scope GbpScope `binapi:"gbp_scope,name=scope" json:"scope,omitempty"` +} + +// GbpRule defines type 'gbp_rule'. +type GbpRule struct { + Action GbpRuleAction `binapi:"gbp_rule_action,name=action" json:"action,omitempty"` + NhSet GbpNextHopSet `binapi:"gbp_next_hop_set,name=nh_set" json:"nh_set,omitempty"` +} + +// GbpSubnet defines type 'gbp_subnet'. +type GbpSubnet struct { + RdID uint32 `binapi:"u32,name=rd_id" json:"rd_id,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Sclass uint16 `binapi:"u16,name=sclass" json:"sclass,omitempty"` + Type GbpSubnetType `binapi:"gbp_subnet_type,name=type" json:"type,omitempty"` + Prefix ip_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` +} + +// GbpVxlanTunnel defines type 'gbp_vxlan_tunnel'. +type GbpVxlanTunnel struct { + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + Mode GbpVxlanTunnelMode `binapi:"gbp_vxlan_tunnel_mode,name=mode" json:"mode,omitempty"` + BdRdID uint32 `binapi:"u32,name=bd_rd_id" json:"bd_rd_id,omitempty"` + Src ip_types.IP4Address `binapi:"ip4_address,name=src" json:"src,omitempty"` +} + +// GbpBridgeDomainAdd defines message 'gbp_bridge_domain_add'. +type GbpBridgeDomainAdd struct { + Bd GbpBridgeDomain `binapi:"gbp_bridge_domain,name=bd" json:"bd,omitempty"` +} + +func (m *GbpBridgeDomainAdd) Reset() { *m = GbpBridgeDomainAdd{} } +func (*GbpBridgeDomainAdd) GetMessageName() string { return "gbp_bridge_domain_add" } +func (*GbpBridgeDomainAdd) GetCrcString() string { return "8454bfdf" } +func (*GbpBridgeDomainAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GbpBridgeDomainAdd) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Bd.BdID + size += 4 // m.Bd.RdID + size += 4 // m.Bd.Flags + size += 4 // m.Bd.BviSwIfIndex + size += 4 // m.Bd.UuFwdSwIfIndex + size += 4 // m.Bd.BmFloodSwIfIndex + return size +} +func (m *GbpBridgeDomainAdd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Bd.BdID)) + buf.EncodeUint32(uint32(m.Bd.RdID)) + buf.EncodeUint32(uint32(m.Bd.Flags)) + buf.EncodeUint32(uint32(m.Bd.BviSwIfIndex)) + buf.EncodeUint32(uint32(m.Bd.UuFwdSwIfIndex)) + buf.EncodeUint32(uint32(m.Bd.BmFloodSwIfIndex)) + return buf.Bytes(), nil +} +func (m *GbpBridgeDomainAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Bd.BdID = buf.DecodeUint32() + m.Bd.RdID = buf.DecodeUint32() + m.Bd.Flags = GbpBridgeDomainFlags(buf.DecodeUint32()) + m.Bd.BviSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Bd.UuFwdSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Bd.BmFloodSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// GbpBridgeDomainAddReply defines message 'gbp_bridge_domain_add_reply'. +type GbpBridgeDomainAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *GbpBridgeDomainAddReply) Reset() { *m = GbpBridgeDomainAddReply{} } +func (*GbpBridgeDomainAddReply) GetMessageName() string { return "gbp_bridge_domain_add_reply" } +func (*GbpBridgeDomainAddReply) GetCrcString() string { return "e8d4e804" } +func (*GbpBridgeDomainAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpBridgeDomainAddReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *GbpBridgeDomainAddReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *GbpBridgeDomainAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// GbpBridgeDomainDel defines message 'gbp_bridge_domain_del'. +type GbpBridgeDomainDel struct { + BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` +} + +func (m *GbpBridgeDomainDel) Reset() { *m = GbpBridgeDomainDel{} } +func (*GbpBridgeDomainDel) GetMessageName() string { return "gbp_bridge_domain_del" } +func (*GbpBridgeDomainDel) GetCrcString() string { return "c25fdce6" } +func (*GbpBridgeDomainDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GbpBridgeDomainDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.BdID + return size +} +func (m *GbpBridgeDomainDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.BdID)) + return buf.Bytes(), nil +} +func (m *GbpBridgeDomainDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BdID = buf.DecodeUint32() + return nil +} + +// GbpBridgeDomainDelReply defines message 'gbp_bridge_domain_del_reply'. +type GbpBridgeDomainDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *GbpBridgeDomainDelReply) Reset() { *m = GbpBridgeDomainDelReply{} } +func (*GbpBridgeDomainDelReply) GetMessageName() string { return "gbp_bridge_domain_del_reply" } +func (*GbpBridgeDomainDelReply) GetCrcString() string { return "e8d4e804" } +func (*GbpBridgeDomainDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpBridgeDomainDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *GbpBridgeDomainDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *GbpBridgeDomainDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// GbpBridgeDomainDetails defines message 'gbp_bridge_domain_details'. +type GbpBridgeDomainDetails struct { + Bd GbpBridgeDomain `binapi:"gbp_bridge_domain,name=bd" json:"bd,omitempty"` +} + +func (m *GbpBridgeDomainDetails) Reset() { *m = GbpBridgeDomainDetails{} } +func (*GbpBridgeDomainDetails) GetMessageName() string { return "gbp_bridge_domain_details" } +func (*GbpBridgeDomainDetails) GetCrcString() string { return "2acd15f9" } +func (*GbpBridgeDomainDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpBridgeDomainDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Bd.BdID + size += 4 // m.Bd.RdID + size += 4 // m.Bd.Flags + size += 4 // m.Bd.BviSwIfIndex + size += 4 // m.Bd.UuFwdSwIfIndex + size += 4 // m.Bd.BmFloodSwIfIndex + return size +} +func (m *GbpBridgeDomainDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Bd.BdID)) + buf.EncodeUint32(uint32(m.Bd.RdID)) + buf.EncodeUint32(uint32(m.Bd.Flags)) + buf.EncodeUint32(uint32(m.Bd.BviSwIfIndex)) + buf.EncodeUint32(uint32(m.Bd.UuFwdSwIfIndex)) + buf.EncodeUint32(uint32(m.Bd.BmFloodSwIfIndex)) + return buf.Bytes(), nil +} +func (m *GbpBridgeDomainDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Bd.BdID = buf.DecodeUint32() + m.Bd.RdID = buf.DecodeUint32() + m.Bd.Flags = GbpBridgeDomainFlags(buf.DecodeUint32()) + m.Bd.BviSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Bd.UuFwdSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Bd.BmFloodSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// GbpBridgeDomainDump defines message 'gbp_bridge_domain_dump'. +type GbpBridgeDomainDump struct{} + +func (m *GbpBridgeDomainDump) Reset() { *m = GbpBridgeDomainDump{} } +func (*GbpBridgeDomainDump) GetMessageName() string { return "gbp_bridge_domain_dump" } +func (*GbpBridgeDomainDump) GetCrcString() string { return "51077d14" } +func (*GbpBridgeDomainDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GbpBridgeDomainDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *GbpBridgeDomainDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *GbpBridgeDomainDump) Unmarshal(b []byte) error { + return nil +} + +// GbpBridgeDomainDumpReply defines message 'gbp_bridge_domain_dump_reply'. +type GbpBridgeDomainDumpReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *GbpBridgeDomainDumpReply) Reset() { *m = GbpBridgeDomainDumpReply{} } +func (*GbpBridgeDomainDumpReply) GetMessageName() string { return "gbp_bridge_domain_dump_reply" } +func (*GbpBridgeDomainDumpReply) GetCrcString() string { return "e8d4e804" } +func (*GbpBridgeDomainDumpReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpBridgeDomainDumpReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *GbpBridgeDomainDumpReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *GbpBridgeDomainDumpReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// GbpContractAddDel defines message 'gbp_contract_add_del'. +type GbpContractAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Contract GbpContract `binapi:"gbp_contract,name=contract" json:"contract,omitempty"` +} + +func (m *GbpContractAddDel) Reset() { *m = GbpContractAddDel{} } +func (*GbpContractAddDel) GetMessageName() string { return "gbp_contract_add_del" } +func (*GbpContractAddDel) GetCrcString() string { return "553e275b" } +func (*GbpContractAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GbpContractAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 2 // m.Contract.Scope + size += 2 // m.Contract.Sclass + size += 2 // m.Contract.Dclass + size += 4 // m.Contract.ACLIndex + size += 1 // m.Contract.NEtherTypes + size += 2 * 16 // m.Contract.AllowedEthertypes + size += 1 // m.Contract.NRules + for j2 := 0; j2 < len(m.Contract.Rules); j2++ { + var s2 GbpRule + _ = s2 + if j2 < len(m.Contract.Rules) { + s2 = m.Contract.Rules[j2] + } + size += 4 // s2.Action + size += 4 // s2.NhSet.HashMode + size += 1 // s2.NhSet.NNhs + for j4 := 0; j4 < 8; j4++ { + var s4 GbpNextHop + _ = s4 + if j4 < len(s2.NhSet.Nhs) { + s4 = s2.NhSet.Nhs[j4] + } + size += 1 // s4.IP.Af + size += 1 * 16 // s4.IP.Un + size += 1 * 6 // s4.Mac + size += 4 // s4.BdID + size += 4 // s4.RdID + } + } + return size +} +func (m *GbpContractAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint16(uint16(m.Contract.Scope)) + buf.EncodeUint16(uint16(m.Contract.Sclass)) + buf.EncodeUint16(uint16(m.Contract.Dclass)) + buf.EncodeUint32(uint32(m.Contract.ACLIndex)) + buf.EncodeUint8(uint8(m.Contract.NEtherTypes)) + for i := 0; i < 16; i++ { + var x uint16 + if i < len(m.Contract.AllowedEthertypes) { + x = uint16(m.Contract.AllowedEthertypes[i]) + } + buf.EncodeUint16(uint16(x)) + } + buf.EncodeUint8(uint8(len(m.Contract.Rules))) + for j1 := 0; j1 < len(m.Contract.Rules); j1++ { + var v1 GbpRule + if j1 < len(m.Contract.Rules) { + v1 = m.Contract.Rules[j1] + } + buf.EncodeUint32(uint32(v1.Action)) + buf.EncodeUint32(uint32(v1.NhSet.HashMode)) + buf.EncodeUint8(uint8(v1.NhSet.NNhs)) + for j3 := 0; j3 < 8; j3++ { + var v3 GbpNextHop + if j3 < len(v1.NhSet.Nhs) { + v3 = v1.NhSet.Nhs[j3] + } + buf.EncodeUint8(uint8(v3.IP.Af)) + buf.EncodeBytes(v3.IP.Un.XXX_UnionData[:], 0) + buf.EncodeBytes(v3.Mac[:], 6) + buf.EncodeUint32(uint32(v3.BdID)) + buf.EncodeUint32(uint32(v3.RdID)) + } + } + return buf.Bytes(), nil +} +func (m *GbpContractAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Contract.Scope = GbpScope(buf.DecodeUint16()) + m.Contract.Sclass = buf.DecodeUint16() + m.Contract.Dclass = buf.DecodeUint16() + m.Contract.ACLIndex = buf.DecodeUint32() + m.Contract.NEtherTypes = buf.DecodeUint8() + m.Contract.AllowedEthertypes = make([]uint16, 16) + for i := 0; i < len(m.Contract.AllowedEthertypes); i++ { + m.Contract.AllowedEthertypes[i] = buf.DecodeUint16() + } + m.Contract.NRules = buf.DecodeUint8() + m.Contract.Rules = make([]GbpRule, int(m.Contract.NRules)) + for j1 := 0; j1 < len(m.Contract.Rules); j1++ { + m.Contract.Rules[j1].Action = GbpRuleAction(buf.DecodeUint32()) + m.Contract.Rules[j1].NhSet.HashMode = GbpHashMode(buf.DecodeUint32()) + m.Contract.Rules[j1].NhSet.NNhs = buf.DecodeUint8() + for j3 := 0; j3 < 8; j3++ { + m.Contract.Rules[j1].NhSet.Nhs[j3].IP.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Contract.Rules[j1].NhSet.Nhs[j3].IP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + copy(m.Contract.Rules[j1].NhSet.Nhs[j3].Mac[:], buf.DecodeBytes(6)) + m.Contract.Rules[j1].NhSet.Nhs[j3].BdID = buf.DecodeUint32() + m.Contract.Rules[j1].NhSet.Nhs[j3].RdID = buf.DecodeUint32() + } + } + return nil +} + +// GbpContractAddDelReply defines message 'gbp_contract_add_del_reply'. +type GbpContractAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` +} + +func (m *GbpContractAddDelReply) Reset() { *m = GbpContractAddDelReply{} } +func (*GbpContractAddDelReply) GetMessageName() string { return "gbp_contract_add_del_reply" } +func (*GbpContractAddDelReply) GetCrcString() string { return "1992deab" } +func (*GbpContractAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpContractAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.StatsIndex + return size +} +func (m *GbpContractAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.StatsIndex)) + return buf.Bytes(), nil +} +func (m *GbpContractAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.StatsIndex = buf.DecodeUint32() + return nil +} + +// GbpContractDetails defines message 'gbp_contract_details'. +type GbpContractDetails struct { + Contract GbpContract `binapi:"gbp_contract,name=contract" json:"contract,omitempty"` +} + +func (m *GbpContractDetails) Reset() { *m = GbpContractDetails{} } +func (*GbpContractDetails) GetMessageName() string { return "gbp_contract_details" } +func (*GbpContractDetails) GetCrcString() string { return "2a18db6e" } +func (*GbpContractDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpContractDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 2 // m.Contract.Scope + size += 2 // m.Contract.Sclass + size += 2 // m.Contract.Dclass + size += 4 // m.Contract.ACLIndex + size += 1 // m.Contract.NEtherTypes + size += 2 * 16 // m.Contract.AllowedEthertypes + size += 1 // m.Contract.NRules + for j2 := 0; j2 < len(m.Contract.Rules); j2++ { + var s2 GbpRule + _ = s2 + if j2 < len(m.Contract.Rules) { + s2 = m.Contract.Rules[j2] + } + size += 4 // s2.Action + size += 4 // s2.NhSet.HashMode + size += 1 // s2.NhSet.NNhs + for j4 := 0; j4 < 8; j4++ { + var s4 GbpNextHop + _ = s4 + if j4 < len(s2.NhSet.Nhs) { + s4 = s2.NhSet.Nhs[j4] + } + size += 1 // s4.IP.Af + size += 1 * 16 // s4.IP.Un + size += 1 * 6 // s4.Mac + size += 4 // s4.BdID + size += 4 // s4.RdID + } + } + return size +} +func (m *GbpContractDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint16(uint16(m.Contract.Scope)) + buf.EncodeUint16(uint16(m.Contract.Sclass)) + buf.EncodeUint16(uint16(m.Contract.Dclass)) + buf.EncodeUint32(uint32(m.Contract.ACLIndex)) + buf.EncodeUint8(uint8(m.Contract.NEtherTypes)) + for i := 0; i < 16; i++ { + var x uint16 + if i < len(m.Contract.AllowedEthertypes) { + x = uint16(m.Contract.AllowedEthertypes[i]) + } + buf.EncodeUint16(uint16(x)) + } + buf.EncodeUint8(uint8(len(m.Contract.Rules))) + for j1 := 0; j1 < len(m.Contract.Rules); j1++ { + var v1 GbpRule + if j1 < len(m.Contract.Rules) { + v1 = m.Contract.Rules[j1] + } + buf.EncodeUint32(uint32(v1.Action)) + buf.EncodeUint32(uint32(v1.NhSet.HashMode)) + buf.EncodeUint8(uint8(v1.NhSet.NNhs)) + for j3 := 0; j3 < 8; j3++ { + var v3 GbpNextHop + if j3 < len(v1.NhSet.Nhs) { + v3 = v1.NhSet.Nhs[j3] + } + buf.EncodeUint8(uint8(v3.IP.Af)) + buf.EncodeBytes(v3.IP.Un.XXX_UnionData[:], 0) + buf.EncodeBytes(v3.Mac[:], 6) + buf.EncodeUint32(uint32(v3.BdID)) + buf.EncodeUint32(uint32(v3.RdID)) + } + } + return buf.Bytes(), nil +} +func (m *GbpContractDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Contract.Scope = GbpScope(buf.DecodeUint16()) + m.Contract.Sclass = buf.DecodeUint16() + m.Contract.Dclass = buf.DecodeUint16() + m.Contract.ACLIndex = buf.DecodeUint32() + m.Contract.NEtherTypes = buf.DecodeUint8() + m.Contract.AllowedEthertypes = make([]uint16, 16) + for i := 0; i < len(m.Contract.AllowedEthertypes); i++ { + m.Contract.AllowedEthertypes[i] = buf.DecodeUint16() + } + m.Contract.NRules = buf.DecodeUint8() + m.Contract.Rules = make([]GbpRule, int(m.Contract.NRules)) + for j1 := 0; j1 < len(m.Contract.Rules); j1++ { + m.Contract.Rules[j1].Action = GbpRuleAction(buf.DecodeUint32()) + m.Contract.Rules[j1].NhSet.HashMode = GbpHashMode(buf.DecodeUint32()) + m.Contract.Rules[j1].NhSet.NNhs = buf.DecodeUint8() + for j3 := 0; j3 < 8; j3++ { + m.Contract.Rules[j1].NhSet.Nhs[j3].IP.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Contract.Rules[j1].NhSet.Nhs[j3].IP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + copy(m.Contract.Rules[j1].NhSet.Nhs[j3].Mac[:], buf.DecodeBytes(6)) + m.Contract.Rules[j1].NhSet.Nhs[j3].BdID = buf.DecodeUint32() + m.Contract.Rules[j1].NhSet.Nhs[j3].RdID = buf.DecodeUint32() + } + } + return nil +} + +// GbpContractDump defines message 'gbp_contract_dump'. +type GbpContractDump struct{} + +func (m *GbpContractDump) Reset() { *m = GbpContractDump{} } +func (*GbpContractDump) GetMessageName() string { return "gbp_contract_dump" } +func (*GbpContractDump) GetCrcString() string { return "51077d14" } +func (*GbpContractDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GbpContractDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *GbpContractDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *GbpContractDump) Unmarshal(b []byte) error { + return nil +} + +// GbpEndpointAdd defines message 'gbp_endpoint_add'. +type GbpEndpointAdd struct { + Endpoint GbpEndpoint `binapi:"gbp_endpoint,name=endpoint" json:"endpoint,omitempty"` +} + +func (m *GbpEndpointAdd) Reset() { *m = GbpEndpointAdd{} } +func (*GbpEndpointAdd) GetMessageName() string { return "gbp_endpoint_add" } +func (*GbpEndpointAdd) GetCrcString() string { return "9ce16d5a" } +func (*GbpEndpointAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GbpEndpointAdd) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Endpoint.SwIfIndex + size += 2 // m.Endpoint.Sclass + size += 4 // m.Endpoint.Flags + size += 1 * 6 // m.Endpoint.Mac + size += 1 // m.Endpoint.Tun.Src.Af + size += 1 * 16 // m.Endpoint.Tun.Src.Un + size += 1 // m.Endpoint.Tun.Dst.Af + size += 1 * 16 // m.Endpoint.Tun.Dst.Un + size += 1 // m.Endpoint.NIps + for j2 := 0; j2 < len(m.Endpoint.Ips); j2++ { + var s2 ip_types.Address + _ = s2 + if j2 < len(m.Endpoint.Ips) { + s2 = m.Endpoint.Ips[j2] + } + size += 1 // s2.Af + size += 1 * 16 // s2.Un + } + return size +} +func (m *GbpEndpointAdd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Endpoint.SwIfIndex)) + buf.EncodeUint16(uint16(m.Endpoint.Sclass)) + buf.EncodeUint32(uint32(m.Endpoint.Flags)) + buf.EncodeBytes(m.Endpoint.Mac[:], 6) + buf.EncodeUint8(uint8(m.Endpoint.Tun.Src.Af)) + buf.EncodeBytes(m.Endpoint.Tun.Src.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Endpoint.Tun.Dst.Af)) + buf.EncodeBytes(m.Endpoint.Tun.Dst.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(len(m.Endpoint.Ips))) + for j1 := 0; j1 < len(m.Endpoint.Ips); j1++ { + var v1 ip_types.Address + if j1 < len(m.Endpoint.Ips) { + v1 = m.Endpoint.Ips[j1] + } + buf.EncodeUint8(uint8(v1.Af)) + buf.EncodeBytes(v1.Un.XXX_UnionData[:], 0) + } + return buf.Bytes(), nil +} +func (m *GbpEndpointAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Endpoint.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Endpoint.Sclass = buf.DecodeUint16() + m.Endpoint.Flags = GbpEndpointFlags(buf.DecodeUint32()) + copy(m.Endpoint.Mac[:], buf.DecodeBytes(6)) + m.Endpoint.Tun.Src.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Endpoint.Tun.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Endpoint.Tun.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Endpoint.Tun.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Endpoint.NIps = buf.DecodeUint8() + m.Endpoint.Ips = make([]ip_types.Address, int(m.Endpoint.NIps)) + for j1 := 0; j1 < len(m.Endpoint.Ips); j1++ { + m.Endpoint.Ips[j1].Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Endpoint.Ips[j1].Un.XXX_UnionData[:], buf.DecodeBytes(16)) + } + return nil +} + +// GbpEndpointAddReply defines message 'gbp_endpoint_add_reply'. +type GbpEndpointAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Handle uint32 `binapi:"u32,name=handle" json:"handle,omitempty"` +} + +func (m *GbpEndpointAddReply) Reset() { *m = GbpEndpointAddReply{} } +func (*GbpEndpointAddReply) GetMessageName() string { return "gbp_endpoint_add_reply" } +func (*GbpEndpointAddReply) GetCrcString() string { return "1dd3ff3e" } +func (*GbpEndpointAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpEndpointAddReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.Handle + return size +} +func (m *GbpEndpointAddReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.Handle)) + return buf.Bytes(), nil +} +func (m *GbpEndpointAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Handle = buf.DecodeUint32() + return nil +} + +// GbpEndpointDel defines message 'gbp_endpoint_del'. +type GbpEndpointDel struct { + Handle uint32 `binapi:"u32,name=handle" json:"handle,omitempty"` +} + +func (m *GbpEndpointDel) Reset() { *m = GbpEndpointDel{} } +func (*GbpEndpointDel) GetMessageName() string { return "gbp_endpoint_del" } +func (*GbpEndpointDel) GetCrcString() string { return "b93cd566" } +func (*GbpEndpointDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GbpEndpointDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Handle + return size +} +func (m *GbpEndpointDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Handle)) + return buf.Bytes(), nil +} +func (m *GbpEndpointDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Handle = buf.DecodeUint32() + return nil +} + +// GbpEndpointDelReply defines message 'gbp_endpoint_del_reply'. +type GbpEndpointDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *GbpEndpointDelReply) Reset() { *m = GbpEndpointDelReply{} } +func (*GbpEndpointDelReply) GetMessageName() string { return "gbp_endpoint_del_reply" } +func (*GbpEndpointDelReply) GetCrcString() string { return "e8d4e804" } +func (*GbpEndpointDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpEndpointDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *GbpEndpointDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *GbpEndpointDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// GbpEndpointDetails defines message 'gbp_endpoint_details'. +type GbpEndpointDetails struct { + Age float64 `binapi:"f64,name=age" json:"age,omitempty"` + Handle uint32 `binapi:"u32,name=handle" json:"handle,omitempty"` + Endpoint GbpEndpoint `binapi:"gbp_endpoint,name=endpoint" json:"endpoint,omitempty"` +} + +func (m *GbpEndpointDetails) Reset() { *m = GbpEndpointDetails{} } +func (*GbpEndpointDetails) GetMessageName() string { return "gbp_endpoint_details" } +func (*GbpEndpointDetails) GetCrcString() string { return "08aecb60" } +func (*GbpEndpointDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpEndpointDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 8 // m.Age + size += 4 // m.Handle + size += 4 // m.Endpoint.SwIfIndex + size += 2 // m.Endpoint.Sclass + size += 4 // m.Endpoint.Flags + size += 1 * 6 // m.Endpoint.Mac + size += 1 // m.Endpoint.Tun.Src.Af + size += 1 * 16 // m.Endpoint.Tun.Src.Un + size += 1 // m.Endpoint.Tun.Dst.Af + size += 1 * 16 // m.Endpoint.Tun.Dst.Un + size += 1 // m.Endpoint.NIps + for j2 := 0; j2 < len(m.Endpoint.Ips); j2++ { + var s2 ip_types.Address + _ = s2 + if j2 < len(m.Endpoint.Ips) { + s2 = m.Endpoint.Ips[j2] + } + size += 1 // s2.Af + size += 1 * 16 // s2.Un + } + return size +} +func (m *GbpEndpointDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeFloat64(float64(m.Age)) + buf.EncodeUint32(uint32(m.Handle)) + buf.EncodeUint32(uint32(m.Endpoint.SwIfIndex)) + buf.EncodeUint16(uint16(m.Endpoint.Sclass)) + buf.EncodeUint32(uint32(m.Endpoint.Flags)) + buf.EncodeBytes(m.Endpoint.Mac[:], 6) + buf.EncodeUint8(uint8(m.Endpoint.Tun.Src.Af)) + buf.EncodeBytes(m.Endpoint.Tun.Src.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Endpoint.Tun.Dst.Af)) + buf.EncodeBytes(m.Endpoint.Tun.Dst.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(len(m.Endpoint.Ips))) + for j1 := 0; j1 < len(m.Endpoint.Ips); j1++ { + var v1 ip_types.Address + if j1 < len(m.Endpoint.Ips) { + v1 = m.Endpoint.Ips[j1] + } + buf.EncodeUint8(uint8(v1.Af)) + buf.EncodeBytes(v1.Un.XXX_UnionData[:], 0) + } + return buf.Bytes(), nil +} +func (m *GbpEndpointDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Age = float64(buf.DecodeFloat64()) + m.Handle = buf.DecodeUint32() + m.Endpoint.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Endpoint.Sclass = buf.DecodeUint16() + m.Endpoint.Flags = GbpEndpointFlags(buf.DecodeUint32()) + copy(m.Endpoint.Mac[:], buf.DecodeBytes(6)) + m.Endpoint.Tun.Src.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Endpoint.Tun.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Endpoint.Tun.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Endpoint.Tun.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Endpoint.NIps = buf.DecodeUint8() + m.Endpoint.Ips = make([]ip_types.Address, int(m.Endpoint.NIps)) + for j1 := 0; j1 < len(m.Endpoint.Ips); j1++ { + m.Endpoint.Ips[j1].Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Endpoint.Ips[j1].Un.XXX_UnionData[:], buf.DecodeBytes(16)) + } + return nil +} + +// GbpEndpointDump defines message 'gbp_endpoint_dump'. +type GbpEndpointDump struct{} + +func (m *GbpEndpointDump) Reset() { *m = GbpEndpointDump{} } +func (*GbpEndpointDump) GetMessageName() string { return "gbp_endpoint_dump" } +func (*GbpEndpointDump) GetCrcString() string { return "51077d14" } +func (*GbpEndpointDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GbpEndpointDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *GbpEndpointDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *GbpEndpointDump) Unmarshal(b []byte) error { + return nil +} + +// GbpEndpointGroupAdd defines message 'gbp_endpoint_group_add'. +type GbpEndpointGroupAdd struct { + Epg GbpEndpointGroup `binapi:"gbp_endpoint_group,name=epg" json:"epg,omitempty"` +} + +func (m *GbpEndpointGroupAdd) Reset() { *m = GbpEndpointGroupAdd{} } +func (*GbpEndpointGroupAdd) GetMessageName() string { return "gbp_endpoint_group_add" } +func (*GbpEndpointGroupAdd) GetCrcString() string { return "8e0f4054" } +func (*GbpEndpointGroupAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GbpEndpointGroupAdd) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Epg.Vnid + size += 2 // m.Epg.Sclass + size += 4 // m.Epg.BdID + size += 4 // m.Epg.RdID + size += 4 // m.Epg.UplinkSwIfIndex + size += 4 // m.Epg.Retention.RemoteEpTimeout + return size +} +func (m *GbpEndpointGroupAdd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Epg.Vnid)) + buf.EncodeUint16(uint16(m.Epg.Sclass)) + buf.EncodeUint32(uint32(m.Epg.BdID)) + buf.EncodeUint32(uint32(m.Epg.RdID)) + buf.EncodeUint32(uint32(m.Epg.UplinkSwIfIndex)) + buf.EncodeUint32(uint32(m.Epg.Retention.RemoteEpTimeout)) + return buf.Bytes(), nil +} +func (m *GbpEndpointGroupAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Epg.Vnid = buf.DecodeUint32() + m.Epg.Sclass = buf.DecodeUint16() + m.Epg.BdID = buf.DecodeUint32() + m.Epg.RdID = buf.DecodeUint32() + m.Epg.UplinkSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Epg.Retention.RemoteEpTimeout = buf.DecodeUint32() + return nil +} + +// GbpEndpointGroupAddReply defines message 'gbp_endpoint_group_add_reply'. +type GbpEndpointGroupAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *GbpEndpointGroupAddReply) Reset() { *m = GbpEndpointGroupAddReply{} } +func (*GbpEndpointGroupAddReply) GetMessageName() string { return "gbp_endpoint_group_add_reply" } +func (*GbpEndpointGroupAddReply) GetCrcString() string { return "e8d4e804" } +func (*GbpEndpointGroupAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpEndpointGroupAddReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *GbpEndpointGroupAddReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *GbpEndpointGroupAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// GbpEndpointGroupDel defines message 'gbp_endpoint_group_del'. +type GbpEndpointGroupDel struct { + Sclass uint16 `binapi:"u16,name=sclass" json:"sclass,omitempty"` +} + +func (m *GbpEndpointGroupDel) Reset() { *m = GbpEndpointGroupDel{} } +func (*GbpEndpointGroupDel) GetMessageName() string { return "gbp_endpoint_group_del" } +func (*GbpEndpointGroupDel) GetCrcString() string { return "3436b8b7" } +func (*GbpEndpointGroupDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GbpEndpointGroupDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 2 // m.Sclass + return size +} +func (m *GbpEndpointGroupDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint16(uint16(m.Sclass)) + return buf.Bytes(), nil +} +func (m *GbpEndpointGroupDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Sclass = buf.DecodeUint16() + return nil +} + +// GbpEndpointGroupDelReply defines message 'gbp_endpoint_group_del_reply'. +type GbpEndpointGroupDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *GbpEndpointGroupDelReply) Reset() { *m = GbpEndpointGroupDelReply{} } +func (*GbpEndpointGroupDelReply) GetMessageName() string { return "gbp_endpoint_group_del_reply" } +func (*GbpEndpointGroupDelReply) GetCrcString() string { return "e8d4e804" } +func (*GbpEndpointGroupDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpEndpointGroupDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *GbpEndpointGroupDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *GbpEndpointGroupDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// GbpEndpointGroupDetails defines message 'gbp_endpoint_group_details'. +type GbpEndpointGroupDetails struct { + Epg GbpEndpointGroup `binapi:"gbp_endpoint_group,name=epg" json:"epg,omitempty"` +} + +func (m *GbpEndpointGroupDetails) Reset() { *m = GbpEndpointGroupDetails{} } +func (*GbpEndpointGroupDetails) GetMessageName() string { return "gbp_endpoint_group_details" } +func (*GbpEndpointGroupDetails) GetCrcString() string { return "8f38292c" } +func (*GbpEndpointGroupDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpEndpointGroupDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Epg.Vnid + size += 2 // m.Epg.Sclass + size += 4 // m.Epg.BdID + size += 4 // m.Epg.RdID + size += 4 // m.Epg.UplinkSwIfIndex + size += 4 // m.Epg.Retention.RemoteEpTimeout + return size +} +func (m *GbpEndpointGroupDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Epg.Vnid)) + buf.EncodeUint16(uint16(m.Epg.Sclass)) + buf.EncodeUint32(uint32(m.Epg.BdID)) + buf.EncodeUint32(uint32(m.Epg.RdID)) + buf.EncodeUint32(uint32(m.Epg.UplinkSwIfIndex)) + buf.EncodeUint32(uint32(m.Epg.Retention.RemoteEpTimeout)) + return buf.Bytes(), nil +} +func (m *GbpEndpointGroupDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Epg.Vnid = buf.DecodeUint32() + m.Epg.Sclass = buf.DecodeUint16() + m.Epg.BdID = buf.DecodeUint32() + m.Epg.RdID = buf.DecodeUint32() + m.Epg.UplinkSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Epg.Retention.RemoteEpTimeout = buf.DecodeUint32() + return nil +} + +// GbpEndpointGroupDump defines message 'gbp_endpoint_group_dump'. +type GbpEndpointGroupDump struct{} + +func (m *GbpEndpointGroupDump) Reset() { *m = GbpEndpointGroupDump{} } +func (*GbpEndpointGroupDump) GetMessageName() string { return "gbp_endpoint_group_dump" } +func (*GbpEndpointGroupDump) GetCrcString() string { return "51077d14" } +func (*GbpEndpointGroupDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GbpEndpointGroupDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *GbpEndpointGroupDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *GbpEndpointGroupDump) Unmarshal(b []byte) error { + return nil +} + +// GbpExtItfAddDel defines message 'gbp_ext_itf_add_del'. +type GbpExtItfAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + ExtItf GbpExtItf `binapi:"gbp_ext_itf,name=ext_itf" json:"ext_itf,omitempty"` +} + +func (m *GbpExtItfAddDel) Reset() { *m = GbpExtItfAddDel{} } +func (*GbpExtItfAddDel) GetMessageName() string { return "gbp_ext_itf_add_del" } +func (*GbpExtItfAddDel) GetCrcString() string { return "12ed5700" } +func (*GbpExtItfAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GbpExtItfAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.ExtItf.SwIfIndex + size += 4 // m.ExtItf.BdID + size += 4 // m.ExtItf.RdID + size += 4 // m.ExtItf.Flags + return size +} +func (m *GbpExtItfAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.ExtItf.SwIfIndex)) + buf.EncodeUint32(uint32(m.ExtItf.BdID)) + buf.EncodeUint32(uint32(m.ExtItf.RdID)) + buf.EncodeUint32(uint32(m.ExtItf.Flags)) + return buf.Bytes(), nil +} +func (m *GbpExtItfAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.ExtItf.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.ExtItf.BdID = buf.DecodeUint32() + m.ExtItf.RdID = buf.DecodeUint32() + m.ExtItf.Flags = GbpExtItfFlags(buf.DecodeUint32()) + return nil +} + +// GbpExtItfAddDelReply defines message 'gbp_ext_itf_add_del_reply'. +type GbpExtItfAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *GbpExtItfAddDelReply) Reset() { *m = GbpExtItfAddDelReply{} } +func (*GbpExtItfAddDelReply) GetMessageName() string { return "gbp_ext_itf_add_del_reply" } +func (*GbpExtItfAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*GbpExtItfAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpExtItfAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *GbpExtItfAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *GbpExtItfAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// GbpExtItfDetails defines message 'gbp_ext_itf_details'. +type GbpExtItfDetails struct { + ExtItf GbpExtItf `binapi:"gbp_ext_itf,name=ext_itf" json:"ext_itf,omitempty"` +} + +func (m *GbpExtItfDetails) Reset() { *m = GbpExtItfDetails{} } +func (*GbpExtItfDetails) GetMessageName() string { return "gbp_ext_itf_details" } +func (*GbpExtItfDetails) GetCrcString() string { return "408a45c0" } +func (*GbpExtItfDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpExtItfDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ExtItf.SwIfIndex + size += 4 // m.ExtItf.BdID + size += 4 // m.ExtItf.RdID + size += 4 // m.ExtItf.Flags + return size +} +func (m *GbpExtItfDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ExtItf.SwIfIndex)) + buf.EncodeUint32(uint32(m.ExtItf.BdID)) + buf.EncodeUint32(uint32(m.ExtItf.RdID)) + buf.EncodeUint32(uint32(m.ExtItf.Flags)) + return buf.Bytes(), nil +} +func (m *GbpExtItfDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ExtItf.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.ExtItf.BdID = buf.DecodeUint32() + m.ExtItf.RdID = buf.DecodeUint32() + m.ExtItf.Flags = GbpExtItfFlags(buf.DecodeUint32()) + return nil +} + +// GbpExtItfDump defines message 'gbp_ext_itf_dump'. +type GbpExtItfDump struct{} + +func (m *GbpExtItfDump) Reset() { *m = GbpExtItfDump{} } +func (*GbpExtItfDump) GetMessageName() string { return "gbp_ext_itf_dump" } +func (*GbpExtItfDump) GetCrcString() string { return "51077d14" } +func (*GbpExtItfDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GbpExtItfDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *GbpExtItfDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *GbpExtItfDump) Unmarshal(b []byte) error { + return nil +} + +// GbpRecircAddDel defines message 'gbp_recirc_add_del'. +type GbpRecircAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Recirc GbpRecirc `binapi:"gbp_recirc,name=recirc" json:"recirc,omitempty"` +} + +func (m *GbpRecircAddDel) Reset() { *m = GbpRecircAddDel{} } +func (*GbpRecircAddDel) GetMessageName() string { return "gbp_recirc_add_del" } +func (*GbpRecircAddDel) GetCrcString() string { return "718c69c3" } +func (*GbpRecircAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GbpRecircAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Recirc.SwIfIndex + size += 2 // m.Recirc.Sclass + size += 1 // m.Recirc.IsExt + return size +} +func (m *GbpRecircAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Recirc.SwIfIndex)) + buf.EncodeUint16(uint16(m.Recirc.Sclass)) + buf.EncodeBool(m.Recirc.IsExt) + return buf.Bytes(), nil +} +func (m *GbpRecircAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Recirc.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Recirc.Sclass = buf.DecodeUint16() + m.Recirc.IsExt = buf.DecodeBool() + return nil +} + +// GbpRecircAddDelReply defines message 'gbp_recirc_add_del_reply'. +type GbpRecircAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *GbpRecircAddDelReply) Reset() { *m = GbpRecircAddDelReply{} } +func (*GbpRecircAddDelReply) GetMessageName() string { return "gbp_recirc_add_del_reply" } +func (*GbpRecircAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*GbpRecircAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpRecircAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *GbpRecircAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *GbpRecircAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// GbpRecircDetails defines message 'gbp_recirc_details'. +type GbpRecircDetails struct { + Recirc GbpRecirc `binapi:"gbp_recirc,name=recirc" json:"recirc,omitempty"` +} + +func (m *GbpRecircDetails) Reset() { *m = GbpRecircDetails{} } +func (*GbpRecircDetails) GetMessageName() string { return "gbp_recirc_details" } +func (*GbpRecircDetails) GetCrcString() string { return "66ecc42e" } +func (*GbpRecircDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpRecircDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Recirc.SwIfIndex + size += 2 // m.Recirc.Sclass + size += 1 // m.Recirc.IsExt + return size +} +func (m *GbpRecircDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Recirc.SwIfIndex)) + buf.EncodeUint16(uint16(m.Recirc.Sclass)) + buf.EncodeBool(m.Recirc.IsExt) + return buf.Bytes(), nil +} +func (m *GbpRecircDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Recirc.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Recirc.Sclass = buf.DecodeUint16() + m.Recirc.IsExt = buf.DecodeBool() + return nil +} + +// GbpRecircDump defines message 'gbp_recirc_dump'. +type GbpRecircDump struct{} + +func (m *GbpRecircDump) Reset() { *m = GbpRecircDump{} } +func (*GbpRecircDump) GetMessageName() string { return "gbp_recirc_dump" } +func (*GbpRecircDump) GetCrcString() string { return "51077d14" } +func (*GbpRecircDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GbpRecircDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *GbpRecircDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *GbpRecircDump) Unmarshal(b []byte) error { + return nil +} + +// GbpRouteDomainAdd defines message 'gbp_route_domain_add'. +type GbpRouteDomainAdd struct { + Rd GbpRouteDomain `binapi:"gbp_route_domain,name=rd" json:"rd,omitempty"` +} + +func (m *GbpRouteDomainAdd) Reset() { *m = GbpRouteDomainAdd{} } +func (*GbpRouteDomainAdd) GetMessageName() string { return "gbp_route_domain_add" } +func (*GbpRouteDomainAdd) GetCrcString() string { return "2d0afe38" } +func (*GbpRouteDomainAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GbpRouteDomainAdd) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Rd.RdID + size += 4 // m.Rd.IP4TableID + size += 4 // m.Rd.IP6TableID + size += 4 // m.Rd.IP4UuSwIfIndex + size += 4 // m.Rd.IP6UuSwIfIndex + size += 2 // m.Rd.Scope + return size +} +func (m *GbpRouteDomainAdd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Rd.RdID)) + buf.EncodeUint32(uint32(m.Rd.IP4TableID)) + buf.EncodeUint32(uint32(m.Rd.IP6TableID)) + buf.EncodeUint32(uint32(m.Rd.IP4UuSwIfIndex)) + buf.EncodeUint32(uint32(m.Rd.IP6UuSwIfIndex)) + buf.EncodeUint16(uint16(m.Rd.Scope)) + return buf.Bytes(), nil +} +func (m *GbpRouteDomainAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Rd.RdID = buf.DecodeUint32() + m.Rd.IP4TableID = buf.DecodeUint32() + m.Rd.IP6TableID = buf.DecodeUint32() + m.Rd.IP4UuSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Rd.IP6UuSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Rd.Scope = GbpScope(buf.DecodeUint16()) + return nil +} + +// GbpRouteDomainAddReply defines message 'gbp_route_domain_add_reply'. +type GbpRouteDomainAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *GbpRouteDomainAddReply) Reset() { *m = GbpRouteDomainAddReply{} } +func (*GbpRouteDomainAddReply) GetMessageName() string { return "gbp_route_domain_add_reply" } +func (*GbpRouteDomainAddReply) GetCrcString() string { return "e8d4e804" } +func (*GbpRouteDomainAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpRouteDomainAddReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *GbpRouteDomainAddReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *GbpRouteDomainAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// GbpRouteDomainDel defines message 'gbp_route_domain_del'. +type GbpRouteDomainDel struct { + RdID uint32 `binapi:"u32,name=rd_id" json:"rd_id,omitempty"` +} + +func (m *GbpRouteDomainDel) Reset() { *m = GbpRouteDomainDel{} } +func (*GbpRouteDomainDel) GetMessageName() string { return "gbp_route_domain_del" } +func (*GbpRouteDomainDel) GetCrcString() string { return "bee4edcd" } +func (*GbpRouteDomainDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GbpRouteDomainDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.RdID + return size +} +func (m *GbpRouteDomainDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.RdID)) + return buf.Bytes(), nil +} +func (m *GbpRouteDomainDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.RdID = buf.DecodeUint32() + return nil +} + +// GbpRouteDomainDelReply defines message 'gbp_route_domain_del_reply'. +type GbpRouteDomainDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *GbpRouteDomainDelReply) Reset() { *m = GbpRouteDomainDelReply{} } +func (*GbpRouteDomainDelReply) GetMessageName() string { return "gbp_route_domain_del_reply" } +func (*GbpRouteDomainDelReply) GetCrcString() string { return "e8d4e804" } +func (*GbpRouteDomainDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpRouteDomainDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *GbpRouteDomainDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *GbpRouteDomainDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// GbpRouteDomainDetails defines message 'gbp_route_domain_details'. +type GbpRouteDomainDetails struct { + Rd GbpRouteDomain `binapi:"gbp_route_domain,name=rd" json:"rd,omitempty"` +} + +func (m *GbpRouteDomainDetails) Reset() { *m = GbpRouteDomainDetails{} } +func (*GbpRouteDomainDetails) GetMessageName() string { return "gbp_route_domain_details" } +func (*GbpRouteDomainDetails) GetCrcString() string { return "8ab11375" } +func (*GbpRouteDomainDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpRouteDomainDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Rd.RdID + size += 4 // m.Rd.IP4TableID + size += 4 // m.Rd.IP6TableID + size += 4 // m.Rd.IP4UuSwIfIndex + size += 4 // m.Rd.IP6UuSwIfIndex + size += 2 // m.Rd.Scope + return size +} +func (m *GbpRouteDomainDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Rd.RdID)) + buf.EncodeUint32(uint32(m.Rd.IP4TableID)) + buf.EncodeUint32(uint32(m.Rd.IP6TableID)) + buf.EncodeUint32(uint32(m.Rd.IP4UuSwIfIndex)) + buf.EncodeUint32(uint32(m.Rd.IP6UuSwIfIndex)) + buf.EncodeUint16(uint16(m.Rd.Scope)) + return buf.Bytes(), nil +} +func (m *GbpRouteDomainDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Rd.RdID = buf.DecodeUint32() + m.Rd.IP4TableID = buf.DecodeUint32() + m.Rd.IP6TableID = buf.DecodeUint32() + m.Rd.IP4UuSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Rd.IP6UuSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Rd.Scope = GbpScope(buf.DecodeUint16()) + return nil +} + +// GbpRouteDomainDump defines message 'gbp_route_domain_dump'. +type GbpRouteDomainDump struct{} + +func (m *GbpRouteDomainDump) Reset() { *m = GbpRouteDomainDump{} } +func (*GbpRouteDomainDump) GetMessageName() string { return "gbp_route_domain_dump" } +func (*GbpRouteDomainDump) GetCrcString() string { return "51077d14" } +func (*GbpRouteDomainDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GbpRouteDomainDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *GbpRouteDomainDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *GbpRouteDomainDump) Unmarshal(b []byte) error { + return nil +} + +// GbpRouteDomainDumpReply defines message 'gbp_route_domain_dump_reply'. +type GbpRouteDomainDumpReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *GbpRouteDomainDumpReply) Reset() { *m = GbpRouteDomainDumpReply{} } +func (*GbpRouteDomainDumpReply) GetMessageName() string { return "gbp_route_domain_dump_reply" } +func (*GbpRouteDomainDumpReply) GetCrcString() string { return "e8d4e804" } +func (*GbpRouteDomainDumpReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpRouteDomainDumpReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *GbpRouteDomainDumpReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *GbpRouteDomainDumpReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// GbpSubnetAddDel defines message 'gbp_subnet_add_del'. +type GbpSubnetAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Subnet GbpSubnet `binapi:"gbp_subnet,name=subnet" json:"subnet,omitempty"` +} + +func (m *GbpSubnetAddDel) Reset() { *m = GbpSubnetAddDel{} } +func (*GbpSubnetAddDel) GetMessageName() string { return "gbp_subnet_add_del" } +func (*GbpSubnetAddDel) GetCrcString() string { return "888aca35" } +func (*GbpSubnetAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GbpSubnetAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Subnet.RdID + size += 4 // m.Subnet.SwIfIndex + size += 2 // m.Subnet.Sclass + size += 4 // m.Subnet.Type + size += 1 // m.Subnet.Prefix.Address.Af + size += 1 * 16 // m.Subnet.Prefix.Address.Un + size += 1 // m.Subnet.Prefix.Len + return size +} +func (m *GbpSubnetAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Subnet.RdID)) + buf.EncodeUint32(uint32(m.Subnet.SwIfIndex)) + buf.EncodeUint16(uint16(m.Subnet.Sclass)) + buf.EncodeUint32(uint32(m.Subnet.Type)) + buf.EncodeUint8(uint8(m.Subnet.Prefix.Address.Af)) + buf.EncodeBytes(m.Subnet.Prefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Subnet.Prefix.Len)) + return buf.Bytes(), nil +} +func (m *GbpSubnetAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Subnet.RdID = buf.DecodeUint32() + m.Subnet.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Subnet.Sclass = buf.DecodeUint16() + m.Subnet.Type = GbpSubnetType(buf.DecodeUint32()) + m.Subnet.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Subnet.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Subnet.Prefix.Len = buf.DecodeUint8() + return nil +} + +// GbpSubnetAddDelReply defines message 'gbp_subnet_add_del_reply'. +type GbpSubnetAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *GbpSubnetAddDelReply) Reset() { *m = GbpSubnetAddDelReply{} } +func (*GbpSubnetAddDelReply) GetMessageName() string { return "gbp_subnet_add_del_reply" } +func (*GbpSubnetAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*GbpSubnetAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpSubnetAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *GbpSubnetAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *GbpSubnetAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// GbpSubnetDetails defines message 'gbp_subnet_details'. +type GbpSubnetDetails struct { + Subnet GbpSubnet `binapi:"gbp_subnet,name=subnet" json:"subnet,omitempty"` +} + +func (m *GbpSubnetDetails) Reset() { *m = GbpSubnetDetails{} } +func (*GbpSubnetDetails) GetMessageName() string { return "gbp_subnet_details" } +func (*GbpSubnetDetails) GetCrcString() string { return "4ed84156" } +func (*GbpSubnetDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpSubnetDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Subnet.RdID + size += 4 // m.Subnet.SwIfIndex + size += 2 // m.Subnet.Sclass + size += 4 // m.Subnet.Type + size += 1 // m.Subnet.Prefix.Address.Af + size += 1 * 16 // m.Subnet.Prefix.Address.Un + size += 1 // m.Subnet.Prefix.Len + return size +} +func (m *GbpSubnetDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Subnet.RdID)) + buf.EncodeUint32(uint32(m.Subnet.SwIfIndex)) + buf.EncodeUint16(uint16(m.Subnet.Sclass)) + buf.EncodeUint32(uint32(m.Subnet.Type)) + buf.EncodeUint8(uint8(m.Subnet.Prefix.Address.Af)) + buf.EncodeBytes(m.Subnet.Prefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Subnet.Prefix.Len)) + return buf.Bytes(), nil +} +func (m *GbpSubnetDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Subnet.RdID = buf.DecodeUint32() + m.Subnet.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Subnet.Sclass = buf.DecodeUint16() + m.Subnet.Type = GbpSubnetType(buf.DecodeUint32()) + m.Subnet.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Subnet.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Subnet.Prefix.Len = buf.DecodeUint8() + return nil +} + +// GbpSubnetDump defines message 'gbp_subnet_dump'. +type GbpSubnetDump struct{} + +func (m *GbpSubnetDump) Reset() { *m = GbpSubnetDump{} } +func (*GbpSubnetDump) GetMessageName() string { return "gbp_subnet_dump" } +func (*GbpSubnetDump) GetCrcString() string { return "51077d14" } +func (*GbpSubnetDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GbpSubnetDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *GbpSubnetDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *GbpSubnetDump) Unmarshal(b []byte) error { + return nil +} + +// GbpVxlanTunnelAdd defines message 'gbp_vxlan_tunnel_add'. +type GbpVxlanTunnelAdd struct { + Tunnel GbpVxlanTunnel `binapi:"gbp_vxlan_tunnel,name=tunnel" json:"tunnel,omitempty"` +} + +func (m *GbpVxlanTunnelAdd) Reset() { *m = GbpVxlanTunnelAdd{} } +func (*GbpVxlanTunnelAdd) GetMessageName() string { return "gbp_vxlan_tunnel_add" } +func (*GbpVxlanTunnelAdd) GetCrcString() string { return "3e070b35" } +func (*GbpVxlanTunnelAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GbpVxlanTunnelAdd) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Tunnel.Vni + size += 4 // m.Tunnel.Mode + size += 4 // m.Tunnel.BdRdID + size += 1 * 4 // m.Tunnel.Src + return size +} +func (m *GbpVxlanTunnelAdd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Tunnel.Vni)) + buf.EncodeUint32(uint32(m.Tunnel.Mode)) + buf.EncodeUint32(uint32(m.Tunnel.BdRdID)) + buf.EncodeBytes(m.Tunnel.Src[:], 4) + return buf.Bytes(), nil +} +func (m *GbpVxlanTunnelAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Tunnel.Vni = buf.DecodeUint32() + m.Tunnel.Mode = GbpVxlanTunnelMode(buf.DecodeUint32()) + m.Tunnel.BdRdID = buf.DecodeUint32() + copy(m.Tunnel.Src[:], buf.DecodeBytes(4)) + return nil +} + +// GbpVxlanTunnelAddReply defines message 'gbp_vxlan_tunnel_add_reply'. +type GbpVxlanTunnelAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *GbpVxlanTunnelAddReply) Reset() { *m = GbpVxlanTunnelAddReply{} } +func (*GbpVxlanTunnelAddReply) GetMessageName() string { return "gbp_vxlan_tunnel_add_reply" } +func (*GbpVxlanTunnelAddReply) GetCrcString() string { return "5383d31f" } +func (*GbpVxlanTunnelAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpVxlanTunnelAddReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *GbpVxlanTunnelAddReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *GbpVxlanTunnelAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// GbpVxlanTunnelDel defines message 'gbp_vxlan_tunnel_del'. +type GbpVxlanTunnelDel struct { + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` +} + +func (m *GbpVxlanTunnelDel) Reset() { *m = GbpVxlanTunnelDel{} } +func (*GbpVxlanTunnelDel) GetMessageName() string { return "gbp_vxlan_tunnel_del" } +func (*GbpVxlanTunnelDel) GetCrcString() string { return "8d1f2fe9" } +func (*GbpVxlanTunnelDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GbpVxlanTunnelDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Vni + return size +} +func (m *GbpVxlanTunnelDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Vni)) + return buf.Bytes(), nil +} +func (m *GbpVxlanTunnelDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Vni = buf.DecodeUint32() + return nil +} + +// GbpVxlanTunnelDelReply defines message 'gbp_vxlan_tunnel_del_reply'. +type GbpVxlanTunnelDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *GbpVxlanTunnelDelReply) Reset() { *m = GbpVxlanTunnelDelReply{} } +func (*GbpVxlanTunnelDelReply) GetMessageName() string { return "gbp_vxlan_tunnel_del_reply" } +func (*GbpVxlanTunnelDelReply) GetCrcString() string { return "e8d4e804" } +func (*GbpVxlanTunnelDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpVxlanTunnelDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *GbpVxlanTunnelDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *GbpVxlanTunnelDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// GbpVxlanTunnelDetails defines message 'gbp_vxlan_tunnel_details'. +type GbpVxlanTunnelDetails struct { + Tunnel GbpVxlanTunnel `binapi:"gbp_vxlan_tunnel,name=tunnel" json:"tunnel,omitempty"` +} + +func (m *GbpVxlanTunnelDetails) Reset() { *m = GbpVxlanTunnelDetails{} } +func (*GbpVxlanTunnelDetails) GetMessageName() string { return "gbp_vxlan_tunnel_details" } +func (*GbpVxlanTunnelDetails) GetCrcString() string { return "65c6c818" } +func (*GbpVxlanTunnelDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GbpVxlanTunnelDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Tunnel.Vni + size += 4 // m.Tunnel.Mode + size += 4 // m.Tunnel.BdRdID + size += 1 * 4 // m.Tunnel.Src + return size +} +func (m *GbpVxlanTunnelDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Tunnel.Vni)) + buf.EncodeUint32(uint32(m.Tunnel.Mode)) + buf.EncodeUint32(uint32(m.Tunnel.BdRdID)) + buf.EncodeBytes(m.Tunnel.Src[:], 4) + return buf.Bytes(), nil +} +func (m *GbpVxlanTunnelDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Tunnel.Vni = buf.DecodeUint32() + m.Tunnel.Mode = GbpVxlanTunnelMode(buf.DecodeUint32()) + m.Tunnel.BdRdID = buf.DecodeUint32() + copy(m.Tunnel.Src[:], buf.DecodeBytes(4)) + return nil +} + +// GbpVxlanTunnelDump defines message 'gbp_vxlan_tunnel_dump'. +type GbpVxlanTunnelDump struct{} + +func (m *GbpVxlanTunnelDump) Reset() { *m = GbpVxlanTunnelDump{} } +func (*GbpVxlanTunnelDump) GetMessageName() string { return "gbp_vxlan_tunnel_dump" } +func (*GbpVxlanTunnelDump) GetCrcString() string { return "51077d14" } +func (*GbpVxlanTunnelDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GbpVxlanTunnelDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *GbpVxlanTunnelDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *GbpVxlanTunnelDump) Unmarshal(b []byte) error { + return nil +} + +func init() { file_gbp_binapi_init() } +func file_gbp_binapi_init() { + api.RegisterMessage((*GbpBridgeDomainAdd)(nil), "gbp_bridge_domain_add_8454bfdf") + api.RegisterMessage((*GbpBridgeDomainAddReply)(nil), "gbp_bridge_domain_add_reply_e8d4e804") + api.RegisterMessage((*GbpBridgeDomainDel)(nil), "gbp_bridge_domain_del_c25fdce6") + api.RegisterMessage((*GbpBridgeDomainDelReply)(nil), "gbp_bridge_domain_del_reply_e8d4e804") + api.RegisterMessage((*GbpBridgeDomainDetails)(nil), "gbp_bridge_domain_details_2acd15f9") + api.RegisterMessage((*GbpBridgeDomainDump)(nil), "gbp_bridge_domain_dump_51077d14") + api.RegisterMessage((*GbpBridgeDomainDumpReply)(nil), "gbp_bridge_domain_dump_reply_e8d4e804") + api.RegisterMessage((*GbpContractAddDel)(nil), "gbp_contract_add_del_553e275b") + api.RegisterMessage((*GbpContractAddDelReply)(nil), "gbp_contract_add_del_reply_1992deab") + api.RegisterMessage((*GbpContractDetails)(nil), "gbp_contract_details_2a18db6e") + api.RegisterMessage((*GbpContractDump)(nil), "gbp_contract_dump_51077d14") + api.RegisterMessage((*GbpEndpointAdd)(nil), "gbp_endpoint_add_9ce16d5a") + api.RegisterMessage((*GbpEndpointAddReply)(nil), "gbp_endpoint_add_reply_1dd3ff3e") + api.RegisterMessage((*GbpEndpointDel)(nil), "gbp_endpoint_del_b93cd566") + api.RegisterMessage((*GbpEndpointDelReply)(nil), "gbp_endpoint_del_reply_e8d4e804") + api.RegisterMessage((*GbpEndpointDetails)(nil), "gbp_endpoint_details_08aecb60") + api.RegisterMessage((*GbpEndpointDump)(nil), "gbp_endpoint_dump_51077d14") + api.RegisterMessage((*GbpEndpointGroupAdd)(nil), "gbp_endpoint_group_add_8e0f4054") + api.RegisterMessage((*GbpEndpointGroupAddReply)(nil), "gbp_endpoint_group_add_reply_e8d4e804") + api.RegisterMessage((*GbpEndpointGroupDel)(nil), "gbp_endpoint_group_del_3436b8b7") + api.RegisterMessage((*GbpEndpointGroupDelReply)(nil), "gbp_endpoint_group_del_reply_e8d4e804") + api.RegisterMessage((*GbpEndpointGroupDetails)(nil), "gbp_endpoint_group_details_8f38292c") + api.RegisterMessage((*GbpEndpointGroupDump)(nil), "gbp_endpoint_group_dump_51077d14") + api.RegisterMessage((*GbpExtItfAddDel)(nil), "gbp_ext_itf_add_del_12ed5700") + api.RegisterMessage((*GbpExtItfAddDelReply)(nil), "gbp_ext_itf_add_del_reply_e8d4e804") + api.RegisterMessage((*GbpExtItfDetails)(nil), "gbp_ext_itf_details_408a45c0") + api.RegisterMessage((*GbpExtItfDump)(nil), "gbp_ext_itf_dump_51077d14") + api.RegisterMessage((*GbpRecircAddDel)(nil), "gbp_recirc_add_del_718c69c3") + api.RegisterMessage((*GbpRecircAddDelReply)(nil), "gbp_recirc_add_del_reply_e8d4e804") + api.RegisterMessage((*GbpRecircDetails)(nil), "gbp_recirc_details_66ecc42e") + api.RegisterMessage((*GbpRecircDump)(nil), "gbp_recirc_dump_51077d14") + api.RegisterMessage((*GbpRouteDomainAdd)(nil), "gbp_route_domain_add_2d0afe38") + api.RegisterMessage((*GbpRouteDomainAddReply)(nil), "gbp_route_domain_add_reply_e8d4e804") + api.RegisterMessage((*GbpRouteDomainDel)(nil), "gbp_route_domain_del_bee4edcd") + api.RegisterMessage((*GbpRouteDomainDelReply)(nil), "gbp_route_domain_del_reply_e8d4e804") + api.RegisterMessage((*GbpRouteDomainDetails)(nil), "gbp_route_domain_details_8ab11375") + api.RegisterMessage((*GbpRouteDomainDump)(nil), "gbp_route_domain_dump_51077d14") + api.RegisterMessage((*GbpRouteDomainDumpReply)(nil), "gbp_route_domain_dump_reply_e8d4e804") + api.RegisterMessage((*GbpSubnetAddDel)(nil), "gbp_subnet_add_del_888aca35") + api.RegisterMessage((*GbpSubnetAddDelReply)(nil), "gbp_subnet_add_del_reply_e8d4e804") + api.RegisterMessage((*GbpSubnetDetails)(nil), "gbp_subnet_details_4ed84156") + api.RegisterMessage((*GbpSubnetDump)(nil), "gbp_subnet_dump_51077d14") + api.RegisterMessage((*GbpVxlanTunnelAdd)(nil), "gbp_vxlan_tunnel_add_3e070b35") + api.RegisterMessage((*GbpVxlanTunnelAddReply)(nil), "gbp_vxlan_tunnel_add_reply_5383d31f") + api.RegisterMessage((*GbpVxlanTunnelDel)(nil), "gbp_vxlan_tunnel_del_8d1f2fe9") + api.RegisterMessage((*GbpVxlanTunnelDelReply)(nil), "gbp_vxlan_tunnel_del_reply_e8d4e804") + api.RegisterMessage((*GbpVxlanTunnelDetails)(nil), "gbp_vxlan_tunnel_details_65c6c818") + api.RegisterMessage((*GbpVxlanTunnelDump)(nil), "gbp_vxlan_tunnel_dump_51077d14") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*GbpBridgeDomainAdd)(nil), + (*GbpBridgeDomainAddReply)(nil), + (*GbpBridgeDomainDel)(nil), + (*GbpBridgeDomainDelReply)(nil), + (*GbpBridgeDomainDetails)(nil), + (*GbpBridgeDomainDump)(nil), + (*GbpBridgeDomainDumpReply)(nil), + (*GbpContractAddDel)(nil), + (*GbpContractAddDelReply)(nil), + (*GbpContractDetails)(nil), + (*GbpContractDump)(nil), + (*GbpEndpointAdd)(nil), + (*GbpEndpointAddReply)(nil), + (*GbpEndpointDel)(nil), + (*GbpEndpointDelReply)(nil), + (*GbpEndpointDetails)(nil), + (*GbpEndpointDump)(nil), + (*GbpEndpointGroupAdd)(nil), + (*GbpEndpointGroupAddReply)(nil), + (*GbpEndpointGroupDel)(nil), + (*GbpEndpointGroupDelReply)(nil), + (*GbpEndpointGroupDetails)(nil), + (*GbpEndpointGroupDump)(nil), + (*GbpExtItfAddDel)(nil), + (*GbpExtItfAddDelReply)(nil), + (*GbpExtItfDetails)(nil), + (*GbpExtItfDump)(nil), + (*GbpRecircAddDel)(nil), + (*GbpRecircAddDelReply)(nil), + (*GbpRecircDetails)(nil), + (*GbpRecircDump)(nil), + (*GbpRouteDomainAdd)(nil), + (*GbpRouteDomainAddReply)(nil), + (*GbpRouteDomainDel)(nil), + (*GbpRouteDomainDelReply)(nil), + (*GbpRouteDomainDetails)(nil), + (*GbpRouteDomainDump)(nil), + (*GbpRouteDomainDumpReply)(nil), + (*GbpSubnetAddDel)(nil), + (*GbpSubnetAddDelReply)(nil), + (*GbpSubnetDetails)(nil), + (*GbpSubnetDump)(nil), + (*GbpVxlanTunnelAdd)(nil), + (*GbpVxlanTunnelAddReply)(nil), + (*GbpVxlanTunnelDel)(nil), + (*GbpVxlanTunnelDelReply)(nil), + (*GbpVxlanTunnelDetails)(nil), + (*GbpVxlanTunnelDump)(nil), + } +} diff --git a/binapi/gbp/gbp_rest.ba.go b/binapi/gbp/gbp_rest.ba.go new file mode 100644 index 0000000..9999a07 --- /dev/null +++ b/binapi/gbp/gbp_rest.ba.go @@ -0,0 +1,336 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package gbp + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/gbp_bridge_domain_add", func(w http.ResponseWriter, req *http.Request) { + var request = new(GbpBridgeDomainAdd) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GbpBridgeDomainAdd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/gbp_bridge_domain_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(GbpBridgeDomainDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GbpBridgeDomainDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/gbp_contract_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(GbpContractAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GbpContractAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/gbp_endpoint_add", func(w http.ResponseWriter, req *http.Request) { + var request = new(GbpEndpointAdd) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GbpEndpointAdd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/gbp_endpoint_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(GbpEndpointDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GbpEndpointDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/gbp_endpoint_group_add", func(w http.ResponseWriter, req *http.Request) { + var request = new(GbpEndpointGroupAdd) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GbpEndpointGroupAdd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/gbp_endpoint_group_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(GbpEndpointGroupDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GbpEndpointGroupDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/gbp_ext_itf_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(GbpExtItfAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GbpExtItfAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/gbp_recirc_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(GbpRecircAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GbpRecircAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/gbp_route_domain_add", func(w http.ResponseWriter, req *http.Request) { + var request = new(GbpRouteDomainAdd) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GbpRouteDomainAdd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/gbp_route_domain_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(GbpRouteDomainDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GbpRouteDomainDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/gbp_subnet_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(GbpSubnetAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GbpSubnetAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/gbp_vxlan_tunnel_add", func(w http.ResponseWriter, req *http.Request) { + var request = new(GbpVxlanTunnelAdd) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GbpVxlanTunnelAdd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/gbp_vxlan_tunnel_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(GbpVxlanTunnelDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GbpVxlanTunnelDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/gbp/gbp_rpc.ba.go b/binapi/gbp/gbp_rpc.ba.go new file mode 100644 index 0000000..d10e224 --- /dev/null +++ b/binapi/gbp/gbp_rpc.ba.go @@ -0,0 +1,523 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package gbp + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service gbp. +type RPCService interface { + GbpBridgeDomainAdd(ctx context.Context, in *GbpBridgeDomainAdd) (*GbpBridgeDomainAddReply, error) + GbpBridgeDomainDel(ctx context.Context, in *GbpBridgeDomainDel) (*GbpBridgeDomainDelReply, error) + GbpBridgeDomainDump(ctx context.Context, in *GbpBridgeDomainDump) (RPCService_GbpBridgeDomainDumpClient, error) + GbpContractAddDel(ctx context.Context, in *GbpContractAddDel) (*GbpContractAddDelReply, error) + GbpContractDump(ctx context.Context, in *GbpContractDump) (RPCService_GbpContractDumpClient, error) + GbpEndpointAdd(ctx context.Context, in *GbpEndpointAdd) (*GbpEndpointAddReply, error) + GbpEndpointDel(ctx context.Context, in *GbpEndpointDel) (*GbpEndpointDelReply, error) + GbpEndpointDump(ctx context.Context, in *GbpEndpointDump) (RPCService_GbpEndpointDumpClient, error) + GbpEndpointGroupAdd(ctx context.Context, in *GbpEndpointGroupAdd) (*GbpEndpointGroupAddReply, error) + GbpEndpointGroupDel(ctx context.Context, in *GbpEndpointGroupDel) (*GbpEndpointGroupDelReply, error) + GbpEndpointGroupDump(ctx context.Context, in *GbpEndpointGroupDump) (RPCService_GbpEndpointGroupDumpClient, error) + GbpExtItfAddDel(ctx context.Context, in *GbpExtItfAddDel) (*GbpExtItfAddDelReply, error) + GbpExtItfDump(ctx context.Context, in *GbpExtItfDump) (RPCService_GbpExtItfDumpClient, error) + GbpRecircAddDel(ctx context.Context, in *GbpRecircAddDel) (*GbpRecircAddDelReply, error) + GbpRecircDump(ctx context.Context, in *GbpRecircDump) (RPCService_GbpRecircDumpClient, error) + GbpRouteDomainAdd(ctx context.Context, in *GbpRouteDomainAdd) (*GbpRouteDomainAddReply, error) + GbpRouteDomainDel(ctx context.Context, in *GbpRouteDomainDel) (*GbpRouteDomainDelReply, error) + GbpRouteDomainDump(ctx context.Context, in *GbpRouteDomainDump) (RPCService_GbpRouteDomainDumpClient, error) + GbpSubnetAddDel(ctx context.Context, in *GbpSubnetAddDel) (*GbpSubnetAddDelReply, error) + GbpSubnetDump(ctx context.Context, in *GbpSubnetDump) (RPCService_GbpSubnetDumpClient, error) + GbpVxlanTunnelAdd(ctx context.Context, in *GbpVxlanTunnelAdd) (*GbpVxlanTunnelAddReply, error) + GbpVxlanTunnelDel(ctx context.Context, in *GbpVxlanTunnelDel) (*GbpVxlanTunnelDelReply, error) + GbpVxlanTunnelDump(ctx context.Context, in *GbpVxlanTunnelDump) (RPCService_GbpVxlanTunnelDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) GbpBridgeDomainAdd(ctx context.Context, in *GbpBridgeDomainAdd) (*GbpBridgeDomainAddReply, error) { + out := new(GbpBridgeDomainAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GbpBridgeDomainDel(ctx context.Context, in *GbpBridgeDomainDel) (*GbpBridgeDomainDelReply, error) { + out := new(GbpBridgeDomainDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GbpBridgeDomainDump(ctx context.Context, in *GbpBridgeDomainDump) (RPCService_GbpBridgeDomainDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_GbpBridgeDomainDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_GbpBridgeDomainDumpClient interface { + Recv() (*GbpBridgeDomainDetails, error) + api.Stream +} + +type serviceClient_GbpBridgeDomainDumpClient struct { + api.Stream +} + +func (c *serviceClient_GbpBridgeDomainDumpClient) Recv() (*GbpBridgeDomainDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *GbpBridgeDomainDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) GbpContractAddDel(ctx context.Context, in *GbpContractAddDel) (*GbpContractAddDelReply, error) { + out := new(GbpContractAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GbpContractDump(ctx context.Context, in *GbpContractDump) (RPCService_GbpContractDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_GbpContractDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_GbpContractDumpClient interface { + Recv() (*GbpContractDetails, error) + api.Stream +} + +type serviceClient_GbpContractDumpClient struct { + api.Stream +} + +func (c *serviceClient_GbpContractDumpClient) Recv() (*GbpContractDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *GbpContractDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) GbpEndpointAdd(ctx context.Context, in *GbpEndpointAdd) (*GbpEndpointAddReply, error) { + out := new(GbpEndpointAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GbpEndpointDel(ctx context.Context, in *GbpEndpointDel) (*GbpEndpointDelReply, error) { + out := new(GbpEndpointDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GbpEndpointDump(ctx context.Context, in *GbpEndpointDump) (RPCService_GbpEndpointDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_GbpEndpointDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_GbpEndpointDumpClient interface { + Recv() (*GbpEndpointDetails, error) + api.Stream +} + +type serviceClient_GbpEndpointDumpClient struct { + api.Stream +} + +func (c *serviceClient_GbpEndpointDumpClient) Recv() (*GbpEndpointDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *GbpEndpointDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) GbpEndpointGroupAdd(ctx context.Context, in *GbpEndpointGroupAdd) (*GbpEndpointGroupAddReply, error) { + out := new(GbpEndpointGroupAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GbpEndpointGroupDel(ctx context.Context, in *GbpEndpointGroupDel) (*GbpEndpointGroupDelReply, error) { + out := new(GbpEndpointGroupDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GbpEndpointGroupDump(ctx context.Context, in *GbpEndpointGroupDump) (RPCService_GbpEndpointGroupDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_GbpEndpointGroupDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_GbpEndpointGroupDumpClient interface { + Recv() (*GbpEndpointGroupDetails, error) + api.Stream +} + +type serviceClient_GbpEndpointGroupDumpClient struct { + api.Stream +} + +func (c *serviceClient_GbpEndpointGroupDumpClient) Recv() (*GbpEndpointGroupDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *GbpEndpointGroupDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) GbpExtItfAddDel(ctx context.Context, in *GbpExtItfAddDel) (*GbpExtItfAddDelReply, error) { + out := new(GbpExtItfAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GbpExtItfDump(ctx context.Context, in *GbpExtItfDump) (RPCService_GbpExtItfDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_GbpExtItfDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_GbpExtItfDumpClient interface { + Recv() (*GbpExtItfDetails, error) + api.Stream +} + +type serviceClient_GbpExtItfDumpClient struct { + api.Stream +} + +func (c *serviceClient_GbpExtItfDumpClient) Recv() (*GbpExtItfDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *GbpExtItfDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) GbpRecircAddDel(ctx context.Context, in *GbpRecircAddDel) (*GbpRecircAddDelReply, error) { + out := new(GbpRecircAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GbpRecircDump(ctx context.Context, in *GbpRecircDump) (RPCService_GbpRecircDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_GbpRecircDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_GbpRecircDumpClient interface { + Recv() (*GbpRecircDetails, error) + api.Stream +} + +type serviceClient_GbpRecircDumpClient struct { + api.Stream +} + +func (c *serviceClient_GbpRecircDumpClient) Recv() (*GbpRecircDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *GbpRecircDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) GbpRouteDomainAdd(ctx context.Context, in *GbpRouteDomainAdd) (*GbpRouteDomainAddReply, error) { + out := new(GbpRouteDomainAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GbpRouteDomainDel(ctx context.Context, in *GbpRouteDomainDel) (*GbpRouteDomainDelReply, error) { + out := new(GbpRouteDomainDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GbpRouteDomainDump(ctx context.Context, in *GbpRouteDomainDump) (RPCService_GbpRouteDomainDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_GbpRouteDomainDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_GbpRouteDomainDumpClient interface { + Recv() (*GbpRouteDomainDetails, error) + api.Stream +} + +type serviceClient_GbpRouteDomainDumpClient struct { + api.Stream +} + +func (c *serviceClient_GbpRouteDomainDumpClient) Recv() (*GbpRouteDomainDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *GbpRouteDomainDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) GbpSubnetAddDel(ctx context.Context, in *GbpSubnetAddDel) (*GbpSubnetAddDelReply, error) { + out := new(GbpSubnetAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GbpSubnetDump(ctx context.Context, in *GbpSubnetDump) (RPCService_GbpSubnetDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_GbpSubnetDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_GbpSubnetDumpClient interface { + Recv() (*GbpSubnetDetails, error) + api.Stream +} + +type serviceClient_GbpSubnetDumpClient struct { + api.Stream +} + +func (c *serviceClient_GbpSubnetDumpClient) Recv() (*GbpSubnetDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *GbpSubnetDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) GbpVxlanTunnelAdd(ctx context.Context, in *GbpVxlanTunnelAdd) (*GbpVxlanTunnelAddReply, error) { + out := new(GbpVxlanTunnelAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GbpVxlanTunnelDel(ctx context.Context, in *GbpVxlanTunnelDel) (*GbpVxlanTunnelDelReply, error) { + out := new(GbpVxlanTunnelDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GbpVxlanTunnelDump(ctx context.Context, in *GbpVxlanTunnelDump) (RPCService_GbpVxlanTunnelDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_GbpVxlanTunnelDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_GbpVxlanTunnelDumpClient interface { + Recv() (*GbpVxlanTunnelDetails, error) + api.Stream +} + +type serviceClient_GbpVxlanTunnelDumpClient struct { + api.Stream +} + +func (c *serviceClient_GbpVxlanTunnelDumpClient) Recv() (*GbpVxlanTunnelDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *GbpVxlanTunnelDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/geneve/geneve.ba.go b/binapi/geneve/geneve.ba.go new file mode 100644 index 0000000..154ce6a --- /dev/null +++ b/binapi/geneve/geneve.ba.go @@ -0,0 +1,344 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/geneve.api.json + +// Package geneve contains generated bindings for API file geneve.api. +// +// Contents: +// 6 messages +// +package geneve + +import ( + api "git.fd.io/govpp.git/api" + _ "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "geneve" + APIVersion = "2.0.0" + VersionCrc = 0x7730c1d3 +) + +// GeneveAddDelTunnel defines message 'geneve_add_del_tunnel'. +type GeneveAddDelTunnel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + LocalAddress ip_types.Address `binapi:"address,name=local_address" json:"local_address,omitempty"` + RemoteAddress ip_types.Address `binapi:"address,name=remote_address" json:"remote_address,omitempty"` + McastSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mcast_sw_if_index" json:"mcast_sw_if_index,omitempty"` + EncapVrfID uint32 `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"` + DecapNextIndex uint32 `binapi:"u32,name=decap_next_index" json:"decap_next_index,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` +} + +func (m *GeneveAddDelTunnel) Reset() { *m = GeneveAddDelTunnel{} } +func (*GeneveAddDelTunnel) GetMessageName() string { return "geneve_add_del_tunnel" } +func (*GeneveAddDelTunnel) GetCrcString() string { return "976693b5" } +func (*GeneveAddDelTunnel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GeneveAddDelTunnel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.LocalAddress.Af + size += 1 * 16 // m.LocalAddress.Un + size += 1 // m.RemoteAddress.Af + size += 1 * 16 // m.RemoteAddress.Un + size += 4 // m.McastSwIfIndex + size += 4 // m.EncapVrfID + size += 4 // m.DecapNextIndex + size += 4 // m.Vni + return size +} +func (m *GeneveAddDelTunnel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.LocalAddress.Af)) + buf.EncodeBytes(m.LocalAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.RemoteAddress.Af)) + buf.EncodeBytes(m.RemoteAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.McastSwIfIndex)) + buf.EncodeUint32(uint32(m.EncapVrfID)) + buf.EncodeUint32(uint32(m.DecapNextIndex)) + buf.EncodeUint32(uint32(m.Vni)) + return buf.Bytes(), nil +} +func (m *GeneveAddDelTunnel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.LocalAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.LocalAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.RemoteAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.RemoteAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.EncapVrfID = buf.DecodeUint32() + m.DecapNextIndex = buf.DecodeUint32() + m.Vni = buf.DecodeUint32() + return nil +} + +// GeneveAddDelTunnelReply defines message 'geneve_add_del_tunnel_reply'. +type GeneveAddDelTunnelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *GeneveAddDelTunnelReply) Reset() { *m = GeneveAddDelTunnelReply{} } +func (*GeneveAddDelTunnelReply) GetMessageName() string { return "geneve_add_del_tunnel_reply" } +func (*GeneveAddDelTunnelReply) GetCrcString() string { return "5383d31f" } +func (*GeneveAddDelTunnelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GeneveAddDelTunnelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *GeneveAddDelTunnelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *GeneveAddDelTunnelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// GeneveTunnelDetails defines message 'geneve_tunnel_details'. +type GeneveTunnelDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SrcAddress ip_types.Address `binapi:"address,name=src_address" json:"src_address,omitempty"` + DstAddress ip_types.Address `binapi:"address,name=dst_address" json:"dst_address,omitempty"` + McastSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mcast_sw_if_index" json:"mcast_sw_if_index,omitempty"` + EncapVrfID uint32 `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"` + DecapNextIndex uint32 `binapi:"u32,name=decap_next_index" json:"decap_next_index,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` +} + +func (m *GeneveTunnelDetails) Reset() { *m = GeneveTunnelDetails{} } +func (*GeneveTunnelDetails) GetMessageName() string { return "geneve_tunnel_details" } +func (*GeneveTunnelDetails) GetCrcString() string { return "e27e2748" } +func (*GeneveTunnelDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GeneveTunnelDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.SrcAddress.Af + size += 1 * 16 // m.SrcAddress.Un + size += 1 // m.DstAddress.Af + size += 1 * 16 // m.DstAddress.Un + size += 4 // m.McastSwIfIndex + size += 4 // m.EncapVrfID + size += 4 // m.DecapNextIndex + size += 4 // m.Vni + return size +} +func (m *GeneveTunnelDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.SrcAddress.Af)) + buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.DstAddress.Af)) + buf.EncodeBytes(m.DstAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.McastSwIfIndex)) + buf.EncodeUint32(uint32(m.EncapVrfID)) + buf.EncodeUint32(uint32(m.DecapNextIndex)) + buf.EncodeUint32(uint32(m.Vni)) + return buf.Bytes(), nil +} +func (m *GeneveTunnelDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.SrcAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.SrcAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.DstAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.DstAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.EncapVrfID = buf.DecodeUint32() + m.DecapNextIndex = buf.DecodeUint32() + m.Vni = buf.DecodeUint32() + return nil +} + +// GeneveTunnelDump defines message 'geneve_tunnel_dump'. +type GeneveTunnelDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *GeneveTunnelDump) Reset() { *m = GeneveTunnelDump{} } +func (*GeneveTunnelDump) GetMessageName() string { return "geneve_tunnel_dump" } +func (*GeneveTunnelDump) GetCrcString() string { return "f9e6675e" } +func (*GeneveTunnelDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GeneveTunnelDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *GeneveTunnelDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *GeneveTunnelDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// SwInterfaceSetGeneveBypass defines message 'sw_interface_set_geneve_bypass'. +type SwInterfaceSetGeneveBypass struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *SwInterfaceSetGeneveBypass) Reset() { *m = SwInterfaceSetGeneveBypass{} } +func (*SwInterfaceSetGeneveBypass) GetMessageName() string { return "sw_interface_set_geneve_bypass" } +func (*SwInterfaceSetGeneveBypass) GetCrcString() string { return "65247409" } +func (*SwInterfaceSetGeneveBypass) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetGeneveBypass) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.IsIPv6 + size += 1 // m.Enable + return size +} +func (m *SwInterfaceSetGeneveBypass) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsIPv6) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetGeneveBypass) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsIPv6 = buf.DecodeBool() + m.Enable = buf.DecodeBool() + return nil +} + +// SwInterfaceSetGeneveBypassReply defines message 'sw_interface_set_geneve_bypass_reply'. +type SwInterfaceSetGeneveBypassReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetGeneveBypassReply) Reset() { *m = SwInterfaceSetGeneveBypassReply{} } +func (*SwInterfaceSetGeneveBypassReply) GetMessageName() string { + return "sw_interface_set_geneve_bypass_reply" +} +func (*SwInterfaceSetGeneveBypassReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetGeneveBypassReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetGeneveBypassReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetGeneveBypassReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetGeneveBypassReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_geneve_binapi_init() } +func file_geneve_binapi_init() { + api.RegisterMessage((*GeneveAddDelTunnel)(nil), "geneve_add_del_tunnel_976693b5") + api.RegisterMessage((*GeneveAddDelTunnelReply)(nil), "geneve_add_del_tunnel_reply_5383d31f") + api.RegisterMessage((*GeneveTunnelDetails)(nil), "geneve_tunnel_details_e27e2748") + api.RegisterMessage((*GeneveTunnelDump)(nil), "geneve_tunnel_dump_f9e6675e") + api.RegisterMessage((*SwInterfaceSetGeneveBypass)(nil), "sw_interface_set_geneve_bypass_65247409") + api.RegisterMessage((*SwInterfaceSetGeneveBypassReply)(nil), "sw_interface_set_geneve_bypass_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*GeneveAddDelTunnel)(nil), + (*GeneveAddDelTunnelReply)(nil), + (*GeneveTunnelDetails)(nil), + (*GeneveTunnelDump)(nil), + (*SwInterfaceSetGeneveBypass)(nil), + (*SwInterfaceSetGeneveBypassReply)(nil), + } +} diff --git a/binapi/geneve/geneve_rest.ba.go b/binapi/geneve/geneve_rest.ba.go new file mode 100644 index 0000000..4987b1d --- /dev/null +++ b/binapi/geneve/geneve_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package geneve + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/geneve_add_del_tunnel", func(w http.ResponseWriter, req *http.Request) { + var request = new(GeneveAddDelTunnel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GeneveAddDelTunnel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_set_geneve_bypass", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceSetGeneveBypass) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceSetGeneveBypass(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/geneve/geneve_rpc.ba.go b/binapi/geneve/geneve_rpc.ba.go new file mode 100644 index 0000000..df9a6be --- /dev/null +++ b/binapi/geneve/geneve_rpc.ba.go @@ -0,0 +1,83 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package geneve + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service geneve. +type RPCService interface { + GeneveAddDelTunnel(ctx context.Context, in *GeneveAddDelTunnel) (*GeneveAddDelTunnelReply, error) + GeneveTunnelDump(ctx context.Context, in *GeneveTunnelDump) (RPCService_GeneveTunnelDumpClient, error) + SwInterfaceSetGeneveBypass(ctx context.Context, in *SwInterfaceSetGeneveBypass) (*SwInterfaceSetGeneveBypassReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) GeneveAddDelTunnel(ctx context.Context, in *GeneveAddDelTunnel) (*GeneveAddDelTunnelReply, error) { + out := new(GeneveAddDelTunnelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GeneveTunnelDump(ctx context.Context, in *GeneveTunnelDump) (RPCService_GeneveTunnelDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_GeneveTunnelDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_GeneveTunnelDumpClient interface { + Recv() (*GeneveTunnelDetails, error) + api.Stream +} + +type serviceClient_GeneveTunnelDumpClient struct { + api.Stream +} + +func (c *serviceClient_GeneveTunnelDumpClient) Recv() (*GeneveTunnelDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *GeneveTunnelDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) SwInterfaceSetGeneveBypass(ctx context.Context, in *SwInterfaceSetGeneveBypass) (*SwInterfaceSetGeneveBypassReply, error) { + out := new(SwInterfaceSetGeneveBypassReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/gre/gre.ba.go b/binapi/gre/gre.ba.go new file mode 100644 index 0000000..e87e88f --- /dev/null +++ b/binapi/gre/gre.ba.go @@ -0,0 +1,308 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/gre.api.json + +// Package gre contains generated bindings for API file gre.api. +// +// Contents: +// 1 enum +// 1 struct +// 4 messages +// +package gre + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + tunnel_types "git.fd.io/govpp.git/binapi/tunnel_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "gre" + APIVersion = "2.1.0" + VersionCrc = 0xb9021569 +) + +// GreTunnelType defines enum 'gre_tunnel_type'. +type GreTunnelType uint8 + +const ( + GRE_API_TUNNEL_TYPE_L3 GreTunnelType = 0 + GRE_API_TUNNEL_TYPE_TEB GreTunnelType = 1 + GRE_API_TUNNEL_TYPE_ERSPAN GreTunnelType = 2 +) + +var ( + GreTunnelType_name = map[uint8]string{ + 0: "GRE_API_TUNNEL_TYPE_L3", + 1: "GRE_API_TUNNEL_TYPE_TEB", + 2: "GRE_API_TUNNEL_TYPE_ERSPAN", + } + GreTunnelType_value = map[string]uint8{ + "GRE_API_TUNNEL_TYPE_L3": 0, + "GRE_API_TUNNEL_TYPE_TEB": 1, + "GRE_API_TUNNEL_TYPE_ERSPAN": 2, + } +) + +func (x GreTunnelType) String() string { + s, ok := GreTunnelType_name[uint8(x)] + if ok { + return s + } + return "GreTunnelType(" + strconv.Itoa(int(x)) + ")" +} + +// GreTunnel defines type 'gre_tunnel'. +type GreTunnel struct { + Type GreTunnelType `binapi:"gre_tunnel_type,name=type" json:"type,omitempty"` + Mode tunnel_types.TunnelMode `binapi:"tunnel_mode,name=mode" json:"mode,omitempty"` + Flags tunnel_types.TunnelEncapDecapFlags `binapi:"tunnel_encap_decap_flags,name=flags" json:"flags,omitempty"` + SessionID uint16 `binapi:"u16,name=session_id" json:"session_id,omitempty"` + Instance uint32 `binapi:"u32,name=instance" json:"instance,omitempty"` + OuterTableID uint32 `binapi:"u32,name=outer_table_id" json:"outer_table_id,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Src ip_types.Address `binapi:"address,name=src" json:"src,omitempty"` + Dst ip_types.Address `binapi:"address,name=dst" json:"dst,omitempty"` +} + +// GreTunnelAddDel defines message 'gre_tunnel_add_del'. +type GreTunnelAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Tunnel GreTunnel `binapi:"gre_tunnel,name=tunnel" json:"tunnel,omitempty"` +} + +func (m *GreTunnelAddDel) Reset() { *m = GreTunnelAddDel{} } +func (*GreTunnelAddDel) GetMessageName() string { return "gre_tunnel_add_del" } +func (*GreTunnelAddDel) GetCrcString() string { return "6efc9c22" } +func (*GreTunnelAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GreTunnelAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.Tunnel.Type + size += 1 // m.Tunnel.Mode + size += 1 // m.Tunnel.Flags + size += 2 // m.Tunnel.SessionID + size += 4 // m.Tunnel.Instance + size += 4 // m.Tunnel.OuterTableID + size += 4 // m.Tunnel.SwIfIndex + size += 1 // m.Tunnel.Src.Af + size += 1 * 16 // m.Tunnel.Src.Un + size += 1 // m.Tunnel.Dst.Af + size += 1 * 16 // m.Tunnel.Dst.Un + return size +} +func (m *GreTunnelAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.Tunnel.Type)) + buf.EncodeUint8(uint8(m.Tunnel.Mode)) + buf.EncodeUint8(uint8(m.Tunnel.Flags)) + buf.EncodeUint16(uint16(m.Tunnel.SessionID)) + buf.EncodeUint32(uint32(m.Tunnel.Instance)) + buf.EncodeUint32(uint32(m.Tunnel.OuterTableID)) + buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex)) + buf.EncodeUint8(uint8(m.Tunnel.Src.Af)) + buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Tunnel.Dst.Af)) + buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *GreTunnelAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Tunnel.Type = GreTunnelType(buf.DecodeUint8()) + m.Tunnel.Mode = tunnel_types.TunnelMode(buf.DecodeUint8()) + m.Tunnel.Flags = tunnel_types.TunnelEncapDecapFlags(buf.DecodeUint8()) + m.Tunnel.SessionID = buf.DecodeUint16() + m.Tunnel.Instance = buf.DecodeUint32() + m.Tunnel.OuterTableID = buf.DecodeUint32() + m.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// GreTunnelAddDelReply defines message 'gre_tunnel_add_del_reply'. +type GreTunnelAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *GreTunnelAddDelReply) Reset() { *m = GreTunnelAddDelReply{} } +func (*GreTunnelAddDelReply) GetMessageName() string { return "gre_tunnel_add_del_reply" } +func (*GreTunnelAddDelReply) GetCrcString() string { return "5383d31f" } +func (*GreTunnelAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GreTunnelAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *GreTunnelAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *GreTunnelAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// GreTunnelDetails defines message 'gre_tunnel_details'. +type GreTunnelDetails struct { + Tunnel GreTunnel `binapi:"gre_tunnel,name=tunnel" json:"tunnel,omitempty"` +} + +func (m *GreTunnelDetails) Reset() { *m = GreTunnelDetails{} } +func (*GreTunnelDetails) GetMessageName() string { return "gre_tunnel_details" } +func (*GreTunnelDetails) GetCrcString() string { return "003bfbf1" } +func (*GreTunnelDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GreTunnelDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Tunnel.Type + size += 1 // m.Tunnel.Mode + size += 1 // m.Tunnel.Flags + size += 2 // m.Tunnel.SessionID + size += 4 // m.Tunnel.Instance + size += 4 // m.Tunnel.OuterTableID + size += 4 // m.Tunnel.SwIfIndex + size += 1 // m.Tunnel.Src.Af + size += 1 * 16 // m.Tunnel.Src.Un + size += 1 // m.Tunnel.Dst.Af + size += 1 * 16 // m.Tunnel.Dst.Un + return size +} +func (m *GreTunnelDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Tunnel.Type)) + buf.EncodeUint8(uint8(m.Tunnel.Mode)) + buf.EncodeUint8(uint8(m.Tunnel.Flags)) + buf.EncodeUint16(uint16(m.Tunnel.SessionID)) + buf.EncodeUint32(uint32(m.Tunnel.Instance)) + buf.EncodeUint32(uint32(m.Tunnel.OuterTableID)) + buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex)) + buf.EncodeUint8(uint8(m.Tunnel.Src.Af)) + buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Tunnel.Dst.Af)) + buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *GreTunnelDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Tunnel.Type = GreTunnelType(buf.DecodeUint8()) + m.Tunnel.Mode = tunnel_types.TunnelMode(buf.DecodeUint8()) + m.Tunnel.Flags = tunnel_types.TunnelEncapDecapFlags(buf.DecodeUint8()) + m.Tunnel.SessionID = buf.DecodeUint16() + m.Tunnel.Instance = buf.DecodeUint32() + m.Tunnel.OuterTableID = buf.DecodeUint32() + m.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// GreTunnelDump defines message 'gre_tunnel_dump'. +type GreTunnelDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *GreTunnelDump) Reset() { *m = GreTunnelDump{} } +func (*GreTunnelDump) GetMessageName() string { return "gre_tunnel_dump" } +func (*GreTunnelDump) GetCrcString() string { return "f9e6675e" } +func (*GreTunnelDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GreTunnelDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *GreTunnelDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *GreTunnelDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +func init() { file_gre_binapi_init() } +func file_gre_binapi_init() { + api.RegisterMessage((*GreTunnelAddDel)(nil), "gre_tunnel_add_del_6efc9c22") + api.RegisterMessage((*GreTunnelAddDelReply)(nil), "gre_tunnel_add_del_reply_5383d31f") + api.RegisterMessage((*GreTunnelDetails)(nil), "gre_tunnel_details_003bfbf1") + api.RegisterMessage((*GreTunnelDump)(nil), "gre_tunnel_dump_f9e6675e") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*GreTunnelAddDel)(nil), + (*GreTunnelAddDelReply)(nil), + (*GreTunnelDetails)(nil), + (*GreTunnelDump)(nil), + } +} diff --git a/binapi/gre/gre_rest.ba.go b/binapi/gre/gre_rest.ba.go new file mode 100644 index 0000000..d344aa8 --- /dev/null +++ b/binapi/gre/gre_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package gre + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/gre_tunnel_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(GreTunnelAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GreTunnelAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/gre/gre_rpc.ba.go b/binapi/gre/gre_rpc.ba.go new file mode 100644 index 0000000..f664fb3 --- /dev/null +++ b/binapi/gre/gre_rpc.ba.go @@ -0,0 +1,73 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package gre + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service gre. +type RPCService interface { + GreTunnelAddDel(ctx context.Context, in *GreTunnelAddDel) (*GreTunnelAddDelReply, error) + GreTunnelDump(ctx context.Context, in *GreTunnelDump) (RPCService_GreTunnelDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) GreTunnelAddDel(ctx context.Context, in *GreTunnelAddDel) (*GreTunnelAddDelReply, error) { + out := new(GreTunnelAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GreTunnelDump(ctx context.Context, in *GreTunnelDump) (RPCService_GreTunnelDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_GreTunnelDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_GreTunnelDumpClient interface { + Recv() (*GreTunnelDetails, error) + api.Stream +} + +type serviceClient_GreTunnelDumpClient struct { + api.Stream +} + +func (c *serviceClient_GreTunnelDumpClient) Recv() (*GreTunnelDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *GreTunnelDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/gso/gso.ba.go b/binapi/gso/gso.ba.go new file mode 100644 index 0000000..2b2d45a --- /dev/null +++ b/binapi/gso/gso.ba.go @@ -0,0 +1,122 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/gso.api.json + +// Package gso contains generated bindings for API file gso.api. +// +// Contents: +// 2 messages +// +package gso + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "gso" + APIVersion = "1.0.0" + VersionCrc = 0x2ec8641f +) + +// FeatureGsoEnableDisable defines message 'feature_gso_enable_disable'. +type FeatureGsoEnableDisable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` +} + +func (m *FeatureGsoEnableDisable) Reset() { *m = FeatureGsoEnableDisable{} } +func (*FeatureGsoEnableDisable) GetMessageName() string { return "feature_gso_enable_disable" } +func (*FeatureGsoEnableDisable) GetCrcString() string { return "5501adee" } +func (*FeatureGsoEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *FeatureGsoEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.EnableDisable + return size +} +func (m *FeatureGsoEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.EnableDisable) + return buf.Bytes(), nil +} +func (m *FeatureGsoEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.EnableDisable = buf.DecodeBool() + return nil +} + +// FeatureGsoEnableDisableReply defines message 'feature_gso_enable_disable_reply'. +type FeatureGsoEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *FeatureGsoEnableDisableReply) Reset() { *m = FeatureGsoEnableDisableReply{} } +func (*FeatureGsoEnableDisableReply) GetMessageName() string { + return "feature_gso_enable_disable_reply" +} +func (*FeatureGsoEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*FeatureGsoEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *FeatureGsoEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *FeatureGsoEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *FeatureGsoEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_gso_binapi_init() } +func file_gso_binapi_init() { + api.RegisterMessage((*FeatureGsoEnableDisable)(nil), "feature_gso_enable_disable_5501adee") + api.RegisterMessage((*FeatureGsoEnableDisableReply)(nil), "feature_gso_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*FeatureGsoEnableDisable)(nil), + (*FeatureGsoEnableDisableReply)(nil), + } +} diff --git a/binapi/gso/gso_rest.ba.go b/binapi/gso/gso_rest.ba.go new file mode 100644 index 0000000..d04c3bd --- /dev/null +++ b/binapi/gso/gso_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package gso + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/feature_gso_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(FeatureGsoEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.FeatureGsoEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/gso/gso_rpc.ba.go b/binapi/gso/gso_rpc.ba.go new file mode 100644 index 0000000..d955acc --- /dev/null +++ b/binapi/gso/gso_rpc.ba.go @@ -0,0 +1,30 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package gso + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service gso. +type RPCService interface { + FeatureGsoEnableDisable(ctx context.Context, in *FeatureGsoEnableDisable) (*FeatureGsoEnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) FeatureGsoEnableDisable(ctx context.Context, in *FeatureGsoEnableDisable) (*FeatureGsoEnableDisableReply, error) { + out := new(FeatureGsoEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/gtpu/gtpu.ba.go b/binapi/gtpu/gtpu.ba.go new file mode 100644 index 0000000..02903a9 --- /dev/null +++ b/binapi/gtpu/gtpu.ba.go @@ -0,0 +1,427 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/gtpu.api.json + +// Package gtpu contains generated bindings for API file gtpu.api. +// +// Contents: +// 8 messages +// +package gtpu + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "gtpu" + APIVersion = "2.0.0" + VersionCrc = 0x30326e2d +) + +// GtpuAddDelTunnel defines message 'gtpu_add_del_tunnel'. +type GtpuAddDelTunnel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SrcAddress ip_types.Address `binapi:"address,name=src_address" json:"src_address,omitempty"` + DstAddress ip_types.Address `binapi:"address,name=dst_address" json:"dst_address,omitempty"` + McastSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mcast_sw_if_index" json:"mcast_sw_if_index,omitempty"` + EncapVrfID uint32 `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"` + DecapNextIndex uint32 `binapi:"u32,name=decap_next_index" json:"decap_next_index,omitempty"` + Teid uint32 `binapi:"u32,name=teid" json:"teid,omitempty"` +} + +func (m *GtpuAddDelTunnel) Reset() { *m = GtpuAddDelTunnel{} } +func (*GtpuAddDelTunnel) GetMessageName() string { return "gtpu_add_del_tunnel" } +func (*GtpuAddDelTunnel) GetCrcString() string { return "9a26a51c" } +func (*GtpuAddDelTunnel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GtpuAddDelTunnel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.SrcAddress.Af + size += 1 * 16 // m.SrcAddress.Un + size += 1 // m.DstAddress.Af + size += 1 * 16 // m.DstAddress.Un + size += 4 // m.McastSwIfIndex + size += 4 // m.EncapVrfID + size += 4 // m.DecapNextIndex + size += 4 // m.Teid + return size +} +func (m *GtpuAddDelTunnel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.SrcAddress.Af)) + buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.DstAddress.Af)) + buf.EncodeBytes(m.DstAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.McastSwIfIndex)) + buf.EncodeUint32(uint32(m.EncapVrfID)) + buf.EncodeUint32(uint32(m.DecapNextIndex)) + buf.EncodeUint32(uint32(m.Teid)) + return buf.Bytes(), nil +} +func (m *GtpuAddDelTunnel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.SrcAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.SrcAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.DstAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.DstAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.EncapVrfID = buf.DecodeUint32() + m.DecapNextIndex = buf.DecodeUint32() + m.Teid = buf.DecodeUint32() + return nil +} + +// GtpuAddDelTunnelReply defines message 'gtpu_add_del_tunnel_reply'. +type GtpuAddDelTunnelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *GtpuAddDelTunnelReply) Reset() { *m = GtpuAddDelTunnelReply{} } +func (*GtpuAddDelTunnelReply) GetMessageName() string { return "gtpu_add_del_tunnel_reply" } +func (*GtpuAddDelTunnelReply) GetCrcString() string { return "5383d31f" } +func (*GtpuAddDelTunnelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GtpuAddDelTunnelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *GtpuAddDelTunnelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *GtpuAddDelTunnelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// GtpuOffloadRx defines message 'gtpu_offload_rx'. +type GtpuOffloadRx struct { + HwIfIndex uint32 `binapi:"u32,name=hw_if_index" json:"hw_if_index,omitempty"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Enable uint8 `binapi:"u8,name=enable" json:"enable,omitempty"` +} + +func (m *GtpuOffloadRx) Reset() { *m = GtpuOffloadRx{} } +func (*GtpuOffloadRx) GetMessageName() string { return "gtpu_offload_rx" } +func (*GtpuOffloadRx) GetCrcString() string { return "f0b08786" } +func (*GtpuOffloadRx) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GtpuOffloadRx) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.HwIfIndex + size += 4 // m.SwIfIndex + size += 1 // m.Enable + return size +} +func (m *GtpuOffloadRx) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.HwIfIndex)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.Enable)) + return buf.Bytes(), nil +} +func (m *GtpuOffloadRx) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.HwIfIndex = buf.DecodeUint32() + m.SwIfIndex = buf.DecodeUint32() + m.Enable = buf.DecodeUint8() + return nil +} + +// GtpuOffloadRxReply defines message 'gtpu_offload_rx_reply'. +type GtpuOffloadRxReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *GtpuOffloadRxReply) Reset() { *m = GtpuOffloadRxReply{} } +func (*GtpuOffloadRxReply) GetMessageName() string { return "gtpu_offload_rx_reply" } +func (*GtpuOffloadRxReply) GetCrcString() string { return "e8d4e804" } +func (*GtpuOffloadRxReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GtpuOffloadRxReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *GtpuOffloadRxReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *GtpuOffloadRxReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// GtpuTunnelDetails defines message 'gtpu_tunnel_details'. +type GtpuTunnelDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SrcAddress ip_types.Address `binapi:"address,name=src_address" json:"src_address,omitempty"` + DstAddress ip_types.Address `binapi:"address,name=dst_address" json:"dst_address,omitempty"` + McastSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mcast_sw_if_index" json:"mcast_sw_if_index,omitempty"` + EncapVrfID uint32 `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"` + DecapNextIndex uint32 `binapi:"u32,name=decap_next_index" json:"decap_next_index,omitempty"` + Teid uint32 `binapi:"u32,name=teid" json:"teid,omitempty"` +} + +func (m *GtpuTunnelDetails) Reset() { *m = GtpuTunnelDetails{} } +func (*GtpuTunnelDetails) GetMessageName() string { return "gtpu_tunnel_details" } +func (*GtpuTunnelDetails) GetCrcString() string { return "a4d81a09" } +func (*GtpuTunnelDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GtpuTunnelDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.SrcAddress.Af + size += 1 * 16 // m.SrcAddress.Un + size += 1 // m.DstAddress.Af + size += 1 * 16 // m.DstAddress.Un + size += 4 // m.McastSwIfIndex + size += 4 // m.EncapVrfID + size += 4 // m.DecapNextIndex + size += 4 // m.Teid + return size +} +func (m *GtpuTunnelDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.SrcAddress.Af)) + buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.DstAddress.Af)) + buf.EncodeBytes(m.DstAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.McastSwIfIndex)) + buf.EncodeUint32(uint32(m.EncapVrfID)) + buf.EncodeUint32(uint32(m.DecapNextIndex)) + buf.EncodeUint32(uint32(m.Teid)) + return buf.Bytes(), nil +} +func (m *GtpuTunnelDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.SrcAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.SrcAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.DstAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.DstAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.EncapVrfID = buf.DecodeUint32() + m.DecapNextIndex = buf.DecodeUint32() + m.Teid = buf.DecodeUint32() + return nil +} + +// GtpuTunnelDump defines message 'gtpu_tunnel_dump'. +type GtpuTunnelDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *GtpuTunnelDump) Reset() { *m = GtpuTunnelDump{} } +func (*GtpuTunnelDump) GetMessageName() string { return "gtpu_tunnel_dump" } +func (*GtpuTunnelDump) GetCrcString() string { return "f9e6675e" } +func (*GtpuTunnelDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GtpuTunnelDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *GtpuTunnelDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *GtpuTunnelDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// SwInterfaceSetGtpuBypass defines message 'sw_interface_set_gtpu_bypass'. +type SwInterfaceSetGtpuBypass struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *SwInterfaceSetGtpuBypass) Reset() { *m = SwInterfaceSetGtpuBypass{} } +func (*SwInterfaceSetGtpuBypass) GetMessageName() string { return "sw_interface_set_gtpu_bypass" } +func (*SwInterfaceSetGtpuBypass) GetCrcString() string { return "65247409" } +func (*SwInterfaceSetGtpuBypass) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetGtpuBypass) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.IsIPv6 + size += 1 // m.Enable + return size +} +func (m *SwInterfaceSetGtpuBypass) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsIPv6) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetGtpuBypass) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsIPv6 = buf.DecodeBool() + m.Enable = buf.DecodeBool() + return nil +} + +// SwInterfaceSetGtpuBypassReply defines message 'sw_interface_set_gtpu_bypass_reply'. +type SwInterfaceSetGtpuBypassReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetGtpuBypassReply) Reset() { *m = SwInterfaceSetGtpuBypassReply{} } +func (*SwInterfaceSetGtpuBypassReply) GetMessageName() string { + return "sw_interface_set_gtpu_bypass_reply" +} +func (*SwInterfaceSetGtpuBypassReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetGtpuBypassReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetGtpuBypassReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetGtpuBypassReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetGtpuBypassReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_gtpu_binapi_init() } +func file_gtpu_binapi_init() { + api.RegisterMessage((*GtpuAddDelTunnel)(nil), "gtpu_add_del_tunnel_9a26a51c") + api.RegisterMessage((*GtpuAddDelTunnelReply)(nil), "gtpu_add_del_tunnel_reply_5383d31f") + api.RegisterMessage((*GtpuOffloadRx)(nil), "gtpu_offload_rx_f0b08786") + api.RegisterMessage((*GtpuOffloadRxReply)(nil), "gtpu_offload_rx_reply_e8d4e804") + api.RegisterMessage((*GtpuTunnelDetails)(nil), "gtpu_tunnel_details_a4d81a09") + api.RegisterMessage((*GtpuTunnelDump)(nil), "gtpu_tunnel_dump_f9e6675e") + api.RegisterMessage((*SwInterfaceSetGtpuBypass)(nil), "sw_interface_set_gtpu_bypass_65247409") + api.RegisterMessage((*SwInterfaceSetGtpuBypassReply)(nil), "sw_interface_set_gtpu_bypass_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*GtpuAddDelTunnel)(nil), + (*GtpuAddDelTunnelReply)(nil), + (*GtpuOffloadRx)(nil), + (*GtpuOffloadRxReply)(nil), + (*GtpuTunnelDetails)(nil), + (*GtpuTunnelDump)(nil), + (*SwInterfaceSetGtpuBypass)(nil), + (*SwInterfaceSetGtpuBypassReply)(nil), + } +} diff --git a/binapi/gtpu/gtpu_rest.ba.go b/binapi/gtpu/gtpu_rest.ba.go new file mode 100644 index 0000000..6631cd8 --- /dev/null +++ b/binapi/gtpu/gtpu_rest.ba.go @@ -0,0 +1,83 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package gtpu + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/gtpu_add_del_tunnel", func(w http.ResponseWriter, req *http.Request) { + var request = new(GtpuAddDelTunnel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GtpuAddDelTunnel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/gtpu_offload_rx", func(w http.ResponseWriter, req *http.Request) { + var request = new(GtpuOffloadRx) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GtpuOffloadRx(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_set_gtpu_bypass", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceSetGtpuBypass) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceSetGtpuBypass(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/gtpu/gtpu_rpc.ba.go b/binapi/gtpu/gtpu_rpc.ba.go new file mode 100644 index 0000000..fb0bb47 --- /dev/null +++ b/binapi/gtpu/gtpu_rpc.ba.go @@ -0,0 +1,93 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package gtpu + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service gtpu. +type RPCService interface { + GtpuAddDelTunnel(ctx context.Context, in *GtpuAddDelTunnel) (*GtpuAddDelTunnelReply, error) + GtpuOffloadRx(ctx context.Context, in *GtpuOffloadRx) (*GtpuOffloadRxReply, error) + GtpuTunnelDump(ctx context.Context, in *GtpuTunnelDump) (RPCService_GtpuTunnelDumpClient, error) + SwInterfaceSetGtpuBypass(ctx context.Context, in *SwInterfaceSetGtpuBypass) (*SwInterfaceSetGtpuBypassReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) GtpuAddDelTunnel(ctx context.Context, in *GtpuAddDelTunnel) (*GtpuAddDelTunnelReply, error) { + out := new(GtpuAddDelTunnelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GtpuOffloadRx(ctx context.Context, in *GtpuOffloadRx) (*GtpuOffloadRxReply, error) { + out := new(GtpuOffloadRxReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GtpuTunnelDump(ctx context.Context, in *GtpuTunnelDump) (RPCService_GtpuTunnelDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_GtpuTunnelDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_GtpuTunnelDumpClient interface { + Recv() (*GtpuTunnelDetails, error) + api.Stream +} + +type serviceClient_GtpuTunnelDumpClient struct { + api.Stream +} + +func (c *serviceClient_GtpuTunnelDumpClient) Recv() (*GtpuTunnelDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *GtpuTunnelDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) SwInterfaceSetGtpuBypass(ctx context.Context, in *SwInterfaceSetGtpuBypass) (*SwInterfaceSetGtpuBypassReply, error) { + out := new(SwInterfaceSetGtpuBypassReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/http_static/http_static.ba.go b/binapi/http_static/http_static.ba.go new file mode 100644 index 0000000..c1338ed --- /dev/null +++ b/binapi/http_static/http_static.ba.go @@ -0,0 +1,135 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/http_static.api.json + +// Package http_static contains generated bindings for API file http_static.api. +// +// Contents: +// 2 messages +// +package http_static + +import ( + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "http_static" + APIVersion = "2.1.0" + VersionCrc = 0xd29e72e9 +) + +// HTTPStaticEnable defines message 'http_static_enable'. +type HTTPStaticEnable struct { + FifoSize uint32 `binapi:"u32,name=fifo_size" json:"fifo_size,omitempty"` + CacheSizeLimit uint32 `binapi:"u32,name=cache_size_limit" json:"cache_size_limit,omitempty"` + PreallocFifos uint32 `binapi:"u32,name=prealloc_fifos" json:"prealloc_fifos,omitempty"` + PrivateSegmentSize uint32 `binapi:"u32,name=private_segment_size" json:"private_segment_size,omitempty"` + WwwRoot string `binapi:"string[256],name=www_root" json:"www_root,omitempty"` + URI string `binapi:"string[256],name=uri" json:"uri,omitempty"` +} + +func (m *HTTPStaticEnable) Reset() { *m = HTTPStaticEnable{} } +func (*HTTPStaticEnable) GetMessageName() string { return "http_static_enable" } +func (*HTTPStaticEnable) GetCrcString() string { return "075f8292" } +func (*HTTPStaticEnable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *HTTPStaticEnable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.FifoSize + size += 4 // m.CacheSizeLimit + size += 4 // m.PreallocFifos + size += 4 // m.PrivateSegmentSize + size += 256 // m.WwwRoot + size += 256 // m.URI + return size +} +func (m *HTTPStaticEnable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.FifoSize)) + buf.EncodeUint32(uint32(m.CacheSizeLimit)) + buf.EncodeUint32(uint32(m.PreallocFifos)) + buf.EncodeUint32(uint32(m.PrivateSegmentSize)) + buf.EncodeString(m.WwwRoot, 256) + buf.EncodeString(m.URI, 256) + return buf.Bytes(), nil +} +func (m *HTTPStaticEnable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.FifoSize = buf.DecodeUint32() + m.CacheSizeLimit = buf.DecodeUint32() + m.PreallocFifos = buf.DecodeUint32() + m.PrivateSegmentSize = buf.DecodeUint32() + m.WwwRoot = buf.DecodeString(256) + m.URI = buf.DecodeString(256) + return nil +} + +// HTTPStaticEnableReply defines message 'http_static_enable_reply'. +type HTTPStaticEnableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *HTTPStaticEnableReply) Reset() { *m = HTTPStaticEnableReply{} } +func (*HTTPStaticEnableReply) GetMessageName() string { return "http_static_enable_reply" } +func (*HTTPStaticEnableReply) GetCrcString() string { return "e8d4e804" } +func (*HTTPStaticEnableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *HTTPStaticEnableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *HTTPStaticEnableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *HTTPStaticEnableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_http_static_binapi_init() } +func file_http_static_binapi_init() { + api.RegisterMessage((*HTTPStaticEnable)(nil), "http_static_enable_075f8292") + api.RegisterMessage((*HTTPStaticEnableReply)(nil), "http_static_enable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*HTTPStaticEnable)(nil), + (*HTTPStaticEnableReply)(nil), + } +} diff --git a/binapi/http_static/http_static_rest.ba.go b/binapi/http_static/http_static_rest.ba.go new file mode 100644 index 0000000..f488f5a --- /dev/null +++ b/binapi/http_static/http_static_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package http_static + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/http_static_enable", func(w http.ResponseWriter, req *http.Request) { + var request = new(HTTPStaticEnable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.HTTPStaticEnable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/http_static/http_static_rpc.ba.go b/binapi/http_static/http_static_rpc.ba.go new file mode 100644 index 0000000..415313d --- /dev/null +++ b/binapi/http_static/http_static_rpc.ba.go @@ -0,0 +1,30 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package http_static + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service http_static. +type RPCService interface { + HTTPStaticEnable(ctx context.Context, in *HTTPStaticEnable) (*HTTPStaticEnableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) HTTPStaticEnable(ctx context.Context, in *HTTPStaticEnable) (*HTTPStaticEnableReply, error) { + out := new(HTTPStaticEnableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/igmp/igmp.ba.go b/binapi/igmp/igmp.ba.go new file mode 100644 index 0000000..5e520cc --- /dev/null +++ b/binapi/igmp/igmp.ba.go @@ -0,0 +1,927 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/igmp.api.json + +// Package igmp contains generated bindings for API file igmp.api. +// +// Contents: +// 2 enums +// 2 structs +// 19 messages +// +package igmp + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "igmp" + APIVersion = "1.0.0" + VersionCrc = 0x290eccf8 +) + +// FilterMode defines enum 'filter_mode'. +type FilterMode uint32 + +const ( + EXCLUDE FilterMode = 0 + INCLUDE FilterMode = 1 +) + +var ( + FilterMode_name = map[uint32]string{ + 0: "EXCLUDE", + 1: "INCLUDE", + } + FilterMode_value = map[string]uint32{ + "EXCLUDE": 0, + "INCLUDE": 1, + } +) + +func (x FilterMode) String() string { + s, ok := FilterMode_name[uint32(x)] + if ok { + return s + } + return "FilterMode(" + strconv.Itoa(int(x)) + ")" +} + +// GroupPrefixType defines enum 'group_prefix_type'. +type GroupPrefixType uint32 + +const ( + ASM GroupPrefixType = 0 + SSM GroupPrefixType = 1 +) + +var ( + GroupPrefixType_name = map[uint32]string{ + 0: "ASM", + 1: "SSM", + } + GroupPrefixType_value = map[string]uint32{ + "ASM": 0, + "SSM": 1, + } +) + +func (x GroupPrefixType) String() string { + s, ok := GroupPrefixType_name[uint32(x)] + if ok { + return s + } + return "GroupPrefixType(" + strconv.Itoa(int(x)) + ")" +} + +// GroupPrefix defines type 'group_prefix'. +type GroupPrefix struct { + Type GroupPrefixType `binapi:"group_prefix_type,name=type" json:"type,omitempty"` + Prefix ip_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` +} + +// IgmpGroup defines type 'igmp_group'. +type IgmpGroup struct { + Filter FilterMode `binapi:"filter_mode,name=filter" json:"filter,omitempty"` + NSrcs uint8 `binapi:"u8,name=n_srcs" json:"-"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Gaddr ip_types.IP4Address `binapi:"ip4_address,name=gaddr" json:"gaddr,omitempty"` + Saddrs []ip_types.IP4Address `binapi:"ip4_address[n_srcs],name=saddrs" json:"saddrs,omitempty"` +} + +// IgmpClearInterface defines message 'igmp_clear_interface'. +type IgmpClearInterface struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *IgmpClearInterface) Reset() { *m = IgmpClearInterface{} } +func (*IgmpClearInterface) GetMessageName() string { return "igmp_clear_interface" } +func (*IgmpClearInterface) GetCrcString() string { return "f9e6675e" } +func (*IgmpClearInterface) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IgmpClearInterface) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *IgmpClearInterface) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *IgmpClearInterface) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// IgmpClearInterfaceReply defines message 'igmp_clear_interface_reply'. +type IgmpClearInterfaceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IgmpClearInterfaceReply) Reset() { *m = IgmpClearInterfaceReply{} } +func (*IgmpClearInterfaceReply) GetMessageName() string { return "igmp_clear_interface_reply" } +func (*IgmpClearInterfaceReply) GetCrcString() string { return "e8d4e804" } +func (*IgmpClearInterfaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IgmpClearInterfaceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IgmpClearInterfaceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IgmpClearInterfaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IgmpDetails defines message 'igmp_details'. +type IgmpDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Saddr ip_types.IP4Address `binapi:"ip4_address,name=saddr" json:"saddr,omitempty"` + Gaddr ip_types.IP4Address `binapi:"ip4_address,name=gaddr" json:"gaddr,omitempty"` +} + +func (m *IgmpDetails) Reset() { *m = IgmpDetails{} } +func (*IgmpDetails) GetMessageName() string { return "igmp_details" } +func (*IgmpDetails) GetCrcString() string { return "52f12a89" } +func (*IgmpDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IgmpDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 * 4 // m.Saddr + size += 1 * 4 // m.Gaddr + return size +} +func (m *IgmpDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBytes(m.Saddr[:], 4) + buf.EncodeBytes(m.Gaddr[:], 4) + return buf.Bytes(), nil +} +func (m *IgmpDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + copy(m.Saddr[:], buf.DecodeBytes(4)) + copy(m.Gaddr[:], buf.DecodeBytes(4)) + return nil +} + +// IgmpDump defines message 'igmp_dump'. +type IgmpDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *IgmpDump) Reset() { *m = IgmpDump{} } +func (*IgmpDump) GetMessageName() string { return "igmp_dump" } +func (*IgmpDump) GetCrcString() string { return "f9e6675e" } +func (*IgmpDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IgmpDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *IgmpDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *IgmpDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// IgmpEnableDisable defines message 'igmp_enable_disable'. +type IgmpEnableDisable struct { + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` + Mode uint8 `binapi:"u8,name=mode" json:"mode,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *IgmpEnableDisable) Reset() { *m = IgmpEnableDisable{} } +func (*IgmpEnableDisable) GetMessageName() string { return "igmp_enable_disable" } +func (*IgmpEnableDisable) GetCrcString() string { return "b1edfb96" } +func (*IgmpEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IgmpEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Enable + size += 1 // m.Mode + size += 4 // m.SwIfIndex + return size +} +func (m *IgmpEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.Enable) + buf.EncodeUint8(uint8(m.Mode)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *IgmpEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Enable = buf.DecodeBool() + m.Mode = buf.DecodeUint8() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// IgmpEnableDisableReply defines message 'igmp_enable_disable_reply'. +type IgmpEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IgmpEnableDisableReply) Reset() { *m = IgmpEnableDisableReply{} } +func (*IgmpEnableDisableReply) GetMessageName() string { return "igmp_enable_disable_reply" } +func (*IgmpEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*IgmpEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IgmpEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IgmpEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IgmpEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IgmpEvent defines message 'igmp_event'. +type IgmpEvent struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Filter FilterMode `binapi:"filter_mode,name=filter" json:"filter,omitempty"` + Saddr ip_types.IP4Address `binapi:"ip4_address,name=saddr" json:"saddr,omitempty"` + Gaddr ip_types.IP4Address `binapi:"ip4_address,name=gaddr" json:"gaddr,omitempty"` +} + +func (m *IgmpEvent) Reset() { *m = IgmpEvent{} } +func (*IgmpEvent) GetMessageName() string { return "igmp_event" } +func (*IgmpEvent) GetCrcString() string { return "d7696eaf" } +func (*IgmpEvent) GetMessageType() api.MessageType { + return api.OtherMessage +} + +func (m *IgmpEvent) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.Filter + size += 1 * 4 // m.Saddr + size += 1 * 4 // m.Gaddr + return size +} +func (m *IgmpEvent) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.Filter)) + buf.EncodeBytes(m.Saddr[:], 4) + buf.EncodeBytes(m.Gaddr[:], 4) + return buf.Bytes(), nil +} +func (m *IgmpEvent) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Filter = FilterMode(buf.DecodeUint32()) + copy(m.Saddr[:], buf.DecodeBytes(4)) + copy(m.Gaddr[:], buf.DecodeBytes(4)) + return nil +} + +// IgmpGroupPrefixDetails defines message 'igmp_group_prefix_details'. +type IgmpGroupPrefixDetails struct { + Gp GroupPrefix `binapi:"group_prefix,name=gp" json:"gp,omitempty"` +} + +func (m *IgmpGroupPrefixDetails) Reset() { *m = IgmpGroupPrefixDetails{} } +func (*IgmpGroupPrefixDetails) GetMessageName() string { return "igmp_group_prefix_details" } +func (*IgmpGroupPrefixDetails) GetCrcString() string { return "c3b3c526" } +func (*IgmpGroupPrefixDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IgmpGroupPrefixDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Gp.Type + size += 1 // m.Gp.Prefix.Address.Af + size += 1 * 16 // m.Gp.Prefix.Address.Un + size += 1 // m.Gp.Prefix.Len + return size +} +func (m *IgmpGroupPrefixDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Gp.Type)) + buf.EncodeUint8(uint8(m.Gp.Prefix.Address.Af)) + buf.EncodeBytes(m.Gp.Prefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Gp.Prefix.Len)) + return buf.Bytes(), nil +} +func (m *IgmpGroupPrefixDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Gp.Type = GroupPrefixType(buf.DecodeUint32()) + m.Gp.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Gp.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Gp.Prefix.Len = buf.DecodeUint8() + return nil +} + +// IgmpGroupPrefixDump defines message 'igmp_group_prefix_dump'. +type IgmpGroupPrefixDump struct{} + +func (m *IgmpGroupPrefixDump) Reset() { *m = IgmpGroupPrefixDump{} } +func (*IgmpGroupPrefixDump) GetMessageName() string { return "igmp_group_prefix_dump" } +func (*IgmpGroupPrefixDump) GetCrcString() string { return "51077d14" } +func (*IgmpGroupPrefixDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IgmpGroupPrefixDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *IgmpGroupPrefixDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *IgmpGroupPrefixDump) Unmarshal(b []byte) error { + return nil +} + +// IgmpGroupPrefixSet defines message 'igmp_group_prefix_set'. +type IgmpGroupPrefixSet struct { + Gp GroupPrefix `binapi:"group_prefix,name=gp" json:"gp,omitempty"` +} + +func (m *IgmpGroupPrefixSet) Reset() { *m = IgmpGroupPrefixSet{} } +func (*IgmpGroupPrefixSet) GetMessageName() string { return "igmp_group_prefix_set" } +func (*IgmpGroupPrefixSet) GetCrcString() string { return "d4f20ac5" } +func (*IgmpGroupPrefixSet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IgmpGroupPrefixSet) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Gp.Type + size += 1 // m.Gp.Prefix.Address.Af + size += 1 * 16 // m.Gp.Prefix.Address.Un + size += 1 // m.Gp.Prefix.Len + return size +} +func (m *IgmpGroupPrefixSet) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Gp.Type)) + buf.EncodeUint8(uint8(m.Gp.Prefix.Address.Af)) + buf.EncodeBytes(m.Gp.Prefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Gp.Prefix.Len)) + return buf.Bytes(), nil +} +func (m *IgmpGroupPrefixSet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Gp.Type = GroupPrefixType(buf.DecodeUint32()) + m.Gp.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Gp.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Gp.Prefix.Len = buf.DecodeUint8() + return nil +} + +// IgmpGroupPrefixSetReply defines message 'igmp_group_prefix_set_reply'. +type IgmpGroupPrefixSetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IgmpGroupPrefixSetReply) Reset() { *m = IgmpGroupPrefixSetReply{} } +func (*IgmpGroupPrefixSetReply) GetMessageName() string { return "igmp_group_prefix_set_reply" } +func (*IgmpGroupPrefixSetReply) GetCrcString() string { return "e8d4e804" } +func (*IgmpGroupPrefixSetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IgmpGroupPrefixSetReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IgmpGroupPrefixSetReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IgmpGroupPrefixSetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IgmpListen defines message 'igmp_listen'. +type IgmpListen struct { + Group IgmpGroup `binapi:"igmp_group,name=group" json:"group,omitempty"` +} + +func (m *IgmpListen) Reset() { *m = IgmpListen{} } +func (*IgmpListen) GetMessageName() string { return "igmp_listen" } +func (*IgmpListen) GetCrcString() string { return "3f93a51a" } +func (*IgmpListen) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IgmpListen) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Group.Filter + size += 1 // m.Group.NSrcs + size += 4 // m.Group.SwIfIndex + size += 1 * 4 // m.Group.Gaddr + for j2 := 0; j2 < len(m.Group.Saddrs); j2++ { + var s2 ip_types.IP4Address + _ = s2 + if j2 < len(m.Group.Saddrs) { + s2 = m.Group.Saddrs[j2] + } + size += 1 * 4 // s2 + } + return size +} +func (m *IgmpListen) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Group.Filter)) + buf.EncodeUint8(uint8(len(m.Group.Saddrs))) + buf.EncodeUint32(uint32(m.Group.SwIfIndex)) + buf.EncodeBytes(m.Group.Gaddr[:], 4) + for j1 := 0; j1 < len(m.Group.Saddrs); j1++ { + var v1 ip_types.IP4Address + if j1 < len(m.Group.Saddrs) { + v1 = m.Group.Saddrs[j1] + } + buf.EncodeBytes(v1[:], 4) + } + return buf.Bytes(), nil +} +func (m *IgmpListen) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Group.Filter = FilterMode(buf.DecodeUint32()) + m.Group.NSrcs = buf.DecodeUint8() + m.Group.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + copy(m.Group.Gaddr[:], buf.DecodeBytes(4)) + m.Group.Saddrs = make([]ip_types.IP4Address, int(m.Group.NSrcs)) + for j1 := 0; j1 < len(m.Group.Saddrs); j1++ { + copy(m.Group.Saddrs[j1][:], buf.DecodeBytes(4)) + } + return nil +} + +// IgmpListenReply defines message 'igmp_listen_reply'. +type IgmpListenReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IgmpListenReply) Reset() { *m = IgmpListenReply{} } +func (*IgmpListenReply) GetMessageName() string { return "igmp_listen_reply" } +func (*IgmpListenReply) GetCrcString() string { return "e8d4e804" } +func (*IgmpListenReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IgmpListenReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IgmpListenReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IgmpListenReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IgmpProxyDeviceAddDel defines message 'igmp_proxy_device_add_del'. +type IgmpProxyDeviceAddDel struct { + Add uint8 `binapi:"u8,name=add" json:"add,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *IgmpProxyDeviceAddDel) Reset() { *m = IgmpProxyDeviceAddDel{} } +func (*IgmpProxyDeviceAddDel) GetMessageName() string { return "igmp_proxy_device_add_del" } +func (*IgmpProxyDeviceAddDel) GetCrcString() string { return "0b9be9ce" } +func (*IgmpProxyDeviceAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IgmpProxyDeviceAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Add + size += 4 // m.VrfID + size += 4 // m.SwIfIndex + return size +} +func (m *IgmpProxyDeviceAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Add)) + buf.EncodeUint32(uint32(m.VrfID)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *IgmpProxyDeviceAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Add = buf.DecodeUint8() + m.VrfID = buf.DecodeUint32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// IgmpProxyDeviceAddDelInterface defines message 'igmp_proxy_device_add_del_interface'. +type IgmpProxyDeviceAddDelInterface struct { + Add bool `binapi:"bool,name=add" json:"add,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *IgmpProxyDeviceAddDelInterface) Reset() { *m = IgmpProxyDeviceAddDelInterface{} } +func (*IgmpProxyDeviceAddDelInterface) GetMessageName() string { + return "igmp_proxy_device_add_del_interface" +} +func (*IgmpProxyDeviceAddDelInterface) GetCrcString() string { return "1a9ec24a" } +func (*IgmpProxyDeviceAddDelInterface) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IgmpProxyDeviceAddDelInterface) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Add + size += 4 // m.VrfID + size += 4 // m.SwIfIndex + return size +} +func (m *IgmpProxyDeviceAddDelInterface) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.Add) + buf.EncodeUint32(uint32(m.VrfID)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *IgmpProxyDeviceAddDelInterface) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Add = buf.DecodeBool() + m.VrfID = buf.DecodeUint32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// IgmpProxyDeviceAddDelInterfaceReply defines message 'igmp_proxy_device_add_del_interface_reply'. +type IgmpProxyDeviceAddDelInterfaceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IgmpProxyDeviceAddDelInterfaceReply) Reset() { *m = IgmpProxyDeviceAddDelInterfaceReply{} } +func (*IgmpProxyDeviceAddDelInterfaceReply) GetMessageName() string { + return "igmp_proxy_device_add_del_interface_reply" +} +func (*IgmpProxyDeviceAddDelInterfaceReply) GetCrcString() string { return "e8d4e804" } +func (*IgmpProxyDeviceAddDelInterfaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IgmpProxyDeviceAddDelInterfaceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IgmpProxyDeviceAddDelInterfaceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IgmpProxyDeviceAddDelInterfaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IgmpProxyDeviceAddDelReply defines message 'igmp_proxy_device_add_del_reply'. +type IgmpProxyDeviceAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IgmpProxyDeviceAddDelReply) Reset() { *m = IgmpProxyDeviceAddDelReply{} } +func (*IgmpProxyDeviceAddDelReply) GetMessageName() string { return "igmp_proxy_device_add_del_reply" } +func (*IgmpProxyDeviceAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*IgmpProxyDeviceAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IgmpProxyDeviceAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IgmpProxyDeviceAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IgmpProxyDeviceAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// WantIgmpEvents defines message 'want_igmp_events'. +type WantIgmpEvents struct { + Enable uint32 `binapi:"u32,name=enable" json:"enable,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` +} + +func (m *WantIgmpEvents) Reset() { *m = WantIgmpEvents{} } +func (*WantIgmpEvents) GetMessageName() string { return "want_igmp_events" } +func (*WantIgmpEvents) GetCrcString() string { return "cfaccc1f" } +func (*WantIgmpEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WantIgmpEvents) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Enable + size += 4 // m.PID + return size +} +func (m *WantIgmpEvents) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Enable)) + buf.EncodeUint32(uint32(m.PID)) + return buf.Bytes(), nil +} +func (m *WantIgmpEvents) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Enable = buf.DecodeUint32() + m.PID = buf.DecodeUint32() + return nil +} + +// WantIgmpEventsReply defines message 'want_igmp_events_reply'. +type WantIgmpEventsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WantIgmpEventsReply) Reset() { *m = WantIgmpEventsReply{} } +func (*WantIgmpEventsReply) GetMessageName() string { return "want_igmp_events_reply" } +func (*WantIgmpEventsReply) GetCrcString() string { return "e8d4e804" } +func (*WantIgmpEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WantIgmpEventsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *WantIgmpEventsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *WantIgmpEventsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_igmp_binapi_init() } +func file_igmp_binapi_init() { + api.RegisterMessage((*IgmpClearInterface)(nil), "igmp_clear_interface_f9e6675e") + api.RegisterMessage((*IgmpClearInterfaceReply)(nil), "igmp_clear_interface_reply_e8d4e804") + api.RegisterMessage((*IgmpDetails)(nil), "igmp_details_52f12a89") + api.RegisterMessage((*IgmpDump)(nil), "igmp_dump_f9e6675e") + api.RegisterMessage((*IgmpEnableDisable)(nil), "igmp_enable_disable_b1edfb96") + api.RegisterMessage((*IgmpEnableDisableReply)(nil), "igmp_enable_disable_reply_e8d4e804") + api.RegisterMessage((*IgmpEvent)(nil), "igmp_event_d7696eaf") + api.RegisterMessage((*IgmpGroupPrefixDetails)(nil), "igmp_group_prefix_details_c3b3c526") + api.RegisterMessage((*IgmpGroupPrefixDump)(nil), "igmp_group_prefix_dump_51077d14") + api.RegisterMessage((*IgmpGroupPrefixSet)(nil), "igmp_group_prefix_set_d4f20ac5") + api.RegisterMessage((*IgmpGroupPrefixSetReply)(nil), "igmp_group_prefix_set_reply_e8d4e804") + api.RegisterMessage((*IgmpListen)(nil), "igmp_listen_3f93a51a") + api.RegisterMessage((*IgmpListenReply)(nil), "igmp_listen_reply_e8d4e804") + api.RegisterMessage((*IgmpProxyDeviceAddDel)(nil), "igmp_proxy_device_add_del_0b9be9ce") + api.RegisterMessage((*IgmpProxyDeviceAddDelInterface)(nil), "igmp_proxy_device_add_del_interface_1a9ec24a") + api.RegisterMessage((*IgmpProxyDeviceAddDelInterfaceReply)(nil), "igmp_proxy_device_add_del_interface_reply_e8d4e804") + api.RegisterMessage((*IgmpProxyDeviceAddDelReply)(nil), "igmp_proxy_device_add_del_reply_e8d4e804") + api.RegisterMessage((*WantIgmpEvents)(nil), "want_igmp_events_cfaccc1f") + api.RegisterMessage((*WantIgmpEventsReply)(nil), "want_igmp_events_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*IgmpClearInterface)(nil), + (*IgmpClearInterfaceReply)(nil), + (*IgmpDetails)(nil), + (*IgmpDump)(nil), + (*IgmpEnableDisable)(nil), + (*IgmpEnableDisableReply)(nil), + (*IgmpEvent)(nil), + (*IgmpGroupPrefixDetails)(nil), + (*IgmpGroupPrefixDump)(nil), + (*IgmpGroupPrefixSet)(nil), + (*IgmpGroupPrefixSetReply)(nil), + (*IgmpListen)(nil), + (*IgmpListenReply)(nil), + (*IgmpProxyDeviceAddDel)(nil), + (*IgmpProxyDeviceAddDelInterface)(nil), + (*IgmpProxyDeviceAddDelInterfaceReply)(nil), + (*IgmpProxyDeviceAddDelReply)(nil), + (*WantIgmpEvents)(nil), + (*WantIgmpEventsReply)(nil), + } +} diff --git a/binapi/igmp/igmp_rest.ba.go b/binapi/igmp/igmp_rest.ba.go new file mode 100644 index 0000000..c3869ff --- /dev/null +++ b/binapi/igmp/igmp_rest.ba.go @@ -0,0 +1,175 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package igmp + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/igmp_clear_interface", func(w http.ResponseWriter, req *http.Request) { + var request = new(IgmpClearInterface) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IgmpClearInterface(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/igmp_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(IgmpEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IgmpEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/igmp_group_prefix_set", func(w http.ResponseWriter, req *http.Request) { + var request = new(IgmpGroupPrefixSet) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IgmpGroupPrefixSet(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/igmp_listen", func(w http.ResponseWriter, req *http.Request) { + var request = new(IgmpListen) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IgmpListen(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/igmp_proxy_device_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(IgmpProxyDeviceAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IgmpProxyDeviceAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/igmp_proxy_device_add_del_interface", func(w http.ResponseWriter, req *http.Request) { + var request = new(IgmpProxyDeviceAddDelInterface) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IgmpProxyDeviceAddDelInterface(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/want_igmp_events", func(w http.ResponseWriter, req *http.Request) { + var request = new(WantIgmpEvents) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.WantIgmpEvents(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/igmp/igmp_rpc.ba.go b/binapi/igmp/igmp_rpc.ba.go new file mode 100644 index 0000000..b873bda --- /dev/null +++ b/binapi/igmp/igmp_rpc.ba.go @@ -0,0 +1,173 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package igmp + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service igmp. +type RPCService interface { + IgmpClearInterface(ctx context.Context, in *IgmpClearInterface) (*IgmpClearInterfaceReply, error) + IgmpDump(ctx context.Context, in *IgmpDump) (RPCService_IgmpDumpClient, error) + IgmpEnableDisable(ctx context.Context, in *IgmpEnableDisable) (*IgmpEnableDisableReply, error) + IgmpGroupPrefixDump(ctx context.Context, in *IgmpGroupPrefixDump) (RPCService_IgmpGroupPrefixDumpClient, error) + IgmpGroupPrefixSet(ctx context.Context, in *IgmpGroupPrefixSet) (*IgmpGroupPrefixSetReply, error) + IgmpListen(ctx context.Context, in *IgmpListen) (*IgmpListenReply, error) + IgmpProxyDeviceAddDel(ctx context.Context, in *IgmpProxyDeviceAddDel) (*IgmpProxyDeviceAddDelReply, error) + IgmpProxyDeviceAddDelInterface(ctx context.Context, in *IgmpProxyDeviceAddDelInterface) (*IgmpProxyDeviceAddDelInterfaceReply, error) + WantIgmpEvents(ctx context.Context, in *WantIgmpEvents) (*WantIgmpEventsReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) IgmpClearInterface(ctx context.Context, in *IgmpClearInterface) (*IgmpClearInterfaceReply, error) { + out := new(IgmpClearInterfaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IgmpDump(ctx context.Context, in *IgmpDump) (RPCService_IgmpDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IgmpDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IgmpDumpClient interface { + Recv() (*IgmpDetails, error) + api.Stream +} + +type serviceClient_IgmpDumpClient struct { + api.Stream +} + +func (c *serviceClient_IgmpDumpClient) Recv() (*IgmpDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IgmpDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IgmpEnableDisable(ctx context.Context, in *IgmpEnableDisable) (*IgmpEnableDisableReply, error) { + out := new(IgmpEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IgmpGroupPrefixDump(ctx context.Context, in *IgmpGroupPrefixDump) (RPCService_IgmpGroupPrefixDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IgmpGroupPrefixDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IgmpGroupPrefixDumpClient interface { + Recv() (*IgmpGroupPrefixDetails, error) + api.Stream +} + +type serviceClient_IgmpGroupPrefixDumpClient struct { + api.Stream +} + +func (c *serviceClient_IgmpGroupPrefixDumpClient) Recv() (*IgmpGroupPrefixDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IgmpGroupPrefixDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IgmpGroupPrefixSet(ctx context.Context, in *IgmpGroupPrefixSet) (*IgmpGroupPrefixSetReply, error) { + out := new(IgmpGroupPrefixSetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IgmpListen(ctx context.Context, in *IgmpListen) (*IgmpListenReply, error) { + out := new(IgmpListenReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IgmpProxyDeviceAddDel(ctx context.Context, in *IgmpProxyDeviceAddDel) (*IgmpProxyDeviceAddDelReply, error) { + out := new(IgmpProxyDeviceAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IgmpProxyDeviceAddDelInterface(ctx context.Context, in *IgmpProxyDeviceAddDelInterface) (*IgmpProxyDeviceAddDelInterfaceReply, error) { + out := new(IgmpProxyDeviceAddDelInterfaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantIgmpEvents(ctx context.Context, in *WantIgmpEvents) (*WantIgmpEventsReply, error) { + out := new(WantIgmpEventsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/ikev2/ikev2.ba.go b/binapi/ikev2/ikev2.ba.go new file mode 100644 index 0000000..4f06ed9 --- /dev/null +++ b/binapi/ikev2/ikev2.ba.go @@ -0,0 +1,1553 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/ikev2.api.json + +// Package ikev2 contains generated bindings for API file ikev2.api. +// +// Contents: +// 36 messages +// +package ikev2 + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "ikev2" + APIVersion = "1.0.1" + VersionCrc = 0x2ebaa2d8 +) + +// Ikev2InitiateDelChildSa defines message 'ikev2_initiate_del_child_sa'. +type Ikev2InitiateDelChildSa struct { + Ispi uint32 `binapi:"u32,name=ispi" json:"ispi,omitempty"` +} + +func (m *Ikev2InitiateDelChildSa) Reset() { *m = Ikev2InitiateDelChildSa{} } +func (*Ikev2InitiateDelChildSa) GetMessageName() string { return "ikev2_initiate_del_child_sa" } +func (*Ikev2InitiateDelChildSa) GetCrcString() string { return "7f004d2e" } +func (*Ikev2InitiateDelChildSa) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2InitiateDelChildSa) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Ispi + return size +} +func (m *Ikev2InitiateDelChildSa) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Ispi)) + return buf.Bytes(), nil +} +func (m *Ikev2InitiateDelChildSa) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Ispi = buf.DecodeUint32() + return nil +} + +// Ikev2InitiateDelChildSaReply defines message 'ikev2_initiate_del_child_sa_reply'. +type Ikev2InitiateDelChildSaReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Ikev2InitiateDelChildSaReply) Reset() { *m = Ikev2InitiateDelChildSaReply{} } +func (*Ikev2InitiateDelChildSaReply) GetMessageName() string { + return "ikev2_initiate_del_child_sa_reply" +} +func (*Ikev2InitiateDelChildSaReply) GetCrcString() string { return "e8d4e804" } +func (*Ikev2InitiateDelChildSaReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2InitiateDelChildSaReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Ikev2InitiateDelChildSaReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Ikev2InitiateDelChildSaReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Ikev2InitiateDelIkeSa defines message 'ikev2_initiate_del_ike_sa'. +type Ikev2InitiateDelIkeSa struct { + Ispi uint64 `binapi:"u64,name=ispi" json:"ispi,omitempty"` +} + +func (m *Ikev2InitiateDelIkeSa) Reset() { *m = Ikev2InitiateDelIkeSa{} } +func (*Ikev2InitiateDelIkeSa) GetMessageName() string { return "ikev2_initiate_del_ike_sa" } +func (*Ikev2InitiateDelIkeSa) GetCrcString() string { return "8d125bdd" } +func (*Ikev2InitiateDelIkeSa) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2InitiateDelIkeSa) Size() int { + if m == nil { + return 0 + } + var size int + size += 8 // m.Ispi + return size +} +func (m *Ikev2InitiateDelIkeSa) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint64(uint64(m.Ispi)) + return buf.Bytes(), nil +} +func (m *Ikev2InitiateDelIkeSa) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Ispi = buf.DecodeUint64() + return nil +} + +// Ikev2InitiateDelIkeSaReply defines message 'ikev2_initiate_del_ike_sa_reply'. +type Ikev2InitiateDelIkeSaReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Ikev2InitiateDelIkeSaReply) Reset() { *m = Ikev2InitiateDelIkeSaReply{} } +func (*Ikev2InitiateDelIkeSaReply) GetMessageName() string { return "ikev2_initiate_del_ike_sa_reply" } +func (*Ikev2InitiateDelIkeSaReply) GetCrcString() string { return "e8d4e804" } +func (*Ikev2InitiateDelIkeSaReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2InitiateDelIkeSaReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Ikev2InitiateDelIkeSaReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Ikev2InitiateDelIkeSaReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Ikev2InitiateRekeyChildSa defines message 'ikev2_initiate_rekey_child_sa'. +type Ikev2InitiateRekeyChildSa struct { + Ispi uint32 `binapi:"u32,name=ispi" json:"ispi,omitempty"` +} + +func (m *Ikev2InitiateRekeyChildSa) Reset() { *m = Ikev2InitiateRekeyChildSa{} } +func (*Ikev2InitiateRekeyChildSa) GetMessageName() string { return "ikev2_initiate_rekey_child_sa" } +func (*Ikev2InitiateRekeyChildSa) GetCrcString() string { return "7f004d2e" } +func (*Ikev2InitiateRekeyChildSa) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2InitiateRekeyChildSa) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Ispi + return size +} +func (m *Ikev2InitiateRekeyChildSa) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Ispi)) + return buf.Bytes(), nil +} +func (m *Ikev2InitiateRekeyChildSa) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Ispi = buf.DecodeUint32() + return nil +} + +// Ikev2InitiateRekeyChildSaReply defines message 'ikev2_initiate_rekey_child_sa_reply'. +type Ikev2InitiateRekeyChildSaReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Ikev2InitiateRekeyChildSaReply) Reset() { *m = Ikev2InitiateRekeyChildSaReply{} } +func (*Ikev2InitiateRekeyChildSaReply) GetMessageName() string { + return "ikev2_initiate_rekey_child_sa_reply" +} +func (*Ikev2InitiateRekeyChildSaReply) GetCrcString() string { return "e8d4e804" } +func (*Ikev2InitiateRekeyChildSaReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2InitiateRekeyChildSaReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Ikev2InitiateRekeyChildSaReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Ikev2InitiateRekeyChildSaReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Ikev2InitiateSaInit defines message 'ikev2_initiate_sa_init'. +type Ikev2InitiateSaInit struct { + Name string `binapi:"string[64],name=name" json:"name,omitempty"` +} + +func (m *Ikev2InitiateSaInit) Reset() { *m = Ikev2InitiateSaInit{} } +func (*Ikev2InitiateSaInit) GetMessageName() string { return "ikev2_initiate_sa_init" } +func (*Ikev2InitiateSaInit) GetCrcString() string { return "ebf79a66" } +func (*Ikev2InitiateSaInit) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2InitiateSaInit) Size() int { + if m == nil { + return 0 + } + var size int + size += 64 // m.Name + return size +} +func (m *Ikev2InitiateSaInit) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.Name, 64) + return buf.Bytes(), nil +} +func (m *Ikev2InitiateSaInit) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Name = buf.DecodeString(64) + return nil +} + +// Ikev2InitiateSaInitReply defines message 'ikev2_initiate_sa_init_reply'. +type Ikev2InitiateSaInitReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Ikev2InitiateSaInitReply) Reset() { *m = Ikev2InitiateSaInitReply{} } +func (*Ikev2InitiateSaInitReply) GetMessageName() string { return "ikev2_initiate_sa_init_reply" } +func (*Ikev2InitiateSaInitReply) GetCrcString() string { return "e8d4e804" } +func (*Ikev2InitiateSaInitReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2InitiateSaInitReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Ikev2InitiateSaInitReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Ikev2InitiateSaInitReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Ikev2PluginGetVersion defines message 'ikev2_plugin_get_version'. +type Ikev2PluginGetVersion struct{} + +func (m *Ikev2PluginGetVersion) Reset() { *m = Ikev2PluginGetVersion{} } +func (*Ikev2PluginGetVersion) GetMessageName() string { return "ikev2_plugin_get_version" } +func (*Ikev2PluginGetVersion) GetCrcString() string { return "51077d14" } +func (*Ikev2PluginGetVersion) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2PluginGetVersion) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *Ikev2PluginGetVersion) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *Ikev2PluginGetVersion) Unmarshal(b []byte) error { + return nil +} + +// Ikev2PluginGetVersionReply defines message 'ikev2_plugin_get_version_reply'. +type Ikev2PluginGetVersionReply struct { + Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` + Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` +} + +func (m *Ikev2PluginGetVersionReply) Reset() { *m = Ikev2PluginGetVersionReply{} } +func (*Ikev2PluginGetVersionReply) GetMessageName() string { return "ikev2_plugin_get_version_reply" } +func (*Ikev2PluginGetVersionReply) GetCrcString() string { return "9b32cf86" } +func (*Ikev2PluginGetVersionReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2PluginGetVersionReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Major + size += 4 // m.Minor + return size +} +func (m *Ikev2PluginGetVersionReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Major)) + buf.EncodeUint32(uint32(m.Minor)) + return buf.Bytes(), nil +} +func (m *Ikev2PluginGetVersionReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Major = buf.DecodeUint32() + m.Minor = buf.DecodeUint32() + return nil +} + +// Ikev2ProfileAddDel defines message 'ikev2_profile_add_del'. +type Ikev2ProfileAddDel struct { + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *Ikev2ProfileAddDel) Reset() { *m = Ikev2ProfileAddDel{} } +func (*Ikev2ProfileAddDel) GetMessageName() string { return "ikev2_profile_add_del" } +func (*Ikev2ProfileAddDel) GetCrcString() string { return "2c925b55" } +func (*Ikev2ProfileAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2ProfileAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 64 // m.Name + size += 1 // m.IsAdd + return size +} +func (m *Ikev2ProfileAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.Name, 64) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *Ikev2ProfileAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Name = buf.DecodeString(64) + m.IsAdd = buf.DecodeBool() + return nil +} + +// Ikev2ProfileAddDelReply defines message 'ikev2_profile_add_del_reply'. +type Ikev2ProfileAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Ikev2ProfileAddDelReply) Reset() { *m = Ikev2ProfileAddDelReply{} } +func (*Ikev2ProfileAddDelReply) GetMessageName() string { return "ikev2_profile_add_del_reply" } +func (*Ikev2ProfileAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*Ikev2ProfileAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2ProfileAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Ikev2ProfileAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Ikev2ProfileAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Ikev2ProfileSetAuth defines message 'ikev2_profile_set_auth'. +type Ikev2ProfileSetAuth struct { + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + AuthMethod uint8 `binapi:"u8,name=auth_method" json:"auth_method,omitempty"` + IsHex bool `binapi:"bool,name=is_hex" json:"is_hex,omitempty"` + DataLen uint32 `binapi:"u32,name=data_len" json:"-"` + Data []byte `binapi:"u8[data_len],name=data" json:"data,omitempty"` +} + +func (m *Ikev2ProfileSetAuth) Reset() { *m = Ikev2ProfileSetAuth{} } +func (*Ikev2ProfileSetAuth) GetMessageName() string { return "ikev2_profile_set_auth" } +func (*Ikev2ProfileSetAuth) GetCrcString() string { return "642c97cd" } +func (*Ikev2ProfileSetAuth) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2ProfileSetAuth) Size() int { + if m == nil { + return 0 + } + var size int + size += 64 // m.Name + size += 1 // m.AuthMethod + size += 1 // m.IsHex + size += 4 // m.DataLen + size += 1 * len(m.Data) // m.Data + return size +} +func (m *Ikev2ProfileSetAuth) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.Name, 64) + buf.EncodeUint8(uint8(m.AuthMethod)) + buf.EncodeBool(m.IsHex) + buf.EncodeUint32(uint32(len(m.Data))) + buf.EncodeBytes(m.Data[:], 0) + return buf.Bytes(), nil +} +func (m *Ikev2ProfileSetAuth) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Name = buf.DecodeString(64) + m.AuthMethod = buf.DecodeUint8() + m.IsHex = buf.DecodeBool() + m.DataLen = buf.DecodeUint32() + copy(m.Data[:], buf.DecodeBytes(0)) + return nil +} + +// Ikev2ProfileSetAuthReply defines message 'ikev2_profile_set_auth_reply'. +type Ikev2ProfileSetAuthReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Ikev2ProfileSetAuthReply) Reset() { *m = Ikev2ProfileSetAuthReply{} } +func (*Ikev2ProfileSetAuthReply) GetMessageName() string { return "ikev2_profile_set_auth_reply" } +func (*Ikev2ProfileSetAuthReply) GetCrcString() string { return "e8d4e804" } +func (*Ikev2ProfileSetAuthReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2ProfileSetAuthReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Ikev2ProfileSetAuthReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Ikev2ProfileSetAuthReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Ikev2ProfileSetID defines message 'ikev2_profile_set_id'. +type Ikev2ProfileSetID struct { + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + IsLocal bool `binapi:"bool,name=is_local" json:"is_local,omitempty"` + IDType uint8 `binapi:"u8,name=id_type" json:"id_type,omitempty"` + DataLen uint32 `binapi:"u32,name=data_len" json:"-"` + Data []byte `binapi:"u8[data_len],name=data" json:"data,omitempty"` +} + +func (m *Ikev2ProfileSetID) Reset() { *m = Ikev2ProfileSetID{} } +func (*Ikev2ProfileSetID) GetMessageName() string { return "ikev2_profile_set_id" } +func (*Ikev2ProfileSetID) GetCrcString() string { return "4d7e2418" } +func (*Ikev2ProfileSetID) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2ProfileSetID) Size() int { + if m == nil { + return 0 + } + var size int + size += 64 // m.Name + size += 1 // m.IsLocal + size += 1 // m.IDType + size += 4 // m.DataLen + size += 1 * len(m.Data) // m.Data + return size +} +func (m *Ikev2ProfileSetID) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.Name, 64) + buf.EncodeBool(m.IsLocal) + buf.EncodeUint8(uint8(m.IDType)) + buf.EncodeUint32(uint32(len(m.Data))) + buf.EncodeBytes(m.Data[:], 0) + return buf.Bytes(), nil +} +func (m *Ikev2ProfileSetID) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Name = buf.DecodeString(64) + m.IsLocal = buf.DecodeBool() + m.IDType = buf.DecodeUint8() + m.DataLen = buf.DecodeUint32() + copy(m.Data[:], buf.DecodeBytes(0)) + return nil +} + +// Ikev2ProfileSetIDReply defines message 'ikev2_profile_set_id_reply'. +type Ikev2ProfileSetIDReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Ikev2ProfileSetIDReply) Reset() { *m = Ikev2ProfileSetIDReply{} } +func (*Ikev2ProfileSetIDReply) GetMessageName() string { return "ikev2_profile_set_id_reply" } +func (*Ikev2ProfileSetIDReply) GetCrcString() string { return "e8d4e804" } +func (*Ikev2ProfileSetIDReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2ProfileSetIDReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Ikev2ProfileSetIDReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Ikev2ProfileSetIDReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Ikev2ProfileSetIpsecUDPPort defines message 'ikev2_profile_set_ipsec_udp_port'. +type Ikev2ProfileSetIpsecUDPPort struct { + IsSet uint8 `binapi:"u8,name=is_set" json:"is_set,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty"` +} + +func (m *Ikev2ProfileSetIpsecUDPPort) Reset() { *m = Ikev2ProfileSetIpsecUDPPort{} } +func (*Ikev2ProfileSetIpsecUDPPort) GetMessageName() string { + return "ikev2_profile_set_ipsec_udp_port" +} +func (*Ikev2ProfileSetIpsecUDPPort) GetCrcString() string { return "615ce758" } +func (*Ikev2ProfileSetIpsecUDPPort) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2ProfileSetIpsecUDPPort) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsSet + size += 2 // m.Port + size += 64 // m.Name + return size +} +func (m *Ikev2ProfileSetIpsecUDPPort) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.IsSet)) + buf.EncodeUint16(uint16(m.Port)) + buf.EncodeString(m.Name, 64) + return buf.Bytes(), nil +} +func (m *Ikev2ProfileSetIpsecUDPPort) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsSet = buf.DecodeUint8() + m.Port = buf.DecodeUint16() + m.Name = buf.DecodeString(64) + return nil +} + +// Ikev2ProfileSetIpsecUDPPortReply defines message 'ikev2_profile_set_ipsec_udp_port_reply'. +type Ikev2ProfileSetIpsecUDPPortReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Ikev2ProfileSetIpsecUDPPortReply) Reset() { *m = Ikev2ProfileSetIpsecUDPPortReply{} } +func (*Ikev2ProfileSetIpsecUDPPortReply) GetMessageName() string { + return "ikev2_profile_set_ipsec_udp_port_reply" +} +func (*Ikev2ProfileSetIpsecUDPPortReply) GetCrcString() string { return "e8d4e804" } +func (*Ikev2ProfileSetIpsecUDPPortReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2ProfileSetIpsecUDPPortReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Ikev2ProfileSetIpsecUDPPortReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Ikev2ProfileSetIpsecUDPPortReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Ikev2ProfileSetLiveness defines message 'ikev2_profile_set_liveness'. +type Ikev2ProfileSetLiveness struct { + Period uint32 `binapi:"u32,name=period" json:"period,omitempty"` + MaxRetries uint32 `binapi:"u32,name=max_retries" json:"max_retries,omitempty"` +} + +func (m *Ikev2ProfileSetLiveness) Reset() { *m = Ikev2ProfileSetLiveness{} } +func (*Ikev2ProfileSetLiveness) GetMessageName() string { return "ikev2_profile_set_liveness" } +func (*Ikev2ProfileSetLiveness) GetCrcString() string { return "6bdf4d65" } +func (*Ikev2ProfileSetLiveness) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2ProfileSetLiveness) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Period + size += 4 // m.MaxRetries + return size +} +func (m *Ikev2ProfileSetLiveness) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Period)) + buf.EncodeUint32(uint32(m.MaxRetries)) + return buf.Bytes(), nil +} +func (m *Ikev2ProfileSetLiveness) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Period = buf.DecodeUint32() + m.MaxRetries = buf.DecodeUint32() + return nil +} + +// Ikev2ProfileSetLivenessReply defines message 'ikev2_profile_set_liveness_reply'. +type Ikev2ProfileSetLivenessReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Ikev2ProfileSetLivenessReply) Reset() { *m = Ikev2ProfileSetLivenessReply{} } +func (*Ikev2ProfileSetLivenessReply) GetMessageName() string { + return "ikev2_profile_set_liveness_reply" +} +func (*Ikev2ProfileSetLivenessReply) GetCrcString() string { return "e8d4e804" } +func (*Ikev2ProfileSetLivenessReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2ProfileSetLivenessReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Ikev2ProfileSetLivenessReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Ikev2ProfileSetLivenessReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Ikev2ProfileSetTs defines message 'ikev2_profile_set_ts'. +type Ikev2ProfileSetTs struct { + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + IsLocal bool `binapi:"bool,name=is_local" json:"is_local,omitempty"` + Proto uint8 `binapi:"u8,name=proto" json:"proto,omitempty"` + StartPort uint16 `binapi:"u16,name=start_port" json:"start_port,omitempty"` + EndPort uint16 `binapi:"u16,name=end_port" json:"end_port,omitempty"` + StartAddr uint32 `binapi:"u32,name=start_addr" json:"start_addr,omitempty"` + EndAddr uint32 `binapi:"u32,name=end_addr" json:"end_addr,omitempty"` +} + +func (m *Ikev2ProfileSetTs) Reset() { *m = Ikev2ProfileSetTs{} } +func (*Ikev2ProfileSetTs) GetMessageName() string { return "ikev2_profile_set_ts" } +func (*Ikev2ProfileSetTs) GetCrcString() string { return "64d55c16" } +func (*Ikev2ProfileSetTs) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2ProfileSetTs) Size() int { + if m == nil { + return 0 + } + var size int + size += 64 // m.Name + size += 1 // m.IsLocal + size += 1 // m.Proto + size += 2 // m.StartPort + size += 2 // m.EndPort + size += 4 // m.StartAddr + size += 4 // m.EndAddr + return size +} +func (m *Ikev2ProfileSetTs) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.Name, 64) + buf.EncodeBool(m.IsLocal) + buf.EncodeUint8(uint8(m.Proto)) + buf.EncodeUint16(uint16(m.StartPort)) + buf.EncodeUint16(uint16(m.EndPort)) + buf.EncodeUint32(uint32(m.StartAddr)) + buf.EncodeUint32(uint32(m.EndAddr)) + return buf.Bytes(), nil +} +func (m *Ikev2ProfileSetTs) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Name = buf.DecodeString(64) + m.IsLocal = buf.DecodeBool() + m.Proto = buf.DecodeUint8() + m.StartPort = buf.DecodeUint16() + m.EndPort = buf.DecodeUint16() + m.StartAddr = buf.DecodeUint32() + m.EndAddr = buf.DecodeUint32() + return nil +} + +// Ikev2ProfileSetTsReply defines message 'ikev2_profile_set_ts_reply'. +type Ikev2ProfileSetTsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Ikev2ProfileSetTsReply) Reset() { *m = Ikev2ProfileSetTsReply{} } +func (*Ikev2ProfileSetTsReply) GetMessageName() string { return "ikev2_profile_set_ts_reply" } +func (*Ikev2ProfileSetTsReply) GetCrcString() string { return "e8d4e804" } +func (*Ikev2ProfileSetTsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2ProfileSetTsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Ikev2ProfileSetTsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Ikev2ProfileSetTsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Ikev2ProfileSetUDPEncap defines message 'ikev2_profile_set_udp_encap'. +type Ikev2ProfileSetUDPEncap struct { + Name string `binapi:"string[64],name=name" json:"name,omitempty"` +} + +func (m *Ikev2ProfileSetUDPEncap) Reset() { *m = Ikev2ProfileSetUDPEncap{} } +func (*Ikev2ProfileSetUDPEncap) GetMessageName() string { return "ikev2_profile_set_udp_encap" } +func (*Ikev2ProfileSetUDPEncap) GetCrcString() string { return "ebf79a66" } +func (*Ikev2ProfileSetUDPEncap) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2ProfileSetUDPEncap) Size() int { + if m == nil { + return 0 + } + var size int + size += 64 // m.Name + return size +} +func (m *Ikev2ProfileSetUDPEncap) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.Name, 64) + return buf.Bytes(), nil +} +func (m *Ikev2ProfileSetUDPEncap) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Name = buf.DecodeString(64) + return nil +} + +// Ikev2ProfileSetUDPEncapReply defines message 'ikev2_profile_set_udp_encap_reply'. +type Ikev2ProfileSetUDPEncapReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Ikev2ProfileSetUDPEncapReply) Reset() { *m = Ikev2ProfileSetUDPEncapReply{} } +func (*Ikev2ProfileSetUDPEncapReply) GetMessageName() string { + return "ikev2_profile_set_udp_encap_reply" +} +func (*Ikev2ProfileSetUDPEncapReply) GetCrcString() string { return "e8d4e804" } +func (*Ikev2ProfileSetUDPEncapReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2ProfileSetUDPEncapReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Ikev2ProfileSetUDPEncapReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Ikev2ProfileSetUDPEncapReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Ikev2SetEspTransforms defines message 'ikev2_set_esp_transforms'. +type Ikev2SetEspTransforms struct { + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + CryptoAlg uint32 `binapi:"u32,name=crypto_alg" json:"crypto_alg,omitempty"` + CryptoKeySize uint32 `binapi:"u32,name=crypto_key_size" json:"crypto_key_size,omitempty"` + IntegAlg uint32 `binapi:"u32,name=integ_alg" json:"integ_alg,omitempty"` + DhGroup uint32 `binapi:"u32,name=dh_group" json:"dh_group,omitempty"` +} + +func (m *Ikev2SetEspTransforms) Reset() { *m = Ikev2SetEspTransforms{} } +func (*Ikev2SetEspTransforms) GetMessageName() string { return "ikev2_set_esp_transforms" } +func (*Ikev2SetEspTransforms) GetCrcString() string { return "936a1a37" } +func (*Ikev2SetEspTransforms) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2SetEspTransforms) Size() int { + if m == nil { + return 0 + } + var size int + size += 64 // m.Name + size += 4 // m.CryptoAlg + size += 4 // m.CryptoKeySize + size += 4 // m.IntegAlg + size += 4 // m.DhGroup + return size +} +func (m *Ikev2SetEspTransforms) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.Name, 64) + buf.EncodeUint32(uint32(m.CryptoAlg)) + buf.EncodeUint32(uint32(m.CryptoKeySize)) + buf.EncodeUint32(uint32(m.IntegAlg)) + buf.EncodeUint32(uint32(m.DhGroup)) + return buf.Bytes(), nil +} +func (m *Ikev2SetEspTransforms) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Name = buf.DecodeString(64) + m.CryptoAlg = buf.DecodeUint32() + m.CryptoKeySize = buf.DecodeUint32() + m.IntegAlg = buf.DecodeUint32() + m.DhGroup = buf.DecodeUint32() + return nil +} + +// Ikev2SetEspTransformsReply defines message 'ikev2_set_esp_transforms_reply'. +type Ikev2SetEspTransformsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Ikev2SetEspTransformsReply) Reset() { *m = Ikev2SetEspTransformsReply{} } +func (*Ikev2SetEspTransformsReply) GetMessageName() string { return "ikev2_set_esp_transforms_reply" } +func (*Ikev2SetEspTransformsReply) GetCrcString() string { return "e8d4e804" } +func (*Ikev2SetEspTransformsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2SetEspTransformsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Ikev2SetEspTransformsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Ikev2SetEspTransformsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Ikev2SetIkeTransforms defines message 'ikev2_set_ike_transforms'. +type Ikev2SetIkeTransforms struct { + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + CryptoAlg uint32 `binapi:"u32,name=crypto_alg" json:"crypto_alg,omitempty"` + CryptoKeySize uint32 `binapi:"u32,name=crypto_key_size" json:"crypto_key_size,omitempty"` + IntegAlg uint32 `binapi:"u32,name=integ_alg" json:"integ_alg,omitempty"` + DhGroup uint32 `binapi:"u32,name=dh_group" json:"dh_group,omitempty"` +} + +func (m *Ikev2SetIkeTransforms) Reset() { *m = Ikev2SetIkeTransforms{} } +func (*Ikev2SetIkeTransforms) GetMessageName() string { return "ikev2_set_ike_transforms" } +func (*Ikev2SetIkeTransforms) GetCrcString() string { return "936a1a37" } +func (*Ikev2SetIkeTransforms) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2SetIkeTransforms) Size() int { + if m == nil { + return 0 + } + var size int + size += 64 // m.Name + size += 4 // m.CryptoAlg + size += 4 // m.CryptoKeySize + size += 4 // m.IntegAlg + size += 4 // m.DhGroup + return size +} +func (m *Ikev2SetIkeTransforms) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.Name, 64) + buf.EncodeUint32(uint32(m.CryptoAlg)) + buf.EncodeUint32(uint32(m.CryptoKeySize)) + buf.EncodeUint32(uint32(m.IntegAlg)) + buf.EncodeUint32(uint32(m.DhGroup)) + return buf.Bytes(), nil +} +func (m *Ikev2SetIkeTransforms) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Name = buf.DecodeString(64) + m.CryptoAlg = buf.DecodeUint32() + m.CryptoKeySize = buf.DecodeUint32() + m.IntegAlg = buf.DecodeUint32() + m.DhGroup = buf.DecodeUint32() + return nil +} + +// Ikev2SetIkeTransformsReply defines message 'ikev2_set_ike_transforms_reply'. +type Ikev2SetIkeTransformsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Ikev2SetIkeTransformsReply) Reset() { *m = Ikev2SetIkeTransformsReply{} } +func (*Ikev2SetIkeTransformsReply) GetMessageName() string { return "ikev2_set_ike_transforms_reply" } +func (*Ikev2SetIkeTransformsReply) GetCrcString() string { return "e8d4e804" } +func (*Ikev2SetIkeTransformsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2SetIkeTransformsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Ikev2SetIkeTransformsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Ikev2SetIkeTransformsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Ikev2SetLocalKey defines message 'ikev2_set_local_key'. +type Ikev2SetLocalKey struct { + KeyFile string `binapi:"string[256],name=key_file" json:"key_file,omitempty"` +} + +func (m *Ikev2SetLocalKey) Reset() { *m = Ikev2SetLocalKey{} } +func (*Ikev2SetLocalKey) GetMessageName() string { return "ikev2_set_local_key" } +func (*Ikev2SetLocalKey) GetCrcString() string { return "799b69ec" } +func (*Ikev2SetLocalKey) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2SetLocalKey) Size() int { + if m == nil { + return 0 + } + var size int + size += 256 // m.KeyFile + return size +} +func (m *Ikev2SetLocalKey) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.KeyFile, 256) + return buf.Bytes(), nil +} +func (m *Ikev2SetLocalKey) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.KeyFile = buf.DecodeString(256) + return nil +} + +// Ikev2SetLocalKeyReply defines message 'ikev2_set_local_key_reply'. +type Ikev2SetLocalKeyReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Ikev2SetLocalKeyReply) Reset() { *m = Ikev2SetLocalKeyReply{} } +func (*Ikev2SetLocalKeyReply) GetMessageName() string { return "ikev2_set_local_key_reply" } +func (*Ikev2SetLocalKeyReply) GetCrcString() string { return "e8d4e804" } +func (*Ikev2SetLocalKeyReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2SetLocalKeyReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Ikev2SetLocalKeyReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Ikev2SetLocalKeyReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Ikev2SetResponder defines message 'ikev2_set_responder'. +type Ikev2SetResponder struct { + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Address ip_types.IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` +} + +func (m *Ikev2SetResponder) Reset() { *m = Ikev2SetResponder{} } +func (*Ikev2SetResponder) GetMessageName() string { return "ikev2_set_responder" } +func (*Ikev2SetResponder) GetCrcString() string { return "f0d3dc80" } +func (*Ikev2SetResponder) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2SetResponder) Size() int { + if m == nil { + return 0 + } + var size int + size += 64 // m.Name + size += 4 // m.SwIfIndex + size += 1 * 4 // m.Address + return size +} +func (m *Ikev2SetResponder) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.Name, 64) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBytes(m.Address[:], 4) + return buf.Bytes(), nil +} +func (m *Ikev2SetResponder) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Name = buf.DecodeString(64) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + copy(m.Address[:], buf.DecodeBytes(4)) + return nil +} + +// Ikev2SetResponderReply defines message 'ikev2_set_responder_reply'. +type Ikev2SetResponderReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Ikev2SetResponderReply) Reset() { *m = Ikev2SetResponderReply{} } +func (*Ikev2SetResponderReply) GetMessageName() string { return "ikev2_set_responder_reply" } +func (*Ikev2SetResponderReply) GetCrcString() string { return "e8d4e804" } +func (*Ikev2SetResponderReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2SetResponderReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Ikev2SetResponderReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Ikev2SetResponderReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Ikev2SetSaLifetime defines message 'ikev2_set_sa_lifetime'. +type Ikev2SetSaLifetime struct { + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + Lifetime uint64 `binapi:"u64,name=lifetime" json:"lifetime,omitempty"` + LifetimeJitter uint32 `binapi:"u32,name=lifetime_jitter" json:"lifetime_jitter,omitempty"` + Handover uint32 `binapi:"u32,name=handover" json:"handover,omitempty"` + LifetimeMaxdata uint64 `binapi:"u64,name=lifetime_maxdata" json:"lifetime_maxdata,omitempty"` +} + +func (m *Ikev2SetSaLifetime) Reset() { *m = Ikev2SetSaLifetime{} } +func (*Ikev2SetSaLifetime) GetMessageName() string { return "ikev2_set_sa_lifetime" } +func (*Ikev2SetSaLifetime) GetCrcString() string { return "7039feaa" } +func (*Ikev2SetSaLifetime) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2SetSaLifetime) Size() int { + if m == nil { + return 0 + } + var size int + size += 64 // m.Name + size += 8 // m.Lifetime + size += 4 // m.LifetimeJitter + size += 4 // m.Handover + size += 8 // m.LifetimeMaxdata + return size +} +func (m *Ikev2SetSaLifetime) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.Name, 64) + buf.EncodeUint64(uint64(m.Lifetime)) + buf.EncodeUint32(uint32(m.LifetimeJitter)) + buf.EncodeUint32(uint32(m.Handover)) + buf.EncodeUint64(uint64(m.LifetimeMaxdata)) + return buf.Bytes(), nil +} +func (m *Ikev2SetSaLifetime) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Name = buf.DecodeString(64) + m.Lifetime = buf.DecodeUint64() + m.LifetimeJitter = buf.DecodeUint32() + m.Handover = buf.DecodeUint32() + m.LifetimeMaxdata = buf.DecodeUint64() + return nil +} + +// Ikev2SetSaLifetimeReply defines message 'ikev2_set_sa_lifetime_reply'. +type Ikev2SetSaLifetimeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Ikev2SetSaLifetimeReply) Reset() { *m = Ikev2SetSaLifetimeReply{} } +func (*Ikev2SetSaLifetimeReply) GetMessageName() string { return "ikev2_set_sa_lifetime_reply" } +func (*Ikev2SetSaLifetimeReply) GetCrcString() string { return "e8d4e804" } +func (*Ikev2SetSaLifetimeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2SetSaLifetimeReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Ikev2SetSaLifetimeReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Ikev2SetSaLifetimeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Ikev2SetTunnelInterface defines message 'ikev2_set_tunnel_interface'. +type Ikev2SetTunnelInterface struct { + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Ikev2SetTunnelInterface) Reset() { *m = Ikev2SetTunnelInterface{} } +func (*Ikev2SetTunnelInterface) GetMessageName() string { return "ikev2_set_tunnel_interface" } +func (*Ikev2SetTunnelInterface) GetCrcString() string { return "ca67182c" } +func (*Ikev2SetTunnelInterface) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ikev2SetTunnelInterface) Size() int { + if m == nil { + return 0 + } + var size int + size += 64 // m.Name + size += 4 // m.SwIfIndex + return size +} +func (m *Ikev2SetTunnelInterface) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.Name, 64) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Ikev2SetTunnelInterface) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Name = buf.DecodeString(64) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Ikev2SetTunnelInterfaceReply defines message 'ikev2_set_tunnel_interface_reply'. +type Ikev2SetTunnelInterfaceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Ikev2SetTunnelInterfaceReply) Reset() { *m = Ikev2SetTunnelInterfaceReply{} } +func (*Ikev2SetTunnelInterfaceReply) GetMessageName() string { + return "ikev2_set_tunnel_interface_reply" +} +func (*Ikev2SetTunnelInterfaceReply) GetCrcString() string { return "e8d4e804" } +func (*Ikev2SetTunnelInterfaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ikev2SetTunnelInterfaceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Ikev2SetTunnelInterfaceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Ikev2SetTunnelInterfaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_ikev2_binapi_init() } +func file_ikev2_binapi_init() { + api.RegisterMessage((*Ikev2InitiateDelChildSa)(nil), "ikev2_initiate_del_child_sa_7f004d2e") + api.RegisterMessage((*Ikev2InitiateDelChildSaReply)(nil), "ikev2_initiate_del_child_sa_reply_e8d4e804") + api.RegisterMessage((*Ikev2InitiateDelIkeSa)(nil), "ikev2_initiate_del_ike_sa_8d125bdd") + api.RegisterMessage((*Ikev2InitiateDelIkeSaReply)(nil), "ikev2_initiate_del_ike_sa_reply_e8d4e804") + api.RegisterMessage((*Ikev2InitiateRekeyChildSa)(nil), "ikev2_initiate_rekey_child_sa_7f004d2e") + api.RegisterMessage((*Ikev2InitiateRekeyChildSaReply)(nil), "ikev2_initiate_rekey_child_sa_reply_e8d4e804") + api.RegisterMessage((*Ikev2InitiateSaInit)(nil), "ikev2_initiate_sa_init_ebf79a66") + api.RegisterMessage((*Ikev2InitiateSaInitReply)(nil), "ikev2_initiate_sa_init_reply_e8d4e804") + api.RegisterMessage((*Ikev2PluginGetVersion)(nil), "ikev2_plugin_get_version_51077d14") + api.RegisterMessage((*Ikev2PluginGetVersionReply)(nil), "ikev2_plugin_get_version_reply_9b32cf86") + api.RegisterMessage((*Ikev2ProfileAddDel)(nil), "ikev2_profile_add_del_2c925b55") + api.RegisterMessage((*Ikev2ProfileAddDelReply)(nil), "ikev2_profile_add_del_reply_e8d4e804") + api.RegisterMessage((*Ikev2ProfileSetAuth)(nil), "ikev2_profile_set_auth_642c97cd") + api.RegisterMessage((*Ikev2ProfileSetAuthReply)(nil), "ikev2_profile_set_auth_reply_e8d4e804") + api.RegisterMessage((*Ikev2ProfileSetID)(nil), "ikev2_profile_set_id_4d7e2418") + api.RegisterMessage((*Ikev2ProfileSetIDReply)(nil), "ikev2_profile_set_id_reply_e8d4e804") + api.RegisterMessage((*Ikev2ProfileSetIpsecUDPPort)(nil), "ikev2_profile_set_ipsec_udp_port_615ce758") + api.RegisterMessage((*Ikev2ProfileSetIpsecUDPPortReply)(nil), "ikev2_profile_set_ipsec_udp_port_reply_e8d4e804") + api.RegisterMessage((*Ikev2ProfileSetLiveness)(nil), "ikev2_profile_set_liveness_6bdf4d65") + api.RegisterMessage((*Ikev2ProfileSetLivenessReply)(nil), "ikev2_profile_set_liveness_reply_e8d4e804") + api.RegisterMessage((*Ikev2ProfileSetTs)(nil), "ikev2_profile_set_ts_64d55c16") + api.RegisterMessage((*Ikev2ProfileSetTsReply)(nil), "ikev2_profile_set_ts_reply_e8d4e804") + api.RegisterMessage((*Ikev2ProfileSetUDPEncap)(nil), "ikev2_profile_set_udp_encap_ebf79a66") + api.RegisterMessage((*Ikev2ProfileSetUDPEncapReply)(nil), "ikev2_profile_set_udp_encap_reply_e8d4e804") + api.RegisterMessage((*Ikev2SetEspTransforms)(nil), "ikev2_set_esp_transforms_936a1a37") + api.RegisterMessage((*Ikev2SetEspTransformsReply)(nil), "ikev2_set_esp_transforms_reply_e8d4e804") + api.RegisterMessage((*Ikev2SetIkeTransforms)(nil), "ikev2_set_ike_transforms_936a1a37") + api.RegisterMessage((*Ikev2SetIkeTransformsReply)(nil), "ikev2_set_ike_transforms_reply_e8d4e804") + api.RegisterMessage((*Ikev2SetLocalKey)(nil), "ikev2_set_local_key_799b69ec") + api.RegisterMessage((*Ikev2SetLocalKeyReply)(nil), "ikev2_set_local_key_reply_e8d4e804") + api.RegisterMessage((*Ikev2SetResponder)(nil), "ikev2_set_responder_f0d3dc80") + api.RegisterMessage((*Ikev2SetResponderReply)(nil), "ikev2_set_responder_reply_e8d4e804") + api.RegisterMessage((*Ikev2SetSaLifetime)(nil), "ikev2_set_sa_lifetime_7039feaa") + api.RegisterMessage((*Ikev2SetSaLifetimeReply)(nil), "ikev2_set_sa_lifetime_reply_e8d4e804") + api.RegisterMessage((*Ikev2SetTunnelInterface)(nil), "ikev2_set_tunnel_interface_ca67182c") + api.RegisterMessage((*Ikev2SetTunnelInterfaceReply)(nil), "ikev2_set_tunnel_interface_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*Ikev2InitiateDelChildSa)(nil), + (*Ikev2InitiateDelChildSaReply)(nil), + (*Ikev2InitiateDelIkeSa)(nil), + (*Ikev2InitiateDelIkeSaReply)(nil), + (*Ikev2InitiateRekeyChildSa)(nil), + (*Ikev2InitiateRekeyChildSaReply)(nil), + (*Ikev2InitiateSaInit)(nil), + (*Ikev2InitiateSaInitReply)(nil), + (*Ikev2PluginGetVersion)(nil), + (*Ikev2PluginGetVersionReply)(nil), + (*Ikev2ProfileAddDel)(nil), + (*Ikev2ProfileAddDelReply)(nil), + (*Ikev2ProfileSetAuth)(nil), + (*Ikev2ProfileSetAuthReply)(nil), + (*Ikev2ProfileSetID)(nil), + (*Ikev2ProfileSetIDReply)(nil), + (*Ikev2ProfileSetIpsecUDPPort)(nil), + (*Ikev2ProfileSetIpsecUDPPortReply)(nil), + (*Ikev2ProfileSetLiveness)(nil), + (*Ikev2ProfileSetLivenessReply)(nil), + (*Ikev2ProfileSetTs)(nil), + (*Ikev2ProfileSetTsReply)(nil), + (*Ikev2ProfileSetUDPEncap)(nil), + (*Ikev2ProfileSetUDPEncapReply)(nil), + (*Ikev2SetEspTransforms)(nil), + (*Ikev2SetEspTransformsReply)(nil), + (*Ikev2SetIkeTransforms)(nil), + (*Ikev2SetIkeTransformsReply)(nil), + (*Ikev2SetLocalKey)(nil), + (*Ikev2SetLocalKeyReply)(nil), + (*Ikev2SetResponder)(nil), + (*Ikev2SetResponderReply)(nil), + (*Ikev2SetSaLifetime)(nil), + (*Ikev2SetSaLifetimeReply)(nil), + (*Ikev2SetTunnelInterface)(nil), + (*Ikev2SetTunnelInterfaceReply)(nil), + } +} diff --git a/binapi/ikev2/ikev2_rest.ba.go b/binapi/ikev2/ikev2_rest.ba.go new file mode 100644 index 0000000..9ffdffa --- /dev/null +++ b/binapi/ikev2/ikev2_rest.ba.go @@ -0,0 +1,419 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ikev2 + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/ikev2_initiate_del_child_sa", func(w http.ResponseWriter, req *http.Request) { + var request = new(Ikev2InitiateDelChildSa) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Ikev2InitiateDelChildSa(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ikev2_initiate_del_ike_sa", func(w http.ResponseWriter, req *http.Request) { + var request = new(Ikev2InitiateDelIkeSa) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Ikev2InitiateDelIkeSa(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ikev2_initiate_rekey_child_sa", func(w http.ResponseWriter, req *http.Request) { + var request = new(Ikev2InitiateRekeyChildSa) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Ikev2InitiateRekeyChildSa(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ikev2_initiate_sa_init", func(w http.ResponseWriter, req *http.Request) { + var request = new(Ikev2InitiateSaInit) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Ikev2InitiateSaInit(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ikev2_plugin_get_version", func(w http.ResponseWriter, req *http.Request) { + var request = new(Ikev2PluginGetVersion) + reply, err := rpc.Ikev2PluginGetVersion(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ikev2_profile_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(Ikev2ProfileAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Ikev2ProfileAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ikev2_profile_set_auth", func(w http.ResponseWriter, req *http.Request) { + var request = new(Ikev2ProfileSetAuth) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Ikev2ProfileSetAuth(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ikev2_profile_set_id", func(w http.ResponseWriter, req *http.Request) { + var request = new(Ikev2ProfileSetID) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Ikev2ProfileSetID(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ikev2_profile_set_ipsec_udp_port", func(w http.ResponseWriter, req *http.Request) { + var request = new(Ikev2ProfileSetIpsecUDPPort) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Ikev2ProfileSetIpsecUDPPort(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ikev2_profile_set_liveness", func(w http.ResponseWriter, req *http.Request) { + var request = new(Ikev2ProfileSetLiveness) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Ikev2ProfileSetLiveness(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ikev2_profile_set_ts", func(w http.ResponseWriter, req *http.Request) { + var request = new(Ikev2ProfileSetTs) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Ikev2ProfileSetTs(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ikev2_profile_set_udp_encap", func(w http.ResponseWriter, req *http.Request) { + var request = new(Ikev2ProfileSetUDPEncap) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Ikev2ProfileSetUDPEncap(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ikev2_set_esp_transforms", func(w http.ResponseWriter, req *http.Request) { + var request = new(Ikev2SetEspTransforms) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Ikev2SetEspTransforms(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ikev2_set_ike_transforms", func(w http.ResponseWriter, req *http.Request) { + var request = new(Ikev2SetIkeTransforms) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Ikev2SetIkeTransforms(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ikev2_set_local_key", func(w http.ResponseWriter, req *http.Request) { + var request = new(Ikev2SetLocalKey) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Ikev2SetLocalKey(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ikev2_set_responder", func(w http.ResponseWriter, req *http.Request) { + var request = new(Ikev2SetResponder) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Ikev2SetResponder(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ikev2_set_sa_lifetime", func(w http.ResponseWriter, req *http.Request) { + var request = new(Ikev2SetSaLifetime) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Ikev2SetSaLifetime(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ikev2_set_tunnel_interface", func(w http.ResponseWriter, req *http.Request) { + var request = new(Ikev2SetTunnelInterface) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Ikev2SetTunnelInterface(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/ikev2/ikev2_rpc.ba.go b/binapi/ikev2/ikev2_rpc.ba.go new file mode 100644 index 0000000..59616cb --- /dev/null +++ b/binapi/ikev2/ikev2_rpc.ba.go @@ -0,0 +1,200 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ikev2 + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service ikev2. +type RPCService interface { + Ikev2InitiateDelChildSa(ctx context.Context, in *Ikev2InitiateDelChildSa) (*Ikev2InitiateDelChildSaReply, error) + Ikev2InitiateDelIkeSa(ctx context.Context, in *Ikev2InitiateDelIkeSa) (*Ikev2InitiateDelIkeSaReply, error) + Ikev2InitiateRekeyChildSa(ctx context.Context, in *Ikev2InitiateRekeyChildSa) (*Ikev2InitiateRekeyChildSaReply, error) + Ikev2InitiateSaInit(ctx context.Context, in *Ikev2InitiateSaInit) (*Ikev2InitiateSaInitReply, error) + Ikev2PluginGetVersion(ctx context.Context, in *Ikev2PluginGetVersion) (*Ikev2PluginGetVersionReply, error) + Ikev2ProfileAddDel(ctx context.Context, in *Ikev2ProfileAddDel) (*Ikev2ProfileAddDelReply, error) + Ikev2ProfileSetAuth(ctx context.Context, in *Ikev2ProfileSetAuth) (*Ikev2ProfileSetAuthReply, error) + Ikev2ProfileSetID(ctx context.Context, in *Ikev2ProfileSetID) (*Ikev2ProfileSetIDReply, error) + Ikev2ProfileSetIpsecUDPPort(ctx context.Context, in *Ikev2ProfileSetIpsecUDPPort) (*Ikev2ProfileSetIpsecUDPPortReply, error) + Ikev2ProfileSetLiveness(ctx context.Context, in *Ikev2ProfileSetLiveness) (*Ikev2ProfileSetLivenessReply, error) + Ikev2ProfileSetTs(ctx context.Context, in *Ikev2ProfileSetTs) (*Ikev2ProfileSetTsReply, error) + Ikev2ProfileSetUDPEncap(ctx context.Context, in *Ikev2ProfileSetUDPEncap) (*Ikev2ProfileSetUDPEncapReply, error) + Ikev2SetEspTransforms(ctx context.Context, in *Ikev2SetEspTransforms) (*Ikev2SetEspTransformsReply, error) + Ikev2SetIkeTransforms(ctx context.Context, in *Ikev2SetIkeTransforms) (*Ikev2SetIkeTransformsReply, error) + Ikev2SetLocalKey(ctx context.Context, in *Ikev2SetLocalKey) (*Ikev2SetLocalKeyReply, error) + Ikev2SetResponder(ctx context.Context, in *Ikev2SetResponder) (*Ikev2SetResponderReply, error) + Ikev2SetSaLifetime(ctx context.Context, in *Ikev2SetSaLifetime) (*Ikev2SetSaLifetimeReply, error) + Ikev2SetTunnelInterface(ctx context.Context, in *Ikev2SetTunnelInterface) (*Ikev2SetTunnelInterfaceReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) Ikev2InitiateDelChildSa(ctx context.Context, in *Ikev2InitiateDelChildSa) (*Ikev2InitiateDelChildSaReply, error) { + out := new(Ikev2InitiateDelChildSaReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2InitiateDelIkeSa(ctx context.Context, in *Ikev2InitiateDelIkeSa) (*Ikev2InitiateDelIkeSaReply, error) { + out := new(Ikev2InitiateDelIkeSaReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2InitiateRekeyChildSa(ctx context.Context, in *Ikev2InitiateRekeyChildSa) (*Ikev2InitiateRekeyChildSaReply, error) { + out := new(Ikev2InitiateRekeyChildSaReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2InitiateSaInit(ctx context.Context, in *Ikev2InitiateSaInit) (*Ikev2InitiateSaInitReply, error) { + out := new(Ikev2InitiateSaInitReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2PluginGetVersion(ctx context.Context, in *Ikev2PluginGetVersion) (*Ikev2PluginGetVersionReply, error) { + out := new(Ikev2PluginGetVersionReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2ProfileAddDel(ctx context.Context, in *Ikev2ProfileAddDel) (*Ikev2ProfileAddDelReply, error) { + out := new(Ikev2ProfileAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2ProfileSetAuth(ctx context.Context, in *Ikev2ProfileSetAuth) (*Ikev2ProfileSetAuthReply, error) { + out := new(Ikev2ProfileSetAuthReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2ProfileSetID(ctx context.Context, in *Ikev2ProfileSetID) (*Ikev2ProfileSetIDReply, error) { + out := new(Ikev2ProfileSetIDReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2ProfileSetIpsecUDPPort(ctx context.Context, in *Ikev2ProfileSetIpsecUDPPort) (*Ikev2ProfileSetIpsecUDPPortReply, error) { + out := new(Ikev2ProfileSetIpsecUDPPortReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2ProfileSetLiveness(ctx context.Context, in *Ikev2ProfileSetLiveness) (*Ikev2ProfileSetLivenessReply, error) { + out := new(Ikev2ProfileSetLivenessReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2ProfileSetTs(ctx context.Context, in *Ikev2ProfileSetTs) (*Ikev2ProfileSetTsReply, error) { + out := new(Ikev2ProfileSetTsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2ProfileSetUDPEncap(ctx context.Context, in *Ikev2ProfileSetUDPEncap) (*Ikev2ProfileSetUDPEncapReply, error) { + out := new(Ikev2ProfileSetUDPEncapReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2SetEspTransforms(ctx context.Context, in *Ikev2SetEspTransforms) (*Ikev2SetEspTransformsReply, error) { + out := new(Ikev2SetEspTransformsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2SetIkeTransforms(ctx context.Context, in *Ikev2SetIkeTransforms) (*Ikev2SetIkeTransformsReply, error) { + out := new(Ikev2SetIkeTransformsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2SetLocalKey(ctx context.Context, in *Ikev2SetLocalKey) (*Ikev2SetLocalKeyReply, error) { + out := new(Ikev2SetLocalKeyReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2SetResponder(ctx context.Context, in *Ikev2SetResponder) (*Ikev2SetResponderReply, error) { + out := new(Ikev2SetResponderReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2SetSaLifetime(ctx context.Context, in *Ikev2SetSaLifetime) (*Ikev2SetSaLifetimeReply, error) { + out := new(Ikev2SetSaLifetimeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2SetTunnelInterface(ctx context.Context, in *Ikev2SetTunnelInterface) (*Ikev2SetTunnelInterfaceReply, error) { + out := new(Ikev2SetTunnelInterfaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/interface/interface.ba.go b/binapi/interface/interface.ba.go new file mode 100644 index 0000000..9c2dd23 --- /dev/null +++ b/binapi/interface/interface.ba.go @@ -0,0 +1,2542 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/interface.api.json + +// Package interfaces contains generated bindings for API file interface.api. +// +// Contents: +// 57 messages +// +package interfaces + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "interface" + APIVersion = "3.2.2" + VersionCrc = 0x58d4cf5a +) + +// CollectDetailedInterfaceStats defines message 'collect_detailed_interface_stats'. +type CollectDetailedInterfaceStats struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` +} + +func (m *CollectDetailedInterfaceStats) Reset() { *m = CollectDetailedInterfaceStats{} } +func (*CollectDetailedInterfaceStats) GetMessageName() string { + return "collect_detailed_interface_stats" +} +func (*CollectDetailedInterfaceStats) GetCrcString() string { return "5501adee" } +func (*CollectDetailedInterfaceStats) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CollectDetailedInterfaceStats) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.EnableDisable + return size +} +func (m *CollectDetailedInterfaceStats) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.EnableDisable) + return buf.Bytes(), nil +} +func (m *CollectDetailedInterfaceStats) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.EnableDisable = buf.DecodeBool() + return nil +} + +// CollectDetailedInterfaceStatsReply defines message 'collect_detailed_interface_stats_reply'. +type CollectDetailedInterfaceStatsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *CollectDetailedInterfaceStatsReply) Reset() { *m = CollectDetailedInterfaceStatsReply{} } +func (*CollectDetailedInterfaceStatsReply) GetMessageName() string { + return "collect_detailed_interface_stats_reply" +} +func (*CollectDetailedInterfaceStatsReply) GetCrcString() string { return "e8d4e804" } +func (*CollectDetailedInterfaceStatsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CollectDetailedInterfaceStatsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *CollectDetailedInterfaceStatsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *CollectDetailedInterfaceStatsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// CreateLoopback defines message 'create_loopback'. +type CreateLoopback struct { + MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` +} + +func (m *CreateLoopback) Reset() { *m = CreateLoopback{} } +func (*CreateLoopback) GetMessageName() string { return "create_loopback" } +func (*CreateLoopback) GetCrcString() string { return "42bb5d22" } +func (*CreateLoopback) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CreateLoopback) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 6 // m.MacAddress + return size +} +func (m *CreateLoopback) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.MacAddress[:], 6) + return buf.Bytes(), nil +} +func (m *CreateLoopback) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.MacAddress[:], buf.DecodeBytes(6)) + return nil +} + +// CreateLoopbackInstance defines message 'create_loopback_instance'. +type CreateLoopbackInstance struct { + MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` + IsSpecified bool `binapi:"bool,name=is_specified" json:"is_specified,omitempty"` + UserInstance uint32 `binapi:"u32,name=user_instance" json:"user_instance,omitempty"` +} + +func (m *CreateLoopbackInstance) Reset() { *m = CreateLoopbackInstance{} } +func (*CreateLoopbackInstance) GetMessageName() string { return "create_loopback_instance" } +func (*CreateLoopbackInstance) GetCrcString() string { return "d36a3ee2" } +func (*CreateLoopbackInstance) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CreateLoopbackInstance) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 6 // m.MacAddress + size += 1 // m.IsSpecified + size += 4 // m.UserInstance + return size +} +func (m *CreateLoopbackInstance) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.MacAddress[:], 6) + buf.EncodeBool(m.IsSpecified) + buf.EncodeUint32(uint32(m.UserInstance)) + return buf.Bytes(), nil +} +func (m *CreateLoopbackInstance) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.MacAddress[:], buf.DecodeBytes(6)) + m.IsSpecified = buf.DecodeBool() + m.UserInstance = buf.DecodeUint32() + return nil +} + +// CreateLoopbackInstanceReply defines message 'create_loopback_instance_reply'. +type CreateLoopbackInstanceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *CreateLoopbackInstanceReply) Reset() { *m = CreateLoopbackInstanceReply{} } +func (*CreateLoopbackInstanceReply) GetMessageName() string { return "create_loopback_instance_reply" } +func (*CreateLoopbackInstanceReply) GetCrcString() string { return "5383d31f" } +func (*CreateLoopbackInstanceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CreateLoopbackInstanceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *CreateLoopbackInstanceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *CreateLoopbackInstanceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// CreateLoopbackReply defines message 'create_loopback_reply'. +type CreateLoopbackReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *CreateLoopbackReply) Reset() { *m = CreateLoopbackReply{} } +func (*CreateLoopbackReply) GetMessageName() string { return "create_loopback_reply" } +func (*CreateLoopbackReply) GetCrcString() string { return "5383d31f" } +func (*CreateLoopbackReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CreateLoopbackReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *CreateLoopbackReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *CreateLoopbackReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// CreateSubif defines message 'create_subif'. +type CreateSubif struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SubID uint32 `binapi:"u32,name=sub_id" json:"sub_id,omitempty"` + SubIfFlags interface_types.SubIfFlags `binapi:"sub_if_flags,name=sub_if_flags" json:"sub_if_flags,omitempty"` + OuterVlanID uint16 `binapi:"u16,name=outer_vlan_id" json:"outer_vlan_id,omitempty"` + InnerVlanID uint16 `binapi:"u16,name=inner_vlan_id" json:"inner_vlan_id,omitempty"` +} + +func (m *CreateSubif) Reset() { *m = CreateSubif{} } +func (*CreateSubif) GetMessageName() string { return "create_subif" } +func (*CreateSubif) GetCrcString() string { return "cb371063" } +func (*CreateSubif) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CreateSubif) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.SubID + size += 4 // m.SubIfFlags + size += 2 // m.OuterVlanID + size += 2 // m.InnerVlanID + return size +} +func (m *CreateSubif) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.SubID)) + buf.EncodeUint32(uint32(m.SubIfFlags)) + buf.EncodeUint16(uint16(m.OuterVlanID)) + buf.EncodeUint16(uint16(m.InnerVlanID)) + return buf.Bytes(), nil +} +func (m *CreateSubif) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.SubID = buf.DecodeUint32() + m.SubIfFlags = interface_types.SubIfFlags(buf.DecodeUint32()) + m.OuterVlanID = buf.DecodeUint16() + m.InnerVlanID = buf.DecodeUint16() + return nil +} + +// CreateSubifReply defines message 'create_subif_reply'. +type CreateSubifReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *CreateSubifReply) Reset() { *m = CreateSubifReply{} } +func (*CreateSubifReply) GetMessageName() string { return "create_subif_reply" } +func (*CreateSubifReply) GetCrcString() string { return "5383d31f" } +func (*CreateSubifReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CreateSubifReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *CreateSubifReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *CreateSubifReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// CreateVlanSubif defines message 'create_vlan_subif'. +type CreateVlanSubif struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + VlanID uint32 `binapi:"u32,name=vlan_id" json:"vlan_id,omitempty"` +} + +func (m *CreateVlanSubif) Reset() { *m = CreateVlanSubif{} } +func (*CreateVlanSubif) GetMessageName() string { return "create_vlan_subif" } +func (*CreateVlanSubif) GetCrcString() string { return "af34ac8b" } +func (*CreateVlanSubif) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CreateVlanSubif) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.VlanID + return size +} +func (m *CreateVlanSubif) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.VlanID)) + return buf.Bytes(), nil +} +func (m *CreateVlanSubif) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.VlanID = buf.DecodeUint32() + return nil +} + +// CreateVlanSubifReply defines message 'create_vlan_subif_reply'. +type CreateVlanSubifReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *CreateVlanSubifReply) Reset() { *m = CreateVlanSubifReply{} } +func (*CreateVlanSubifReply) GetMessageName() string { return "create_vlan_subif_reply" } +func (*CreateVlanSubifReply) GetCrcString() string { return "5383d31f" } +func (*CreateVlanSubifReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CreateVlanSubifReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *CreateVlanSubifReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *CreateVlanSubifReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// DeleteLoopback defines message 'delete_loopback'. +type DeleteLoopback struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *DeleteLoopback) Reset() { *m = DeleteLoopback{} } +func (*DeleteLoopback) GetMessageName() string { return "delete_loopback" } +func (*DeleteLoopback) GetCrcString() string { return "f9e6675e" } +func (*DeleteLoopback) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DeleteLoopback) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *DeleteLoopback) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *DeleteLoopback) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// DeleteLoopbackReply defines message 'delete_loopback_reply'. +type DeleteLoopbackReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DeleteLoopbackReply) Reset() { *m = DeleteLoopbackReply{} } +func (*DeleteLoopbackReply) GetMessageName() string { return "delete_loopback_reply" } +func (*DeleteLoopbackReply) GetCrcString() string { return "e8d4e804" } +func (*DeleteLoopbackReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DeleteLoopbackReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DeleteLoopbackReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DeleteLoopbackReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// DeleteSubif defines message 'delete_subif'. +type DeleteSubif struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *DeleteSubif) Reset() { *m = DeleteSubif{} } +func (*DeleteSubif) GetMessageName() string { return "delete_subif" } +func (*DeleteSubif) GetCrcString() string { return "f9e6675e" } +func (*DeleteSubif) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DeleteSubif) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *DeleteSubif) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *DeleteSubif) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// DeleteSubifReply defines message 'delete_subif_reply'. +type DeleteSubifReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DeleteSubifReply) Reset() { *m = DeleteSubifReply{} } +func (*DeleteSubifReply) GetMessageName() string { return "delete_subif_reply" } +func (*DeleteSubifReply) GetCrcString() string { return "e8d4e804" } +func (*DeleteSubifReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DeleteSubifReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DeleteSubifReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DeleteSubifReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// HwInterfaceSetMtu defines message 'hw_interface_set_mtu'. +type HwInterfaceSetMtu struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Mtu uint16 `binapi:"u16,name=mtu" json:"mtu,omitempty"` +} + +func (m *HwInterfaceSetMtu) Reset() { *m = HwInterfaceSetMtu{} } +func (*HwInterfaceSetMtu) GetMessageName() string { return "hw_interface_set_mtu" } +func (*HwInterfaceSetMtu) GetCrcString() string { return "e6746899" } +func (*HwInterfaceSetMtu) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *HwInterfaceSetMtu) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 2 // m.Mtu + return size +} +func (m *HwInterfaceSetMtu) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint16(uint16(m.Mtu)) + return buf.Bytes(), nil +} +func (m *HwInterfaceSetMtu) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Mtu = buf.DecodeUint16() + return nil +} + +// HwInterfaceSetMtuReply defines message 'hw_interface_set_mtu_reply'. +type HwInterfaceSetMtuReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *HwInterfaceSetMtuReply) Reset() { *m = HwInterfaceSetMtuReply{} } +func (*HwInterfaceSetMtuReply) GetMessageName() string { return "hw_interface_set_mtu_reply" } +func (*HwInterfaceSetMtuReply) GetCrcString() string { return "e8d4e804" } +func (*HwInterfaceSetMtuReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *HwInterfaceSetMtuReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *HwInterfaceSetMtuReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *HwInterfaceSetMtuReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// InterfaceNameRenumber defines message 'interface_name_renumber'. +type InterfaceNameRenumber struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + NewShowDevInstance uint32 `binapi:"u32,name=new_show_dev_instance" json:"new_show_dev_instance,omitempty"` +} + +func (m *InterfaceNameRenumber) Reset() { *m = InterfaceNameRenumber{} } +func (*InterfaceNameRenumber) GetMessageName() string { return "interface_name_renumber" } +func (*InterfaceNameRenumber) GetCrcString() string { return "2b8858b8" } +func (*InterfaceNameRenumber) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *InterfaceNameRenumber) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.NewShowDevInstance + return size +} +func (m *InterfaceNameRenumber) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.NewShowDevInstance)) + return buf.Bytes(), nil +} +func (m *InterfaceNameRenumber) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.NewShowDevInstance = buf.DecodeUint32() + return nil +} + +// InterfaceNameRenumberReply defines message 'interface_name_renumber_reply'. +type InterfaceNameRenumberReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *InterfaceNameRenumberReply) Reset() { *m = InterfaceNameRenumberReply{} } +func (*InterfaceNameRenumberReply) GetMessageName() string { return "interface_name_renumber_reply" } +func (*InterfaceNameRenumberReply) GetCrcString() string { return "e8d4e804" } +func (*InterfaceNameRenumberReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *InterfaceNameRenumberReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *InterfaceNameRenumberReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *InterfaceNameRenumberReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceAddDelAddress defines message 'sw_interface_add_del_address'. +type SwInterfaceAddDelAddress struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + DelAll bool `binapi:"bool,name=del_all" json:"del_all,omitempty"` + Prefix ip_types.AddressWithPrefix `binapi:"address_with_prefix,name=prefix" json:"prefix,omitempty"` +} + +func (m *SwInterfaceAddDelAddress) Reset() { *m = SwInterfaceAddDelAddress{} } +func (*SwInterfaceAddDelAddress) GetMessageName() string { return "sw_interface_add_del_address" } +func (*SwInterfaceAddDelAddress) GetCrcString() string { return "5803d5c4" } +func (*SwInterfaceAddDelAddress) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceAddDelAddress) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.IsAdd + size += 1 // m.DelAll + size += 1 // m.Prefix.Address.Af + size += 1 * 16 // m.Prefix.Address.Un + size += 1 // m.Prefix.Len + return size +} +func (m *SwInterfaceAddDelAddress) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsAdd) + buf.EncodeBool(m.DelAll) + buf.EncodeUint8(uint8(m.Prefix.Address.Af)) + buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Prefix.Len)) + return buf.Bytes(), nil +} +func (m *SwInterfaceAddDelAddress) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsAdd = buf.DecodeBool() + m.DelAll = buf.DecodeBool() + m.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Prefix.Len = buf.DecodeUint8() + return nil +} + +// SwInterfaceAddDelAddressReply defines message 'sw_interface_add_del_address_reply'. +type SwInterfaceAddDelAddressReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceAddDelAddressReply) Reset() { *m = SwInterfaceAddDelAddressReply{} } +func (*SwInterfaceAddDelAddressReply) GetMessageName() string { + return "sw_interface_add_del_address_reply" +} +func (*SwInterfaceAddDelAddressReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceAddDelAddressReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceAddDelAddressReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceAddDelAddressReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceAddDelAddressReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceAddDelMacAddress defines message 'sw_interface_add_del_mac_address'. +type SwInterfaceAddDelMacAddress struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Addr ethernet_types.MacAddress `binapi:"mac_address,name=addr" json:"addr,omitempty"` + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` +} + +func (m *SwInterfaceAddDelMacAddress) Reset() { *m = SwInterfaceAddDelMacAddress{} } +func (*SwInterfaceAddDelMacAddress) GetMessageName() string { + return "sw_interface_add_del_mac_address" +} +func (*SwInterfaceAddDelMacAddress) GetCrcString() string { return "638bb9f4" } +func (*SwInterfaceAddDelMacAddress) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceAddDelMacAddress) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 * 6 // m.Addr + size += 1 // m.IsAdd + return size +} +func (m *SwInterfaceAddDelMacAddress) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBytes(m.Addr[:], 6) + buf.EncodeUint8(uint8(m.IsAdd)) + return buf.Bytes(), nil +} +func (m *SwInterfaceAddDelMacAddress) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = buf.DecodeUint32() + copy(m.Addr[:], buf.DecodeBytes(6)) + m.IsAdd = buf.DecodeUint8() + return nil +} + +// SwInterfaceAddDelMacAddressReply defines message 'sw_interface_add_del_mac_address_reply'. +type SwInterfaceAddDelMacAddressReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceAddDelMacAddressReply) Reset() { *m = SwInterfaceAddDelMacAddressReply{} } +func (*SwInterfaceAddDelMacAddressReply) GetMessageName() string { + return "sw_interface_add_del_mac_address_reply" +} +func (*SwInterfaceAddDelMacAddressReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceAddDelMacAddressReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceAddDelMacAddressReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceAddDelMacAddressReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceAddDelMacAddressReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceAddressReplaceBegin defines message 'sw_interface_address_replace_begin'. +type SwInterfaceAddressReplaceBegin struct{} + +func (m *SwInterfaceAddressReplaceBegin) Reset() { *m = SwInterfaceAddressReplaceBegin{} } +func (*SwInterfaceAddressReplaceBegin) GetMessageName() string { + return "sw_interface_address_replace_begin" +} +func (*SwInterfaceAddressReplaceBegin) GetCrcString() string { return "51077d14" } +func (*SwInterfaceAddressReplaceBegin) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceAddressReplaceBegin) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SwInterfaceAddressReplaceBegin) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *SwInterfaceAddressReplaceBegin) Unmarshal(b []byte) error { + return nil +} + +// SwInterfaceAddressReplaceBeginReply defines message 'sw_interface_address_replace_begin_reply'. +type SwInterfaceAddressReplaceBeginReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceAddressReplaceBeginReply) Reset() { *m = SwInterfaceAddressReplaceBeginReply{} } +func (*SwInterfaceAddressReplaceBeginReply) GetMessageName() string { + return "sw_interface_address_replace_begin_reply" +} +func (*SwInterfaceAddressReplaceBeginReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceAddressReplaceBeginReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceAddressReplaceBeginReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceAddressReplaceBeginReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceAddressReplaceBeginReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceAddressReplaceEnd defines message 'sw_interface_address_replace_end'. +type SwInterfaceAddressReplaceEnd struct{} + +func (m *SwInterfaceAddressReplaceEnd) Reset() { *m = SwInterfaceAddressReplaceEnd{} } +func (*SwInterfaceAddressReplaceEnd) GetMessageName() string { + return "sw_interface_address_replace_end" +} +func (*SwInterfaceAddressReplaceEnd) GetCrcString() string { return "51077d14" } +func (*SwInterfaceAddressReplaceEnd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceAddressReplaceEnd) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SwInterfaceAddressReplaceEnd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *SwInterfaceAddressReplaceEnd) Unmarshal(b []byte) error { + return nil +} + +// SwInterfaceAddressReplaceEndReply defines message 'sw_interface_address_replace_end_reply'. +type SwInterfaceAddressReplaceEndReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceAddressReplaceEndReply) Reset() { *m = SwInterfaceAddressReplaceEndReply{} } +func (*SwInterfaceAddressReplaceEndReply) GetMessageName() string { + return "sw_interface_address_replace_end_reply" +} +func (*SwInterfaceAddressReplaceEndReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceAddressReplaceEndReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceAddressReplaceEndReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceAddressReplaceEndReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceAddressReplaceEndReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceClearStats defines message 'sw_interface_clear_stats'. +type SwInterfaceClearStats struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *SwInterfaceClearStats) Reset() { *m = SwInterfaceClearStats{} } +func (*SwInterfaceClearStats) GetMessageName() string { return "sw_interface_clear_stats" } +func (*SwInterfaceClearStats) GetCrcString() string { return "f9e6675e" } +func (*SwInterfaceClearStats) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceClearStats) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *SwInterfaceClearStats) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *SwInterfaceClearStats) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// SwInterfaceClearStatsReply defines message 'sw_interface_clear_stats_reply'. +type SwInterfaceClearStatsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceClearStatsReply) Reset() { *m = SwInterfaceClearStatsReply{} } +func (*SwInterfaceClearStatsReply) GetMessageName() string { return "sw_interface_clear_stats_reply" } +func (*SwInterfaceClearStatsReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceClearStatsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceClearStatsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceClearStatsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceClearStatsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceDetails defines message 'sw_interface_details'. +type SwInterfaceDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SupSwIfIndex uint32 `binapi:"u32,name=sup_sw_if_index" json:"sup_sw_if_index,omitempty"` + L2Address ethernet_types.MacAddress `binapi:"mac_address,name=l2_address" json:"l2_address,omitempty"` + Flags interface_types.IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` + Type interface_types.IfType `binapi:"if_type,name=type" json:"type,omitempty"` + LinkDuplex interface_types.LinkDuplex `binapi:"link_duplex,name=link_duplex" json:"link_duplex,omitempty"` + LinkSpeed uint32 `binapi:"u32,name=link_speed" json:"link_speed,omitempty"` + LinkMtu uint16 `binapi:"u16,name=link_mtu" json:"link_mtu,omitempty"` + Mtu []uint32 `binapi:"u32[4],name=mtu" json:"mtu,omitempty"` + SubID uint32 `binapi:"u32,name=sub_id" json:"sub_id,omitempty"` + SubNumberOfTags uint8 `binapi:"u8,name=sub_number_of_tags" json:"sub_number_of_tags,omitempty"` + SubOuterVlanID uint16 `binapi:"u16,name=sub_outer_vlan_id" json:"sub_outer_vlan_id,omitempty"` + SubInnerVlanID uint16 `binapi:"u16,name=sub_inner_vlan_id" json:"sub_inner_vlan_id,omitempty"` + SubIfFlags interface_types.SubIfFlags `binapi:"sub_if_flags,name=sub_if_flags" json:"sub_if_flags,omitempty"` + VtrOp uint32 `binapi:"u32,name=vtr_op" json:"vtr_op,omitempty"` + VtrPushDot1q uint32 `binapi:"u32,name=vtr_push_dot1q" json:"vtr_push_dot1q,omitempty"` + VtrTag1 uint32 `binapi:"u32,name=vtr_tag1" json:"vtr_tag1,omitempty"` + VtrTag2 uint32 `binapi:"u32,name=vtr_tag2" json:"vtr_tag2,omitempty"` + OuterTag uint16 `binapi:"u16,name=outer_tag" json:"outer_tag,omitempty"` + BDmac ethernet_types.MacAddress `binapi:"mac_address,name=b_dmac" json:"b_dmac,omitempty"` + BSmac ethernet_types.MacAddress `binapi:"mac_address,name=b_smac" json:"b_smac,omitempty"` + BVlanid uint16 `binapi:"u16,name=b_vlanid" json:"b_vlanid,omitempty"` + ISid uint32 `binapi:"u32,name=i_sid" json:"i_sid,omitempty"` + InterfaceName string `binapi:"string[64],name=interface_name" json:"interface_name,omitempty"` + InterfaceDevType string `binapi:"string[64],name=interface_dev_type" json:"interface_dev_type,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` +} + +func (m *SwInterfaceDetails) Reset() { *m = SwInterfaceDetails{} } +func (*SwInterfaceDetails) GetMessageName() string { return "sw_interface_details" } +func (*SwInterfaceDetails) GetCrcString() string { return "17b69fa2" } +func (*SwInterfaceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.SupSwIfIndex + size += 1 * 6 // m.L2Address + size += 4 // m.Flags + size += 4 // m.Type + size += 4 // m.LinkDuplex + size += 4 // m.LinkSpeed + size += 2 // m.LinkMtu + size += 4 * 4 // m.Mtu + size += 4 // m.SubID + size += 1 // m.SubNumberOfTags + size += 2 // m.SubOuterVlanID + size += 2 // m.SubInnerVlanID + size += 4 // m.SubIfFlags + size += 4 // m.VtrOp + size += 4 // m.VtrPushDot1q + size += 4 // m.VtrTag1 + size += 4 // m.VtrTag2 + size += 2 // m.OuterTag + size += 1 * 6 // m.BDmac + size += 1 * 6 // m.BSmac + size += 2 // m.BVlanid + size += 4 // m.ISid + size += 64 // m.InterfaceName + size += 64 // m.InterfaceDevType + size += 64 // m.Tag + return size +} +func (m *SwInterfaceDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.SupSwIfIndex)) + buf.EncodeBytes(m.L2Address[:], 6) + buf.EncodeUint32(uint32(m.Flags)) + buf.EncodeUint32(uint32(m.Type)) + buf.EncodeUint32(uint32(m.LinkDuplex)) + buf.EncodeUint32(uint32(m.LinkSpeed)) + buf.EncodeUint16(uint16(m.LinkMtu)) + for i := 0; i < 4; i++ { + var x uint32 + if i < len(m.Mtu) { + x = uint32(m.Mtu[i]) + } + buf.EncodeUint32(uint32(x)) + } + buf.EncodeUint32(uint32(m.SubID)) + buf.EncodeUint8(uint8(m.SubNumberOfTags)) + buf.EncodeUint16(uint16(m.SubOuterVlanID)) + buf.EncodeUint16(uint16(m.SubInnerVlanID)) + buf.EncodeUint32(uint32(m.SubIfFlags)) + buf.EncodeUint32(uint32(m.VtrOp)) + buf.EncodeUint32(uint32(m.VtrPushDot1q)) + buf.EncodeUint32(uint32(m.VtrTag1)) + buf.EncodeUint32(uint32(m.VtrTag2)) + buf.EncodeUint16(uint16(m.OuterTag)) + buf.EncodeBytes(m.BDmac[:], 6) + buf.EncodeBytes(m.BSmac[:], 6) + buf.EncodeUint16(uint16(m.BVlanid)) + buf.EncodeUint32(uint32(m.ISid)) + buf.EncodeString(m.InterfaceName, 64) + buf.EncodeString(m.InterfaceDevType, 64) + buf.EncodeString(m.Tag, 64) + return buf.Bytes(), nil +} +func (m *SwInterfaceDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.SupSwIfIndex = buf.DecodeUint32() + copy(m.L2Address[:], buf.DecodeBytes(6)) + m.Flags = interface_types.IfStatusFlags(buf.DecodeUint32()) + m.Type = interface_types.IfType(buf.DecodeUint32()) + m.LinkDuplex = interface_types.LinkDuplex(buf.DecodeUint32()) + m.LinkSpeed = buf.DecodeUint32() + m.LinkMtu = buf.DecodeUint16() + m.Mtu = make([]uint32, 4) + for i := 0; i < len(m.Mtu); i++ { + m.Mtu[i] = buf.DecodeUint32() + } + m.SubID = buf.DecodeUint32() + m.SubNumberOfTags = buf.DecodeUint8() + m.SubOuterVlanID = buf.DecodeUint16() + m.SubInnerVlanID = buf.DecodeUint16() + m.SubIfFlags = interface_types.SubIfFlags(buf.DecodeUint32()) + m.VtrOp = buf.DecodeUint32() + m.VtrPushDot1q = buf.DecodeUint32() + m.VtrTag1 = buf.DecodeUint32() + m.VtrTag2 = buf.DecodeUint32() + m.OuterTag = buf.DecodeUint16() + copy(m.BDmac[:], buf.DecodeBytes(6)) + copy(m.BSmac[:], buf.DecodeBytes(6)) + m.BVlanid = buf.DecodeUint16() + m.ISid = buf.DecodeUint32() + m.InterfaceName = buf.DecodeString(64) + m.InterfaceDevType = buf.DecodeString(64) + m.Tag = buf.DecodeString(64) + return nil +} + +// SwInterfaceDump defines message 'sw_interface_dump'. +type SwInterfaceDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"` + NameFilterValid bool `binapi:"bool,name=name_filter_valid" json:"name_filter_valid,omitempty"` + NameFilter string `binapi:"string[],name=name_filter" json:"name_filter,omitempty"` +} + +func (m *SwInterfaceDump) Reset() { *m = SwInterfaceDump{} } +func (*SwInterfaceDump) GetMessageName() string { return "sw_interface_dump" } +func (*SwInterfaceDump) GetCrcString() string { return "aa610c27" } +func (*SwInterfaceDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.NameFilterValid + size += 4 + len(m.NameFilter) // m.NameFilter + return size +} +func (m *SwInterfaceDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.NameFilterValid) + buf.EncodeString(m.NameFilter, 0) + return buf.Bytes(), nil +} +func (m *SwInterfaceDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.NameFilterValid = buf.DecodeBool() + m.NameFilter = buf.DecodeString(0) + return nil +} + +// SwInterfaceEvent defines message 'sw_interface_event'. +type SwInterfaceEvent struct { + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Flags interface_types.IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` + Deleted bool `binapi:"bool,name=deleted" json:"deleted,omitempty"` +} + +func (m *SwInterfaceEvent) Reset() { *m = SwInterfaceEvent{} } +func (*SwInterfaceEvent) GetMessageName() string { return "sw_interface_event" } +func (*SwInterfaceEvent) GetCrcString() string { return "f709f78d" } +func (*SwInterfaceEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +func (m *SwInterfaceEvent) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.PID + size += 4 // m.SwIfIndex + size += 4 // m.Flags + size += 1 // m.Deleted + return size +} +func (m *SwInterfaceEvent) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.PID)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.Flags)) + buf.EncodeBool(m.Deleted) + return buf.Bytes(), nil +} +func (m *SwInterfaceEvent) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PID = buf.DecodeUint32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Flags = interface_types.IfStatusFlags(buf.DecodeUint32()) + m.Deleted = buf.DecodeBool() + return nil +} + +// SwInterfaceGetMacAddress defines message 'sw_interface_get_mac_address'. +type SwInterfaceGetMacAddress struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *SwInterfaceGetMacAddress) Reset() { *m = SwInterfaceGetMacAddress{} } +func (*SwInterfaceGetMacAddress) GetMessageName() string { return "sw_interface_get_mac_address" } +func (*SwInterfaceGetMacAddress) GetCrcString() string { return "f9e6675e" } +func (*SwInterfaceGetMacAddress) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceGetMacAddress) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *SwInterfaceGetMacAddress) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *SwInterfaceGetMacAddress) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// SwInterfaceGetMacAddressReply defines message 'sw_interface_get_mac_address_reply'. +type SwInterfaceGetMacAddressReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` +} + +func (m *SwInterfaceGetMacAddressReply) Reset() { *m = SwInterfaceGetMacAddressReply{} } +func (*SwInterfaceGetMacAddressReply) GetMessageName() string { + return "sw_interface_get_mac_address_reply" +} +func (*SwInterfaceGetMacAddressReply) GetCrcString() string { return "40ef2c08" } +func (*SwInterfaceGetMacAddressReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceGetMacAddressReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 * 6 // m.MacAddress + return size +} +func (m *SwInterfaceGetMacAddressReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBytes(m.MacAddress[:], 6) + return buf.Bytes(), nil +} +func (m *SwInterfaceGetMacAddressReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + copy(m.MacAddress[:], buf.DecodeBytes(6)) + return nil +} + +// SwInterfaceGetTable defines message 'sw_interface_get_table'. +type SwInterfaceGetTable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` +} + +func (m *SwInterfaceGetTable) Reset() { *m = SwInterfaceGetTable{} } +func (*SwInterfaceGetTable) GetMessageName() string { return "sw_interface_get_table" } +func (*SwInterfaceGetTable) GetCrcString() string { return "2d033de4" } +func (*SwInterfaceGetTable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceGetTable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.IsIPv6 + return size +} +func (m *SwInterfaceGetTable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsIPv6) + return buf.Bytes(), nil +} +func (m *SwInterfaceGetTable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsIPv6 = buf.DecodeBool() + return nil +} + +// SwInterfaceGetTableReply defines message 'sw_interface_get_table_reply'. +type SwInterfaceGetTableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +func (m *SwInterfaceGetTableReply) Reset() { *m = SwInterfaceGetTableReply{} } +func (*SwInterfaceGetTableReply) GetMessageName() string { return "sw_interface_get_table_reply" } +func (*SwInterfaceGetTableReply) GetCrcString() string { return "a6eb0109" } +func (*SwInterfaceGetTableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceGetTableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.VrfID + return size +} +func (m *SwInterfaceGetTableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.VrfID)) + return buf.Bytes(), nil +} +func (m *SwInterfaceGetTableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.VrfID = buf.DecodeUint32() + return nil +} + +// SwInterfaceRxPlacementDetails defines message 'sw_interface_rx_placement_details'. +type SwInterfaceRxPlacementDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` + WorkerID uint32 `binapi:"u32,name=worker_id" json:"worker_id,omitempty"` + Mode interface_types.RxMode `binapi:"rx_mode,name=mode" json:"mode,omitempty"` +} + +func (m *SwInterfaceRxPlacementDetails) Reset() { *m = SwInterfaceRxPlacementDetails{} } +func (*SwInterfaceRxPlacementDetails) GetMessageName() string { + return "sw_interface_rx_placement_details" +} +func (*SwInterfaceRxPlacementDetails) GetCrcString() string { return "f6d7d024" } +func (*SwInterfaceRxPlacementDetails) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceRxPlacementDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.QueueID + size += 4 // m.WorkerID + size += 4 // m.Mode + return size +} +func (m *SwInterfaceRxPlacementDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.QueueID)) + buf.EncodeUint32(uint32(m.WorkerID)) + buf.EncodeUint32(uint32(m.Mode)) + return buf.Bytes(), nil +} +func (m *SwInterfaceRxPlacementDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.QueueID = buf.DecodeUint32() + m.WorkerID = buf.DecodeUint32() + m.Mode = interface_types.RxMode(buf.DecodeUint32()) + return nil +} + +// SwInterfaceRxPlacementDump defines message 'sw_interface_rx_placement_dump'. +type SwInterfaceRxPlacementDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *SwInterfaceRxPlacementDump) Reset() { *m = SwInterfaceRxPlacementDump{} } +func (*SwInterfaceRxPlacementDump) GetMessageName() string { return "sw_interface_rx_placement_dump" } +func (*SwInterfaceRxPlacementDump) GetCrcString() string { return "f9e6675e" } +func (*SwInterfaceRxPlacementDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceRxPlacementDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *SwInterfaceRxPlacementDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *SwInterfaceRxPlacementDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// SwInterfaceSetFlags defines message 'sw_interface_set_flags'. +type SwInterfaceSetFlags struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Flags interface_types.IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` +} + +func (m *SwInterfaceSetFlags) Reset() { *m = SwInterfaceSetFlags{} } +func (*SwInterfaceSetFlags) GetMessageName() string { return "sw_interface_set_flags" } +func (*SwInterfaceSetFlags) GetCrcString() string { return "6a2b491a" } +func (*SwInterfaceSetFlags) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetFlags) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.Flags + return size +} +func (m *SwInterfaceSetFlags) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.Flags)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetFlags) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Flags = interface_types.IfStatusFlags(buf.DecodeUint32()) + return nil +} + +// SwInterfaceSetFlagsReply defines message 'sw_interface_set_flags_reply'. +type SwInterfaceSetFlagsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetFlagsReply) Reset() { *m = SwInterfaceSetFlagsReply{} } +func (*SwInterfaceSetFlagsReply) GetMessageName() string { return "sw_interface_set_flags_reply" } +func (*SwInterfaceSetFlagsReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetFlagsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetFlagsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetFlagsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetFlagsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceSetIPDirectedBroadcast defines message 'sw_interface_set_ip_directed_broadcast'. +type SwInterfaceSetIPDirectedBroadcast struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *SwInterfaceSetIPDirectedBroadcast) Reset() { *m = SwInterfaceSetIPDirectedBroadcast{} } +func (*SwInterfaceSetIPDirectedBroadcast) GetMessageName() string { + return "sw_interface_set_ip_directed_broadcast" +} +func (*SwInterfaceSetIPDirectedBroadcast) GetCrcString() string { return "ae6cfcfb" } +func (*SwInterfaceSetIPDirectedBroadcast) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetIPDirectedBroadcast) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Enable + return size +} +func (m *SwInterfaceSetIPDirectedBroadcast) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetIPDirectedBroadcast) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Enable = buf.DecodeBool() + return nil +} + +// SwInterfaceSetIPDirectedBroadcastReply defines message 'sw_interface_set_ip_directed_broadcast_reply'. +type SwInterfaceSetIPDirectedBroadcastReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetIPDirectedBroadcastReply) Reset() { + *m = SwInterfaceSetIPDirectedBroadcastReply{} +} +func (*SwInterfaceSetIPDirectedBroadcastReply) GetMessageName() string { + return "sw_interface_set_ip_directed_broadcast_reply" +} +func (*SwInterfaceSetIPDirectedBroadcastReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetIPDirectedBroadcastReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetIPDirectedBroadcastReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetIPDirectedBroadcastReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetIPDirectedBroadcastReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceSetMacAddress defines message 'sw_interface_set_mac_address'. +type SwInterfaceSetMacAddress struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` +} + +func (m *SwInterfaceSetMacAddress) Reset() { *m = SwInterfaceSetMacAddress{} } +func (*SwInterfaceSetMacAddress) GetMessageName() string { return "sw_interface_set_mac_address" } +func (*SwInterfaceSetMacAddress) GetCrcString() string { return "6aca746a" } +func (*SwInterfaceSetMacAddress) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetMacAddress) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 * 6 // m.MacAddress + return size +} +func (m *SwInterfaceSetMacAddress) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBytes(m.MacAddress[:], 6) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetMacAddress) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + copy(m.MacAddress[:], buf.DecodeBytes(6)) + return nil +} + +// SwInterfaceSetMacAddressReply defines message 'sw_interface_set_mac_address_reply'. +type SwInterfaceSetMacAddressReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetMacAddressReply) Reset() { *m = SwInterfaceSetMacAddressReply{} } +func (*SwInterfaceSetMacAddressReply) GetMessageName() string { + return "sw_interface_set_mac_address_reply" +} +func (*SwInterfaceSetMacAddressReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetMacAddressReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetMacAddressReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetMacAddressReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetMacAddressReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceSetMtu defines message 'sw_interface_set_mtu'. +type SwInterfaceSetMtu struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Mtu []uint32 `binapi:"u32[4],name=mtu" json:"mtu,omitempty"` +} + +func (m *SwInterfaceSetMtu) Reset() { *m = SwInterfaceSetMtu{} } +func (*SwInterfaceSetMtu) GetMessageName() string { return "sw_interface_set_mtu" } +func (*SwInterfaceSetMtu) GetCrcString() string { return "5cbe85e5" } +func (*SwInterfaceSetMtu) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetMtu) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 * 4 // m.Mtu + return size +} +func (m *SwInterfaceSetMtu) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + for i := 0; i < 4; i++ { + var x uint32 + if i < len(m.Mtu) { + x = uint32(m.Mtu[i]) + } + buf.EncodeUint32(uint32(x)) + } + return buf.Bytes(), nil +} +func (m *SwInterfaceSetMtu) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Mtu = make([]uint32, 4) + for i := 0; i < len(m.Mtu); i++ { + m.Mtu[i] = buf.DecodeUint32() + } + return nil +} + +// SwInterfaceSetMtuReply defines message 'sw_interface_set_mtu_reply'. +type SwInterfaceSetMtuReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetMtuReply) Reset() { *m = SwInterfaceSetMtuReply{} } +func (*SwInterfaceSetMtuReply) GetMessageName() string { return "sw_interface_set_mtu_reply" } +func (*SwInterfaceSetMtuReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetMtuReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetMtuReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetMtuReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetMtuReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceSetRxMode defines message 'sw_interface_set_rx_mode'. +type SwInterfaceSetRxMode struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + QueueIDValid bool `binapi:"bool,name=queue_id_valid" json:"queue_id_valid,omitempty"` + QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` + Mode interface_types.RxMode `binapi:"rx_mode,name=mode" json:"mode,omitempty"` +} + +func (m *SwInterfaceSetRxMode) Reset() { *m = SwInterfaceSetRxMode{} } +func (*SwInterfaceSetRxMode) GetMessageName() string { return "sw_interface_set_rx_mode" } +func (*SwInterfaceSetRxMode) GetCrcString() string { return "780f5cee" } +func (*SwInterfaceSetRxMode) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetRxMode) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.QueueIDValid + size += 4 // m.QueueID + size += 4 // m.Mode + return size +} +func (m *SwInterfaceSetRxMode) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.QueueIDValid) + buf.EncodeUint32(uint32(m.QueueID)) + buf.EncodeUint32(uint32(m.Mode)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetRxMode) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.QueueIDValid = buf.DecodeBool() + m.QueueID = buf.DecodeUint32() + m.Mode = interface_types.RxMode(buf.DecodeUint32()) + return nil +} + +// SwInterfaceSetRxModeReply defines message 'sw_interface_set_rx_mode_reply'. +type SwInterfaceSetRxModeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetRxModeReply) Reset() { *m = SwInterfaceSetRxModeReply{} } +func (*SwInterfaceSetRxModeReply) GetMessageName() string { return "sw_interface_set_rx_mode_reply" } +func (*SwInterfaceSetRxModeReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetRxModeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetRxModeReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetRxModeReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetRxModeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceSetRxPlacement defines message 'sw_interface_set_rx_placement'. +type SwInterfaceSetRxPlacement struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` + WorkerID uint32 `binapi:"u32,name=worker_id" json:"worker_id,omitempty"` + IsMain bool `binapi:"bool,name=is_main" json:"is_main,omitempty"` +} + +func (m *SwInterfaceSetRxPlacement) Reset() { *m = SwInterfaceSetRxPlacement{} } +func (*SwInterfaceSetRxPlacement) GetMessageName() string { return "sw_interface_set_rx_placement" } +func (*SwInterfaceSetRxPlacement) GetCrcString() string { return "db65f3c9" } +func (*SwInterfaceSetRxPlacement) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetRxPlacement) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.QueueID + size += 4 // m.WorkerID + size += 1 // m.IsMain + return size +} +func (m *SwInterfaceSetRxPlacement) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.QueueID)) + buf.EncodeUint32(uint32(m.WorkerID)) + buf.EncodeBool(m.IsMain) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetRxPlacement) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.QueueID = buf.DecodeUint32() + m.WorkerID = buf.DecodeUint32() + m.IsMain = buf.DecodeBool() + return nil +} + +// SwInterfaceSetRxPlacementReply defines message 'sw_interface_set_rx_placement_reply'. +type SwInterfaceSetRxPlacementReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetRxPlacementReply) Reset() { *m = SwInterfaceSetRxPlacementReply{} } +func (*SwInterfaceSetRxPlacementReply) GetMessageName() string { + return "sw_interface_set_rx_placement_reply" +} +func (*SwInterfaceSetRxPlacementReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetRxPlacementReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetRxPlacementReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetRxPlacementReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetRxPlacementReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceSetTable defines message 'sw_interface_set_table'. +type SwInterfaceSetTable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +func (m *SwInterfaceSetTable) Reset() { *m = SwInterfaceSetTable{} } +func (*SwInterfaceSetTable) GetMessageName() string { return "sw_interface_set_table" } +func (*SwInterfaceSetTable) GetCrcString() string { return "df42a577" } +func (*SwInterfaceSetTable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetTable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.IsIPv6 + size += 4 // m.VrfID + return size +} +func (m *SwInterfaceSetTable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsIPv6) + buf.EncodeUint32(uint32(m.VrfID)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetTable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsIPv6 = buf.DecodeBool() + m.VrfID = buf.DecodeUint32() + return nil +} + +// SwInterfaceSetTableReply defines message 'sw_interface_set_table_reply'. +type SwInterfaceSetTableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetTableReply) Reset() { *m = SwInterfaceSetTableReply{} } +func (*SwInterfaceSetTableReply) GetMessageName() string { return "sw_interface_set_table_reply" } +func (*SwInterfaceSetTableReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetTableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetTableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetTableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetTableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceSetUnnumbered defines message 'sw_interface_set_unnumbered'. +type SwInterfaceSetUnnumbered struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + UnnumberedSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=unnumbered_sw_if_index" json:"unnumbered_sw_if_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *SwInterfaceSetUnnumbered) Reset() { *m = SwInterfaceSetUnnumbered{} } +func (*SwInterfaceSetUnnumbered) GetMessageName() string { return "sw_interface_set_unnumbered" } +func (*SwInterfaceSetUnnumbered) GetCrcString() string { return "938ef33b" } +func (*SwInterfaceSetUnnumbered) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetUnnumbered) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.UnnumberedSwIfIndex + size += 1 // m.IsAdd + return size +} +func (m *SwInterfaceSetUnnumbered) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.UnnumberedSwIfIndex)) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetUnnumbered) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.UnnumberedSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsAdd = buf.DecodeBool() + return nil +} + +// SwInterfaceSetUnnumberedReply defines message 'sw_interface_set_unnumbered_reply'. +type SwInterfaceSetUnnumberedReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetUnnumberedReply) Reset() { *m = SwInterfaceSetUnnumberedReply{} } +func (*SwInterfaceSetUnnumberedReply) GetMessageName() string { + return "sw_interface_set_unnumbered_reply" +} +func (*SwInterfaceSetUnnumberedReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetUnnumberedReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetUnnumberedReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetUnnumberedReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetUnnumberedReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceTagAddDel defines message 'sw_interface_tag_add_del'. +type SwInterfaceTagAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` +} + +func (m *SwInterfaceTagAddDel) Reset() { *m = SwInterfaceTagAddDel{} } +func (*SwInterfaceTagAddDel) GetMessageName() string { return "sw_interface_tag_add_del" } +func (*SwInterfaceTagAddDel) GetCrcString() string { return "426f8bc1" } +func (*SwInterfaceTagAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceTagAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.SwIfIndex + size += 64 // m.Tag + return size +} +func (m *SwInterfaceTagAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeString(m.Tag, 64) + return buf.Bytes(), nil +} +func (m *SwInterfaceTagAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Tag = buf.DecodeString(64) + return nil +} + +// SwInterfaceTagAddDelReply defines message 'sw_interface_tag_add_del_reply'. +type SwInterfaceTagAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceTagAddDelReply) Reset() { *m = SwInterfaceTagAddDelReply{} } +func (*SwInterfaceTagAddDelReply) GetMessageName() string { return "sw_interface_tag_add_del_reply" } +func (*SwInterfaceTagAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceTagAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceTagAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceTagAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceTagAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// WantInterfaceEvents defines message 'want_interface_events'. +type WantInterfaceEvents struct { + EnableDisable uint32 `binapi:"u32,name=enable_disable" json:"enable_disable,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` +} + +func (m *WantInterfaceEvents) Reset() { *m = WantInterfaceEvents{} } +func (*WantInterfaceEvents) GetMessageName() string { return "want_interface_events" } +func (*WantInterfaceEvents) GetCrcString() string { return "476f5a08" } +func (*WantInterfaceEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WantInterfaceEvents) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.EnableDisable + size += 4 // m.PID + return size +} +func (m *WantInterfaceEvents) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.EnableDisable)) + buf.EncodeUint32(uint32(m.PID)) + return buf.Bytes(), nil +} +func (m *WantInterfaceEvents) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EnableDisable = buf.DecodeUint32() + m.PID = buf.DecodeUint32() + return nil +} + +// WantInterfaceEventsReply defines message 'want_interface_events_reply'. +type WantInterfaceEventsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WantInterfaceEventsReply) Reset() { *m = WantInterfaceEventsReply{} } +func (*WantInterfaceEventsReply) GetMessageName() string { return "want_interface_events_reply" } +func (*WantInterfaceEventsReply) GetCrcString() string { return "e8d4e804" } +func (*WantInterfaceEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WantInterfaceEventsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *WantInterfaceEventsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *WantInterfaceEventsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_interfaces_binapi_init() } +func file_interfaces_binapi_init() { + api.RegisterMessage((*CollectDetailedInterfaceStats)(nil), "collect_detailed_interface_stats_5501adee") + api.RegisterMessage((*CollectDetailedInterfaceStatsReply)(nil), "collect_detailed_interface_stats_reply_e8d4e804") + api.RegisterMessage((*CreateLoopback)(nil), "create_loopback_42bb5d22") + api.RegisterMessage((*CreateLoopbackInstance)(nil), "create_loopback_instance_d36a3ee2") + api.RegisterMessage((*CreateLoopbackInstanceReply)(nil), "create_loopback_instance_reply_5383d31f") + api.RegisterMessage((*CreateLoopbackReply)(nil), "create_loopback_reply_5383d31f") + api.RegisterMessage((*CreateSubif)(nil), "create_subif_cb371063") + api.RegisterMessage((*CreateSubifReply)(nil), "create_subif_reply_5383d31f") + api.RegisterMessage((*CreateVlanSubif)(nil), "create_vlan_subif_af34ac8b") + api.RegisterMessage((*CreateVlanSubifReply)(nil), "create_vlan_subif_reply_5383d31f") + api.RegisterMessage((*DeleteLoopback)(nil), "delete_loopback_f9e6675e") + api.RegisterMessage((*DeleteLoopbackReply)(nil), "delete_loopback_reply_e8d4e804") + api.RegisterMessage((*DeleteSubif)(nil), "delete_subif_f9e6675e") + api.RegisterMessage((*DeleteSubifReply)(nil), "delete_subif_reply_e8d4e804") + api.RegisterMessage((*HwInterfaceSetMtu)(nil), "hw_interface_set_mtu_e6746899") + api.RegisterMessage((*HwInterfaceSetMtuReply)(nil), "hw_interface_set_mtu_reply_e8d4e804") + api.RegisterMessage((*InterfaceNameRenumber)(nil), "interface_name_renumber_2b8858b8") + api.RegisterMessage((*InterfaceNameRenumberReply)(nil), "interface_name_renumber_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceAddDelAddress)(nil), "sw_interface_add_del_address_5803d5c4") + api.RegisterMessage((*SwInterfaceAddDelAddressReply)(nil), "sw_interface_add_del_address_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceAddDelMacAddress)(nil), "sw_interface_add_del_mac_address_638bb9f4") + api.RegisterMessage((*SwInterfaceAddDelMacAddressReply)(nil), "sw_interface_add_del_mac_address_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceAddressReplaceBegin)(nil), "sw_interface_address_replace_begin_51077d14") + api.RegisterMessage((*SwInterfaceAddressReplaceBeginReply)(nil), "sw_interface_address_replace_begin_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceAddressReplaceEnd)(nil), "sw_interface_address_replace_end_51077d14") + api.RegisterMessage((*SwInterfaceAddressReplaceEndReply)(nil), "sw_interface_address_replace_end_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceClearStats)(nil), "sw_interface_clear_stats_f9e6675e") + api.RegisterMessage((*SwInterfaceClearStatsReply)(nil), "sw_interface_clear_stats_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceDetails)(nil), "sw_interface_details_17b69fa2") + api.RegisterMessage((*SwInterfaceDump)(nil), "sw_interface_dump_aa610c27") + api.RegisterMessage((*SwInterfaceEvent)(nil), "sw_interface_event_f709f78d") + api.RegisterMessage((*SwInterfaceGetMacAddress)(nil), "sw_interface_get_mac_address_f9e6675e") + api.RegisterMessage((*SwInterfaceGetMacAddressReply)(nil), "sw_interface_get_mac_address_reply_40ef2c08") + api.RegisterMessage((*SwInterfaceGetTable)(nil), "sw_interface_get_table_2d033de4") + api.RegisterMessage((*SwInterfaceGetTableReply)(nil), "sw_interface_get_table_reply_a6eb0109") + api.RegisterMessage((*SwInterfaceRxPlacementDetails)(nil), "sw_interface_rx_placement_details_f6d7d024") + api.RegisterMessage((*SwInterfaceRxPlacementDump)(nil), "sw_interface_rx_placement_dump_f9e6675e") + api.RegisterMessage((*SwInterfaceSetFlags)(nil), "sw_interface_set_flags_6a2b491a") + api.RegisterMessage((*SwInterfaceSetFlagsReply)(nil), "sw_interface_set_flags_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSetIPDirectedBroadcast)(nil), "sw_interface_set_ip_directed_broadcast_ae6cfcfb") + api.RegisterMessage((*SwInterfaceSetIPDirectedBroadcastReply)(nil), "sw_interface_set_ip_directed_broadcast_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSetMacAddress)(nil), "sw_interface_set_mac_address_6aca746a") + api.RegisterMessage((*SwInterfaceSetMacAddressReply)(nil), "sw_interface_set_mac_address_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSetMtu)(nil), "sw_interface_set_mtu_5cbe85e5") + api.RegisterMessage((*SwInterfaceSetMtuReply)(nil), "sw_interface_set_mtu_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSetRxMode)(nil), "sw_interface_set_rx_mode_780f5cee") + api.RegisterMessage((*SwInterfaceSetRxModeReply)(nil), "sw_interface_set_rx_mode_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSetRxPlacement)(nil), "sw_interface_set_rx_placement_db65f3c9") + api.RegisterMessage((*SwInterfaceSetRxPlacementReply)(nil), "sw_interface_set_rx_placement_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSetTable)(nil), "sw_interface_set_table_df42a577") + api.RegisterMessage((*SwInterfaceSetTableReply)(nil), "sw_interface_set_table_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSetUnnumbered)(nil), "sw_interface_set_unnumbered_938ef33b") + api.RegisterMessage((*SwInterfaceSetUnnumberedReply)(nil), "sw_interface_set_unnumbered_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceTagAddDel)(nil), "sw_interface_tag_add_del_426f8bc1") + api.RegisterMessage((*SwInterfaceTagAddDelReply)(nil), "sw_interface_tag_add_del_reply_e8d4e804") + api.RegisterMessage((*WantInterfaceEvents)(nil), "want_interface_events_476f5a08") + api.RegisterMessage((*WantInterfaceEventsReply)(nil), "want_interface_events_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*CollectDetailedInterfaceStats)(nil), + (*CollectDetailedInterfaceStatsReply)(nil), + (*CreateLoopback)(nil), + (*CreateLoopbackInstance)(nil), + (*CreateLoopbackInstanceReply)(nil), + (*CreateLoopbackReply)(nil), + (*CreateSubif)(nil), + (*CreateSubifReply)(nil), + (*CreateVlanSubif)(nil), + (*CreateVlanSubifReply)(nil), + (*DeleteLoopback)(nil), + (*DeleteLoopbackReply)(nil), + (*DeleteSubif)(nil), + (*DeleteSubifReply)(nil), + (*HwInterfaceSetMtu)(nil), + (*HwInterfaceSetMtuReply)(nil), + (*InterfaceNameRenumber)(nil), + (*InterfaceNameRenumberReply)(nil), + (*SwInterfaceAddDelAddress)(nil), + (*SwInterfaceAddDelAddressReply)(nil), + (*SwInterfaceAddDelMacAddress)(nil), + (*SwInterfaceAddDelMacAddressReply)(nil), + (*SwInterfaceAddressReplaceBegin)(nil), + (*SwInterfaceAddressReplaceBeginReply)(nil), + (*SwInterfaceAddressReplaceEnd)(nil), + (*SwInterfaceAddressReplaceEndReply)(nil), + (*SwInterfaceClearStats)(nil), + (*SwInterfaceClearStatsReply)(nil), + (*SwInterfaceDetails)(nil), + (*SwInterfaceDump)(nil), + (*SwInterfaceEvent)(nil), + (*SwInterfaceGetMacAddress)(nil), + (*SwInterfaceGetMacAddressReply)(nil), + (*SwInterfaceGetTable)(nil), + (*SwInterfaceGetTableReply)(nil), + (*SwInterfaceRxPlacementDetails)(nil), + (*SwInterfaceRxPlacementDump)(nil), + (*SwInterfaceSetFlags)(nil), + (*SwInterfaceSetFlagsReply)(nil), + (*SwInterfaceSetIPDirectedBroadcast)(nil), + (*SwInterfaceSetIPDirectedBroadcastReply)(nil), + (*SwInterfaceSetMacAddress)(nil), + (*SwInterfaceSetMacAddressReply)(nil), + (*SwInterfaceSetMtu)(nil), + (*SwInterfaceSetMtuReply)(nil), + (*SwInterfaceSetRxMode)(nil), + (*SwInterfaceSetRxModeReply)(nil), + (*SwInterfaceSetRxPlacement)(nil), + (*SwInterfaceSetRxPlacementReply)(nil), + (*SwInterfaceSetTable)(nil), + (*SwInterfaceSetTableReply)(nil), + (*SwInterfaceSetUnnumbered)(nil), + (*SwInterfaceSetUnnumberedReply)(nil), + (*SwInterfaceTagAddDel)(nil), + (*SwInterfaceTagAddDelReply)(nil), + (*WantInterfaceEvents)(nil), + (*WantInterfaceEventsReply)(nil), + } +} diff --git a/binapi/interface/interface_rest.ba.go b/binapi/interface/interface_rest.ba.go new file mode 100644 index 0000000..da5b899 --- /dev/null +++ b/binapi/interface/interface_rest.ba.go @@ -0,0 +1,594 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package interfaces + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/collect_detailed_interface_stats", func(w http.ResponseWriter, req *http.Request) { + var request = new(CollectDetailedInterfaceStats) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.CollectDetailedInterfaceStats(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/create_loopback", func(w http.ResponseWriter, req *http.Request) { + var request = new(CreateLoopback) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.CreateLoopback(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/create_loopback_instance", func(w http.ResponseWriter, req *http.Request) { + var request = new(CreateLoopbackInstance) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.CreateLoopbackInstance(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/create_subif", func(w http.ResponseWriter, req *http.Request) { + var request = new(CreateSubif) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.CreateSubif(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/create_vlan_subif", func(w http.ResponseWriter, req *http.Request) { + var request = new(CreateVlanSubif) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.CreateVlanSubif(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/delete_loopback", func(w http.ResponseWriter, req *http.Request) { + var request = new(DeleteLoopback) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DeleteLoopback(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/delete_subif", func(w http.ResponseWriter, req *http.Request) { + var request = new(DeleteSubif) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DeleteSubif(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/hw_interface_set_mtu", func(w http.ResponseWriter, req *http.Request) { + var request = new(HwInterfaceSetMtu) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.HwInterfaceSetMtu(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/interface_name_renumber", func(w http.ResponseWriter, req *http.Request) { + var request = new(InterfaceNameRenumber) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.InterfaceNameRenumber(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_add_del_address", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceAddDelAddress) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceAddDelAddress(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_add_del_mac_address", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceAddDelMacAddress) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceAddDelMacAddress(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_address_replace_begin", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceAddressReplaceBegin) + reply, err := rpc.SwInterfaceAddressReplaceBegin(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_address_replace_end", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceAddressReplaceEnd) + reply, err := rpc.SwInterfaceAddressReplaceEnd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_clear_stats", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceClearStats) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceClearStats(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_get_mac_address", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceGetMacAddress) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceGetMacAddress(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_get_table", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceGetTable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceGetTable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_set_flags", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceSetFlags) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceSetFlags(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_set_ip_directed_broadcast", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceSetIPDirectedBroadcast) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceSetIPDirectedBroadcast(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_set_mac_address", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceSetMacAddress) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceSetMacAddress(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_set_mtu", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceSetMtu) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceSetMtu(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_set_rx_mode", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceSetRxMode) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceSetRxMode(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_set_rx_placement", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceSetRxPlacement) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceSetRxPlacement(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_set_table", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceSetTable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceSetTable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_set_unnumbered", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceSetUnnumbered) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceSetUnnumbered(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_tag_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceTagAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceTagAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/want_interface_events", func(w http.ResponseWriter, req *http.Request) { + var request = new(WantInterfaceEvents) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.WantInterfaceEvents(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/interface/interface_rpc.ba.go b/binapi/interface/interface_rpc.ba.go new file mode 100644 index 0000000..6dc6a43 --- /dev/null +++ b/binapi/interface/interface_rpc.ba.go @@ -0,0 +1,363 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package interfaces + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service interface. +type RPCService interface { + CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) + CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) + CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) + CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) + CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) + DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) + DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) + HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) + InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) + SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) + SwInterfaceAddDelMacAddress(ctx context.Context, in *SwInterfaceAddDelMacAddress) (*SwInterfaceAddDelMacAddressReply, error) + SwInterfaceAddressReplaceBegin(ctx context.Context, in *SwInterfaceAddressReplaceBegin) (*SwInterfaceAddressReplaceBeginReply, error) + SwInterfaceAddressReplaceEnd(ctx context.Context, in *SwInterfaceAddressReplaceEnd) (*SwInterfaceAddressReplaceEndReply, error) + SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) + SwInterfaceDump(ctx context.Context, in *SwInterfaceDump) (RPCService_SwInterfaceDumpClient, error) + SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) + SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) + SwInterfaceRxPlacementDump(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_SwInterfaceRxPlacementDumpClient, error) + SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) + SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) + SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) + SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) + SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) + SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) + SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) + SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) + SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) + WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) { + out := new(CollectDetailedInterfaceStatsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) { + out := new(CreateLoopbackReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) { + out := new(CreateLoopbackInstanceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) { + out := new(CreateSubifReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) { + out := new(CreateVlanSubifReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) { + out := new(DeleteLoopbackReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) { + out := new(DeleteSubifReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) { + out := new(HwInterfaceSetMtuReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) { + out := new(InterfaceNameRenumberReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) { + out := new(SwInterfaceAddDelAddressReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceAddDelMacAddress(ctx context.Context, in *SwInterfaceAddDelMacAddress) (*SwInterfaceAddDelMacAddressReply, error) { + out := new(SwInterfaceAddDelMacAddressReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceAddressReplaceBegin(ctx context.Context, in *SwInterfaceAddressReplaceBegin) (*SwInterfaceAddressReplaceBeginReply, error) { + out := new(SwInterfaceAddressReplaceBeginReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceAddressReplaceEnd(ctx context.Context, in *SwInterfaceAddressReplaceEnd) (*SwInterfaceAddressReplaceEndReply, error) { + out := new(SwInterfaceAddressReplaceEndReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) { + out := new(SwInterfaceClearStatsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceDump(ctx context.Context, in *SwInterfaceDump) (RPCService_SwInterfaceDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SwInterfaceDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_SwInterfaceDumpClient interface { + Recv() (*SwInterfaceDetails, error) + api.Stream +} + +type serviceClient_SwInterfaceDumpClient struct { + api.Stream +} + +func (c *serviceClient_SwInterfaceDumpClient) Recv() (*SwInterfaceDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SwInterfaceDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) { + out := new(SwInterfaceGetMacAddressReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) { + out := new(SwInterfaceGetTableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceRxPlacementDump(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_SwInterfaceRxPlacementDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SwInterfaceRxPlacementDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_SwInterfaceRxPlacementDumpClient interface { + Recv() (*SwInterfaceRxPlacementDetails, error) + api.Stream +} + +type serviceClient_SwInterfaceRxPlacementDumpClient struct { + api.Stream +} + +func (c *serviceClient_SwInterfaceRxPlacementDumpClient) Recv() (*SwInterfaceRxPlacementDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SwInterfaceRxPlacementDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) { + out := new(SwInterfaceSetFlagsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) { + out := new(SwInterfaceSetIPDirectedBroadcastReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) { + out := new(SwInterfaceSetMacAddressReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) { + out := new(SwInterfaceSetMtuReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) { + out := new(SwInterfaceSetRxModeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) { + out := new(SwInterfaceSetRxPlacementReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) { + out := new(SwInterfaceSetTableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) { + out := new(SwInterfaceSetUnnumberedReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) { + out := new(SwInterfaceTagAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) { + out := new(WantInterfaceEventsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/interface_types/interface_types.ba.go b/binapi/interface_types/interface_types.ba.go new file mode 100644 index 0000000..607dc9b --- /dev/null +++ b/binapi/interface_types/interface_types.ba.go @@ -0,0 +1,275 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/interface_types.api.json + +// Package interface_types contains generated bindings for API file interface_types.api. +// +// Contents: +// 1 alias +// 6 enums +// +package interface_types + +import ( + api "git.fd.io/govpp.git/api" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +// IfStatusFlags defines enum 'if_status_flags'. +type IfStatusFlags uint32 + +const ( + IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 + IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 +) + +var ( + IfStatusFlags_name = map[uint32]string{ + 1: "IF_STATUS_API_FLAG_ADMIN_UP", + 2: "IF_STATUS_API_FLAG_LINK_UP", + } + IfStatusFlags_value = map[string]uint32{ + "IF_STATUS_API_FLAG_ADMIN_UP": 1, + "IF_STATUS_API_FLAG_LINK_UP": 2, + } +) + +func (x IfStatusFlags) String() string { + s, ok := IfStatusFlags_name[uint32(x)] + if ok { + return s + } + str := func(n uint32) string { + s, ok := IfStatusFlags_name[uint32(n)] + if ok { + return s + } + return "IfStatusFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint32(0); i <= 32; i++ { + val := uint32(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint32(x)) + } + return s +} + +// IfType defines enum 'if_type'. +type IfType uint32 + +const ( + IF_API_TYPE_HARDWARE IfType = 0 + IF_API_TYPE_SUB IfType = 1 + IF_API_TYPE_P2P IfType = 2 + IF_API_TYPE_PIPE IfType = 3 +) + +var ( + IfType_name = map[uint32]string{ + 0: "IF_API_TYPE_HARDWARE", + 1: "IF_API_TYPE_SUB", + 2: "IF_API_TYPE_P2P", + 3: "IF_API_TYPE_PIPE", + } + IfType_value = map[string]uint32{ + "IF_API_TYPE_HARDWARE": 0, + "IF_API_TYPE_SUB": 1, + "IF_API_TYPE_P2P": 2, + "IF_API_TYPE_PIPE": 3, + } +) + +func (x IfType) String() string { + s, ok := IfType_name[uint32(x)] + if ok { + return s + } + return "IfType(" + strconv.Itoa(int(x)) + ")" +} + +// LinkDuplex defines enum 'link_duplex'. +type LinkDuplex uint32 + +const ( + LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 + LINK_DUPLEX_API_HALF LinkDuplex = 1 + LINK_DUPLEX_API_FULL LinkDuplex = 2 +) + +var ( + LinkDuplex_name = map[uint32]string{ + 0: "LINK_DUPLEX_API_UNKNOWN", + 1: "LINK_DUPLEX_API_HALF", + 2: "LINK_DUPLEX_API_FULL", + } + LinkDuplex_value = map[string]uint32{ + "LINK_DUPLEX_API_UNKNOWN": 0, + "LINK_DUPLEX_API_HALF": 1, + "LINK_DUPLEX_API_FULL": 2, + } +) + +func (x LinkDuplex) String() string { + s, ok := LinkDuplex_name[uint32(x)] + if ok { + return s + } + return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" +} + +// MtuProto defines enum 'mtu_proto'. +type MtuProto uint32 + +const ( + MTU_PROTO_API_L3 MtuProto = 0 + MTU_PROTO_API_IP4 MtuProto = 1 + MTU_PROTO_API_IP6 MtuProto = 2 + MTU_PROTO_API_MPLS MtuProto = 3 +) + +var ( + MtuProto_name = map[uint32]string{ + 0: "MTU_PROTO_API_L3", + 1: "MTU_PROTO_API_IP4", + 2: "MTU_PROTO_API_IP6", + 3: "MTU_PROTO_API_MPLS", + } + MtuProto_value = map[string]uint32{ + "MTU_PROTO_API_L3": 0, + "MTU_PROTO_API_IP4": 1, + "MTU_PROTO_API_IP6": 2, + "MTU_PROTO_API_MPLS": 3, + } +) + +func (x MtuProto) String() string { + s, ok := MtuProto_name[uint32(x)] + if ok { + return s + } + return "MtuProto(" + strconv.Itoa(int(x)) + ")" +} + +// RxMode defines enum 'rx_mode'. +type RxMode uint32 + +const ( + RX_MODE_API_UNKNOWN RxMode = 0 + RX_MODE_API_POLLING RxMode = 1 + RX_MODE_API_INTERRUPT RxMode = 2 + RX_MODE_API_ADAPTIVE RxMode = 3 + RX_MODE_API_DEFAULT RxMode = 4 +) + +var ( + RxMode_name = map[uint32]string{ + 0: "RX_MODE_API_UNKNOWN", + 1: "RX_MODE_API_POLLING", + 2: "RX_MODE_API_INTERRUPT", + 3: "RX_MODE_API_ADAPTIVE", + 4: "RX_MODE_API_DEFAULT", + } + RxMode_value = map[string]uint32{ + "RX_MODE_API_UNKNOWN": 0, + "RX_MODE_API_POLLING": 1, + "RX_MODE_API_INTERRUPT": 2, + "RX_MODE_API_ADAPTIVE": 3, + "RX_MODE_API_DEFAULT": 4, + } +) + +func (x RxMode) String() string { + s, ok := RxMode_name[uint32(x)] + if ok { + return s + } + return "RxMode(" + strconv.Itoa(int(x)) + ")" +} + +// SubIfFlags defines enum 'sub_if_flags'. +type SubIfFlags uint32 + +const ( + SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 + SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 + SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 + SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 + SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 + SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 + SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 + SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 + SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 + SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 +) + +var ( + SubIfFlags_name = map[uint32]string{ + 1: "SUB_IF_API_FLAG_NO_TAGS", + 2: "SUB_IF_API_FLAG_ONE_TAG", + 4: "SUB_IF_API_FLAG_TWO_TAGS", + 8: "SUB_IF_API_FLAG_DOT1AD", + 16: "SUB_IF_API_FLAG_EXACT_MATCH", + 32: "SUB_IF_API_FLAG_DEFAULT", + 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", + 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", + 254: "SUB_IF_API_FLAG_MASK_VNET", + 256: "SUB_IF_API_FLAG_DOT1AH", + } + SubIfFlags_value = map[string]uint32{ + "SUB_IF_API_FLAG_NO_TAGS": 1, + "SUB_IF_API_FLAG_ONE_TAG": 2, + "SUB_IF_API_FLAG_TWO_TAGS": 4, + "SUB_IF_API_FLAG_DOT1AD": 8, + "SUB_IF_API_FLAG_EXACT_MATCH": 16, + "SUB_IF_API_FLAG_DEFAULT": 32, + "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, + "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, + "SUB_IF_API_FLAG_MASK_VNET": 254, + "SUB_IF_API_FLAG_DOT1AH": 256, + } +) + +func (x SubIfFlags) String() string { + s, ok := SubIfFlags_name[uint32(x)] + if ok { + return s + } + str := func(n uint32) string { + s, ok := SubIfFlags_name[uint32(n)] + if ok { + return s + } + return "SubIfFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint32(0); i <= 32; i++ { + val := uint32(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint32(x)) + } + return s +} + +// InterfaceIndex defines alias 'interface_index'. +type InterfaceIndex uint32 diff --git a/binapi/ioam_cache/ioam_cache.ba.go b/binapi/ioam_cache/ioam_cache.ba.go new file mode 100644 index 0000000..d48b15b --- /dev/null +++ b/binapi/ioam_cache/ioam_cache.ba.go @@ -0,0 +1,117 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/ioam_cache.api.json + +// Package ioam_cache contains generated bindings for API file ioam_cache.api. +// +// Contents: +// 2 messages +// +package ioam_cache + +import ( + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "ioam_cache" + APIVersion = "1.0.0" + VersionCrc = 0xd0a0cf20 +) + +// IoamCacheIP6EnableDisable defines message 'ioam_cache_ip6_enable_disable'. +type IoamCacheIP6EnableDisable struct { + IsDisable bool `binapi:"bool,name=is_disable" json:"is_disable,omitempty"` +} + +func (m *IoamCacheIP6EnableDisable) Reset() { *m = IoamCacheIP6EnableDisable{} } +func (*IoamCacheIP6EnableDisable) GetMessageName() string { return "ioam_cache_ip6_enable_disable" } +func (*IoamCacheIP6EnableDisable) GetCrcString() string { return "47705c03" } +func (*IoamCacheIP6EnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IoamCacheIP6EnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsDisable + return size +} +func (m *IoamCacheIP6EnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsDisable) + return buf.Bytes(), nil +} +func (m *IoamCacheIP6EnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsDisable = buf.DecodeBool() + return nil +} + +// IoamCacheIP6EnableDisableReply defines message 'ioam_cache_ip6_enable_disable_reply'. +type IoamCacheIP6EnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IoamCacheIP6EnableDisableReply) Reset() { *m = IoamCacheIP6EnableDisableReply{} } +func (*IoamCacheIP6EnableDisableReply) GetMessageName() string { + return "ioam_cache_ip6_enable_disable_reply" +} +func (*IoamCacheIP6EnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*IoamCacheIP6EnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IoamCacheIP6EnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IoamCacheIP6EnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IoamCacheIP6EnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_ioam_cache_binapi_init() } +func file_ioam_cache_binapi_init() { + api.RegisterMessage((*IoamCacheIP6EnableDisable)(nil), "ioam_cache_ip6_enable_disable_47705c03") + api.RegisterMessage((*IoamCacheIP6EnableDisableReply)(nil), "ioam_cache_ip6_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*IoamCacheIP6EnableDisable)(nil), + (*IoamCacheIP6EnableDisableReply)(nil), + } +} diff --git a/binapi/ioam_cache/ioam_cache_rest.ba.go b/binapi/ioam_cache/ioam_cache_rest.ba.go new file mode 100644 index 0000000..4090307 --- /dev/null +++ b/binapi/ioam_cache/ioam_cache_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ioam_cache + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/ioam_cache_ip6_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(IoamCacheIP6EnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IoamCacheIP6EnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/ioam_cache/ioam_cache_rpc.ba.go b/binapi/ioam_cache/ioam_cache_rpc.ba.go new file mode 100644 index 0000000..33a721f --- /dev/null +++ b/binapi/ioam_cache/ioam_cache_rpc.ba.go @@ -0,0 +1,30 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ioam_cache + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service ioam_cache. +type RPCService interface { + IoamCacheIP6EnableDisable(ctx context.Context, in *IoamCacheIP6EnableDisable) (*IoamCacheIP6EnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) IoamCacheIP6EnableDisable(ctx context.Context, in *IoamCacheIP6EnableDisable) (*IoamCacheIP6EnableDisableReply, error) { + out := new(IoamCacheIP6EnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/ioam_export/ioam_export.ba.go b/binapi/ioam_export/ioam_export.ba.go new file mode 100644 index 0000000..b95f506 --- /dev/null +++ b/binapi/ioam_export/ioam_export.ba.go @@ -0,0 +1,126 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/ioam_export.api.json + +// Package ioam_export contains generated bindings for API file ioam_export.api. +// +// Contents: +// 2 messages +// +package ioam_export + +import ( + api "git.fd.io/govpp.git/api" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "ioam_export" + APIVersion = "1.0.0" + VersionCrc = 0x56bd3b73 +) + +// IoamExportIP6EnableDisable defines message 'ioam_export_ip6_enable_disable'. +type IoamExportIP6EnableDisable struct { + IsDisable bool `binapi:"bool,name=is_disable" json:"is_disable,omitempty"` + CollectorAddress ip_types.IP4Address `binapi:"ip4_address,name=collector_address" json:"collector_address,omitempty"` + SrcAddress ip_types.IP4Address `binapi:"ip4_address,name=src_address" json:"src_address,omitempty"` +} + +func (m *IoamExportIP6EnableDisable) Reset() { *m = IoamExportIP6EnableDisable{} } +func (*IoamExportIP6EnableDisable) GetMessageName() string { return "ioam_export_ip6_enable_disable" } +func (*IoamExportIP6EnableDisable) GetCrcString() string { return "e4d4ebfa" } +func (*IoamExportIP6EnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IoamExportIP6EnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsDisable + size += 1 * 4 // m.CollectorAddress + size += 1 * 4 // m.SrcAddress + return size +} +func (m *IoamExportIP6EnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsDisable) + buf.EncodeBytes(m.CollectorAddress[:], 4) + buf.EncodeBytes(m.SrcAddress[:], 4) + return buf.Bytes(), nil +} +func (m *IoamExportIP6EnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsDisable = buf.DecodeBool() + copy(m.CollectorAddress[:], buf.DecodeBytes(4)) + copy(m.SrcAddress[:], buf.DecodeBytes(4)) + return nil +} + +// IoamExportIP6EnableDisableReply defines message 'ioam_export_ip6_enable_disable_reply'. +type IoamExportIP6EnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IoamExportIP6EnableDisableReply) Reset() { *m = IoamExportIP6EnableDisableReply{} } +func (*IoamExportIP6EnableDisableReply) GetMessageName() string { + return "ioam_export_ip6_enable_disable_reply" +} +func (*IoamExportIP6EnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*IoamExportIP6EnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IoamExportIP6EnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IoamExportIP6EnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IoamExportIP6EnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_ioam_export_binapi_init() } +func file_ioam_export_binapi_init() { + api.RegisterMessage((*IoamExportIP6EnableDisable)(nil), "ioam_export_ip6_enable_disable_e4d4ebfa") + api.RegisterMessage((*IoamExportIP6EnableDisableReply)(nil), "ioam_export_ip6_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*IoamExportIP6EnableDisable)(nil), + (*IoamExportIP6EnableDisableReply)(nil), + } +} diff --git a/binapi/ioam_export/ioam_export_rest.ba.go b/binapi/ioam_export/ioam_export_rest.ba.go new file mode 100644 index 0000000..06ee0bc --- /dev/null +++ b/binapi/ioam_export/ioam_export_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ioam_export + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/ioam_export_ip6_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(IoamExportIP6EnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IoamExportIP6EnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/ioam_export/ioam_export_rpc.ba.go b/binapi/ioam_export/ioam_export_rpc.ba.go new file mode 100644 index 0000000..584a563 --- /dev/null +++ b/binapi/ioam_export/ioam_export_rpc.ba.go @@ -0,0 +1,30 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ioam_export + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service ioam_export. +type RPCService interface { + IoamExportIP6EnableDisable(ctx context.Context, in *IoamExportIP6EnableDisable) (*IoamExportIP6EnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) IoamExportIP6EnableDisable(ctx context.Context, in *IoamExportIP6EnableDisable) (*IoamExportIP6EnableDisableReply, error) { + out := new(IoamExportIP6EnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe.ba.go b/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe.ba.go new file mode 100644 index 0000000..819b136 --- /dev/null +++ b/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe.ba.go @@ -0,0 +1,556 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/ioam_vxlan_gpe.api.json + +// Package ioam_vxlan_gpe contains generated bindings for API file ioam_vxlan_gpe.api. +// +// Contents: +// 12 messages +// +package ioam_vxlan_gpe + +import ( + api "git.fd.io/govpp.git/api" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "ioam_vxlan_gpe" + APIVersion = "1.0.0" + VersionCrc = 0xe60c2de2 +) + +// VxlanGpeIoamDisable defines message 'vxlan_gpe_ioam_disable'. +type VxlanGpeIoamDisable struct { + ID uint16 `binapi:"u16,name=id" json:"id,omitempty"` +} + +func (m *VxlanGpeIoamDisable) Reset() { *m = VxlanGpeIoamDisable{} } +func (*VxlanGpeIoamDisable) GetMessageName() string { return "vxlan_gpe_ioam_disable" } +func (*VxlanGpeIoamDisable) GetCrcString() string { return "6b16a45e" } +func (*VxlanGpeIoamDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VxlanGpeIoamDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 2 // m.ID + return size +} +func (m *VxlanGpeIoamDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint16(uint16(m.ID)) + return buf.Bytes(), nil +} +func (m *VxlanGpeIoamDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ID = buf.DecodeUint16() + return nil +} + +// VxlanGpeIoamDisableReply defines message 'vxlan_gpe_ioam_disable_reply'. +type VxlanGpeIoamDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *VxlanGpeIoamDisableReply) Reset() { *m = VxlanGpeIoamDisableReply{} } +func (*VxlanGpeIoamDisableReply) GetMessageName() string { return "vxlan_gpe_ioam_disable_reply" } +func (*VxlanGpeIoamDisableReply) GetCrcString() string { return "e8d4e804" } +func (*VxlanGpeIoamDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VxlanGpeIoamDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *VxlanGpeIoamDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *VxlanGpeIoamDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// VxlanGpeIoamEnable defines message 'vxlan_gpe_ioam_enable'. +type VxlanGpeIoamEnable struct { + ID uint16 `binapi:"u16,name=id" json:"id,omitempty"` + TracePpc uint8 `binapi:"u8,name=trace_ppc" json:"trace_ppc,omitempty"` + PowEnable bool `binapi:"bool,name=pow_enable" json:"pow_enable,omitempty"` + TraceEnable bool `binapi:"bool,name=trace_enable" json:"trace_enable,omitempty"` +} + +func (m *VxlanGpeIoamEnable) Reset() { *m = VxlanGpeIoamEnable{} } +func (*VxlanGpeIoamEnable) GetMessageName() string { return "vxlan_gpe_ioam_enable" } +func (*VxlanGpeIoamEnable) GetCrcString() string { return "2481bef7" } +func (*VxlanGpeIoamEnable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VxlanGpeIoamEnable) Size() int { + if m == nil { + return 0 + } + var size int + size += 2 // m.ID + size += 1 // m.TracePpc + size += 1 // m.PowEnable + size += 1 // m.TraceEnable + return size +} +func (m *VxlanGpeIoamEnable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint16(uint16(m.ID)) + buf.EncodeUint8(uint8(m.TracePpc)) + buf.EncodeBool(m.PowEnable) + buf.EncodeBool(m.TraceEnable) + return buf.Bytes(), nil +} +func (m *VxlanGpeIoamEnable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ID = buf.DecodeUint16() + m.TracePpc = buf.DecodeUint8() + m.PowEnable = buf.DecodeBool() + m.TraceEnable = buf.DecodeBool() + return nil +} + +// VxlanGpeIoamEnableReply defines message 'vxlan_gpe_ioam_enable_reply'. +type VxlanGpeIoamEnableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *VxlanGpeIoamEnableReply) Reset() { *m = VxlanGpeIoamEnableReply{} } +func (*VxlanGpeIoamEnableReply) GetMessageName() string { return "vxlan_gpe_ioam_enable_reply" } +func (*VxlanGpeIoamEnableReply) GetCrcString() string { return "e8d4e804" } +func (*VxlanGpeIoamEnableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VxlanGpeIoamEnableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *VxlanGpeIoamEnableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *VxlanGpeIoamEnableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// VxlanGpeIoamTransitDisable defines message 'vxlan_gpe_ioam_transit_disable'. +type VxlanGpeIoamTransitDisable struct { + OuterFibIndex uint32 `binapi:"u32,name=outer_fib_index" json:"outer_fib_index,omitempty"` + DstAddr ip_types.Address `binapi:"address,name=dst_addr" json:"dst_addr,omitempty"` +} + +func (m *VxlanGpeIoamTransitDisable) Reset() { *m = VxlanGpeIoamTransitDisable{} } +func (*VxlanGpeIoamTransitDisable) GetMessageName() string { return "vxlan_gpe_ioam_transit_disable" } +func (*VxlanGpeIoamTransitDisable) GetCrcString() string { return "553f5b7b" } +func (*VxlanGpeIoamTransitDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VxlanGpeIoamTransitDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.OuterFibIndex + size += 1 // m.DstAddr.Af + size += 1 * 16 // m.DstAddr.Un + return size +} +func (m *VxlanGpeIoamTransitDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.OuterFibIndex)) + buf.EncodeUint8(uint8(m.DstAddr.Af)) + buf.EncodeBytes(m.DstAddr.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *VxlanGpeIoamTransitDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.OuterFibIndex = buf.DecodeUint32() + m.DstAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.DstAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// VxlanGpeIoamTransitDisableReply defines message 'vxlan_gpe_ioam_transit_disable_reply'. +type VxlanGpeIoamTransitDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *VxlanGpeIoamTransitDisableReply) Reset() { *m = VxlanGpeIoamTransitDisableReply{} } +func (*VxlanGpeIoamTransitDisableReply) GetMessageName() string { + return "vxlan_gpe_ioam_transit_disable_reply" +} +func (*VxlanGpeIoamTransitDisableReply) GetCrcString() string { return "e8d4e804" } +func (*VxlanGpeIoamTransitDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VxlanGpeIoamTransitDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *VxlanGpeIoamTransitDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *VxlanGpeIoamTransitDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// VxlanGpeIoamTransitEnable defines message 'vxlan_gpe_ioam_transit_enable'. +type VxlanGpeIoamTransitEnable struct { + OuterFibIndex uint32 `binapi:"u32,name=outer_fib_index" json:"outer_fib_index,omitempty"` + DstAddr ip_types.Address `binapi:"address,name=dst_addr" json:"dst_addr,omitempty"` +} + +func (m *VxlanGpeIoamTransitEnable) Reset() { *m = VxlanGpeIoamTransitEnable{} } +func (*VxlanGpeIoamTransitEnable) GetMessageName() string { return "vxlan_gpe_ioam_transit_enable" } +func (*VxlanGpeIoamTransitEnable) GetCrcString() string { return "553f5b7b" } +func (*VxlanGpeIoamTransitEnable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VxlanGpeIoamTransitEnable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.OuterFibIndex + size += 1 // m.DstAddr.Af + size += 1 * 16 // m.DstAddr.Un + return size +} +func (m *VxlanGpeIoamTransitEnable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.OuterFibIndex)) + buf.EncodeUint8(uint8(m.DstAddr.Af)) + buf.EncodeBytes(m.DstAddr.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *VxlanGpeIoamTransitEnable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.OuterFibIndex = buf.DecodeUint32() + m.DstAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.DstAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// VxlanGpeIoamTransitEnableReply defines message 'vxlan_gpe_ioam_transit_enable_reply'. +type VxlanGpeIoamTransitEnableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *VxlanGpeIoamTransitEnableReply) Reset() { *m = VxlanGpeIoamTransitEnableReply{} } +func (*VxlanGpeIoamTransitEnableReply) GetMessageName() string { + return "vxlan_gpe_ioam_transit_enable_reply" +} +func (*VxlanGpeIoamTransitEnableReply) GetCrcString() string { return "e8d4e804" } +func (*VxlanGpeIoamTransitEnableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VxlanGpeIoamTransitEnableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *VxlanGpeIoamTransitEnableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *VxlanGpeIoamTransitEnableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// VxlanGpeIoamVniDisable defines message 'vxlan_gpe_ioam_vni_disable'. +type VxlanGpeIoamVniDisable struct { + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + Local ip_types.Address `binapi:"address,name=local" json:"local,omitempty"` + Remote ip_types.Address `binapi:"address,name=remote" json:"remote,omitempty"` +} + +func (m *VxlanGpeIoamVniDisable) Reset() { *m = VxlanGpeIoamVniDisable{} } +func (*VxlanGpeIoamVniDisable) GetMessageName() string { return "vxlan_gpe_ioam_vni_disable" } +func (*VxlanGpeIoamVniDisable) GetCrcString() string { return "997161fb" } +func (*VxlanGpeIoamVniDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VxlanGpeIoamVniDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Vni + size += 1 // m.Local.Af + size += 1 * 16 // m.Local.Un + size += 1 // m.Remote.Af + size += 1 * 16 // m.Remote.Un + return size +} +func (m *VxlanGpeIoamVniDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Vni)) + buf.EncodeUint8(uint8(m.Local.Af)) + buf.EncodeBytes(m.Local.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Remote.Af)) + buf.EncodeBytes(m.Remote.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *VxlanGpeIoamVniDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Vni = buf.DecodeUint32() + m.Local.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Local.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Remote.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Remote.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// VxlanGpeIoamVniDisableReply defines message 'vxlan_gpe_ioam_vni_disable_reply'. +type VxlanGpeIoamVniDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *VxlanGpeIoamVniDisableReply) Reset() { *m = VxlanGpeIoamVniDisableReply{} } +func (*VxlanGpeIoamVniDisableReply) GetMessageName() string { + return "vxlan_gpe_ioam_vni_disable_reply" +} +func (*VxlanGpeIoamVniDisableReply) GetCrcString() string { return "e8d4e804" } +func (*VxlanGpeIoamVniDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VxlanGpeIoamVniDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *VxlanGpeIoamVniDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *VxlanGpeIoamVniDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// VxlanGpeIoamVniEnable defines message 'vxlan_gpe_ioam_vni_enable'. +type VxlanGpeIoamVniEnable struct { + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + Local ip_types.Address `binapi:"address,name=local" json:"local,omitempty"` + Remote ip_types.Address `binapi:"address,name=remote" json:"remote,omitempty"` +} + +func (m *VxlanGpeIoamVniEnable) Reset() { *m = VxlanGpeIoamVniEnable{} } +func (*VxlanGpeIoamVniEnable) GetMessageName() string { return "vxlan_gpe_ioam_vni_enable" } +func (*VxlanGpeIoamVniEnable) GetCrcString() string { return "997161fb" } +func (*VxlanGpeIoamVniEnable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VxlanGpeIoamVniEnable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Vni + size += 1 // m.Local.Af + size += 1 * 16 // m.Local.Un + size += 1 // m.Remote.Af + size += 1 * 16 // m.Remote.Un + return size +} +func (m *VxlanGpeIoamVniEnable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Vni)) + buf.EncodeUint8(uint8(m.Local.Af)) + buf.EncodeBytes(m.Local.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Remote.Af)) + buf.EncodeBytes(m.Remote.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *VxlanGpeIoamVniEnable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Vni = buf.DecodeUint32() + m.Local.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Local.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Remote.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Remote.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// VxlanGpeIoamVniEnableReply defines message 'vxlan_gpe_ioam_vni_enable_reply'. +type VxlanGpeIoamVniEnableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *VxlanGpeIoamVniEnableReply) Reset() { *m = VxlanGpeIoamVniEnableReply{} } +func (*VxlanGpeIoamVniEnableReply) GetMessageName() string { return "vxlan_gpe_ioam_vni_enable_reply" } +func (*VxlanGpeIoamVniEnableReply) GetCrcString() string { return "e8d4e804" } +func (*VxlanGpeIoamVniEnableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VxlanGpeIoamVniEnableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *VxlanGpeIoamVniEnableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *VxlanGpeIoamVniEnableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_ioam_vxlan_gpe_binapi_init() } +func file_ioam_vxlan_gpe_binapi_init() { + api.RegisterMessage((*VxlanGpeIoamDisable)(nil), "vxlan_gpe_ioam_disable_6b16a45e") + api.RegisterMessage((*VxlanGpeIoamDisableReply)(nil), "vxlan_gpe_ioam_disable_reply_e8d4e804") + api.RegisterMessage((*VxlanGpeIoamEnable)(nil), "vxlan_gpe_ioam_enable_2481bef7") + api.RegisterMessage((*VxlanGpeIoamEnableReply)(nil), "vxlan_gpe_ioam_enable_reply_e8d4e804") + api.RegisterMessage((*VxlanGpeIoamTransitDisable)(nil), "vxlan_gpe_ioam_transit_disable_553f5b7b") + api.RegisterMessage((*VxlanGpeIoamTransitDisableReply)(nil), "vxlan_gpe_ioam_transit_disable_reply_e8d4e804") + api.RegisterMessage((*VxlanGpeIoamTransitEnable)(nil), "vxlan_gpe_ioam_transit_enable_553f5b7b") + api.RegisterMessage((*VxlanGpeIoamTransitEnableReply)(nil), "vxlan_gpe_ioam_transit_enable_reply_e8d4e804") + api.RegisterMessage((*VxlanGpeIoamVniDisable)(nil), "vxlan_gpe_ioam_vni_disable_997161fb") + api.RegisterMessage((*VxlanGpeIoamVniDisableReply)(nil), "vxlan_gpe_ioam_vni_disable_reply_e8d4e804") + api.RegisterMessage((*VxlanGpeIoamVniEnable)(nil), "vxlan_gpe_ioam_vni_enable_997161fb") + api.RegisterMessage((*VxlanGpeIoamVniEnableReply)(nil), "vxlan_gpe_ioam_vni_enable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*VxlanGpeIoamDisable)(nil), + (*VxlanGpeIoamDisableReply)(nil), + (*VxlanGpeIoamEnable)(nil), + (*VxlanGpeIoamEnableReply)(nil), + (*VxlanGpeIoamTransitDisable)(nil), + (*VxlanGpeIoamTransitDisableReply)(nil), + (*VxlanGpeIoamTransitEnable)(nil), + (*VxlanGpeIoamTransitEnableReply)(nil), + (*VxlanGpeIoamVniDisable)(nil), + (*VxlanGpeIoamVniDisableReply)(nil), + (*VxlanGpeIoamVniEnable)(nil), + (*VxlanGpeIoamVniEnableReply)(nil), + } +} diff --git a/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rest.ba.go b/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rest.ba.go new file mode 100644 index 0000000..bc34d36 --- /dev/null +++ b/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rest.ba.go @@ -0,0 +1,152 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ioam_vxlan_gpe + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/vxlan_gpe_ioam_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(VxlanGpeIoamDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.VxlanGpeIoamDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/vxlan_gpe_ioam_enable", func(w http.ResponseWriter, req *http.Request) { + var request = new(VxlanGpeIoamEnable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.VxlanGpeIoamEnable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/vxlan_gpe_ioam_transit_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(VxlanGpeIoamTransitDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.VxlanGpeIoamTransitDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/vxlan_gpe_ioam_transit_enable", func(w http.ResponseWriter, req *http.Request) { + var request = new(VxlanGpeIoamTransitEnable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.VxlanGpeIoamTransitEnable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/vxlan_gpe_ioam_vni_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(VxlanGpeIoamVniDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.VxlanGpeIoamVniDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/vxlan_gpe_ioam_vni_enable", func(w http.ResponseWriter, req *http.Request) { + var request = new(VxlanGpeIoamVniEnable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.VxlanGpeIoamVniEnable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rpc.ba.go b/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rpc.ba.go new file mode 100644 index 0000000..e06b33a --- /dev/null +++ b/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rpc.ba.go @@ -0,0 +1,80 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ioam_vxlan_gpe + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service ioam_vxlan_gpe. +type RPCService interface { + VxlanGpeIoamDisable(ctx context.Context, in *VxlanGpeIoamDisable) (*VxlanGpeIoamDisableReply, error) + VxlanGpeIoamEnable(ctx context.Context, in *VxlanGpeIoamEnable) (*VxlanGpeIoamEnableReply, error) + VxlanGpeIoamTransitDisable(ctx context.Context, in *VxlanGpeIoamTransitDisable) (*VxlanGpeIoamTransitDisableReply, error) + VxlanGpeIoamTransitEnable(ctx context.Context, in *VxlanGpeIoamTransitEnable) (*VxlanGpeIoamTransitEnableReply, error) + VxlanGpeIoamVniDisable(ctx context.Context, in *VxlanGpeIoamVniDisable) (*VxlanGpeIoamVniDisableReply, error) + VxlanGpeIoamVniEnable(ctx context.Context, in *VxlanGpeIoamVniEnable) (*VxlanGpeIoamVniEnableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) VxlanGpeIoamDisable(ctx context.Context, in *VxlanGpeIoamDisable) (*VxlanGpeIoamDisableReply, error) { + out := new(VxlanGpeIoamDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VxlanGpeIoamEnable(ctx context.Context, in *VxlanGpeIoamEnable) (*VxlanGpeIoamEnableReply, error) { + out := new(VxlanGpeIoamEnableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VxlanGpeIoamTransitDisable(ctx context.Context, in *VxlanGpeIoamTransitDisable) (*VxlanGpeIoamTransitDisableReply, error) { + out := new(VxlanGpeIoamTransitDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VxlanGpeIoamTransitEnable(ctx context.Context, in *VxlanGpeIoamTransitEnable) (*VxlanGpeIoamTransitEnableReply, error) { + out := new(VxlanGpeIoamTransitEnableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VxlanGpeIoamVniDisable(ctx context.Context, in *VxlanGpeIoamVniDisable) (*VxlanGpeIoamVniDisableReply, error) { + out := new(VxlanGpeIoamVniDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VxlanGpeIoamVniEnable(ctx context.Context, in *VxlanGpeIoamVniEnable) (*VxlanGpeIoamVniEnableReply, error) { + out := new(VxlanGpeIoamVniEnableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/ip/ip.ba.go b/binapi/ip/ip.ba.go new file mode 100644 index 0000000..7702c92 --- /dev/null +++ b/binapi/ip/ip.ba.go @@ -0,0 +1,3269 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/ip.api.json + +// Package ip contains generated bindings for API file ip.api. +// +// Contents: +// 1 enum +// 4 structs +// 60 messages +// +package ip + +import ( + api "git.fd.io/govpp.git/api" + _ "git.fd.io/govpp.git/binapi/ethernet_types" + fib_types "git.fd.io/govpp.git/binapi/fib_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + mfib_types "git.fd.io/govpp.git/binapi/mfib_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "ip" + APIVersion = "3.0.1" + VersionCrc = 0x765d74b1 +) + +// IPReassType defines enum 'ip_reass_type'. +type IPReassType uint32 + +const ( + IP_REASS_TYPE_FULL IPReassType = 0 + IP_REASS_TYPE_SHALLOW_VIRTUAL IPReassType = 1 +) + +var ( + IPReassType_name = map[uint32]string{ + 0: "IP_REASS_TYPE_FULL", + 1: "IP_REASS_TYPE_SHALLOW_VIRTUAL", + } + IPReassType_value = map[string]uint32{ + "IP_REASS_TYPE_FULL": 0, + "IP_REASS_TYPE_SHALLOW_VIRTUAL": 1, + } +) + +func (x IPReassType) String() string { + s, ok := IPReassType_name[uint32(x)] + if ok { + return s + } + return "IPReassType(" + strconv.Itoa(int(x)) + ")" +} + +// IPMroute defines type 'ip_mroute'. +type IPMroute struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + EntryFlags uint32 `binapi:"u32,name=entry_flags" json:"entry_flags,omitempty"` + RpfID uint32 `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"` + Prefix ip_types.Mprefix `binapi:"mprefix,name=prefix" json:"prefix,omitempty"` + NPaths uint8 `binapi:"u8,name=n_paths" json:"-"` + Paths []mfib_types.MfibPath `binapi:"mfib_path[n_paths],name=paths" json:"paths,omitempty"` +} + +// IPRoute defines type 'ip_route'. +type IPRoute struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` + Prefix ip_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + NPaths uint8 `binapi:"u8,name=n_paths" json:"-"` + Paths []fib_types.FibPath `binapi:"fib_path[n_paths],name=paths" json:"paths,omitempty"` +} + +// IPTable defines type 'ip_table'. +type IPTable struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty"` +} + +// PuntRedirect defines type 'punt_redirect'. +type PuntRedirect struct { + RxSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=rx_sw_if_index" json:"rx_sw_if_index,omitempty"` + TxSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=tx_sw_if_index" json:"tx_sw_if_index,omitempty"` + Nh ip_types.Address `binapi:"address,name=nh" json:"nh,omitempty"` +} + +// IoamDisable defines message 'ioam_disable'. +type IoamDisable struct { + ID uint16 `binapi:"u16,name=id" json:"id,omitempty"` +} + +func (m *IoamDisable) Reset() { *m = IoamDisable{} } +func (*IoamDisable) GetMessageName() string { return "ioam_disable" } +func (*IoamDisable) GetCrcString() string { return "6b16a45e" } +func (*IoamDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IoamDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 2 // m.ID + return size +} +func (m *IoamDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint16(uint16(m.ID)) + return buf.Bytes(), nil +} +func (m *IoamDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ID = buf.DecodeUint16() + return nil +} + +// IoamDisableReply defines message 'ioam_disable_reply'. +type IoamDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IoamDisableReply) Reset() { *m = IoamDisableReply{} } +func (*IoamDisableReply) GetMessageName() string { return "ioam_disable_reply" } +func (*IoamDisableReply) GetCrcString() string { return "e8d4e804" } +func (*IoamDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IoamDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IoamDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IoamDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IoamEnable defines message 'ioam_enable'. +type IoamEnable struct { + ID uint16 `binapi:"u16,name=id" json:"id,omitempty"` + Seqno bool `binapi:"bool,name=seqno" json:"seqno,omitempty"` + Analyse bool `binapi:"bool,name=analyse" json:"analyse,omitempty"` + PotEnable bool `binapi:"bool,name=pot_enable" json:"pot_enable,omitempty"` + TraceEnable bool `binapi:"bool,name=trace_enable" json:"trace_enable,omitempty"` + NodeID uint32 `binapi:"u32,name=node_id" json:"node_id,omitempty"` +} + +func (m *IoamEnable) Reset() { *m = IoamEnable{} } +func (*IoamEnable) GetMessageName() string { return "ioam_enable" } +func (*IoamEnable) GetCrcString() string { return "51ccd868" } +func (*IoamEnable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IoamEnable) Size() int { + if m == nil { + return 0 + } + var size int + size += 2 // m.ID + size += 1 // m.Seqno + size += 1 // m.Analyse + size += 1 // m.PotEnable + size += 1 // m.TraceEnable + size += 4 // m.NodeID + return size +} +func (m *IoamEnable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint16(uint16(m.ID)) + buf.EncodeBool(m.Seqno) + buf.EncodeBool(m.Analyse) + buf.EncodeBool(m.PotEnable) + buf.EncodeBool(m.TraceEnable) + buf.EncodeUint32(uint32(m.NodeID)) + return buf.Bytes(), nil +} +func (m *IoamEnable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ID = buf.DecodeUint16() + m.Seqno = buf.DecodeBool() + m.Analyse = buf.DecodeBool() + m.PotEnable = buf.DecodeBool() + m.TraceEnable = buf.DecodeBool() + m.NodeID = buf.DecodeUint32() + return nil +} + +// IoamEnableReply defines message 'ioam_enable_reply'. +type IoamEnableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IoamEnableReply) Reset() { *m = IoamEnableReply{} } +func (*IoamEnableReply) GetMessageName() string { return "ioam_enable_reply" } +func (*IoamEnableReply) GetCrcString() string { return "e8d4e804" } +func (*IoamEnableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IoamEnableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IoamEnableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IoamEnableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IPAddressDetails defines message 'ip_address_details'. +type IPAddressDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Prefix ip_types.AddressWithPrefix `binapi:"address_with_prefix,name=prefix" json:"prefix,omitempty"` +} + +func (m *IPAddressDetails) Reset() { *m = IPAddressDetails{} } +func (*IPAddressDetails) GetMessageName() string { return "ip_address_details" } +func (*IPAddressDetails) GetCrcString() string { return "b1199745" } +func (*IPAddressDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPAddressDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Prefix.Address.Af + size += 1 * 16 // m.Prefix.Address.Un + size += 1 // m.Prefix.Len + return size +} +func (m *IPAddressDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.Prefix.Address.Af)) + buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Prefix.Len)) + return buf.Bytes(), nil +} +func (m *IPAddressDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Prefix.Len = buf.DecodeUint8() + return nil +} + +// IPAddressDump defines message 'ip_address_dump'. +type IPAddressDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` +} + +func (m *IPAddressDump) Reset() { *m = IPAddressDump{} } +func (*IPAddressDump) GetMessageName() string { return "ip_address_dump" } +func (*IPAddressDump) GetCrcString() string { return "2d033de4" } +func (*IPAddressDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPAddressDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.IsIPv6 + return size +} +func (m *IPAddressDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsIPv6) + return buf.Bytes(), nil +} +func (m *IPAddressDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsIPv6 = buf.DecodeBool() + return nil +} + +// IPContainerProxyAddDel defines message 'ip_container_proxy_add_del'. +type IPContainerProxyAddDel struct { + Pfx ip_types.Prefix `binapi:"prefix,name=pfx" json:"pfx,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` +} + +func (m *IPContainerProxyAddDel) Reset() { *m = IPContainerProxyAddDel{} } +func (*IPContainerProxyAddDel) GetMessageName() string { return "ip_container_proxy_add_del" } +func (*IPContainerProxyAddDel) GetCrcString() string { return "91189f40" } +func (*IPContainerProxyAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPContainerProxyAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Pfx.Address.Af + size += 1 * 16 // m.Pfx.Address.Un + size += 1 // m.Pfx.Len + size += 4 // m.SwIfIndex + size += 1 // m.IsAdd + return size +} +func (m *IPContainerProxyAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Pfx.Address.Af)) + buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Pfx.Len)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *IPContainerProxyAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Pfx.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Pfx.Len = buf.DecodeUint8() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsAdd = buf.DecodeBool() + return nil +} + +// IPContainerProxyAddDelReply defines message 'ip_container_proxy_add_del_reply'. +type IPContainerProxyAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPContainerProxyAddDelReply) Reset() { *m = IPContainerProxyAddDelReply{} } +func (*IPContainerProxyAddDelReply) GetMessageName() string { + return "ip_container_proxy_add_del_reply" +} +func (*IPContainerProxyAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*IPContainerProxyAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPContainerProxyAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IPContainerProxyAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IPContainerProxyAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IPContainerProxyDetails defines message 'ip_container_proxy_details'. +type IPContainerProxyDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Prefix ip_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` +} + +func (m *IPContainerProxyDetails) Reset() { *m = IPContainerProxyDetails{} } +func (*IPContainerProxyDetails) GetMessageName() string { return "ip_container_proxy_details" } +func (*IPContainerProxyDetails) GetCrcString() string { return "0ee460e8" } +func (*IPContainerProxyDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPContainerProxyDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Prefix.Address.Af + size += 1 * 16 // m.Prefix.Address.Un + size += 1 // m.Prefix.Len + return size +} +func (m *IPContainerProxyDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.Prefix.Address.Af)) + buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Prefix.Len)) + return buf.Bytes(), nil +} +func (m *IPContainerProxyDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Prefix.Len = buf.DecodeUint8() + return nil +} + +// IPContainerProxyDump defines message 'ip_container_proxy_dump'. +type IPContainerProxyDump struct{} + +func (m *IPContainerProxyDump) Reset() { *m = IPContainerProxyDump{} } +func (*IPContainerProxyDump) GetMessageName() string { return "ip_container_proxy_dump" } +func (*IPContainerProxyDump) GetCrcString() string { return "51077d14" } +func (*IPContainerProxyDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPContainerProxyDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *IPContainerProxyDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *IPContainerProxyDump) Unmarshal(b []byte) error { + return nil +} + +// IPDetails defines message 'ip_details'. +type IPDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` +} + +func (m *IPDetails) Reset() { *m = IPDetails{} } +func (*IPDetails) GetMessageName() string { return "ip_details" } +func (*IPDetails) GetCrcString() string { return "eb152d07" } +func (*IPDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.IsIPv6 + return size +} +func (m *IPDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsIPv6) + return buf.Bytes(), nil +} +func (m *IPDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsIPv6 = buf.DecodeBool() + return nil +} + +// IPDump defines message 'ip_dump'. +type IPDump struct { + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` +} + +func (m *IPDump) Reset() { *m = IPDump{} } +func (*IPDump) GetMessageName() string { return "ip_dump" } +func (*IPDump) GetCrcString() string { return "98d231ca" } +func (*IPDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsIPv6 + return size +} +func (m *IPDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsIPv6) + return buf.Bytes(), nil +} +func (m *IPDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsIPv6 = buf.DecodeBool() + return nil +} + +// IPMrouteAddDel defines message 'ip_mroute_add_del'. +type IPMrouteAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IsMultipath bool `binapi:"bool,name=is_multipath" json:"is_multipath,omitempty"` + Route IPMroute `binapi:"ip_mroute,name=route" json:"route,omitempty"` +} + +func (m *IPMrouteAddDel) Reset() { *m = IPMrouteAddDel{} } +func (*IPMrouteAddDel) GetMessageName() string { return "ip_mroute_add_del" } +func (*IPMrouteAddDel) GetCrcString() string { return "f6627d17" } +func (*IPMrouteAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPMrouteAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.IsMultipath + size += 4 // m.Route.TableID + size += 4 // m.Route.EntryFlags + size += 4 // m.Route.RpfID + size += 1 // m.Route.Prefix.Af + size += 2 // m.Route.Prefix.GrpAddressLength + size += 1 * 16 // m.Route.Prefix.GrpAddress + size += 1 * 16 // m.Route.Prefix.SrcAddress + size += 1 // m.Route.NPaths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var s2 mfib_types.MfibPath + _ = s2 + if j2 < len(m.Route.Paths) { + s2 = m.Route.Paths[j2] + } + size += 4 // s2.ItfFlags + size += 4 // s2.Path.SwIfIndex + size += 4 // s2.Path.TableID + size += 4 // s2.Path.RpfID + size += 1 // s2.Path.Weight + size += 1 // s2.Path.Preference + size += 4 // s2.Path.Type + size += 4 // s2.Path.Flags + size += 4 // s2.Path.Proto + size += 1 * 16 // s2.Path.Nh.Address + size += 4 // s2.Path.Nh.ViaLabel + size += 4 // s2.Path.Nh.ObjID + size += 4 // s2.Path.Nh.ClassifyTableIndex + size += 1 // s2.Path.NLabels + for j4 := 0; j4 < 16; j4++ { + var s4 fib_types.FibMplsLabel + _ = s4 + if j4 < len(s2.Path.LabelStack) { + s4 = s2.Path.LabelStack[j4] + } + size += 1 // s4.IsUniform + size += 4 // s4.Label + size += 1 // s4.TTL + size += 1 // s4.Exp + } + } + return size +} +func (m *IPMrouteAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeBool(m.IsMultipath) + buf.EncodeUint32(uint32(m.Route.TableID)) + buf.EncodeUint32(uint32(m.Route.EntryFlags)) + buf.EncodeUint32(uint32(m.Route.RpfID)) + buf.EncodeUint8(uint8(m.Route.Prefix.Af)) + buf.EncodeUint16(uint16(m.Route.Prefix.GrpAddressLength)) + buf.EncodeBytes(m.Route.Prefix.GrpAddress.XXX_UnionData[:], 0) + buf.EncodeBytes(m.Route.Prefix.SrcAddress.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(len(m.Route.Paths))) + for j1 := 0; j1 < len(m.Route.Paths); j1++ { + var v1 mfib_types.MfibPath + if j1 < len(m.Route.Paths) { + v1 = m.Route.Paths[j1] + } + buf.EncodeUint32(uint32(v1.ItfFlags)) + buf.EncodeUint32(uint32(v1.Path.SwIfIndex)) + buf.EncodeUint32(uint32(v1.Path.TableID)) + buf.EncodeUint32(uint32(v1.Path.RpfID)) + buf.EncodeUint8(uint8(v1.Path.Weight)) + buf.EncodeUint8(uint8(v1.Path.Preference)) + buf.EncodeUint32(uint32(v1.Path.Type)) + buf.EncodeUint32(uint32(v1.Path.Flags)) + buf.EncodeUint32(uint32(v1.Path.Proto)) + buf.EncodeBytes(v1.Path.Nh.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v1.Path.Nh.ViaLabel)) + buf.EncodeUint32(uint32(v1.Path.Nh.ObjID)) + buf.EncodeUint32(uint32(v1.Path.Nh.ClassifyTableIndex)) + buf.EncodeUint8(uint8(v1.Path.NLabels)) + for j3 := 0; j3 < 16; j3++ { + var v3 fib_types.FibMplsLabel + if j3 < len(v1.Path.LabelStack) { + v3 = v1.Path.LabelStack[j3] + } + buf.EncodeUint8(uint8(v3.IsUniform)) + buf.EncodeUint32(uint32(v3.Label)) + buf.EncodeUint8(uint8(v3.TTL)) + buf.EncodeUint8(uint8(v3.Exp)) + } + } + return buf.Bytes(), nil +} +func (m *IPMrouteAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.IsMultipath = buf.DecodeBool() + m.Route.TableID = buf.DecodeUint32() + m.Route.EntryFlags = buf.DecodeUint32() + m.Route.RpfID = buf.DecodeUint32() + m.Route.Prefix.Af = ip_types.AddressFamily(buf.DecodeUint8()) + m.Route.Prefix.GrpAddressLength = buf.DecodeUint16() + copy(m.Route.Prefix.GrpAddress.XXX_UnionData[:], buf.DecodeBytes(16)) + copy(m.Route.Prefix.SrcAddress.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Route.NPaths = buf.DecodeUint8() + m.Route.Paths = make([]mfib_types.MfibPath, int(m.Route.NPaths)) + for j1 := 0; j1 < len(m.Route.Paths); j1++ { + m.Route.Paths[j1].ItfFlags = mfib_types.MfibItfFlags(buf.DecodeUint32()) + m.Route.Paths[j1].Path.SwIfIndex = buf.DecodeUint32() + m.Route.Paths[j1].Path.TableID = buf.DecodeUint32() + m.Route.Paths[j1].Path.RpfID = buf.DecodeUint32() + m.Route.Paths[j1].Path.Weight = buf.DecodeUint8() + m.Route.Paths[j1].Path.Preference = buf.DecodeUint8() + m.Route.Paths[j1].Path.Type = fib_types.FibPathType(buf.DecodeUint32()) + m.Route.Paths[j1].Path.Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.Route.Paths[j1].Path.Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.Route.Paths[j1].Path.Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Route.Paths[j1].Path.Nh.ViaLabel = buf.DecodeUint32() + m.Route.Paths[j1].Path.Nh.ObjID = buf.DecodeUint32() + m.Route.Paths[j1].Path.Nh.ClassifyTableIndex = buf.DecodeUint32() + m.Route.Paths[j1].Path.NLabels = buf.DecodeUint8() + for j3 := 0; j3 < 16; j3++ { + m.Route.Paths[j1].Path.LabelStack[j3].IsUniform = buf.DecodeUint8() + m.Route.Paths[j1].Path.LabelStack[j3].Label = buf.DecodeUint32() + m.Route.Paths[j1].Path.LabelStack[j3].TTL = buf.DecodeUint8() + m.Route.Paths[j1].Path.LabelStack[j3].Exp = buf.DecodeUint8() + } + } + return nil +} + +// IPMrouteAddDelReply defines message 'ip_mroute_add_del_reply'. +type IPMrouteAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` +} + +func (m *IPMrouteAddDelReply) Reset() { *m = IPMrouteAddDelReply{} } +func (*IPMrouteAddDelReply) GetMessageName() string { return "ip_mroute_add_del_reply" } +func (*IPMrouteAddDelReply) GetCrcString() string { return "1992deab" } +func (*IPMrouteAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPMrouteAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.StatsIndex + return size +} +func (m *IPMrouteAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.StatsIndex)) + return buf.Bytes(), nil +} +func (m *IPMrouteAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.StatsIndex = buf.DecodeUint32() + return nil +} + +// IPMrouteDetails defines message 'ip_mroute_details'. +type IPMrouteDetails struct { + Route IPMroute `binapi:"ip_mroute,name=route" json:"route,omitempty"` +} + +func (m *IPMrouteDetails) Reset() { *m = IPMrouteDetails{} } +func (*IPMrouteDetails) GetMessageName() string { return "ip_mroute_details" } +func (*IPMrouteDetails) GetCrcString() string { return "c1cb4b44" } +func (*IPMrouteDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPMrouteDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Route.TableID + size += 4 // m.Route.EntryFlags + size += 4 // m.Route.RpfID + size += 1 // m.Route.Prefix.Af + size += 2 // m.Route.Prefix.GrpAddressLength + size += 1 * 16 // m.Route.Prefix.GrpAddress + size += 1 * 16 // m.Route.Prefix.SrcAddress + size += 1 // m.Route.NPaths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var s2 mfib_types.MfibPath + _ = s2 + if j2 < len(m.Route.Paths) { + s2 = m.Route.Paths[j2] + } + size += 4 // s2.ItfFlags + size += 4 // s2.Path.SwIfIndex + size += 4 // s2.Path.TableID + size += 4 // s2.Path.RpfID + size += 1 // s2.Path.Weight + size += 1 // s2.Path.Preference + size += 4 // s2.Path.Type + size += 4 // s2.Path.Flags + size += 4 // s2.Path.Proto + size += 1 * 16 // s2.Path.Nh.Address + size += 4 // s2.Path.Nh.ViaLabel + size += 4 // s2.Path.Nh.ObjID + size += 4 // s2.Path.Nh.ClassifyTableIndex + size += 1 // s2.Path.NLabels + for j4 := 0; j4 < 16; j4++ { + var s4 fib_types.FibMplsLabel + _ = s4 + if j4 < len(s2.Path.LabelStack) { + s4 = s2.Path.LabelStack[j4] + } + size += 1 // s4.IsUniform + size += 4 // s4.Label + size += 1 // s4.TTL + size += 1 // s4.Exp + } + } + return size +} +func (m *IPMrouteDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Route.TableID)) + buf.EncodeUint32(uint32(m.Route.EntryFlags)) + buf.EncodeUint32(uint32(m.Route.RpfID)) + buf.EncodeUint8(uint8(m.Route.Prefix.Af)) + buf.EncodeUint16(uint16(m.Route.Prefix.GrpAddressLength)) + buf.EncodeBytes(m.Route.Prefix.GrpAddress.XXX_UnionData[:], 0) + buf.EncodeBytes(m.Route.Prefix.SrcAddress.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(len(m.Route.Paths))) + for j1 := 0; j1 < len(m.Route.Paths); j1++ { + var v1 mfib_types.MfibPath + if j1 < len(m.Route.Paths) { + v1 = m.Route.Paths[j1] + } + buf.EncodeUint32(uint32(v1.ItfFlags)) + buf.EncodeUint32(uint32(v1.Path.SwIfIndex)) + buf.EncodeUint32(uint32(v1.Path.TableID)) + buf.EncodeUint32(uint32(v1.Path.RpfID)) + buf.EncodeUint8(uint8(v1.Path.Weight)) + buf.EncodeUint8(uint8(v1.Path.Preference)) + buf.EncodeUint32(uint32(v1.Path.Type)) + buf.EncodeUint32(uint32(v1.Path.Flags)) + buf.EncodeUint32(uint32(v1.Path.Proto)) + buf.EncodeBytes(v1.Path.Nh.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v1.Path.Nh.ViaLabel)) + buf.EncodeUint32(uint32(v1.Path.Nh.ObjID)) + buf.EncodeUint32(uint32(v1.Path.Nh.ClassifyTableIndex)) + buf.EncodeUint8(uint8(v1.Path.NLabels)) + for j3 := 0; j3 < 16; j3++ { + var v3 fib_types.FibMplsLabel + if j3 < len(v1.Path.LabelStack) { + v3 = v1.Path.LabelStack[j3] + } + buf.EncodeUint8(uint8(v3.IsUniform)) + buf.EncodeUint32(uint32(v3.Label)) + buf.EncodeUint8(uint8(v3.TTL)) + buf.EncodeUint8(uint8(v3.Exp)) + } + } + return buf.Bytes(), nil +} +func (m *IPMrouteDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Route.TableID = buf.DecodeUint32() + m.Route.EntryFlags = buf.DecodeUint32() + m.Route.RpfID = buf.DecodeUint32() + m.Route.Prefix.Af = ip_types.AddressFamily(buf.DecodeUint8()) + m.Route.Prefix.GrpAddressLength = buf.DecodeUint16() + copy(m.Route.Prefix.GrpAddress.XXX_UnionData[:], buf.DecodeBytes(16)) + copy(m.Route.Prefix.SrcAddress.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Route.NPaths = buf.DecodeUint8() + m.Route.Paths = make([]mfib_types.MfibPath, int(m.Route.NPaths)) + for j1 := 0; j1 < len(m.Route.Paths); j1++ { + m.Route.Paths[j1].ItfFlags = mfib_types.MfibItfFlags(buf.DecodeUint32()) + m.Route.Paths[j1].Path.SwIfIndex = buf.DecodeUint32() + m.Route.Paths[j1].Path.TableID = buf.DecodeUint32() + m.Route.Paths[j1].Path.RpfID = buf.DecodeUint32() + m.Route.Paths[j1].Path.Weight = buf.DecodeUint8() + m.Route.Paths[j1].Path.Preference = buf.DecodeUint8() + m.Route.Paths[j1].Path.Type = fib_types.FibPathType(buf.DecodeUint32()) + m.Route.Paths[j1].Path.Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.Route.Paths[j1].Path.Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.Route.Paths[j1].Path.Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Route.Paths[j1].Path.Nh.ViaLabel = buf.DecodeUint32() + m.Route.Paths[j1].Path.Nh.ObjID = buf.DecodeUint32() + m.Route.Paths[j1].Path.Nh.ClassifyTableIndex = buf.DecodeUint32() + m.Route.Paths[j1].Path.NLabels = buf.DecodeUint8() + for j3 := 0; j3 < 16; j3++ { + m.Route.Paths[j1].Path.LabelStack[j3].IsUniform = buf.DecodeUint8() + m.Route.Paths[j1].Path.LabelStack[j3].Label = buf.DecodeUint32() + m.Route.Paths[j1].Path.LabelStack[j3].TTL = buf.DecodeUint8() + m.Route.Paths[j1].Path.LabelStack[j3].Exp = buf.DecodeUint8() + } + } + return nil +} + +// IPMrouteDump defines message 'ip_mroute_dump'. +type IPMrouteDump struct { + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPMrouteDump) Reset() { *m = IPMrouteDump{} } +func (*IPMrouteDump) GetMessageName() string { return "ip_mroute_dump" } +func (*IPMrouteDump) GetCrcString() string { return "b9d2e09e" } +func (*IPMrouteDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPMrouteDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Table.TableID + size += 1 // m.Table.IsIP6 + size += 64 // m.Table.Name + return size +} +func (m *IPMrouteDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Table.TableID)) + buf.EncodeBool(m.Table.IsIP6) + buf.EncodeString(m.Table.Name, 64) + return buf.Bytes(), nil +} +func (m *IPMrouteDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Table.TableID = buf.DecodeUint32() + m.Table.IsIP6 = buf.DecodeBool() + m.Table.Name = buf.DecodeString(64) + return nil +} + +// IPMtableDetails defines message 'ip_mtable_details'. +type IPMtableDetails struct { + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPMtableDetails) Reset() { *m = IPMtableDetails{} } +func (*IPMtableDetails) GetMessageName() string { return "ip_mtable_details" } +func (*IPMtableDetails) GetCrcString() string { return "b9d2e09e" } +func (*IPMtableDetails) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPMtableDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Table.TableID + size += 1 // m.Table.IsIP6 + size += 64 // m.Table.Name + return size +} +func (m *IPMtableDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Table.TableID)) + buf.EncodeBool(m.Table.IsIP6) + buf.EncodeString(m.Table.Name, 64) + return buf.Bytes(), nil +} +func (m *IPMtableDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Table.TableID = buf.DecodeUint32() + m.Table.IsIP6 = buf.DecodeBool() + m.Table.Name = buf.DecodeString(64) + return nil +} + +// IPMtableDump defines message 'ip_mtable_dump'. +type IPMtableDump struct{} + +func (m *IPMtableDump) Reset() { *m = IPMtableDump{} } +func (*IPMtableDump) GetMessageName() string { return "ip_mtable_dump" } +func (*IPMtableDump) GetCrcString() string { return "51077d14" } +func (*IPMtableDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPMtableDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *IPMtableDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *IPMtableDump) Unmarshal(b []byte) error { + return nil +} + +// IPPuntPolice defines message 'ip_punt_police'. +type IPPuntPolice struct { + PolicerIndex uint32 `binapi:"u32,name=policer_index" json:"policer_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` +} + +func (m *IPPuntPolice) Reset() { *m = IPPuntPolice{} } +func (*IPPuntPolice) GetMessageName() string { return "ip_punt_police" } +func (*IPPuntPolice) GetCrcString() string { return "db867cea" } +func (*IPPuntPolice) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPPuntPolice) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.PolicerIndex + size += 1 // m.IsAdd + size += 1 // m.IsIP6 + return size +} +func (m *IPPuntPolice) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.PolicerIndex)) + buf.EncodeBool(m.IsAdd) + buf.EncodeBool(m.IsIP6) + return buf.Bytes(), nil +} +func (m *IPPuntPolice) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PolicerIndex = buf.DecodeUint32() + m.IsAdd = buf.DecodeBool() + m.IsIP6 = buf.DecodeBool() + return nil +} + +// IPPuntPoliceReply defines message 'ip_punt_police_reply'. +type IPPuntPoliceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPPuntPoliceReply) Reset() { *m = IPPuntPoliceReply{} } +func (*IPPuntPoliceReply) GetMessageName() string { return "ip_punt_police_reply" } +func (*IPPuntPoliceReply) GetCrcString() string { return "e8d4e804" } +func (*IPPuntPoliceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPPuntPoliceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IPPuntPoliceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IPPuntPoliceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IPPuntRedirect defines message 'ip_punt_redirect'. +type IPPuntRedirect struct { + Punt PuntRedirect `binapi:"punt_redirect,name=punt" json:"punt,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` +} + +func (m *IPPuntRedirect) Reset() { *m = IPPuntRedirect{} } +func (*IPPuntRedirect) GetMessageName() string { return "ip_punt_redirect" } +func (*IPPuntRedirect) GetCrcString() string { return "a9a5592c" } +func (*IPPuntRedirect) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPPuntRedirect) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Punt.RxSwIfIndex + size += 4 // m.Punt.TxSwIfIndex + size += 1 // m.Punt.Nh.Af + size += 1 * 16 // m.Punt.Nh.Un + size += 1 // m.IsAdd + return size +} +func (m *IPPuntRedirect) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Punt.RxSwIfIndex)) + buf.EncodeUint32(uint32(m.Punt.TxSwIfIndex)) + buf.EncodeUint8(uint8(m.Punt.Nh.Af)) + buf.EncodeBytes(m.Punt.Nh.Un.XXX_UnionData[:], 0) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *IPPuntRedirect) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Punt.RxSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Punt.TxSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Punt.Nh.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Punt.Nh.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.IsAdd = buf.DecodeBool() + return nil +} + +// IPPuntRedirectDetails defines message 'ip_punt_redirect_details'. +type IPPuntRedirectDetails struct { + Punt PuntRedirect `binapi:"punt_redirect,name=punt" json:"punt,omitempty"` +} + +func (m *IPPuntRedirectDetails) Reset() { *m = IPPuntRedirectDetails{} } +func (*IPPuntRedirectDetails) GetMessageName() string { return "ip_punt_redirect_details" } +func (*IPPuntRedirectDetails) GetCrcString() string { return "3924f5d3" } +func (*IPPuntRedirectDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPPuntRedirectDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Punt.RxSwIfIndex + size += 4 // m.Punt.TxSwIfIndex + size += 1 // m.Punt.Nh.Af + size += 1 * 16 // m.Punt.Nh.Un + return size +} +func (m *IPPuntRedirectDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Punt.RxSwIfIndex)) + buf.EncodeUint32(uint32(m.Punt.TxSwIfIndex)) + buf.EncodeUint8(uint8(m.Punt.Nh.Af)) + buf.EncodeBytes(m.Punt.Nh.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *IPPuntRedirectDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Punt.RxSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Punt.TxSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Punt.Nh.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Punt.Nh.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// IPPuntRedirectDump defines message 'ip_punt_redirect_dump'. +type IPPuntRedirectDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` +} + +func (m *IPPuntRedirectDump) Reset() { *m = IPPuntRedirectDump{} } +func (*IPPuntRedirectDump) GetMessageName() string { return "ip_punt_redirect_dump" } +func (*IPPuntRedirectDump) GetCrcString() string { return "2d033de4" } +func (*IPPuntRedirectDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPPuntRedirectDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.IsIPv6 + return size +} +func (m *IPPuntRedirectDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsIPv6) + return buf.Bytes(), nil +} +func (m *IPPuntRedirectDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsIPv6 = buf.DecodeBool() + return nil +} + +// IPPuntRedirectReply defines message 'ip_punt_redirect_reply'. +type IPPuntRedirectReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPPuntRedirectReply) Reset() { *m = IPPuntRedirectReply{} } +func (*IPPuntRedirectReply) GetMessageName() string { return "ip_punt_redirect_reply" } +func (*IPPuntRedirectReply) GetCrcString() string { return "e8d4e804" } +func (*IPPuntRedirectReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPPuntRedirectReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IPPuntRedirectReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IPPuntRedirectReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IPReassemblyEnableDisable defines message 'ip_reassembly_enable_disable'. +type IPReassemblyEnableDisable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + EnableIP4 bool `binapi:"bool,name=enable_ip4" json:"enable_ip4,omitempty"` + EnableIP6 bool `binapi:"bool,name=enable_ip6" json:"enable_ip6,omitempty"` + Type IPReassType `binapi:"ip_reass_type,name=type" json:"type,omitempty"` +} + +func (m *IPReassemblyEnableDisable) Reset() { *m = IPReassemblyEnableDisable{} } +func (*IPReassemblyEnableDisable) GetMessageName() string { return "ip_reassembly_enable_disable" } +func (*IPReassemblyEnableDisable) GetCrcString() string { return "885c85a6" } +func (*IPReassemblyEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPReassemblyEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.EnableIP4 + size += 1 // m.EnableIP6 + size += 4 // m.Type + return size +} +func (m *IPReassemblyEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.EnableIP4) + buf.EncodeBool(m.EnableIP6) + buf.EncodeUint32(uint32(m.Type)) + return buf.Bytes(), nil +} +func (m *IPReassemblyEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.EnableIP4 = buf.DecodeBool() + m.EnableIP6 = buf.DecodeBool() + m.Type = IPReassType(buf.DecodeUint32()) + return nil +} + +// IPReassemblyEnableDisableReply defines message 'ip_reassembly_enable_disable_reply'. +type IPReassemblyEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPReassemblyEnableDisableReply) Reset() { *m = IPReassemblyEnableDisableReply{} } +func (*IPReassemblyEnableDisableReply) GetMessageName() string { + return "ip_reassembly_enable_disable_reply" +} +func (*IPReassemblyEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*IPReassemblyEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPReassemblyEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IPReassemblyEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IPReassemblyEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IPReassemblyGet defines message 'ip_reassembly_get'. +type IPReassemblyGet struct { + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` + Type IPReassType `binapi:"ip_reass_type,name=type" json:"type,omitempty"` +} + +func (m *IPReassemblyGet) Reset() { *m = IPReassemblyGet{} } +func (*IPReassemblyGet) GetMessageName() string { return "ip_reassembly_get" } +func (*IPReassemblyGet) GetCrcString() string { return "ea13ff63" } +func (*IPReassemblyGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPReassemblyGet) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsIP6 + size += 4 // m.Type + return size +} +func (m *IPReassemblyGet) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsIP6) + buf.EncodeUint32(uint32(m.Type)) + return buf.Bytes(), nil +} +func (m *IPReassemblyGet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsIP6 = buf.DecodeBool() + m.Type = IPReassType(buf.DecodeUint32()) + return nil +} + +// IPReassemblyGetReply defines message 'ip_reassembly_get_reply'. +type IPReassemblyGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + TimeoutMs uint32 `binapi:"u32,name=timeout_ms" json:"timeout_ms,omitempty"` + MaxReassemblies uint32 `binapi:"u32,name=max_reassemblies" json:"max_reassemblies,omitempty"` + MaxReassemblyLength uint32 `binapi:"u32,name=max_reassembly_length" json:"max_reassembly_length,omitempty"` + ExpireWalkIntervalMs uint32 `binapi:"u32,name=expire_walk_interval_ms" json:"expire_walk_interval_ms,omitempty"` + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` +} + +func (m *IPReassemblyGetReply) Reset() { *m = IPReassemblyGetReply{} } +func (*IPReassemblyGetReply) GetMessageName() string { return "ip_reassembly_get_reply" } +func (*IPReassemblyGetReply) GetCrcString() string { return "d5eb8d34" } +func (*IPReassemblyGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPReassemblyGetReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.TimeoutMs + size += 4 // m.MaxReassemblies + size += 4 // m.MaxReassemblyLength + size += 4 // m.ExpireWalkIntervalMs + size += 1 // m.IsIP6 + return size +} +func (m *IPReassemblyGetReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.TimeoutMs)) + buf.EncodeUint32(uint32(m.MaxReassemblies)) + buf.EncodeUint32(uint32(m.MaxReassemblyLength)) + buf.EncodeUint32(uint32(m.ExpireWalkIntervalMs)) + buf.EncodeBool(m.IsIP6) + return buf.Bytes(), nil +} +func (m *IPReassemblyGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.TimeoutMs = buf.DecodeUint32() + m.MaxReassemblies = buf.DecodeUint32() + m.MaxReassemblyLength = buf.DecodeUint32() + m.ExpireWalkIntervalMs = buf.DecodeUint32() + m.IsIP6 = buf.DecodeBool() + return nil +} + +// IPReassemblySet defines message 'ip_reassembly_set'. +type IPReassemblySet struct { + TimeoutMs uint32 `binapi:"u32,name=timeout_ms" json:"timeout_ms,omitempty"` + MaxReassemblies uint32 `binapi:"u32,name=max_reassemblies" json:"max_reassemblies,omitempty"` + MaxReassemblyLength uint32 `binapi:"u32,name=max_reassembly_length" json:"max_reassembly_length,omitempty"` + ExpireWalkIntervalMs uint32 `binapi:"u32,name=expire_walk_interval_ms" json:"expire_walk_interval_ms,omitempty"` + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` + Type IPReassType `binapi:"ip_reass_type,name=type" json:"type,omitempty"` +} + +func (m *IPReassemblySet) Reset() { *m = IPReassemblySet{} } +func (*IPReassemblySet) GetMessageName() string { return "ip_reassembly_set" } +func (*IPReassemblySet) GetCrcString() string { return "16467d25" } +func (*IPReassemblySet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPReassemblySet) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.TimeoutMs + size += 4 // m.MaxReassemblies + size += 4 // m.MaxReassemblyLength + size += 4 // m.ExpireWalkIntervalMs + size += 1 // m.IsIP6 + size += 4 // m.Type + return size +} +func (m *IPReassemblySet) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.TimeoutMs)) + buf.EncodeUint32(uint32(m.MaxReassemblies)) + buf.EncodeUint32(uint32(m.MaxReassemblyLength)) + buf.EncodeUint32(uint32(m.ExpireWalkIntervalMs)) + buf.EncodeBool(m.IsIP6) + buf.EncodeUint32(uint32(m.Type)) + return buf.Bytes(), nil +} +func (m *IPReassemblySet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.TimeoutMs = buf.DecodeUint32() + m.MaxReassemblies = buf.DecodeUint32() + m.MaxReassemblyLength = buf.DecodeUint32() + m.ExpireWalkIntervalMs = buf.DecodeUint32() + m.IsIP6 = buf.DecodeBool() + m.Type = IPReassType(buf.DecodeUint32()) + return nil +} + +// IPReassemblySetReply defines message 'ip_reassembly_set_reply'. +type IPReassemblySetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPReassemblySetReply) Reset() { *m = IPReassemblySetReply{} } +func (*IPReassemblySetReply) GetMessageName() string { return "ip_reassembly_set_reply" } +func (*IPReassemblySetReply) GetCrcString() string { return "e8d4e804" } +func (*IPReassemblySetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPReassemblySetReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IPReassemblySetReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IPReassemblySetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IPRouteAddDel defines message 'ip_route_add_del'. +type IPRouteAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IsMultipath bool `binapi:"bool,name=is_multipath" json:"is_multipath,omitempty"` + Route IPRoute `binapi:"ip_route,name=route" json:"route,omitempty"` +} + +func (m *IPRouteAddDel) Reset() { *m = IPRouteAddDel{} } +func (*IPRouteAddDel) GetMessageName() string { return "ip_route_add_del" } +func (*IPRouteAddDel) GetCrcString() string { return "c1ff832d" } +func (*IPRouteAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPRouteAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.IsMultipath + size += 4 // m.Route.TableID + size += 4 // m.Route.StatsIndex + size += 1 // m.Route.Prefix.Address.Af + size += 1 * 16 // m.Route.Prefix.Address.Un + size += 1 // m.Route.Prefix.Len + size += 1 // m.Route.NPaths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var s2 fib_types.FibPath + _ = s2 + if j2 < len(m.Route.Paths) { + s2 = m.Route.Paths[j2] + } + size += 4 // s2.SwIfIndex + size += 4 // s2.TableID + size += 4 // s2.RpfID + size += 1 // s2.Weight + size += 1 // s2.Preference + size += 4 // s2.Type + size += 4 // s2.Flags + size += 4 // s2.Proto + size += 1 * 16 // s2.Nh.Address + size += 4 // s2.Nh.ViaLabel + size += 4 // s2.Nh.ObjID + size += 4 // s2.Nh.ClassifyTableIndex + size += 1 // s2.NLabels + for j3 := 0; j3 < 16; j3++ { + var s3 fib_types.FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + size += 1 // s3.IsUniform + size += 4 // s3.Label + size += 1 // s3.TTL + size += 1 // s3.Exp + } + } + return size +} +func (m *IPRouteAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeBool(m.IsMultipath) + buf.EncodeUint32(uint32(m.Route.TableID)) + buf.EncodeUint32(uint32(m.Route.StatsIndex)) + buf.EncodeUint8(uint8(m.Route.Prefix.Address.Af)) + buf.EncodeBytes(m.Route.Prefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Route.Prefix.Len)) + buf.EncodeUint8(uint8(len(m.Route.Paths))) + for j1 := 0; j1 < len(m.Route.Paths); j1++ { + var v1 fib_types.FibPath + if j1 < len(m.Route.Paths) { + v1 = m.Route.Paths[j1] + } + buf.EncodeUint32(uint32(v1.SwIfIndex)) + buf.EncodeUint32(uint32(v1.TableID)) + buf.EncodeUint32(uint32(v1.RpfID)) + buf.EncodeUint8(uint8(v1.Weight)) + buf.EncodeUint8(uint8(v1.Preference)) + buf.EncodeUint32(uint32(v1.Type)) + buf.EncodeUint32(uint32(v1.Flags)) + buf.EncodeUint32(uint32(v1.Proto)) + buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v1.Nh.ViaLabel)) + buf.EncodeUint32(uint32(v1.Nh.ObjID)) + buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex)) + buf.EncodeUint8(uint8(v1.NLabels)) + for j2 := 0; j2 < 16; j2++ { + var v2 fib_types.FibMplsLabel + if j2 < len(v1.LabelStack) { + v2 = v1.LabelStack[j2] + } + buf.EncodeUint8(uint8(v2.IsUniform)) + buf.EncodeUint32(uint32(v2.Label)) + buf.EncodeUint8(uint8(v2.TTL)) + buf.EncodeUint8(uint8(v2.Exp)) + } + } + return buf.Bytes(), nil +} +func (m *IPRouteAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.IsMultipath = buf.DecodeBool() + m.Route.TableID = buf.DecodeUint32() + m.Route.StatsIndex = buf.DecodeUint32() + m.Route.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Route.Prefix.Len = buf.DecodeUint8() + m.Route.NPaths = buf.DecodeUint8() + m.Route.Paths = make([]fib_types.FibPath, int(m.Route.NPaths)) + for j1 := 0; j1 < len(m.Route.Paths); j1++ { + m.Route.Paths[j1].SwIfIndex = buf.DecodeUint32() + m.Route.Paths[j1].TableID = buf.DecodeUint32() + m.Route.Paths[j1].RpfID = buf.DecodeUint32() + m.Route.Paths[j1].Weight = buf.DecodeUint8() + m.Route.Paths[j1].Preference = buf.DecodeUint8() + m.Route.Paths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.Route.Paths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.Route.Paths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.Route.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Route.Paths[j1].Nh.ViaLabel = buf.DecodeUint32() + m.Route.Paths[j1].Nh.ObjID = buf.DecodeUint32() + m.Route.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.Route.Paths[j1].NLabels = buf.DecodeUint8() + for j2 := 0; j2 < 16; j2++ { + m.Route.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() + m.Route.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32() + m.Route.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8() + m.Route.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8() + } + } + return nil +} + +// IPRouteAddDelReply defines message 'ip_route_add_del_reply'. +type IPRouteAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` +} + +func (m *IPRouteAddDelReply) Reset() { *m = IPRouteAddDelReply{} } +func (*IPRouteAddDelReply) GetMessageName() string { return "ip_route_add_del_reply" } +func (*IPRouteAddDelReply) GetCrcString() string { return "1992deab" } +func (*IPRouteAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPRouteAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.StatsIndex + return size +} +func (m *IPRouteAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.StatsIndex)) + return buf.Bytes(), nil +} +func (m *IPRouteAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.StatsIndex = buf.DecodeUint32() + return nil +} + +// IPRouteDetails defines message 'ip_route_details'. +type IPRouteDetails struct { + Route IPRoute `binapi:"ip_route,name=route" json:"route,omitempty"` +} + +func (m *IPRouteDetails) Reset() { *m = IPRouteDetails{} } +func (*IPRouteDetails) GetMessageName() string { return "ip_route_details" } +func (*IPRouteDetails) GetCrcString() string { return "d1ffaae1" } +func (*IPRouteDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPRouteDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Route.TableID + size += 4 // m.Route.StatsIndex + size += 1 // m.Route.Prefix.Address.Af + size += 1 * 16 // m.Route.Prefix.Address.Un + size += 1 // m.Route.Prefix.Len + size += 1 // m.Route.NPaths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var s2 fib_types.FibPath + _ = s2 + if j2 < len(m.Route.Paths) { + s2 = m.Route.Paths[j2] + } + size += 4 // s2.SwIfIndex + size += 4 // s2.TableID + size += 4 // s2.RpfID + size += 1 // s2.Weight + size += 1 // s2.Preference + size += 4 // s2.Type + size += 4 // s2.Flags + size += 4 // s2.Proto + size += 1 * 16 // s2.Nh.Address + size += 4 // s2.Nh.ViaLabel + size += 4 // s2.Nh.ObjID + size += 4 // s2.Nh.ClassifyTableIndex + size += 1 // s2.NLabels + for j3 := 0; j3 < 16; j3++ { + var s3 fib_types.FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + size += 1 // s3.IsUniform + size += 4 // s3.Label + size += 1 // s3.TTL + size += 1 // s3.Exp + } + } + return size +} +func (m *IPRouteDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Route.TableID)) + buf.EncodeUint32(uint32(m.Route.StatsIndex)) + buf.EncodeUint8(uint8(m.Route.Prefix.Address.Af)) + buf.EncodeBytes(m.Route.Prefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Route.Prefix.Len)) + buf.EncodeUint8(uint8(len(m.Route.Paths))) + for j1 := 0; j1 < len(m.Route.Paths); j1++ { + var v1 fib_types.FibPath + if j1 < len(m.Route.Paths) { + v1 = m.Route.Paths[j1] + } + buf.EncodeUint32(uint32(v1.SwIfIndex)) + buf.EncodeUint32(uint32(v1.TableID)) + buf.EncodeUint32(uint32(v1.RpfID)) + buf.EncodeUint8(uint8(v1.Weight)) + buf.EncodeUint8(uint8(v1.Preference)) + buf.EncodeUint32(uint32(v1.Type)) + buf.EncodeUint32(uint32(v1.Flags)) + buf.EncodeUint32(uint32(v1.Proto)) + buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v1.Nh.ViaLabel)) + buf.EncodeUint32(uint32(v1.Nh.ObjID)) + buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex)) + buf.EncodeUint8(uint8(v1.NLabels)) + for j2 := 0; j2 < 16; j2++ { + var v2 fib_types.FibMplsLabel + if j2 < len(v1.LabelStack) { + v2 = v1.LabelStack[j2] + } + buf.EncodeUint8(uint8(v2.IsUniform)) + buf.EncodeUint32(uint32(v2.Label)) + buf.EncodeUint8(uint8(v2.TTL)) + buf.EncodeUint8(uint8(v2.Exp)) + } + } + return buf.Bytes(), nil +} +func (m *IPRouteDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Route.TableID = buf.DecodeUint32() + m.Route.StatsIndex = buf.DecodeUint32() + m.Route.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Route.Prefix.Len = buf.DecodeUint8() + m.Route.NPaths = buf.DecodeUint8() + m.Route.Paths = make([]fib_types.FibPath, int(m.Route.NPaths)) + for j1 := 0; j1 < len(m.Route.Paths); j1++ { + m.Route.Paths[j1].SwIfIndex = buf.DecodeUint32() + m.Route.Paths[j1].TableID = buf.DecodeUint32() + m.Route.Paths[j1].RpfID = buf.DecodeUint32() + m.Route.Paths[j1].Weight = buf.DecodeUint8() + m.Route.Paths[j1].Preference = buf.DecodeUint8() + m.Route.Paths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.Route.Paths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.Route.Paths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.Route.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Route.Paths[j1].Nh.ViaLabel = buf.DecodeUint32() + m.Route.Paths[j1].Nh.ObjID = buf.DecodeUint32() + m.Route.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.Route.Paths[j1].NLabels = buf.DecodeUint8() + for j2 := 0; j2 < 16; j2++ { + m.Route.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() + m.Route.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32() + m.Route.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8() + m.Route.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8() + } + } + return nil +} + +// IPRouteDump defines message 'ip_route_dump'. +type IPRouteDump struct { + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPRouteDump) Reset() { *m = IPRouteDump{} } +func (*IPRouteDump) GetMessageName() string { return "ip_route_dump" } +func (*IPRouteDump) GetCrcString() string { return "b9d2e09e" } +func (*IPRouteDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPRouteDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Table.TableID + size += 1 // m.Table.IsIP6 + size += 64 // m.Table.Name + return size +} +func (m *IPRouteDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Table.TableID)) + buf.EncodeBool(m.Table.IsIP6) + buf.EncodeString(m.Table.Name, 64) + return buf.Bytes(), nil +} +func (m *IPRouteDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Table.TableID = buf.DecodeUint32() + m.Table.IsIP6 = buf.DecodeBool() + m.Table.Name = buf.DecodeString(64) + return nil +} + +// IPRouteLookup defines message 'ip_route_lookup'. +type IPRouteLookup struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + Exact uint8 `binapi:"u8,name=exact" json:"exact,omitempty"` + Prefix ip_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` +} + +func (m *IPRouteLookup) Reset() { *m = IPRouteLookup{} } +func (*IPRouteLookup) GetMessageName() string { return "ip_route_lookup" } +func (*IPRouteLookup) GetCrcString() string { return "e2986185" } +func (*IPRouteLookup) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPRouteLookup) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.TableID + size += 1 // m.Exact + size += 1 // m.Prefix.Address.Af + size += 1 * 16 // m.Prefix.Address.Un + size += 1 // m.Prefix.Len + return size +} +func (m *IPRouteLookup) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.TableID)) + buf.EncodeUint8(uint8(m.Exact)) + buf.EncodeUint8(uint8(m.Prefix.Address.Af)) + buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Prefix.Len)) + return buf.Bytes(), nil +} +func (m *IPRouteLookup) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.TableID = buf.DecodeUint32() + m.Exact = buf.DecodeUint8() + m.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Prefix.Len = buf.DecodeUint8() + return nil +} + +// IPRouteLookupReply defines message 'ip_route_lookup_reply'. +type IPRouteLookupReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Route IPRoute `binapi:"ip_route,name=route" json:"route,omitempty"` +} + +func (m *IPRouteLookupReply) Reset() { *m = IPRouteLookupReply{} } +func (*IPRouteLookupReply) GetMessageName() string { return "ip_route_lookup_reply" } +func (*IPRouteLookupReply) GetCrcString() string { return "ae99de8e" } +func (*IPRouteLookupReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPRouteLookupReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.Route.TableID + size += 4 // m.Route.StatsIndex + size += 1 // m.Route.Prefix.Address.Af + size += 1 * 16 // m.Route.Prefix.Address.Un + size += 1 // m.Route.Prefix.Len + size += 1 // m.Route.NPaths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var s2 fib_types.FibPath + _ = s2 + if j2 < len(m.Route.Paths) { + s2 = m.Route.Paths[j2] + } + size += 4 // s2.SwIfIndex + size += 4 // s2.TableID + size += 4 // s2.RpfID + size += 1 // s2.Weight + size += 1 // s2.Preference + size += 4 // s2.Type + size += 4 // s2.Flags + size += 4 // s2.Proto + size += 1 * 16 // s2.Nh.Address + size += 4 // s2.Nh.ViaLabel + size += 4 // s2.Nh.ObjID + size += 4 // s2.Nh.ClassifyTableIndex + size += 1 // s2.NLabels + for j3 := 0; j3 < 16; j3++ { + var s3 fib_types.FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + size += 1 // s3.IsUniform + size += 4 // s3.Label + size += 1 // s3.TTL + size += 1 // s3.Exp + } + } + return size +} +func (m *IPRouteLookupReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.Route.TableID)) + buf.EncodeUint32(uint32(m.Route.StatsIndex)) + buf.EncodeUint8(uint8(m.Route.Prefix.Address.Af)) + buf.EncodeBytes(m.Route.Prefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Route.Prefix.Len)) + buf.EncodeUint8(uint8(len(m.Route.Paths))) + for j1 := 0; j1 < len(m.Route.Paths); j1++ { + var v1 fib_types.FibPath + if j1 < len(m.Route.Paths) { + v1 = m.Route.Paths[j1] + } + buf.EncodeUint32(uint32(v1.SwIfIndex)) + buf.EncodeUint32(uint32(v1.TableID)) + buf.EncodeUint32(uint32(v1.RpfID)) + buf.EncodeUint8(uint8(v1.Weight)) + buf.EncodeUint8(uint8(v1.Preference)) + buf.EncodeUint32(uint32(v1.Type)) + buf.EncodeUint32(uint32(v1.Flags)) + buf.EncodeUint32(uint32(v1.Proto)) + buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v1.Nh.ViaLabel)) + buf.EncodeUint32(uint32(v1.Nh.ObjID)) + buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex)) + buf.EncodeUint8(uint8(v1.NLabels)) + for j2 := 0; j2 < 16; j2++ { + var v2 fib_types.FibMplsLabel + if j2 < len(v1.LabelStack) { + v2 = v1.LabelStack[j2] + } + buf.EncodeUint8(uint8(v2.IsUniform)) + buf.EncodeUint32(uint32(v2.Label)) + buf.EncodeUint8(uint8(v2.TTL)) + buf.EncodeUint8(uint8(v2.Exp)) + } + } + return buf.Bytes(), nil +} +func (m *IPRouteLookupReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Route.TableID = buf.DecodeUint32() + m.Route.StatsIndex = buf.DecodeUint32() + m.Route.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Route.Prefix.Len = buf.DecodeUint8() + m.Route.NPaths = buf.DecodeUint8() + m.Route.Paths = make([]fib_types.FibPath, int(m.Route.NPaths)) + for j1 := 0; j1 < len(m.Route.Paths); j1++ { + m.Route.Paths[j1].SwIfIndex = buf.DecodeUint32() + m.Route.Paths[j1].TableID = buf.DecodeUint32() + m.Route.Paths[j1].RpfID = buf.DecodeUint32() + m.Route.Paths[j1].Weight = buf.DecodeUint8() + m.Route.Paths[j1].Preference = buf.DecodeUint8() + m.Route.Paths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.Route.Paths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.Route.Paths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.Route.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Route.Paths[j1].Nh.ViaLabel = buf.DecodeUint32() + m.Route.Paths[j1].Nh.ObjID = buf.DecodeUint32() + m.Route.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.Route.Paths[j1].NLabels = buf.DecodeUint8() + for j2 := 0; j2 < 16; j2++ { + m.Route.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() + m.Route.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32() + m.Route.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8() + m.Route.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8() + } + } + return nil +} + +// IPSourceAndPortRangeCheckAddDel defines message 'ip_source_and_port_range_check_add_del'. +type IPSourceAndPortRangeCheckAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Prefix ip_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + NumberOfRanges uint8 `binapi:"u8,name=number_of_ranges" json:"number_of_ranges,omitempty"` + LowPorts []uint16 `binapi:"u16[32],name=low_ports" json:"low_ports,omitempty"` + HighPorts []uint16 `binapi:"u16[32],name=high_ports" json:"high_ports,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +func (m *IPSourceAndPortRangeCheckAddDel) Reset() { *m = IPSourceAndPortRangeCheckAddDel{} } +func (*IPSourceAndPortRangeCheckAddDel) GetMessageName() string { + return "ip_source_and_port_range_check_add_del" +} +func (*IPSourceAndPortRangeCheckAddDel) GetCrcString() string { return "8bfc76f2" } +func (*IPSourceAndPortRangeCheckAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPSourceAndPortRangeCheckAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.Prefix.Address.Af + size += 1 * 16 // m.Prefix.Address.Un + size += 1 // m.Prefix.Len + size += 1 // m.NumberOfRanges + size += 2 * 32 // m.LowPorts + size += 2 * 32 // m.HighPorts + size += 4 // m.VrfID + return size +} +func (m *IPSourceAndPortRangeCheckAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.Prefix.Address.Af)) + buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Prefix.Len)) + buf.EncodeUint8(uint8(m.NumberOfRanges)) + for i := 0; i < 32; i++ { + var x uint16 + if i < len(m.LowPorts) { + x = uint16(m.LowPorts[i]) + } + buf.EncodeUint16(uint16(x)) + } + for i := 0; i < 32; i++ { + var x uint16 + if i < len(m.HighPorts) { + x = uint16(m.HighPorts[i]) + } + buf.EncodeUint16(uint16(x)) + } + buf.EncodeUint32(uint32(m.VrfID)) + return buf.Bytes(), nil +} +func (m *IPSourceAndPortRangeCheckAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Prefix.Len = buf.DecodeUint8() + m.NumberOfRanges = buf.DecodeUint8() + m.LowPorts = make([]uint16, 32) + for i := 0; i < len(m.LowPorts); i++ { + m.LowPorts[i] = buf.DecodeUint16() + } + m.HighPorts = make([]uint16, 32) + for i := 0; i < len(m.HighPorts); i++ { + m.HighPorts[i] = buf.DecodeUint16() + } + m.VrfID = buf.DecodeUint32() + return nil +} + +// IPSourceAndPortRangeCheckAddDelReply defines message 'ip_source_and_port_range_check_add_del_reply'. +type IPSourceAndPortRangeCheckAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPSourceAndPortRangeCheckAddDelReply) Reset() { *m = IPSourceAndPortRangeCheckAddDelReply{} } +func (*IPSourceAndPortRangeCheckAddDelReply) GetMessageName() string { + return "ip_source_and_port_range_check_add_del_reply" +} +func (*IPSourceAndPortRangeCheckAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*IPSourceAndPortRangeCheckAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPSourceAndPortRangeCheckAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IPSourceAndPortRangeCheckAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IPSourceAndPortRangeCheckAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IPSourceAndPortRangeCheckInterfaceAddDel defines message 'ip_source_and_port_range_check_interface_add_del'. +type IPSourceAndPortRangeCheckInterfaceAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + TCPInVrfID uint32 `binapi:"u32,name=tcp_in_vrf_id" json:"tcp_in_vrf_id,omitempty"` + TCPOutVrfID uint32 `binapi:"u32,name=tcp_out_vrf_id" json:"tcp_out_vrf_id,omitempty"` + UDPInVrfID uint32 `binapi:"u32,name=udp_in_vrf_id" json:"udp_in_vrf_id,omitempty"` + UDPOutVrfID uint32 `binapi:"u32,name=udp_out_vrf_id" json:"udp_out_vrf_id,omitempty"` +} + +func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Reset() { + *m = IPSourceAndPortRangeCheckInterfaceAddDel{} +} +func (*IPSourceAndPortRangeCheckInterfaceAddDel) GetMessageName() string { + return "ip_source_and_port_range_check_interface_add_del" +} +func (*IPSourceAndPortRangeCheckInterfaceAddDel) GetCrcString() string { return "e1ba8987" } +func (*IPSourceAndPortRangeCheckInterfaceAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.SwIfIndex + size += 4 // m.TCPInVrfID + size += 4 // m.TCPOutVrfID + size += 4 // m.UDPInVrfID + size += 4 // m.UDPOutVrfID + return size +} +func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.TCPInVrfID)) + buf.EncodeUint32(uint32(m.TCPOutVrfID)) + buf.EncodeUint32(uint32(m.UDPInVrfID)) + buf.EncodeUint32(uint32(m.UDPOutVrfID)) + return buf.Bytes(), nil +} +func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.TCPInVrfID = buf.DecodeUint32() + m.TCPOutVrfID = buf.DecodeUint32() + m.UDPInVrfID = buf.DecodeUint32() + m.UDPOutVrfID = buf.DecodeUint32() + return nil +} + +// IPSourceAndPortRangeCheckInterfaceAddDelReply defines message 'ip_source_and_port_range_check_interface_add_del_reply'. +type IPSourceAndPortRangeCheckInterfaceAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Reset() { + *m = IPSourceAndPortRangeCheckInterfaceAddDelReply{} +} +func (*IPSourceAndPortRangeCheckInterfaceAddDelReply) GetMessageName() string { + return "ip_source_and_port_range_check_interface_add_del_reply" +} +func (*IPSourceAndPortRangeCheckInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*IPSourceAndPortRangeCheckInterfaceAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IPTableAddDel defines message 'ip_table_add_del'. +type IPTableAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPTableAddDel) Reset() { *m = IPTableAddDel{} } +func (*IPTableAddDel) GetMessageName() string { return "ip_table_add_del" } +func (*IPTableAddDel) GetCrcString() string { return "0ffdaec0" } +func (*IPTableAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPTableAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Table.TableID + size += 1 // m.Table.IsIP6 + size += 64 // m.Table.Name + return size +} +func (m *IPTableAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Table.TableID)) + buf.EncodeBool(m.Table.IsIP6) + buf.EncodeString(m.Table.Name, 64) + return buf.Bytes(), nil +} +func (m *IPTableAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Table.TableID = buf.DecodeUint32() + m.Table.IsIP6 = buf.DecodeBool() + m.Table.Name = buf.DecodeString(64) + return nil +} + +// IPTableAddDelReply defines message 'ip_table_add_del_reply'. +type IPTableAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPTableAddDelReply) Reset() { *m = IPTableAddDelReply{} } +func (*IPTableAddDelReply) GetMessageName() string { return "ip_table_add_del_reply" } +func (*IPTableAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*IPTableAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPTableAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IPTableAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IPTableAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IPTableDetails defines message 'ip_table_details'. +type IPTableDetails struct { + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPTableDetails) Reset() { *m = IPTableDetails{} } +func (*IPTableDetails) GetMessageName() string { return "ip_table_details" } +func (*IPTableDetails) GetCrcString() string { return "c79fca0f" } +func (*IPTableDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPTableDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Table.TableID + size += 1 // m.Table.IsIP6 + size += 64 // m.Table.Name + return size +} +func (m *IPTableDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Table.TableID)) + buf.EncodeBool(m.Table.IsIP6) + buf.EncodeString(m.Table.Name, 64) + return buf.Bytes(), nil +} +func (m *IPTableDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Table.TableID = buf.DecodeUint32() + m.Table.IsIP6 = buf.DecodeBool() + m.Table.Name = buf.DecodeString(64) + return nil +} + +// IPTableDump defines message 'ip_table_dump'. +type IPTableDump struct{} + +func (m *IPTableDump) Reset() { *m = IPTableDump{} } +func (*IPTableDump) GetMessageName() string { return "ip_table_dump" } +func (*IPTableDump) GetCrcString() string { return "51077d14" } +func (*IPTableDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPTableDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *IPTableDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *IPTableDump) Unmarshal(b []byte) error { + return nil +} + +// IPTableFlush defines message 'ip_table_flush'. +type IPTableFlush struct { + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPTableFlush) Reset() { *m = IPTableFlush{} } +func (*IPTableFlush) GetMessageName() string { return "ip_table_flush" } +func (*IPTableFlush) GetCrcString() string { return "b9d2e09e" } +func (*IPTableFlush) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPTableFlush) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Table.TableID + size += 1 // m.Table.IsIP6 + size += 64 // m.Table.Name + return size +} +func (m *IPTableFlush) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Table.TableID)) + buf.EncodeBool(m.Table.IsIP6) + buf.EncodeString(m.Table.Name, 64) + return buf.Bytes(), nil +} +func (m *IPTableFlush) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Table.TableID = buf.DecodeUint32() + m.Table.IsIP6 = buf.DecodeBool() + m.Table.Name = buf.DecodeString(64) + return nil +} + +// IPTableFlushReply defines message 'ip_table_flush_reply'. +type IPTableFlushReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPTableFlushReply) Reset() { *m = IPTableFlushReply{} } +func (*IPTableFlushReply) GetMessageName() string { return "ip_table_flush_reply" } +func (*IPTableFlushReply) GetCrcString() string { return "e8d4e804" } +func (*IPTableFlushReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPTableFlushReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IPTableFlushReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IPTableFlushReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IPTableReplaceBegin defines message 'ip_table_replace_begin'. +type IPTableReplaceBegin struct { + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPTableReplaceBegin) Reset() { *m = IPTableReplaceBegin{} } +func (*IPTableReplaceBegin) GetMessageName() string { return "ip_table_replace_begin" } +func (*IPTableReplaceBegin) GetCrcString() string { return "b9d2e09e" } +func (*IPTableReplaceBegin) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPTableReplaceBegin) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Table.TableID + size += 1 // m.Table.IsIP6 + size += 64 // m.Table.Name + return size +} +func (m *IPTableReplaceBegin) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Table.TableID)) + buf.EncodeBool(m.Table.IsIP6) + buf.EncodeString(m.Table.Name, 64) + return buf.Bytes(), nil +} +func (m *IPTableReplaceBegin) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Table.TableID = buf.DecodeUint32() + m.Table.IsIP6 = buf.DecodeBool() + m.Table.Name = buf.DecodeString(64) + return nil +} + +// IPTableReplaceBeginReply defines message 'ip_table_replace_begin_reply'. +type IPTableReplaceBeginReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPTableReplaceBeginReply) Reset() { *m = IPTableReplaceBeginReply{} } +func (*IPTableReplaceBeginReply) GetMessageName() string { return "ip_table_replace_begin_reply" } +func (*IPTableReplaceBeginReply) GetCrcString() string { return "e8d4e804" } +func (*IPTableReplaceBeginReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPTableReplaceBeginReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IPTableReplaceBeginReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IPTableReplaceBeginReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IPTableReplaceEnd defines message 'ip_table_replace_end'. +type IPTableReplaceEnd struct { + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPTableReplaceEnd) Reset() { *m = IPTableReplaceEnd{} } +func (*IPTableReplaceEnd) GetMessageName() string { return "ip_table_replace_end" } +func (*IPTableReplaceEnd) GetCrcString() string { return "b9d2e09e" } +func (*IPTableReplaceEnd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPTableReplaceEnd) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Table.TableID + size += 1 // m.Table.IsIP6 + size += 64 // m.Table.Name + return size +} +func (m *IPTableReplaceEnd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Table.TableID)) + buf.EncodeBool(m.Table.IsIP6) + buf.EncodeString(m.Table.Name, 64) + return buf.Bytes(), nil +} +func (m *IPTableReplaceEnd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Table.TableID = buf.DecodeUint32() + m.Table.IsIP6 = buf.DecodeBool() + m.Table.Name = buf.DecodeString(64) + return nil +} + +// IPTableReplaceEndReply defines message 'ip_table_replace_end_reply'. +type IPTableReplaceEndReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPTableReplaceEndReply) Reset() { *m = IPTableReplaceEndReply{} } +func (*IPTableReplaceEndReply) GetMessageName() string { return "ip_table_replace_end_reply" } +func (*IPTableReplaceEndReply) GetCrcString() string { return "e8d4e804" } +func (*IPTableReplaceEndReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPTableReplaceEndReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IPTableReplaceEndReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IPTableReplaceEndReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IPUnnumberedDetails defines message 'ip_unnumbered_details'. +type IPUnnumberedDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IPSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=ip_sw_if_index" json:"ip_sw_if_index,omitempty"` +} + +func (m *IPUnnumberedDetails) Reset() { *m = IPUnnumberedDetails{} } +func (*IPUnnumberedDetails) GetMessageName() string { return "ip_unnumbered_details" } +func (*IPUnnumberedDetails) GetCrcString() string { return "aa12a483" } +func (*IPUnnumberedDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPUnnumberedDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.IPSwIfIndex + return size +} +func (m *IPUnnumberedDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.IPSwIfIndex)) + return buf.Bytes(), nil +} +func (m *IPUnnumberedDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IPSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// IPUnnumberedDump defines message 'ip_unnumbered_dump'. +type IPUnnumberedDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"` +} + +func (m *IPUnnumberedDump) Reset() { *m = IPUnnumberedDump{} } +func (*IPUnnumberedDump) GetMessageName() string { return "ip_unnumbered_dump" } +func (*IPUnnumberedDump) GetCrcString() string { return "f9e6675e" } +func (*IPUnnumberedDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPUnnumberedDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *IPUnnumberedDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *IPUnnumberedDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// MfibSignalDetails defines message 'mfib_signal_details'. +type MfibSignalDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + Prefix ip_types.Mprefix `binapi:"mprefix,name=prefix" json:"prefix,omitempty"` + IPPacketLen uint16 `binapi:"u16,name=ip_packet_len" json:"ip_packet_len,omitempty"` + IPPacketData []byte `binapi:"u8[256],name=ip_packet_data" json:"ip_packet_data,omitempty"` +} + +func (m *MfibSignalDetails) Reset() { *m = MfibSignalDetails{} } +func (*MfibSignalDetails) GetMessageName() string { return "mfib_signal_details" } +func (*MfibSignalDetails) GetCrcString() string { return "64398a9a" } +func (*MfibSignalDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MfibSignalDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.TableID + size += 1 // m.Prefix.Af + size += 2 // m.Prefix.GrpAddressLength + size += 1 * 16 // m.Prefix.GrpAddress + size += 1 * 16 // m.Prefix.SrcAddress + size += 2 // m.IPPacketLen + size += 1 * 256 // m.IPPacketData + return size +} +func (m *MfibSignalDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.TableID)) + buf.EncodeUint8(uint8(m.Prefix.Af)) + buf.EncodeUint16(uint16(m.Prefix.GrpAddressLength)) + buf.EncodeBytes(m.Prefix.GrpAddress.XXX_UnionData[:], 0) + buf.EncodeBytes(m.Prefix.SrcAddress.XXX_UnionData[:], 0) + buf.EncodeUint16(uint16(m.IPPacketLen)) + buf.EncodeBytes(m.IPPacketData[:], 256) + return buf.Bytes(), nil +} +func (m *MfibSignalDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.TableID = buf.DecodeUint32() + m.Prefix.Af = ip_types.AddressFamily(buf.DecodeUint8()) + m.Prefix.GrpAddressLength = buf.DecodeUint16() + copy(m.Prefix.GrpAddress.XXX_UnionData[:], buf.DecodeBytes(16)) + copy(m.Prefix.SrcAddress.XXX_UnionData[:], buf.DecodeBytes(16)) + m.IPPacketLen = buf.DecodeUint16() + copy(m.IPPacketData[:], buf.DecodeBytes(256)) + return nil +} + +// MfibSignalDump defines message 'mfib_signal_dump'. +type MfibSignalDump struct{} + +func (m *MfibSignalDump) Reset() { *m = MfibSignalDump{} } +func (*MfibSignalDump) GetMessageName() string { return "mfib_signal_dump" } +func (*MfibSignalDump) GetCrcString() string { return "51077d14" } +func (*MfibSignalDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MfibSignalDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MfibSignalDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *MfibSignalDump) Unmarshal(b []byte) error { + return nil +} + +// SetIPFlowHash defines message 'set_ip_flow_hash'. +type SetIPFlowHash struct { + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + Src bool `binapi:"bool,name=src" json:"src,omitempty"` + Dst bool `binapi:"bool,name=dst" json:"dst,omitempty"` + Sport bool `binapi:"bool,name=sport" json:"sport,omitempty"` + Dport bool `binapi:"bool,name=dport" json:"dport,omitempty"` + Proto bool `binapi:"bool,name=proto" json:"proto,omitempty"` + Reverse bool `binapi:"bool,name=reverse" json:"reverse,omitempty"` + Symmetric bool `binapi:"bool,name=symmetric" json:"symmetric,omitempty"` +} + +func (m *SetIPFlowHash) Reset() { *m = SetIPFlowHash{} } +func (*SetIPFlowHash) GetMessageName() string { return "set_ip_flow_hash" } +func (*SetIPFlowHash) GetCrcString() string { return "084ee09e" } +func (*SetIPFlowHash) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SetIPFlowHash) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.VrfID + size += 1 // m.IsIPv6 + size += 1 // m.Src + size += 1 // m.Dst + size += 1 // m.Sport + size += 1 // m.Dport + size += 1 // m.Proto + size += 1 // m.Reverse + size += 1 // m.Symmetric + return size +} +func (m *SetIPFlowHash) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.VrfID)) + buf.EncodeBool(m.IsIPv6) + buf.EncodeBool(m.Src) + buf.EncodeBool(m.Dst) + buf.EncodeBool(m.Sport) + buf.EncodeBool(m.Dport) + buf.EncodeBool(m.Proto) + buf.EncodeBool(m.Reverse) + buf.EncodeBool(m.Symmetric) + return buf.Bytes(), nil +} +func (m *SetIPFlowHash) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.VrfID = buf.DecodeUint32() + m.IsIPv6 = buf.DecodeBool() + m.Src = buf.DecodeBool() + m.Dst = buf.DecodeBool() + m.Sport = buf.DecodeBool() + m.Dport = buf.DecodeBool() + m.Proto = buf.DecodeBool() + m.Reverse = buf.DecodeBool() + m.Symmetric = buf.DecodeBool() + return nil +} + +// SetIPFlowHashReply defines message 'set_ip_flow_hash_reply'. +type SetIPFlowHashReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SetIPFlowHashReply) Reset() { *m = SetIPFlowHashReply{} } +func (*SetIPFlowHashReply) GetMessageName() string { return "set_ip_flow_hash_reply" } +func (*SetIPFlowHashReply) GetCrcString() string { return "e8d4e804" } +func (*SetIPFlowHashReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SetIPFlowHashReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SetIPFlowHashReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SetIPFlowHashReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceIP6EnableDisable defines message 'sw_interface_ip6_enable_disable'. +type SwInterfaceIP6EnableDisable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *SwInterfaceIP6EnableDisable) Reset() { *m = SwInterfaceIP6EnableDisable{} } +func (*SwInterfaceIP6EnableDisable) GetMessageName() string { return "sw_interface_ip6_enable_disable" } +func (*SwInterfaceIP6EnableDisable) GetCrcString() string { return "ae6cfcfb" } +func (*SwInterfaceIP6EnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceIP6EnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Enable + return size +} +func (m *SwInterfaceIP6EnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *SwInterfaceIP6EnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Enable = buf.DecodeBool() + return nil +} + +// SwInterfaceIP6EnableDisableReply defines message 'sw_interface_ip6_enable_disable_reply'. +type SwInterfaceIP6EnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceIP6EnableDisableReply) Reset() { *m = SwInterfaceIP6EnableDisableReply{} } +func (*SwInterfaceIP6EnableDisableReply) GetMessageName() string { + return "sw_interface_ip6_enable_disable_reply" +} +func (*SwInterfaceIP6EnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceIP6EnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceIP6EnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceIP6EnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceIP6EnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceIP6SetLinkLocalAddress defines message 'sw_interface_ip6_set_link_local_address'. +type SwInterfaceIP6SetLinkLocalAddress struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IP ip_types.IP6Address `binapi:"ip6_address,name=ip" json:"ip,omitempty"` +} + +func (m *SwInterfaceIP6SetLinkLocalAddress) Reset() { *m = SwInterfaceIP6SetLinkLocalAddress{} } +func (*SwInterfaceIP6SetLinkLocalAddress) GetMessageName() string { + return "sw_interface_ip6_set_link_local_address" +} +func (*SwInterfaceIP6SetLinkLocalAddress) GetCrcString() string { return "2931d9fa" } +func (*SwInterfaceIP6SetLinkLocalAddress) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceIP6SetLinkLocalAddress) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 * 16 // m.IP + return size +} +func (m *SwInterfaceIP6SetLinkLocalAddress) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBytes(m.IP[:], 16) + return buf.Bytes(), nil +} +func (m *SwInterfaceIP6SetLinkLocalAddress) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + copy(m.IP[:], buf.DecodeBytes(16)) + return nil +} + +// SwInterfaceIP6SetLinkLocalAddressReply defines message 'sw_interface_ip6_set_link_local_address_reply'. +type SwInterfaceIP6SetLinkLocalAddressReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceIP6SetLinkLocalAddressReply) Reset() { + *m = SwInterfaceIP6SetLinkLocalAddressReply{} +} +func (*SwInterfaceIP6SetLinkLocalAddressReply) GetMessageName() string { + return "sw_interface_ip6_set_link_local_address_reply" +} +func (*SwInterfaceIP6SetLinkLocalAddressReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceIP6SetLinkLocalAddressReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceIP6SetLinkLocalAddressReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceIP6SetLinkLocalAddressReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceIP6SetLinkLocalAddressReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_ip_binapi_init() } +func file_ip_binapi_init() { + api.RegisterMessage((*IoamDisable)(nil), "ioam_disable_6b16a45e") + api.RegisterMessage((*IoamDisableReply)(nil), "ioam_disable_reply_e8d4e804") + api.RegisterMessage((*IoamEnable)(nil), "ioam_enable_51ccd868") + api.RegisterMessage((*IoamEnableReply)(nil), "ioam_enable_reply_e8d4e804") + api.RegisterMessage((*IPAddressDetails)(nil), "ip_address_details_b1199745") + api.RegisterMessage((*IPAddressDump)(nil), "ip_address_dump_2d033de4") + api.RegisterMessage((*IPContainerProxyAddDel)(nil), "ip_container_proxy_add_del_91189f40") + api.RegisterMessage((*IPContainerProxyAddDelReply)(nil), "ip_container_proxy_add_del_reply_e8d4e804") + api.RegisterMessage((*IPContainerProxyDetails)(nil), "ip_container_proxy_details_0ee460e8") + api.RegisterMessage((*IPContainerProxyDump)(nil), "ip_container_proxy_dump_51077d14") + api.RegisterMessage((*IPDetails)(nil), "ip_details_eb152d07") + api.RegisterMessage((*IPDump)(nil), "ip_dump_98d231ca") + api.RegisterMessage((*IPMrouteAddDel)(nil), "ip_mroute_add_del_f6627d17") + api.RegisterMessage((*IPMrouteAddDelReply)(nil), "ip_mroute_add_del_reply_1992deab") + api.RegisterMessage((*IPMrouteDetails)(nil), "ip_mroute_details_c1cb4b44") + api.RegisterMessage((*IPMrouteDump)(nil), "ip_mroute_dump_b9d2e09e") + api.RegisterMessage((*IPMtableDetails)(nil), "ip_mtable_details_b9d2e09e") + api.RegisterMessage((*IPMtableDump)(nil), "ip_mtable_dump_51077d14") + api.RegisterMessage((*IPPuntPolice)(nil), "ip_punt_police_db867cea") + api.RegisterMessage((*IPPuntPoliceReply)(nil), "ip_punt_police_reply_e8d4e804") + api.RegisterMessage((*IPPuntRedirect)(nil), "ip_punt_redirect_a9a5592c") + api.RegisterMessage((*IPPuntRedirectDetails)(nil), "ip_punt_redirect_details_3924f5d3") + api.RegisterMessage((*IPPuntRedirectDump)(nil), "ip_punt_redirect_dump_2d033de4") + api.RegisterMessage((*IPPuntRedirectReply)(nil), "ip_punt_redirect_reply_e8d4e804") + api.RegisterMessage((*IPReassemblyEnableDisable)(nil), "ip_reassembly_enable_disable_885c85a6") + api.RegisterMessage((*IPReassemblyEnableDisableReply)(nil), "ip_reassembly_enable_disable_reply_e8d4e804") + api.RegisterMessage((*IPReassemblyGet)(nil), "ip_reassembly_get_ea13ff63") + api.RegisterMessage((*IPReassemblyGetReply)(nil), "ip_reassembly_get_reply_d5eb8d34") + api.RegisterMessage((*IPReassemblySet)(nil), "ip_reassembly_set_16467d25") + api.RegisterMessage((*IPReassemblySetReply)(nil), "ip_reassembly_set_reply_e8d4e804") + api.RegisterMessage((*IPRouteAddDel)(nil), "ip_route_add_del_c1ff832d") + api.RegisterMessage((*IPRouteAddDelReply)(nil), "ip_route_add_del_reply_1992deab") + api.RegisterMessage((*IPRouteDetails)(nil), "ip_route_details_d1ffaae1") + api.RegisterMessage((*IPRouteDump)(nil), "ip_route_dump_b9d2e09e") + api.RegisterMessage((*IPRouteLookup)(nil), "ip_route_lookup_e2986185") + api.RegisterMessage((*IPRouteLookupReply)(nil), "ip_route_lookup_reply_ae99de8e") + api.RegisterMessage((*IPSourceAndPortRangeCheckAddDel)(nil), "ip_source_and_port_range_check_add_del_8bfc76f2") + api.RegisterMessage((*IPSourceAndPortRangeCheckAddDelReply)(nil), "ip_source_and_port_range_check_add_del_reply_e8d4e804") + api.RegisterMessage((*IPSourceAndPortRangeCheckInterfaceAddDel)(nil), "ip_source_and_port_range_check_interface_add_del_e1ba8987") + api.RegisterMessage((*IPSourceAndPortRangeCheckInterfaceAddDelReply)(nil), "ip_source_and_port_range_check_interface_add_del_reply_e8d4e804") + api.RegisterMessage((*IPTableAddDel)(nil), "ip_table_add_del_0ffdaec0") + api.RegisterMessage((*IPTableAddDelReply)(nil), "ip_table_add_del_reply_e8d4e804") + api.RegisterMessage((*IPTableDetails)(nil), "ip_table_details_c79fca0f") + api.RegisterMessage((*IPTableDump)(nil), "ip_table_dump_51077d14") + api.RegisterMessage((*IPTableFlush)(nil), "ip_table_flush_b9d2e09e") + api.RegisterMessage((*IPTableFlushReply)(nil), "ip_table_flush_reply_e8d4e804") + api.RegisterMessage((*IPTableReplaceBegin)(nil), "ip_table_replace_begin_b9d2e09e") + api.RegisterMessage((*IPTableReplaceBeginReply)(nil), "ip_table_replace_begin_reply_e8d4e804") + api.RegisterMessage((*IPTableReplaceEnd)(nil), "ip_table_replace_end_b9d2e09e") + api.RegisterMessage((*IPTableReplaceEndReply)(nil), "ip_table_replace_end_reply_e8d4e804") + api.RegisterMessage((*IPUnnumberedDetails)(nil), "ip_unnumbered_details_aa12a483") + api.RegisterMessage((*IPUnnumberedDump)(nil), "ip_unnumbered_dump_f9e6675e") + api.RegisterMessage((*MfibSignalDetails)(nil), "mfib_signal_details_64398a9a") + api.RegisterMessage((*MfibSignalDump)(nil), "mfib_signal_dump_51077d14") + api.RegisterMessage((*SetIPFlowHash)(nil), "set_ip_flow_hash_084ee09e") + api.RegisterMessage((*SetIPFlowHashReply)(nil), "set_ip_flow_hash_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceIP6EnableDisable)(nil), "sw_interface_ip6_enable_disable_ae6cfcfb") + api.RegisterMessage((*SwInterfaceIP6EnableDisableReply)(nil), "sw_interface_ip6_enable_disable_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceIP6SetLinkLocalAddress)(nil), "sw_interface_ip6_set_link_local_address_2931d9fa") + api.RegisterMessage((*SwInterfaceIP6SetLinkLocalAddressReply)(nil), "sw_interface_ip6_set_link_local_address_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*IoamDisable)(nil), + (*IoamDisableReply)(nil), + (*IoamEnable)(nil), + (*IoamEnableReply)(nil), + (*IPAddressDetails)(nil), + (*IPAddressDump)(nil), + (*IPContainerProxyAddDel)(nil), + (*IPContainerProxyAddDelReply)(nil), + (*IPContainerProxyDetails)(nil), + (*IPContainerProxyDump)(nil), + (*IPDetails)(nil), + (*IPDump)(nil), + (*IPMrouteAddDel)(nil), + (*IPMrouteAddDelReply)(nil), + (*IPMrouteDetails)(nil), + (*IPMrouteDump)(nil), + (*IPMtableDetails)(nil), + (*IPMtableDump)(nil), + (*IPPuntPolice)(nil), + (*IPPuntPoliceReply)(nil), + (*IPPuntRedirect)(nil), + (*IPPuntRedirectDetails)(nil), + (*IPPuntRedirectDump)(nil), + (*IPPuntRedirectReply)(nil), + (*IPReassemblyEnableDisable)(nil), + (*IPReassemblyEnableDisableReply)(nil), + (*IPReassemblyGet)(nil), + (*IPReassemblyGetReply)(nil), + (*IPReassemblySet)(nil), + (*IPReassemblySetReply)(nil), + (*IPRouteAddDel)(nil), + (*IPRouteAddDelReply)(nil), + (*IPRouteDetails)(nil), + (*IPRouteDump)(nil), + (*IPRouteLookup)(nil), + (*IPRouteLookupReply)(nil), + (*IPSourceAndPortRangeCheckAddDel)(nil), + (*IPSourceAndPortRangeCheckAddDelReply)(nil), + (*IPSourceAndPortRangeCheckInterfaceAddDel)(nil), + (*IPSourceAndPortRangeCheckInterfaceAddDelReply)(nil), + (*IPTableAddDel)(nil), + (*IPTableAddDelReply)(nil), + (*IPTableDetails)(nil), + (*IPTableDump)(nil), + (*IPTableFlush)(nil), + (*IPTableFlushReply)(nil), + (*IPTableReplaceBegin)(nil), + (*IPTableReplaceBeginReply)(nil), + (*IPTableReplaceEnd)(nil), + (*IPTableReplaceEndReply)(nil), + (*IPUnnumberedDetails)(nil), + (*IPUnnumberedDump)(nil), + (*MfibSignalDetails)(nil), + (*MfibSignalDump)(nil), + (*SetIPFlowHash)(nil), + (*SetIPFlowHashReply)(nil), + (*SwInterfaceIP6EnableDisable)(nil), + (*SwInterfaceIP6EnableDisableReply)(nil), + (*SwInterfaceIP6SetLinkLocalAddress)(nil), + (*SwInterfaceIP6SetLinkLocalAddressReply)(nil), + } +} diff --git a/binapi/ip/ip_rest.ba.go b/binapi/ip/ip_rest.ba.go new file mode 100644 index 0000000..245ffed --- /dev/null +++ b/binapi/ip/ip_rest.ba.go @@ -0,0 +1,474 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ip + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/ioam_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(IoamDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IoamDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ioam_enable", func(w http.ResponseWriter, req *http.Request) { + var request = new(IoamEnable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IoamEnable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ip_container_proxy_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(IPContainerProxyAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IPContainerProxyAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ip_mroute_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(IPMrouteAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IPMrouteAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ip_punt_police", func(w http.ResponseWriter, req *http.Request) { + var request = new(IPPuntPolice) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IPPuntPolice(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ip_punt_redirect", func(w http.ResponseWriter, req *http.Request) { + var request = new(IPPuntRedirect) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IPPuntRedirect(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ip_reassembly_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(IPReassemblyEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IPReassemblyEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ip_reassembly_get", func(w http.ResponseWriter, req *http.Request) { + var request = new(IPReassemblyGet) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IPReassemblyGet(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ip_reassembly_set", func(w http.ResponseWriter, req *http.Request) { + var request = new(IPReassemblySet) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IPReassemblySet(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ip_route_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(IPRouteAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IPRouteAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ip_route_lookup", func(w http.ResponseWriter, req *http.Request) { + var request = new(IPRouteLookup) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IPRouteLookup(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ip_source_and_port_range_check_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(IPSourceAndPortRangeCheckAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IPSourceAndPortRangeCheckAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ip_source_and_port_range_check_interface_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(IPSourceAndPortRangeCheckInterfaceAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IPSourceAndPortRangeCheckInterfaceAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ip_table_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(IPTableAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IPTableAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ip_table_flush", func(w http.ResponseWriter, req *http.Request) { + var request = new(IPTableFlush) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IPTableFlush(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ip_table_replace_begin", func(w http.ResponseWriter, req *http.Request) { + var request = new(IPTableReplaceBegin) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IPTableReplaceBegin(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ip_table_replace_end", func(w http.ResponseWriter, req *http.Request) { + var request = new(IPTableReplaceEnd) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IPTableReplaceEnd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/set_ip_flow_hash", func(w http.ResponseWriter, req *http.Request) { + var request = new(SetIPFlowHash) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SetIPFlowHash(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_ip6_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceIP6EnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceIP6EnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_ip6_set_link_local_address", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceIP6SetLinkLocalAddress) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceIP6SetLinkLocalAddress(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/ip/ip_rpc.ba.go b/binapi/ip/ip_rpc.ba.go new file mode 100644 index 0000000..f50c660 --- /dev/null +++ b/binapi/ip/ip_rpc.ba.go @@ -0,0 +1,623 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ip + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service ip. +type RPCService interface { + IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) + IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) + IPAddressDump(ctx context.Context, in *IPAddressDump) (RPCService_IPAddressDumpClient, error) + IPContainerProxyAddDel(ctx context.Context, in *IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) + IPContainerProxyDump(ctx context.Context, in *IPContainerProxyDump) (RPCService_IPContainerProxyDumpClient, error) + IPDump(ctx context.Context, in *IPDump) (RPCService_IPDumpClient, error) + IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) (*IPMrouteAddDelReply, error) + IPMrouteDump(ctx context.Context, in *IPMrouteDump) (RPCService_IPMrouteDumpClient, error) + IPMtableDump(ctx context.Context, in *IPMtableDump) (RPCService_IPMtableDumpClient, error) + IPPuntPolice(ctx context.Context, in *IPPuntPolice) (*IPPuntPoliceReply, error) + IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) (*IPPuntRedirectReply, error) + IPPuntRedirectDump(ctx context.Context, in *IPPuntRedirectDump) (RPCService_IPPuntRedirectDumpClient, error) + IPReassemblyEnableDisable(ctx context.Context, in *IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) + IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) + IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) + IPRouteAddDel(ctx context.Context, in *IPRouteAddDel) (*IPRouteAddDelReply, error) + IPRouteDump(ctx context.Context, in *IPRouteDump) (RPCService_IPRouteDumpClient, error) + IPRouteLookup(ctx context.Context, in *IPRouteLookup) (*IPRouteLookupReply, error) + IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) + IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) + IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) + IPTableDump(ctx context.Context, in *IPTableDump) (RPCService_IPTableDumpClient, error) + IPTableFlush(ctx context.Context, in *IPTableFlush) (*IPTableFlushReply, error) + IPTableReplaceBegin(ctx context.Context, in *IPTableReplaceBegin) (*IPTableReplaceBeginReply, error) + IPTableReplaceEnd(ctx context.Context, in *IPTableReplaceEnd) (*IPTableReplaceEndReply, error) + IPUnnumberedDump(ctx context.Context, in *IPUnnumberedDump) (RPCService_IPUnnumberedDumpClient, error) + MfibSignalDump(ctx context.Context, in *MfibSignalDump) (RPCService_MfibSignalDumpClient, error) + SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (*SetIPFlowHashReply, error) + SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) + SwInterfaceIP6SetLinkLocalAddress(ctx context.Context, in *SwInterfaceIP6SetLinkLocalAddress) (*SwInterfaceIP6SetLinkLocalAddressReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) { + out := new(IoamDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) { + out := new(IoamEnableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPAddressDump(ctx context.Context, in *IPAddressDump) (RPCService_IPAddressDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IPAddressDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IPAddressDumpClient interface { + Recv() (*IPAddressDetails, error) + api.Stream +} + +type serviceClient_IPAddressDumpClient struct { + api.Stream +} + +func (c *serviceClient_IPAddressDumpClient) Recv() (*IPAddressDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IPAddressDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IPContainerProxyAddDel(ctx context.Context, in *IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) { + out := new(IPContainerProxyAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPContainerProxyDump(ctx context.Context, in *IPContainerProxyDump) (RPCService_IPContainerProxyDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IPContainerProxyDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IPContainerProxyDumpClient interface { + Recv() (*IPContainerProxyDetails, error) + api.Stream +} + +type serviceClient_IPContainerProxyDumpClient struct { + api.Stream +} + +func (c *serviceClient_IPContainerProxyDumpClient) Recv() (*IPContainerProxyDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IPContainerProxyDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IPDump(ctx context.Context, in *IPDump) (RPCService_IPDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IPDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IPDumpClient interface { + Recv() (*IPDetails, error) + api.Stream +} + +type serviceClient_IPDumpClient struct { + api.Stream +} + +func (c *serviceClient_IPDumpClient) Recv() (*IPDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IPDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) (*IPMrouteAddDelReply, error) { + out := new(IPMrouteAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPMrouteDump(ctx context.Context, in *IPMrouteDump) (RPCService_IPMrouteDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IPMrouteDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IPMrouteDumpClient interface { + Recv() (*IPMrouteDetails, error) + api.Stream +} + +type serviceClient_IPMrouteDumpClient struct { + api.Stream +} + +func (c *serviceClient_IPMrouteDumpClient) Recv() (*IPMrouteDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IPMrouteDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IPMtableDump(ctx context.Context, in *IPMtableDump) (RPCService_IPMtableDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IPMtableDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IPMtableDumpClient interface { + Recv() (*IPMtableDetails, error) + api.Stream +} + +type serviceClient_IPMtableDumpClient struct { + api.Stream +} + +func (c *serviceClient_IPMtableDumpClient) Recv() (*IPMtableDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IPMtableDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IPPuntPolice(ctx context.Context, in *IPPuntPolice) (*IPPuntPoliceReply, error) { + out := new(IPPuntPoliceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) (*IPPuntRedirectReply, error) { + out := new(IPPuntRedirectReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPPuntRedirectDump(ctx context.Context, in *IPPuntRedirectDump) (RPCService_IPPuntRedirectDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IPPuntRedirectDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IPPuntRedirectDumpClient interface { + Recv() (*IPPuntRedirectDetails, error) + api.Stream +} + +type serviceClient_IPPuntRedirectDumpClient struct { + api.Stream +} + +func (c *serviceClient_IPPuntRedirectDumpClient) Recv() (*IPPuntRedirectDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IPPuntRedirectDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IPReassemblyEnableDisable(ctx context.Context, in *IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) { + out := new(IPReassemblyEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) { + out := new(IPReassemblyGetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) { + out := new(IPReassemblySetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPRouteAddDel(ctx context.Context, in *IPRouteAddDel) (*IPRouteAddDelReply, error) { + out := new(IPRouteAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPRouteDump(ctx context.Context, in *IPRouteDump) (RPCService_IPRouteDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IPRouteDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IPRouteDumpClient interface { + Recv() (*IPRouteDetails, error) + api.Stream +} + +type serviceClient_IPRouteDumpClient struct { + api.Stream +} + +func (c *serviceClient_IPRouteDumpClient) Recv() (*IPRouteDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IPRouteDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IPRouteLookup(ctx context.Context, in *IPRouteLookup) (*IPRouteLookupReply, error) { + out := new(IPRouteLookupReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) { + out := new(IPSourceAndPortRangeCheckAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) { + out := new(IPSourceAndPortRangeCheckInterfaceAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) { + out := new(IPTableAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPTableDump(ctx context.Context, in *IPTableDump) (RPCService_IPTableDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IPTableDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IPTableDumpClient interface { + Recv() (*IPTableDetails, error) + api.Stream +} + +type serviceClient_IPTableDumpClient struct { + api.Stream +} + +func (c *serviceClient_IPTableDumpClient) Recv() (*IPTableDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IPTableDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IPTableFlush(ctx context.Context, in *IPTableFlush) (*IPTableFlushReply, error) { + out := new(IPTableFlushReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPTableReplaceBegin(ctx context.Context, in *IPTableReplaceBegin) (*IPTableReplaceBeginReply, error) { + out := new(IPTableReplaceBeginReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPTableReplaceEnd(ctx context.Context, in *IPTableReplaceEnd) (*IPTableReplaceEndReply, error) { + out := new(IPTableReplaceEndReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPUnnumberedDump(ctx context.Context, in *IPUnnumberedDump) (RPCService_IPUnnumberedDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IPUnnumberedDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IPUnnumberedDumpClient interface { + Recv() (*IPUnnumberedDetails, error) + api.Stream +} + +type serviceClient_IPUnnumberedDumpClient struct { + api.Stream +} + +func (c *serviceClient_IPUnnumberedDumpClient) Recv() (*IPUnnumberedDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IPUnnumberedDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) MfibSignalDump(ctx context.Context, in *MfibSignalDump) (RPCService_MfibSignalDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_MfibSignalDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_MfibSignalDumpClient interface { + Recv() (*MfibSignalDetails, error) + api.Stream +} + +type serviceClient_MfibSignalDumpClient struct { + api.Stream +} + +func (c *serviceClient_MfibSignalDumpClient) Recv() (*MfibSignalDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *MfibSignalDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (*SetIPFlowHashReply, error) { + out := new(SetIPFlowHashReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) { + out := new(SwInterfaceIP6EnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceIP6SetLinkLocalAddress(ctx context.Context, in *SwInterfaceIP6SetLinkLocalAddress) (*SwInterfaceIP6SetLinkLocalAddressReply, error) { + out := new(SwInterfaceIP6SetLinkLocalAddressReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/ip6_nd/ip6_nd.ba.go b/binapi/ip6_nd/ip6_nd.ba.go new file mode 100644 index 0000000..a6f35b4 --- /dev/null +++ b/binapi/ip6_nd/ip6_nd.ba.go @@ -0,0 +1,741 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/ip6_nd.api.json + +// Package ip6_nd contains generated bindings for API file ip6_nd.api. +// +// Contents: +// 1 struct +// 13 messages +// +package ip6_nd + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "ip6_nd" + APIVersion = "1.0.0" + VersionCrc = 0x877c10de +) + +// IP6RaPrefixInfo defines type 'ip6_ra_prefix_info'. +type IP6RaPrefixInfo struct { + Prefix ip_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + Flags uint8 `binapi:"u8,name=flags" json:"flags,omitempty"` + ValidTime uint32 `binapi:"u32,name=valid_time" json:"valid_time,omitempty"` + PreferredTime uint32 `binapi:"u32,name=preferred_time" json:"preferred_time,omitempty"` +} + +// IP6RaEvent defines message 'ip6_ra_event'. +type IP6RaEvent struct { + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + RouterAddr ip_types.IP6Address `binapi:"ip6_address,name=router_addr" json:"router_addr,omitempty"` + CurrentHopLimit uint8 `binapi:"u8,name=current_hop_limit" json:"current_hop_limit,omitempty"` + Flags uint8 `binapi:"u8,name=flags" json:"flags,omitempty"` + RouterLifetimeInSec uint16 `binapi:"u16,name=router_lifetime_in_sec" json:"router_lifetime_in_sec,omitempty"` + NeighborReachableTimeInMsec uint32 `binapi:"u32,name=neighbor_reachable_time_in_msec" json:"neighbor_reachable_time_in_msec,omitempty"` + TimeInMsecBetweenRetransmittedNeighborSolicitations uint32 `binapi:"u32,name=time_in_msec_between_retransmitted_neighbor_solicitations" json:"time_in_msec_between_retransmitted_neighbor_solicitations,omitempty"` + NPrefixes uint32 `binapi:"u32,name=n_prefixes" json:"-"` + Prefixes []IP6RaPrefixInfo `binapi:"ip6_ra_prefix_info[n_prefixes],name=prefixes" json:"prefixes,omitempty"` +} + +func (m *IP6RaEvent) Reset() { *m = IP6RaEvent{} } +func (*IP6RaEvent) GetMessageName() string { return "ip6_ra_event" } +func (*IP6RaEvent) GetCrcString() string { return "47e8cfbe" } +func (*IP6RaEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +func (m *IP6RaEvent) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.PID + size += 4 // m.SwIfIndex + size += 1 * 16 // m.RouterAddr + size += 1 // m.CurrentHopLimit + size += 1 // m.Flags + size += 2 // m.RouterLifetimeInSec + size += 4 // m.NeighborReachableTimeInMsec + size += 4 // m.TimeInMsecBetweenRetransmittedNeighborSolicitations + size += 4 // m.NPrefixes + for j1 := 0; j1 < len(m.Prefixes); j1++ { + var s1 IP6RaPrefixInfo + _ = s1 + if j1 < len(m.Prefixes) { + s1 = m.Prefixes[j1] + } + size += 1 // s1.Prefix.Address.Af + size += 1 * 16 // s1.Prefix.Address.Un + size += 1 // s1.Prefix.Len + size += 1 // s1.Flags + size += 4 // s1.ValidTime + size += 4 // s1.PreferredTime + } + return size +} +func (m *IP6RaEvent) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.PID)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBytes(m.RouterAddr[:], 16) + buf.EncodeUint8(uint8(m.CurrentHopLimit)) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint16(uint16(m.RouterLifetimeInSec)) + buf.EncodeUint32(uint32(m.NeighborReachableTimeInMsec)) + buf.EncodeUint32(uint32(m.TimeInMsecBetweenRetransmittedNeighborSolicitations)) + buf.EncodeUint32(uint32(len(m.Prefixes))) + for j0 := 0; j0 < len(m.Prefixes); j0++ { + var v0 IP6RaPrefixInfo + if j0 < len(m.Prefixes) { + v0 = m.Prefixes[j0] + } + buf.EncodeUint8(uint8(v0.Prefix.Address.Af)) + buf.EncodeBytes(v0.Prefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(v0.Prefix.Len)) + buf.EncodeUint8(uint8(v0.Flags)) + buf.EncodeUint32(uint32(v0.ValidTime)) + buf.EncodeUint32(uint32(v0.PreferredTime)) + } + return buf.Bytes(), nil +} +func (m *IP6RaEvent) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PID = buf.DecodeUint32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + copy(m.RouterAddr[:], buf.DecodeBytes(16)) + m.CurrentHopLimit = buf.DecodeUint8() + m.Flags = buf.DecodeUint8() + m.RouterLifetimeInSec = buf.DecodeUint16() + m.NeighborReachableTimeInMsec = buf.DecodeUint32() + m.TimeInMsecBetweenRetransmittedNeighborSolicitations = buf.DecodeUint32() + m.NPrefixes = buf.DecodeUint32() + m.Prefixes = make([]IP6RaPrefixInfo, int(m.NPrefixes)) + for j0 := 0; j0 < len(m.Prefixes); j0++ { + m.Prefixes[j0].Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Prefixes[j0].Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Prefixes[j0].Prefix.Len = buf.DecodeUint8() + m.Prefixes[j0].Flags = buf.DecodeUint8() + m.Prefixes[j0].ValidTime = buf.DecodeUint32() + m.Prefixes[j0].PreferredTime = buf.DecodeUint32() + } + return nil +} + +// IP6ndProxyAddDel defines message 'ip6nd_proxy_add_del'. +type IP6ndProxyAddDel struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + IP ip_types.IP6Address `binapi:"ip6_address,name=ip" json:"ip,omitempty"` +} + +func (m *IP6ndProxyAddDel) Reset() { *m = IP6ndProxyAddDel{} } +func (*IP6ndProxyAddDel) GetMessageName() string { return "ip6nd_proxy_add_del" } +func (*IP6ndProxyAddDel) GetCrcString() string { return "3fdf6659" } +func (*IP6ndProxyAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IP6ndProxyAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.IsAdd + size += 1 * 16 // m.IP + return size +} +func (m *IP6ndProxyAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsAdd) + buf.EncodeBytes(m.IP[:], 16) + return buf.Bytes(), nil +} +func (m *IP6ndProxyAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsAdd = buf.DecodeBool() + copy(m.IP[:], buf.DecodeBytes(16)) + return nil +} + +// IP6ndProxyAddDelReply defines message 'ip6nd_proxy_add_del_reply'. +type IP6ndProxyAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IP6ndProxyAddDelReply) Reset() { *m = IP6ndProxyAddDelReply{} } +func (*IP6ndProxyAddDelReply) GetMessageName() string { return "ip6nd_proxy_add_del_reply" } +func (*IP6ndProxyAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*IP6ndProxyAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IP6ndProxyAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IP6ndProxyAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IP6ndProxyAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IP6ndProxyDetails defines message 'ip6nd_proxy_details'. +type IP6ndProxyDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IP ip_types.IP6Address `binapi:"ip6_address,name=ip" json:"ip,omitempty"` +} + +func (m *IP6ndProxyDetails) Reset() { *m = IP6ndProxyDetails{} } +func (*IP6ndProxyDetails) GetMessageName() string { return "ip6nd_proxy_details" } +func (*IP6ndProxyDetails) GetCrcString() string { return "d35be8ff" } +func (*IP6ndProxyDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IP6ndProxyDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 * 16 // m.IP + return size +} +func (m *IP6ndProxyDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBytes(m.IP[:], 16) + return buf.Bytes(), nil +} +func (m *IP6ndProxyDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + copy(m.IP[:], buf.DecodeBytes(16)) + return nil +} + +// IP6ndProxyDump defines message 'ip6nd_proxy_dump'. +type IP6ndProxyDump struct{} + +func (m *IP6ndProxyDump) Reset() { *m = IP6ndProxyDump{} } +func (*IP6ndProxyDump) GetMessageName() string { return "ip6nd_proxy_dump" } +func (*IP6ndProxyDump) GetCrcString() string { return "51077d14" } +func (*IP6ndProxyDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IP6ndProxyDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *IP6ndProxyDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *IP6ndProxyDump) Unmarshal(b []byte) error { + return nil +} + +// IP6ndSendRouterSolicitation defines message 'ip6nd_send_router_solicitation'. +type IP6ndSendRouterSolicitation struct { + Irt uint32 `binapi:"u32,name=irt" json:"irt,omitempty"` + Mrt uint32 `binapi:"u32,name=mrt" json:"mrt,omitempty"` + Mrc uint32 `binapi:"u32,name=mrc" json:"mrc,omitempty"` + Mrd uint32 `binapi:"u32,name=mrd" json:"mrd,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Stop bool `binapi:"bool,name=stop" json:"stop,omitempty"` +} + +func (m *IP6ndSendRouterSolicitation) Reset() { *m = IP6ndSendRouterSolicitation{} } +func (*IP6ndSendRouterSolicitation) GetMessageName() string { return "ip6nd_send_router_solicitation" } +func (*IP6ndSendRouterSolicitation) GetCrcString() string { return "e5de609c" } +func (*IP6ndSendRouterSolicitation) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IP6ndSendRouterSolicitation) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Irt + size += 4 // m.Mrt + size += 4 // m.Mrc + size += 4 // m.Mrd + size += 4 // m.SwIfIndex + size += 1 // m.Stop + return size +} +func (m *IP6ndSendRouterSolicitation) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Irt)) + buf.EncodeUint32(uint32(m.Mrt)) + buf.EncodeUint32(uint32(m.Mrc)) + buf.EncodeUint32(uint32(m.Mrd)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.Stop) + return buf.Bytes(), nil +} +func (m *IP6ndSendRouterSolicitation) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Irt = buf.DecodeUint32() + m.Mrt = buf.DecodeUint32() + m.Mrc = buf.DecodeUint32() + m.Mrd = buf.DecodeUint32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Stop = buf.DecodeBool() + return nil +} + +// IP6ndSendRouterSolicitationReply defines message 'ip6nd_send_router_solicitation_reply'. +type IP6ndSendRouterSolicitationReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IP6ndSendRouterSolicitationReply) Reset() { *m = IP6ndSendRouterSolicitationReply{} } +func (*IP6ndSendRouterSolicitationReply) GetMessageName() string { + return "ip6nd_send_router_solicitation_reply" +} +func (*IP6ndSendRouterSolicitationReply) GetCrcString() string { return "e8d4e804" } +func (*IP6ndSendRouterSolicitationReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IP6ndSendRouterSolicitationReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IP6ndSendRouterSolicitationReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IP6ndSendRouterSolicitationReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceIP6ndRaConfig defines message 'sw_interface_ip6nd_ra_config'. +type SwInterfaceIP6ndRaConfig struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Suppress uint8 `binapi:"u8,name=suppress" json:"suppress,omitempty"` + Managed uint8 `binapi:"u8,name=managed" json:"managed,omitempty"` + Other uint8 `binapi:"u8,name=other" json:"other,omitempty"` + LlOption uint8 `binapi:"u8,name=ll_option" json:"ll_option,omitempty"` + SendUnicast uint8 `binapi:"u8,name=send_unicast" json:"send_unicast,omitempty"` + Cease uint8 `binapi:"u8,name=cease" json:"cease,omitempty"` + IsNo bool `binapi:"bool,name=is_no" json:"is_no,omitempty"` + DefaultRouter uint8 `binapi:"u8,name=default_router" json:"default_router,omitempty"` + MaxInterval uint32 `binapi:"u32,name=max_interval" json:"max_interval,omitempty"` + MinInterval uint32 `binapi:"u32,name=min_interval" json:"min_interval,omitempty"` + Lifetime uint32 `binapi:"u32,name=lifetime" json:"lifetime,omitempty"` + InitialCount uint32 `binapi:"u32,name=initial_count" json:"initial_count,omitempty"` + InitialInterval uint32 `binapi:"u32,name=initial_interval" json:"initial_interval,omitempty"` +} + +func (m *SwInterfaceIP6ndRaConfig) Reset() { *m = SwInterfaceIP6ndRaConfig{} } +func (*SwInterfaceIP6ndRaConfig) GetMessageName() string { return "sw_interface_ip6nd_ra_config" } +func (*SwInterfaceIP6ndRaConfig) GetCrcString() string { return "3eb00b1c" } +func (*SwInterfaceIP6ndRaConfig) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceIP6ndRaConfig) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Suppress + size += 1 // m.Managed + size += 1 // m.Other + size += 1 // m.LlOption + size += 1 // m.SendUnicast + size += 1 // m.Cease + size += 1 // m.IsNo + size += 1 // m.DefaultRouter + size += 4 // m.MaxInterval + size += 4 // m.MinInterval + size += 4 // m.Lifetime + size += 4 // m.InitialCount + size += 4 // m.InitialInterval + return size +} +func (m *SwInterfaceIP6ndRaConfig) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.Suppress)) + buf.EncodeUint8(uint8(m.Managed)) + buf.EncodeUint8(uint8(m.Other)) + buf.EncodeUint8(uint8(m.LlOption)) + buf.EncodeUint8(uint8(m.SendUnicast)) + buf.EncodeUint8(uint8(m.Cease)) + buf.EncodeBool(m.IsNo) + buf.EncodeUint8(uint8(m.DefaultRouter)) + buf.EncodeUint32(uint32(m.MaxInterval)) + buf.EncodeUint32(uint32(m.MinInterval)) + buf.EncodeUint32(uint32(m.Lifetime)) + buf.EncodeUint32(uint32(m.InitialCount)) + buf.EncodeUint32(uint32(m.InitialInterval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceIP6ndRaConfig) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Suppress = buf.DecodeUint8() + m.Managed = buf.DecodeUint8() + m.Other = buf.DecodeUint8() + m.LlOption = buf.DecodeUint8() + m.SendUnicast = buf.DecodeUint8() + m.Cease = buf.DecodeUint8() + m.IsNo = buf.DecodeBool() + m.DefaultRouter = buf.DecodeUint8() + m.MaxInterval = buf.DecodeUint32() + m.MinInterval = buf.DecodeUint32() + m.Lifetime = buf.DecodeUint32() + m.InitialCount = buf.DecodeUint32() + m.InitialInterval = buf.DecodeUint32() + return nil +} + +// SwInterfaceIP6ndRaConfigReply defines message 'sw_interface_ip6nd_ra_config_reply'. +type SwInterfaceIP6ndRaConfigReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceIP6ndRaConfigReply) Reset() { *m = SwInterfaceIP6ndRaConfigReply{} } +func (*SwInterfaceIP6ndRaConfigReply) GetMessageName() string { + return "sw_interface_ip6nd_ra_config_reply" +} +func (*SwInterfaceIP6ndRaConfigReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceIP6ndRaConfigReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceIP6ndRaConfigReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceIP6ndRaConfigReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceIP6ndRaConfigReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceIP6ndRaPrefix defines message 'sw_interface_ip6nd_ra_prefix'. +type SwInterfaceIP6ndRaPrefix struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Prefix ip_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + UseDefault bool `binapi:"bool,name=use_default" json:"use_default,omitempty"` + NoAdvertise bool `binapi:"bool,name=no_advertise" json:"no_advertise,omitempty"` + OffLink bool `binapi:"bool,name=off_link" json:"off_link,omitempty"` + NoAutoconfig bool `binapi:"bool,name=no_autoconfig" json:"no_autoconfig,omitempty"` + NoOnlink bool `binapi:"bool,name=no_onlink" json:"no_onlink,omitempty"` + IsNo bool `binapi:"bool,name=is_no" json:"is_no,omitempty"` + ValLifetime uint32 `binapi:"u32,name=val_lifetime" json:"val_lifetime,omitempty"` + PrefLifetime uint32 `binapi:"u32,name=pref_lifetime" json:"pref_lifetime,omitempty"` +} + +func (m *SwInterfaceIP6ndRaPrefix) Reset() { *m = SwInterfaceIP6ndRaPrefix{} } +func (*SwInterfaceIP6ndRaPrefix) GetMessageName() string { return "sw_interface_ip6nd_ra_prefix" } +func (*SwInterfaceIP6ndRaPrefix) GetCrcString() string { return "e098785f" } +func (*SwInterfaceIP6ndRaPrefix) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceIP6ndRaPrefix) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Prefix.Address.Af + size += 1 * 16 // m.Prefix.Address.Un + size += 1 // m.Prefix.Len + size += 1 // m.UseDefault + size += 1 // m.NoAdvertise + size += 1 // m.OffLink + size += 1 // m.NoAutoconfig + size += 1 // m.NoOnlink + size += 1 // m.IsNo + size += 4 // m.ValLifetime + size += 4 // m.PrefLifetime + return size +} +func (m *SwInterfaceIP6ndRaPrefix) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.Prefix.Address.Af)) + buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Prefix.Len)) + buf.EncodeBool(m.UseDefault) + buf.EncodeBool(m.NoAdvertise) + buf.EncodeBool(m.OffLink) + buf.EncodeBool(m.NoAutoconfig) + buf.EncodeBool(m.NoOnlink) + buf.EncodeBool(m.IsNo) + buf.EncodeUint32(uint32(m.ValLifetime)) + buf.EncodeUint32(uint32(m.PrefLifetime)) + return buf.Bytes(), nil +} +func (m *SwInterfaceIP6ndRaPrefix) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Prefix.Len = buf.DecodeUint8() + m.UseDefault = buf.DecodeBool() + m.NoAdvertise = buf.DecodeBool() + m.OffLink = buf.DecodeBool() + m.NoAutoconfig = buf.DecodeBool() + m.NoOnlink = buf.DecodeBool() + m.IsNo = buf.DecodeBool() + m.ValLifetime = buf.DecodeUint32() + m.PrefLifetime = buf.DecodeUint32() + return nil +} + +// SwInterfaceIP6ndRaPrefixReply defines message 'sw_interface_ip6nd_ra_prefix_reply'. +type SwInterfaceIP6ndRaPrefixReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceIP6ndRaPrefixReply) Reset() { *m = SwInterfaceIP6ndRaPrefixReply{} } +func (*SwInterfaceIP6ndRaPrefixReply) GetMessageName() string { + return "sw_interface_ip6nd_ra_prefix_reply" +} +func (*SwInterfaceIP6ndRaPrefixReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceIP6ndRaPrefixReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceIP6ndRaPrefixReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceIP6ndRaPrefixReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceIP6ndRaPrefixReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// WantIP6RaEvents defines message 'want_ip6_ra_events'. +type WantIP6RaEvents struct { + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` +} + +func (m *WantIP6RaEvents) Reset() { *m = WantIP6RaEvents{} } +func (*WantIP6RaEvents) GetMessageName() string { return "want_ip6_ra_events" } +func (*WantIP6RaEvents) GetCrcString() string { return "3ec6d6c2" } +func (*WantIP6RaEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WantIP6RaEvents) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Enable + size += 4 // m.PID + return size +} +func (m *WantIP6RaEvents) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.Enable) + buf.EncodeUint32(uint32(m.PID)) + return buf.Bytes(), nil +} +func (m *WantIP6RaEvents) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Enable = buf.DecodeBool() + m.PID = buf.DecodeUint32() + return nil +} + +// WantIP6RaEventsReply defines message 'want_ip6_ra_events_reply'. +type WantIP6RaEventsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WantIP6RaEventsReply) Reset() { *m = WantIP6RaEventsReply{} } +func (*WantIP6RaEventsReply) GetMessageName() string { return "want_ip6_ra_events_reply" } +func (*WantIP6RaEventsReply) GetCrcString() string { return "e8d4e804" } +func (*WantIP6RaEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WantIP6RaEventsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *WantIP6RaEventsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *WantIP6RaEventsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_ip6_nd_binapi_init() } +func file_ip6_nd_binapi_init() { + api.RegisterMessage((*IP6RaEvent)(nil), "ip6_ra_event_47e8cfbe") + api.RegisterMessage((*IP6ndProxyAddDel)(nil), "ip6nd_proxy_add_del_3fdf6659") + api.RegisterMessage((*IP6ndProxyAddDelReply)(nil), "ip6nd_proxy_add_del_reply_e8d4e804") + api.RegisterMessage((*IP6ndProxyDetails)(nil), "ip6nd_proxy_details_d35be8ff") + api.RegisterMessage((*IP6ndProxyDump)(nil), "ip6nd_proxy_dump_51077d14") + api.RegisterMessage((*IP6ndSendRouterSolicitation)(nil), "ip6nd_send_router_solicitation_e5de609c") + api.RegisterMessage((*IP6ndSendRouterSolicitationReply)(nil), "ip6nd_send_router_solicitation_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceIP6ndRaConfig)(nil), "sw_interface_ip6nd_ra_config_3eb00b1c") + api.RegisterMessage((*SwInterfaceIP6ndRaConfigReply)(nil), "sw_interface_ip6nd_ra_config_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceIP6ndRaPrefix)(nil), "sw_interface_ip6nd_ra_prefix_e098785f") + api.RegisterMessage((*SwInterfaceIP6ndRaPrefixReply)(nil), "sw_interface_ip6nd_ra_prefix_reply_e8d4e804") + api.RegisterMessage((*WantIP6RaEvents)(nil), "want_ip6_ra_events_3ec6d6c2") + api.RegisterMessage((*WantIP6RaEventsReply)(nil), "want_ip6_ra_events_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*IP6RaEvent)(nil), + (*IP6ndProxyAddDel)(nil), + (*IP6ndProxyAddDelReply)(nil), + (*IP6ndProxyDetails)(nil), + (*IP6ndProxyDump)(nil), + (*IP6ndSendRouterSolicitation)(nil), + (*IP6ndSendRouterSolicitationReply)(nil), + (*SwInterfaceIP6ndRaConfig)(nil), + (*SwInterfaceIP6ndRaConfigReply)(nil), + (*SwInterfaceIP6ndRaPrefix)(nil), + (*SwInterfaceIP6ndRaPrefixReply)(nil), + (*WantIP6RaEvents)(nil), + (*WantIP6RaEventsReply)(nil), + } +} diff --git a/binapi/ip6_nd/ip6_nd_rest.ba.go b/binapi/ip6_nd/ip6_nd_rest.ba.go new file mode 100644 index 0000000..2bd060d --- /dev/null +++ b/binapi/ip6_nd/ip6_nd_rest.ba.go @@ -0,0 +1,129 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ip6_nd + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/ip6nd_proxy_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(IP6ndProxyAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IP6ndProxyAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ip6nd_send_router_solicitation", func(w http.ResponseWriter, req *http.Request) { + var request = new(IP6ndSendRouterSolicitation) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IP6ndSendRouterSolicitation(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_ip6nd_ra_config", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceIP6ndRaConfig) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceIP6ndRaConfig(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_ip6nd_ra_prefix", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceIP6ndRaPrefix) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceIP6ndRaPrefix(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/want_ip6_ra_events", func(w http.ResponseWriter, req *http.Request) { + var request = new(WantIP6RaEvents) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.WantIP6RaEvents(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/ip6_nd/ip6_nd_rpc.ba.go b/binapi/ip6_nd/ip6_nd_rpc.ba.go new file mode 100644 index 0000000..3bfbac0 --- /dev/null +++ b/binapi/ip6_nd/ip6_nd_rpc.ba.go @@ -0,0 +1,113 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ip6_nd + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service ip6_nd. +type RPCService interface { + IP6ndProxyAddDel(ctx context.Context, in *IP6ndProxyAddDel) (*IP6ndProxyAddDelReply, error) + IP6ndProxyDump(ctx context.Context, in *IP6ndProxyDump) (RPCService_IP6ndProxyDumpClient, error) + IP6ndSendRouterSolicitation(ctx context.Context, in *IP6ndSendRouterSolicitation) (*IP6ndSendRouterSolicitationReply, error) + SwInterfaceIP6ndRaConfig(ctx context.Context, in *SwInterfaceIP6ndRaConfig) (*SwInterfaceIP6ndRaConfigReply, error) + SwInterfaceIP6ndRaPrefix(ctx context.Context, in *SwInterfaceIP6ndRaPrefix) (*SwInterfaceIP6ndRaPrefixReply, error) + WantIP6RaEvents(ctx context.Context, in *WantIP6RaEvents) (*WantIP6RaEventsReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) IP6ndProxyAddDel(ctx context.Context, in *IP6ndProxyAddDel) (*IP6ndProxyAddDelReply, error) { + out := new(IP6ndProxyAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IP6ndProxyDump(ctx context.Context, in *IP6ndProxyDump) (RPCService_IP6ndProxyDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IP6ndProxyDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IP6ndProxyDumpClient interface { + Recv() (*IP6ndProxyDetails, error) + api.Stream +} + +type serviceClient_IP6ndProxyDumpClient struct { + api.Stream +} + +func (c *serviceClient_IP6ndProxyDumpClient) Recv() (*IP6ndProxyDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IP6ndProxyDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IP6ndSendRouterSolicitation(ctx context.Context, in *IP6ndSendRouterSolicitation) (*IP6ndSendRouterSolicitationReply, error) { + out := new(IP6ndSendRouterSolicitationReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceIP6ndRaConfig(ctx context.Context, in *SwInterfaceIP6ndRaConfig) (*SwInterfaceIP6ndRaConfigReply, error) { + out := new(SwInterfaceIP6ndRaConfigReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceIP6ndRaPrefix(ctx context.Context, in *SwInterfaceIP6ndRaPrefix) (*SwInterfaceIP6ndRaPrefixReply, error) { + out := new(SwInterfaceIP6ndRaPrefixReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantIP6RaEvents(ctx context.Context, in *WantIP6RaEvents) (*WantIP6RaEventsReply, error) { + out := new(WantIP6RaEventsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/ip_neighbor/ip_neighbor.ba.go b/binapi/ip_neighbor/ip_neighbor.ba.go new file mode 100644 index 0000000..60df4cc --- /dev/null +++ b/binapi/ip_neighbor/ip_neighbor.ba.go @@ -0,0 +1,747 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/ip_neighbor.api.json + +// Package ip_neighbor contains generated bindings for API file ip_neighbor.api. +// +// Contents: +// 1 enum +// 1 struct +// 15 messages +// +package ip_neighbor + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "ip_neighbor" + APIVersion = "1.0.0" + VersionCrc = 0xe6512b94 +) + +// IPNeighborFlags defines enum 'ip_neighbor_flags'. +type IPNeighborFlags uint8 + +const ( + IP_API_NEIGHBOR_FLAG_NONE IPNeighborFlags = 0 + IP_API_NEIGHBOR_FLAG_STATIC IPNeighborFlags = 1 + IP_API_NEIGHBOR_FLAG_NO_FIB_ENTRY IPNeighborFlags = 2 +) + +var ( + IPNeighborFlags_name = map[uint8]string{ + 0: "IP_API_NEIGHBOR_FLAG_NONE", + 1: "IP_API_NEIGHBOR_FLAG_STATIC", + 2: "IP_API_NEIGHBOR_FLAG_NO_FIB_ENTRY", + } + IPNeighborFlags_value = map[string]uint8{ + "IP_API_NEIGHBOR_FLAG_NONE": 0, + "IP_API_NEIGHBOR_FLAG_STATIC": 1, + "IP_API_NEIGHBOR_FLAG_NO_FIB_ENTRY": 2, + } +) + +func (x IPNeighborFlags) String() string { + s, ok := IPNeighborFlags_name[uint8(x)] + if ok { + return s + } + str := func(n uint8) string { + s, ok := IPNeighborFlags_name[uint8(n)] + if ok { + return s + } + return "IPNeighborFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint8(0); i <= 8; i++ { + val := uint8(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint8(x)) + } + return s +} + +// IPNeighbor defines type 'ip_neighbor'. +type IPNeighbor struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Flags IPNeighborFlags `binapi:"ip_neighbor_flags,name=flags" json:"flags,omitempty"` + MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` + IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"` +} + +// IPNeighborAddDel defines message 'ip_neighbor_add_del'. +type IPNeighborAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Neighbor IPNeighbor `binapi:"ip_neighbor,name=neighbor" json:"neighbor,omitempty"` +} + +func (m *IPNeighborAddDel) Reset() { *m = IPNeighborAddDel{} } +func (*IPNeighborAddDel) GetMessageName() string { return "ip_neighbor_add_del" } +func (*IPNeighborAddDel) GetCrcString() string { return "105518b6" } +func (*IPNeighborAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPNeighborAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Neighbor.SwIfIndex + size += 1 // m.Neighbor.Flags + size += 1 * 6 // m.Neighbor.MacAddress + size += 1 // m.Neighbor.IPAddress.Af + size += 1 * 16 // m.Neighbor.IPAddress.Un + return size +} +func (m *IPNeighborAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Neighbor.SwIfIndex)) + buf.EncodeUint8(uint8(m.Neighbor.Flags)) + buf.EncodeBytes(m.Neighbor.MacAddress[:], 6) + buf.EncodeUint8(uint8(m.Neighbor.IPAddress.Af)) + buf.EncodeBytes(m.Neighbor.IPAddress.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *IPNeighborAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Neighbor.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Neighbor.Flags = IPNeighborFlags(buf.DecodeUint8()) + copy(m.Neighbor.MacAddress[:], buf.DecodeBytes(6)) + m.Neighbor.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Neighbor.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// IPNeighborAddDelReply defines message 'ip_neighbor_add_del_reply'. +type IPNeighborAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` +} + +func (m *IPNeighborAddDelReply) Reset() { *m = IPNeighborAddDelReply{} } +func (*IPNeighborAddDelReply) GetMessageName() string { return "ip_neighbor_add_del_reply" } +func (*IPNeighborAddDelReply) GetCrcString() string { return "1992deab" } +func (*IPNeighborAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPNeighborAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.StatsIndex + return size +} +func (m *IPNeighborAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.StatsIndex)) + return buf.Bytes(), nil +} +func (m *IPNeighborAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.StatsIndex = buf.DecodeUint32() + return nil +} + +// IPNeighborConfig defines message 'ip_neighbor_config'. +type IPNeighborConfig struct { + Af ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + MaxNumber uint32 `binapi:"u32,name=max_number" json:"max_number,omitempty"` + MaxAge uint32 `binapi:"u32,name=max_age" json:"max_age,omitempty"` + Recycle bool `binapi:"bool,name=recycle" json:"recycle,omitempty"` +} + +func (m *IPNeighborConfig) Reset() { *m = IPNeighborConfig{} } +func (*IPNeighborConfig) GetMessageName() string { return "ip_neighbor_config" } +func (*IPNeighborConfig) GetCrcString() string { return "f4a5cf44" } +func (*IPNeighborConfig) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPNeighborConfig) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Af + size += 4 // m.MaxNumber + size += 4 // m.MaxAge + size += 1 // m.Recycle + return size +} +func (m *IPNeighborConfig) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Af)) + buf.EncodeUint32(uint32(m.MaxNumber)) + buf.EncodeUint32(uint32(m.MaxAge)) + buf.EncodeBool(m.Recycle) + return buf.Bytes(), nil +} +func (m *IPNeighborConfig) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Af = ip_types.AddressFamily(buf.DecodeUint8()) + m.MaxNumber = buf.DecodeUint32() + m.MaxAge = buf.DecodeUint32() + m.Recycle = buf.DecodeBool() + return nil +} + +// IPNeighborConfigReply defines message 'ip_neighbor_config_reply'. +type IPNeighborConfigReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPNeighborConfigReply) Reset() { *m = IPNeighborConfigReply{} } +func (*IPNeighborConfigReply) GetMessageName() string { return "ip_neighbor_config_reply" } +func (*IPNeighborConfigReply) GetCrcString() string { return "e8d4e804" } +func (*IPNeighborConfigReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPNeighborConfigReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IPNeighborConfigReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IPNeighborConfigReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IPNeighborDetails defines message 'ip_neighbor_details'. +type IPNeighborDetails struct { + Age float64 `binapi:"f64,name=age" json:"age,omitempty"` + Neighbor IPNeighbor `binapi:"ip_neighbor,name=neighbor" json:"neighbor,omitempty"` +} + +func (m *IPNeighborDetails) Reset() { *m = IPNeighborDetails{} } +func (*IPNeighborDetails) GetMessageName() string { return "ip_neighbor_details" } +func (*IPNeighborDetails) GetCrcString() string { return "870e80b9" } +func (*IPNeighborDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPNeighborDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 8 // m.Age + size += 4 // m.Neighbor.SwIfIndex + size += 1 // m.Neighbor.Flags + size += 1 * 6 // m.Neighbor.MacAddress + size += 1 // m.Neighbor.IPAddress.Af + size += 1 * 16 // m.Neighbor.IPAddress.Un + return size +} +func (m *IPNeighborDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeFloat64(float64(m.Age)) + buf.EncodeUint32(uint32(m.Neighbor.SwIfIndex)) + buf.EncodeUint8(uint8(m.Neighbor.Flags)) + buf.EncodeBytes(m.Neighbor.MacAddress[:], 6) + buf.EncodeUint8(uint8(m.Neighbor.IPAddress.Af)) + buf.EncodeBytes(m.Neighbor.IPAddress.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *IPNeighborDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Age = float64(buf.DecodeFloat64()) + m.Neighbor.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Neighbor.Flags = IPNeighborFlags(buf.DecodeUint8()) + copy(m.Neighbor.MacAddress[:], buf.DecodeBytes(6)) + m.Neighbor.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Neighbor.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// IPNeighborDump defines message 'ip_neighbor_dump'. +type IPNeighborDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"` + Af ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` +} + +func (m *IPNeighborDump) Reset() { *m = IPNeighborDump{} } +func (*IPNeighborDump) GetMessageName() string { return "ip_neighbor_dump" } +func (*IPNeighborDump) GetCrcString() string { return "cd831298" } +func (*IPNeighborDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPNeighborDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Af + return size +} +func (m *IPNeighborDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.Af)) + return buf.Bytes(), nil +} +func (m *IPNeighborDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Af = ip_types.AddressFamily(buf.DecodeUint8()) + return nil +} + +// IPNeighborEvent defines message 'ip_neighbor_event'. +type IPNeighborEvent struct { + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + Neighbor IPNeighbor `binapi:"ip_neighbor,name=neighbor" json:"neighbor,omitempty"` +} + +func (m *IPNeighborEvent) Reset() { *m = IPNeighborEvent{} } +func (*IPNeighborEvent) GetMessageName() string { return "ip_neighbor_event" } +func (*IPNeighborEvent) GetCrcString() string { return "83933131" } +func (*IPNeighborEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +func (m *IPNeighborEvent) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.PID + size += 4 // m.Neighbor.SwIfIndex + size += 1 // m.Neighbor.Flags + size += 1 * 6 // m.Neighbor.MacAddress + size += 1 // m.Neighbor.IPAddress.Af + size += 1 * 16 // m.Neighbor.IPAddress.Un + return size +} +func (m *IPNeighborEvent) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.PID)) + buf.EncodeUint32(uint32(m.Neighbor.SwIfIndex)) + buf.EncodeUint8(uint8(m.Neighbor.Flags)) + buf.EncodeBytes(m.Neighbor.MacAddress[:], 6) + buf.EncodeUint8(uint8(m.Neighbor.IPAddress.Af)) + buf.EncodeBytes(m.Neighbor.IPAddress.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *IPNeighborEvent) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PID = buf.DecodeUint32() + m.Neighbor.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Neighbor.Flags = IPNeighborFlags(buf.DecodeUint8()) + copy(m.Neighbor.MacAddress[:], buf.DecodeBytes(6)) + m.Neighbor.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Neighbor.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// IPNeighborFlush defines message 'ip_neighbor_flush'. +type IPNeighborFlush struct { + Af ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"` +} + +func (m *IPNeighborFlush) Reset() { *m = IPNeighborFlush{} } +func (*IPNeighborFlush) GetMessageName() string { return "ip_neighbor_flush" } +func (*IPNeighborFlush) GetCrcString() string { return "16aa35d2" } +func (*IPNeighborFlush) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPNeighborFlush) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Af + size += 4 // m.SwIfIndex + return size +} +func (m *IPNeighborFlush) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Af)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *IPNeighborFlush) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Af = ip_types.AddressFamily(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// IPNeighborFlushReply defines message 'ip_neighbor_flush_reply'. +type IPNeighborFlushReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPNeighborFlushReply) Reset() { *m = IPNeighborFlushReply{} } +func (*IPNeighborFlushReply) GetMessageName() string { return "ip_neighbor_flush_reply" } +func (*IPNeighborFlushReply) GetCrcString() string { return "e8d4e804" } +func (*IPNeighborFlushReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPNeighborFlushReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IPNeighborFlushReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IPNeighborFlushReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IPNeighborReplaceBegin defines message 'ip_neighbor_replace_begin'. +type IPNeighborReplaceBegin struct{} + +func (m *IPNeighborReplaceBegin) Reset() { *m = IPNeighborReplaceBegin{} } +func (*IPNeighborReplaceBegin) GetMessageName() string { return "ip_neighbor_replace_begin" } +func (*IPNeighborReplaceBegin) GetCrcString() string { return "51077d14" } +func (*IPNeighborReplaceBegin) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPNeighborReplaceBegin) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *IPNeighborReplaceBegin) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *IPNeighborReplaceBegin) Unmarshal(b []byte) error { + return nil +} + +// IPNeighborReplaceBeginReply defines message 'ip_neighbor_replace_begin_reply'. +type IPNeighborReplaceBeginReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPNeighborReplaceBeginReply) Reset() { *m = IPNeighborReplaceBeginReply{} } +func (*IPNeighborReplaceBeginReply) GetMessageName() string { return "ip_neighbor_replace_begin_reply" } +func (*IPNeighborReplaceBeginReply) GetCrcString() string { return "e8d4e804" } +func (*IPNeighborReplaceBeginReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPNeighborReplaceBeginReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IPNeighborReplaceBeginReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IPNeighborReplaceBeginReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IPNeighborReplaceEnd defines message 'ip_neighbor_replace_end'. +type IPNeighborReplaceEnd struct{} + +func (m *IPNeighborReplaceEnd) Reset() { *m = IPNeighborReplaceEnd{} } +func (*IPNeighborReplaceEnd) GetMessageName() string { return "ip_neighbor_replace_end" } +func (*IPNeighborReplaceEnd) GetCrcString() string { return "51077d14" } +func (*IPNeighborReplaceEnd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPNeighborReplaceEnd) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *IPNeighborReplaceEnd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *IPNeighborReplaceEnd) Unmarshal(b []byte) error { + return nil +} + +// IPNeighborReplaceEndReply defines message 'ip_neighbor_replace_end_reply'. +type IPNeighborReplaceEndReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPNeighborReplaceEndReply) Reset() { *m = IPNeighborReplaceEndReply{} } +func (*IPNeighborReplaceEndReply) GetMessageName() string { return "ip_neighbor_replace_end_reply" } +func (*IPNeighborReplaceEndReply) GetCrcString() string { return "e8d4e804" } +func (*IPNeighborReplaceEndReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPNeighborReplaceEndReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IPNeighborReplaceEndReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IPNeighborReplaceEndReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// WantIPNeighborEvents defines message 'want_ip_neighbor_events'. +type WantIPNeighborEvents struct { + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + IP ip_types.Address `binapi:"address,name=ip" json:"ip,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"` +} + +func (m *WantIPNeighborEvents) Reset() { *m = WantIPNeighborEvents{} } +func (*WantIPNeighborEvents) GetMessageName() string { return "want_ip_neighbor_events" } +func (*WantIPNeighborEvents) GetCrcString() string { return "1a312870" } +func (*WantIPNeighborEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WantIPNeighborEvents) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Enable + size += 4 // m.PID + size += 1 // m.IP.Af + size += 1 * 16 // m.IP.Un + size += 4 // m.SwIfIndex + return size +} +func (m *WantIPNeighborEvents) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.Enable) + buf.EncodeUint32(uint32(m.PID)) + buf.EncodeUint8(uint8(m.IP.Af)) + buf.EncodeBytes(m.IP.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *WantIPNeighborEvents) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Enable = buf.DecodeBool() + m.PID = buf.DecodeUint32() + m.IP.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.IP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// WantIPNeighborEventsReply defines message 'want_ip_neighbor_events_reply'. +type WantIPNeighborEventsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WantIPNeighborEventsReply) Reset() { *m = WantIPNeighborEventsReply{} } +func (*WantIPNeighborEventsReply) GetMessageName() string { return "want_ip_neighbor_events_reply" } +func (*WantIPNeighborEventsReply) GetCrcString() string { return "e8d4e804" } +func (*WantIPNeighborEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WantIPNeighborEventsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *WantIPNeighborEventsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *WantIPNeighborEventsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_ip_neighbor_binapi_init() } +func file_ip_neighbor_binapi_init() { + api.RegisterMessage((*IPNeighborAddDel)(nil), "ip_neighbor_add_del_105518b6") + api.RegisterMessage((*IPNeighborAddDelReply)(nil), "ip_neighbor_add_del_reply_1992deab") + api.RegisterMessage((*IPNeighborConfig)(nil), "ip_neighbor_config_f4a5cf44") + api.RegisterMessage((*IPNeighborConfigReply)(nil), "ip_neighbor_config_reply_e8d4e804") + api.RegisterMessage((*IPNeighborDetails)(nil), "ip_neighbor_details_870e80b9") + api.RegisterMessage((*IPNeighborDump)(nil), "ip_neighbor_dump_cd831298") + api.RegisterMessage((*IPNeighborEvent)(nil), "ip_neighbor_event_83933131") + api.RegisterMessage((*IPNeighborFlush)(nil), "ip_neighbor_flush_16aa35d2") + api.RegisterMessage((*IPNeighborFlushReply)(nil), "ip_neighbor_flush_reply_e8d4e804") + api.RegisterMessage((*IPNeighborReplaceBegin)(nil), "ip_neighbor_replace_begin_51077d14") + api.RegisterMessage((*IPNeighborReplaceBeginReply)(nil), "ip_neighbor_replace_begin_reply_e8d4e804") + api.RegisterMessage((*IPNeighborReplaceEnd)(nil), "ip_neighbor_replace_end_51077d14") + api.RegisterMessage((*IPNeighborReplaceEndReply)(nil), "ip_neighbor_replace_end_reply_e8d4e804") + api.RegisterMessage((*WantIPNeighborEvents)(nil), "want_ip_neighbor_events_1a312870") + api.RegisterMessage((*WantIPNeighborEventsReply)(nil), "want_ip_neighbor_events_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*IPNeighborAddDel)(nil), + (*IPNeighborAddDelReply)(nil), + (*IPNeighborConfig)(nil), + (*IPNeighborConfigReply)(nil), + (*IPNeighborDetails)(nil), + (*IPNeighborDump)(nil), + (*IPNeighborEvent)(nil), + (*IPNeighborFlush)(nil), + (*IPNeighborFlushReply)(nil), + (*IPNeighborReplaceBegin)(nil), + (*IPNeighborReplaceBeginReply)(nil), + (*IPNeighborReplaceEnd)(nil), + (*IPNeighborReplaceEndReply)(nil), + (*WantIPNeighborEvents)(nil), + (*WantIPNeighborEventsReply)(nil), + } +} diff --git a/binapi/ip_neighbor/ip_neighbor_rest.ba.go b/binapi/ip_neighbor/ip_neighbor_rest.ba.go new file mode 100644 index 0000000..7db4694 --- /dev/null +++ b/binapi/ip_neighbor/ip_neighbor_rest.ba.go @@ -0,0 +1,134 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ip_neighbor + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/ip_neighbor_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(IPNeighborAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IPNeighborAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ip_neighbor_config", func(w http.ResponseWriter, req *http.Request) { + var request = new(IPNeighborConfig) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IPNeighborConfig(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ip_neighbor_flush", func(w http.ResponseWriter, req *http.Request) { + var request = new(IPNeighborFlush) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IPNeighborFlush(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ip_neighbor_replace_begin", func(w http.ResponseWriter, req *http.Request) { + var request = new(IPNeighborReplaceBegin) + reply, err := rpc.IPNeighborReplaceBegin(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ip_neighbor_replace_end", func(w http.ResponseWriter, req *http.Request) { + var request = new(IPNeighborReplaceEnd) + reply, err := rpc.IPNeighborReplaceEnd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/want_ip_neighbor_events", func(w http.ResponseWriter, req *http.Request) { + var request = new(WantIPNeighborEvents) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.WantIPNeighborEvents(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/ip_neighbor/ip_neighbor_rpc.ba.go b/binapi/ip_neighbor/ip_neighbor_rpc.ba.go new file mode 100644 index 0000000..86589dd --- /dev/null +++ b/binapi/ip_neighbor/ip_neighbor_rpc.ba.go @@ -0,0 +1,123 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ip_neighbor + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service ip_neighbor. +type RPCService interface { + IPNeighborAddDel(ctx context.Context, in *IPNeighborAddDel) (*IPNeighborAddDelReply, error) + IPNeighborConfig(ctx context.Context, in *IPNeighborConfig) (*IPNeighborConfigReply, error) + IPNeighborDump(ctx context.Context, in *IPNeighborDump) (RPCService_IPNeighborDumpClient, error) + IPNeighborFlush(ctx context.Context, in *IPNeighborFlush) (*IPNeighborFlushReply, error) + IPNeighborReplaceBegin(ctx context.Context, in *IPNeighborReplaceBegin) (*IPNeighborReplaceBeginReply, error) + IPNeighborReplaceEnd(ctx context.Context, in *IPNeighborReplaceEnd) (*IPNeighborReplaceEndReply, error) + WantIPNeighborEvents(ctx context.Context, in *WantIPNeighborEvents) (*WantIPNeighborEventsReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) IPNeighborAddDel(ctx context.Context, in *IPNeighborAddDel) (*IPNeighborAddDelReply, error) { + out := new(IPNeighborAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPNeighborConfig(ctx context.Context, in *IPNeighborConfig) (*IPNeighborConfigReply, error) { + out := new(IPNeighborConfigReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPNeighborDump(ctx context.Context, in *IPNeighborDump) (RPCService_IPNeighborDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IPNeighborDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IPNeighborDumpClient interface { + Recv() (*IPNeighborDetails, error) + api.Stream +} + +type serviceClient_IPNeighborDumpClient struct { + api.Stream +} + +func (c *serviceClient_IPNeighborDumpClient) Recv() (*IPNeighborDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IPNeighborDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IPNeighborFlush(ctx context.Context, in *IPNeighborFlush) (*IPNeighborFlushReply, error) { + out := new(IPNeighborFlushReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPNeighborReplaceBegin(ctx context.Context, in *IPNeighborReplaceBegin) (*IPNeighborReplaceBeginReply, error) { + out := new(IPNeighborReplaceBeginReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPNeighborReplaceEnd(ctx context.Context, in *IPNeighborReplaceEnd) (*IPNeighborReplaceEndReply, error) { + out := new(IPNeighborReplaceEndReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantIPNeighborEvents(ctx context.Context, in *WantIPNeighborEvents) (*WantIPNeighborEventsReply, error) { + out := new(WantIPNeighborEventsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/ip_types/ip_types.ba.go b/binapi/ip_types/ip_types.ba.go new file mode 100644 index 0000000..b9ddb27 --- /dev/null +++ b/binapi/ip_types/ip_types.ba.go @@ -0,0 +1,592 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/ip_types.api.json + +// Package ip_types contains generated bindings for API file ip_types.api. +// +// Contents: +// 5 aliases +// 4 enums +// 6 structs +// 1 union +// +package ip_types + +import ( + "fmt" + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" + "net" + "strconv" + "strings" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +// AddressFamily defines enum 'address_family'. +type AddressFamily uint8 + +const ( + ADDRESS_IP4 AddressFamily = 0 + ADDRESS_IP6 AddressFamily = 1 +) + +var ( + AddressFamily_name = map[uint8]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", + } + AddressFamily_value = map[string]uint8{ + "ADDRESS_IP4": 0, + "ADDRESS_IP6": 1, + } +) + +func (x AddressFamily) String() string { + s, ok := AddressFamily_name[uint8(x)] + if ok { + return s + } + return "AddressFamily(" + strconv.Itoa(int(x)) + ")" +} + +// IPDscp defines enum 'ip_dscp'. +type IPDscp uint8 + +const ( + IP_API_DSCP_CS0 IPDscp = 0 + IP_API_DSCP_CS1 IPDscp = 8 + IP_API_DSCP_AF11 IPDscp = 10 + IP_API_DSCP_AF12 IPDscp = 12 + IP_API_DSCP_AF13 IPDscp = 14 + IP_API_DSCP_CS2 IPDscp = 16 + IP_API_DSCP_AF21 IPDscp = 18 + IP_API_DSCP_AF22 IPDscp = 20 + IP_API_DSCP_AF23 IPDscp = 22 + IP_API_DSCP_CS3 IPDscp = 24 + IP_API_DSCP_AF31 IPDscp = 26 + IP_API_DSCP_AF32 IPDscp = 28 + IP_API_DSCP_AF33 IPDscp = 30 + IP_API_DSCP_CS4 IPDscp = 32 + IP_API_DSCP_AF41 IPDscp = 34 + IP_API_DSCP_AF42 IPDscp = 36 + IP_API_DSCP_AF43 IPDscp = 38 + IP_API_DSCP_CS5 IPDscp = 40 + IP_API_DSCP_EF IPDscp = 46 + IP_API_DSCP_CS6 IPDscp = 48 + IP_API_DSCP_CS7 IPDscp = 50 +) + +var ( + IPDscp_name = map[uint8]string{ + 0: "IP_API_DSCP_CS0", + 8: "IP_API_DSCP_CS1", + 10: "IP_API_DSCP_AF11", + 12: "IP_API_DSCP_AF12", + 14: "IP_API_DSCP_AF13", + 16: "IP_API_DSCP_CS2", + 18: "IP_API_DSCP_AF21", + 20: "IP_API_DSCP_AF22", + 22: "IP_API_DSCP_AF23", + 24: "IP_API_DSCP_CS3", + 26: "IP_API_DSCP_AF31", + 28: "IP_API_DSCP_AF32", + 30: "IP_API_DSCP_AF33", + 32: "IP_API_DSCP_CS4", + 34: "IP_API_DSCP_AF41", + 36: "IP_API_DSCP_AF42", + 38: "IP_API_DSCP_AF43", + 40: "IP_API_DSCP_CS5", + 46: "IP_API_DSCP_EF", + 48: "IP_API_DSCP_CS6", + 50: "IP_API_DSCP_CS7", + } + IPDscp_value = map[string]uint8{ + "IP_API_DSCP_CS0": 0, + "IP_API_DSCP_CS1": 8, + "IP_API_DSCP_AF11": 10, + "IP_API_DSCP_AF12": 12, + "IP_API_DSCP_AF13": 14, + "IP_API_DSCP_CS2": 16, + "IP_API_DSCP_AF21": 18, + "IP_API_DSCP_AF22": 20, + "IP_API_DSCP_AF23": 22, + "IP_API_DSCP_CS3": 24, + "IP_API_DSCP_AF31": 26, + "IP_API_DSCP_AF32": 28, + "IP_API_DSCP_AF33": 30, + "IP_API_DSCP_CS4": 32, + "IP_API_DSCP_AF41": 34, + "IP_API_DSCP_AF42": 36, + "IP_API_DSCP_AF43": 38, + "IP_API_DSCP_CS5": 40, + "IP_API_DSCP_EF": 46, + "IP_API_DSCP_CS6": 48, + "IP_API_DSCP_CS7": 50, + } +) + +func (x IPDscp) String() string { + s, ok := IPDscp_name[uint8(x)] + if ok { + return s + } + return "IPDscp(" + strconv.Itoa(int(x)) + ")" +} + +// IPEcn defines enum 'ip_ecn'. +type IPEcn uint8 + +const ( + IP_API_ECN_NONE IPEcn = 0 + IP_API_ECN_ECT0 IPEcn = 1 + IP_API_ECN_ECT1 IPEcn = 2 + IP_API_ECN_CE IPEcn = 3 +) + +var ( + IPEcn_name = map[uint8]string{ + 0: "IP_API_ECN_NONE", + 1: "IP_API_ECN_ECT0", + 2: "IP_API_ECN_ECT1", + 3: "IP_API_ECN_CE", + } + IPEcn_value = map[string]uint8{ + "IP_API_ECN_NONE": 0, + "IP_API_ECN_ECT0": 1, + "IP_API_ECN_ECT1": 2, + "IP_API_ECN_CE": 3, + } +) + +func (x IPEcn) String() string { + s, ok := IPEcn_name[uint8(x)] + if ok { + return s + } + return "IPEcn(" + strconv.Itoa(int(x)) + ")" +} + +// IPProto defines enum 'ip_proto'. +type IPProto uint8 + +const ( + IP_API_PROTO_HOPOPT IPProto = 0 + IP_API_PROTO_ICMP IPProto = 1 + IP_API_PROTO_IGMP IPProto = 2 + IP_API_PROTO_TCP IPProto = 6 + IP_API_PROTO_UDP IPProto = 17 + IP_API_PROTO_GRE IPProto = 47 + IP_API_PROTO_ESP IPProto = 50 + IP_API_PROTO_AH IPProto = 51 + IP_API_PROTO_ICMP6 IPProto = 58 + IP_API_PROTO_EIGRP IPProto = 88 + IP_API_PROTO_OSPF IPProto = 89 + IP_API_PROTO_SCTP IPProto = 132 + IP_API_PROTO_RESERVED IPProto = 255 +) + +var ( + IPProto_name = map[uint8]string{ + 0: "IP_API_PROTO_HOPOPT", + 1: "IP_API_PROTO_ICMP", + 2: "IP_API_PROTO_IGMP", + 6: "IP_API_PROTO_TCP", + 17: "IP_API_PROTO_UDP", + 47: "IP_API_PROTO_GRE", + 50: "IP_API_PROTO_ESP", + 51: "IP_API_PROTO_AH", + 58: "IP_API_PROTO_ICMP6", + 88: "IP_API_PROTO_EIGRP", + 89: "IP_API_PROTO_OSPF", + 132: "IP_API_PROTO_SCTP", + 255: "IP_API_PROTO_RESERVED", + } + IPProto_value = map[string]uint8{ + "IP_API_PROTO_HOPOPT": 0, + "IP_API_PROTO_ICMP": 1, + "IP_API_PROTO_IGMP": 2, + "IP_API_PROTO_TCP": 6, + "IP_API_PROTO_UDP": 17, + "IP_API_PROTO_GRE": 47, + "IP_API_PROTO_ESP": 50, + "IP_API_PROTO_AH": 51, + "IP_API_PROTO_ICMP6": 58, + "IP_API_PROTO_EIGRP": 88, + "IP_API_PROTO_OSPF": 89, + "IP_API_PROTO_SCTP": 132, + "IP_API_PROTO_RESERVED": 255, + } +) + +func (x IPProto) String() string { + s, ok := IPProto_name[uint8(x)] + if ok { + return s + } + return "IPProto(" + strconv.Itoa(int(x)) + ")" +} + +// AddressWithPrefix defines alias 'address_with_prefix'. +type AddressWithPrefix Prefix + +func ParseAddressWithPrefix(s string) (AddressWithPrefix, error) { + prefix, err := ParsePrefix(s) + if err != nil { + return AddressWithPrefix{}, err + } + return AddressWithPrefix(prefix), nil +} +func (x AddressWithPrefix) String() string { + return Prefix(x).String() +} +func (x *AddressWithPrefix) MarshalText() ([]byte, error) { + return []byte(x.String()), nil +} +func (x *AddressWithPrefix) UnmarshalText(text []byte) error { + prefix, err := ParseAddressWithPrefix(string(text)) + if err != nil { + return err + } + *x = prefix + return nil +} + +// IP4Address defines alias 'ip4_address'. +type IP4Address [4]uint8 + +func ParseIP4Address(s string) (IP4Address, error) { + ip := net.ParseIP(s).To4() + if ip == nil { + return IP4Address{}, fmt.Errorf("invalid IP address: %s", s) + } + var ipaddr IP4Address + copy(ipaddr[:], ip.To4()) + return ipaddr, nil +} + +func (x IP4Address) ToIP() net.IP { + return net.IP(x[:]).To4() +} +func (x IP4Address) String() string { + return x.ToIP().String() +} +func (x *IP4Address) MarshalText() ([]byte, error) { + return []byte(x.String()), nil +} +func (x *IP4Address) UnmarshalText(text []byte) error { + ipaddr, err := ParseIP4Address(string(text)) + if err != nil { + return err + } + *x = ipaddr + return nil +} + +// IP4AddressWithPrefix defines alias 'ip4_address_with_prefix'. +type IP4AddressWithPrefix IP4Prefix + +// IP6Address defines alias 'ip6_address'. +type IP6Address [16]uint8 + +func ParseIP6Address(s string) (IP6Address, error) { + ip := net.ParseIP(s).To16() + if ip == nil { + return IP6Address{}, fmt.Errorf("invalid IP address: %s", s) + } + var ipaddr IP6Address + copy(ipaddr[:], ip.To16()) + return ipaddr, nil +} + +func (x IP6Address) ToIP() net.IP { + return net.IP(x[:]).To16() +} +func (x IP6Address) String() string { + return x.ToIP().String() +} +func (x *IP6Address) MarshalText() ([]byte, error) { + return []byte(x.String()), nil +} +func (x *IP6Address) UnmarshalText(text []byte) error { + ipaddr, err := ParseIP6Address(string(text)) + if err != nil { + return err + } + *x = ipaddr + return nil +} + +// IP6AddressWithPrefix defines alias 'ip6_address_with_prefix'. +type IP6AddressWithPrefix IP6Prefix + +// Address defines type 'address'. +type Address struct { + Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"` +} + +func ParseAddress(s string) (Address, error) { + ip := net.ParseIP(s) + if ip == nil { + return Address{}, fmt.Errorf("invalid address: %s", s) + } + var addr Address + if ip.To4() == nil { + addr.Af = ADDRESS_IP6 + var ip6 IP6Address + copy(ip6[:], ip.To16()) + addr.Un.SetIP6(ip6) + } else { + addr.Af = ADDRESS_IP4 + var ip4 IP4Address + copy(ip4[:], ip.To4()) + addr.Un.SetIP4(ip4) + } + return addr, nil +} +func (x Address) ToIP() net.IP { + if x.Af == ADDRESS_IP6 { + ip6 := x.Un.GetIP6() + return net.IP(ip6[:]).To16() + } else { + ip4 := x.Un.GetIP4() + return net.IP(ip4[:]).To4() + } +} +func (x Address) String() string { + return x.ToIP().String() +} +func (x *Address) MarshalText() ([]byte, error) { + return []byte(x.String()), nil +} +func (x *Address) UnmarshalText(text []byte) error { + addr, err := ParseAddress(string(text)) + if err != nil { + return err + } + *x = addr + return nil +} + +// IP4Prefix defines type 'ip4_prefix'. +type IP4Prefix struct { + Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) { + hasPrefix := strings.Contains(s, "/") + if hasPrefix { + ip, network, err := net.ParseCIDR(s) + if err != nil { + return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) + } + maskSize, _ := network.Mask.Size() + prefix.Len = byte(maskSize) + prefix.Address, err = ParseIP4Address(ip.String()) + if err != nil { + return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) + } + } else { + ip := net.ParseIP(s) + defaultMaskSize, _ := net.CIDRMask(32, 32).Size() + if ip.To4() == nil { + defaultMaskSize, _ = net.CIDRMask(128, 128).Size() + } + prefix.Len = byte(defaultMaskSize) + prefix.Address, err = ParseIP4Address(ip.String()) + if err != nil { + return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) + } + } + return prefix, nil +} +func (x IP4Prefix) ToIPNet() *net.IPNet { + mask := net.CIDRMask(int(x.Len), 32) + ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask} + return ipnet +} +func (x IP4Prefix) String() string { + ip := x.Address.String() + return ip + "/" + strconv.Itoa(int(x.Len)) +} +func (x *IP4Prefix) MarshalText() ([]byte, error) { + return []byte(x.String()), nil +} +func (x *IP4Prefix) UnmarshalText(text []byte) error { + prefix, err := ParseIP4Prefix(string(text)) + if err != nil { + return err + } + *x = prefix + return nil +} + +// IP6Prefix defines type 'ip6_prefix'. +type IP6Prefix struct { + Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) { + hasPrefix := strings.Contains(s, "/") + if hasPrefix { + ip, network, err := net.ParseCIDR(s) + if err != nil { + return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) + } + maskSize, _ := network.Mask.Size() + prefix.Len = byte(maskSize) + prefix.Address, err = ParseIP6Address(ip.String()) + if err != nil { + return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) + } + } else { + ip := net.ParseIP(s) + defaultMaskSize, _ := net.CIDRMask(32, 32).Size() + if ip.To4() == nil { + defaultMaskSize, _ = net.CIDRMask(128, 128).Size() + } + prefix.Len = byte(defaultMaskSize) + prefix.Address, err = ParseIP6Address(ip.String()) + if err != nil { + return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) + } + } + return prefix, nil +} +func (x IP6Prefix) ToIPNet() *net.IPNet { + mask := net.CIDRMask(int(x.Len), 128) + ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask} + return ipnet +} +func (x IP6Prefix) String() string { + ip := x.Address.String() + return ip + "/" + strconv.Itoa(int(x.Len)) +} +func (x *IP6Prefix) MarshalText() ([]byte, error) { + return []byte(x.String()), nil +} +func (x *IP6Prefix) UnmarshalText(text []byte) error { + prefix, err := ParseIP6Prefix(string(text)) + if err != nil { + return err + } + *x = prefix + return nil +} + +// Mprefix defines type 'mprefix'. +type Mprefix struct { + Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"` + GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"` + SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"` +} + +// Prefix defines type 'prefix'. +type Prefix struct { + Address Address `binapi:"address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func ParsePrefix(ip string) (prefix Prefix, err error) { + hasPrefix := strings.Contains(ip, "/") + if hasPrefix { + netIP, network, err := net.ParseCIDR(ip) + if err != nil { + return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err) + } + maskSize, _ := network.Mask.Size() + prefix.Len = byte(maskSize) + prefix.Address, err = ParseAddress(netIP.String()) + if err != nil { + return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err) + } + } else { + netIP := net.ParseIP(ip) + defaultMaskSize, _ := net.CIDRMask(32, 32).Size() + if netIP.To4() == nil { + defaultMaskSize, _ = net.CIDRMask(128, 128).Size() + } + prefix.Len = byte(defaultMaskSize) + prefix.Address, err = ParseAddress(netIP.String()) + if err != nil { + return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err) + } + } + return prefix, nil +} +func (x Prefix) ToIPNet() *net.IPNet { + var mask net.IPMask + if x.Address.Af == ADDRESS_IP4 { + mask = net.CIDRMask(int(x.Len), 32) + } else { + mask = net.CIDRMask(int(x.Len), 128) + } + ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask} + return ipnet +} +func (x Prefix) String() string { + ip := x.Address.String() + return ip + "/" + strconv.Itoa(int(x.Len)) +} +func (x *Prefix) MarshalText() ([]byte, error) { + return []byte(x.String()), nil +} +func (x *Prefix) UnmarshalText(text []byte) error { + prefix, err := ParsePrefix(string(text)) + if err != nil { + return err + } + *x = prefix + return nil +} + +// PrefixMatcher defines type 'prefix_matcher'. +type PrefixMatcher struct { + Le uint8 `binapi:"u8,name=le" json:"le,omitempty"` + Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"` +} + +// AddressUnion defines union 'address_union'. +type AddressUnion struct { + // IP4 *IP4Address + // IP6 *IP6Address + XXX_UnionData [16]byte +} + +func AddressUnionIP4(a IP4Address) (u AddressUnion) { + u.SetIP4(a) + return +} +func (u *AddressUnion) SetIP4(a IP4Address) { + var buf = codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeBytes(a[:], 4) +} +func (u *AddressUnion) GetIP4() (a IP4Address) { + var buf = codec.NewBuffer(u.XXX_UnionData[:]) + copy(a[:], buf.DecodeBytes(4)) + return +} + +func AddressUnionIP6(a IP6Address) (u AddressUnion) { + u.SetIP6(a) + return +} +func (u *AddressUnion) SetIP6(a IP6Address) { + var buf = codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeBytes(a[:], 16) +} +func (u *AddressUnion) GetIP6() (a IP6Address) { + var buf = codec.NewBuffer(u.XXX_UnionData[:]) + copy(a[:], buf.DecodeBytes(16)) + return +} diff --git a/binapi/ipfix_export/ipfix_export.ba.go b/binapi/ipfix_export/ipfix_export.ba.go new file mode 100644 index 0000000..7d548f2 --- /dev/null +++ b/binapi/ipfix_export/ipfix_export.ba.go @@ -0,0 +1,638 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/ipfix_export.api.json + +// Package ipfix_export contains generated bindings for API file ipfix_export.api. +// +// Contents: +// 14 messages +// +package ipfix_export + +import ( + api "git.fd.io/govpp.git/api" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "ipfix_export" + APIVersion = "2.0.1" + VersionCrc = 0xb7e9cad2 +) + +// IpfixClassifyStreamDetails defines message 'ipfix_classify_stream_details'. +type IpfixClassifyStreamDetails struct { + DomainID uint32 `binapi:"u32,name=domain_id" json:"domain_id,omitempty"` + SrcPort uint16 `binapi:"u16,name=src_port" json:"src_port,omitempty"` +} + +func (m *IpfixClassifyStreamDetails) Reset() { *m = IpfixClassifyStreamDetails{} } +func (*IpfixClassifyStreamDetails) GetMessageName() string { return "ipfix_classify_stream_details" } +func (*IpfixClassifyStreamDetails) GetCrcString() string { return "2903539d" } +func (*IpfixClassifyStreamDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpfixClassifyStreamDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.DomainID + size += 2 // m.SrcPort + return size +} +func (m *IpfixClassifyStreamDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.DomainID)) + buf.EncodeUint16(uint16(m.SrcPort)) + return buf.Bytes(), nil +} +func (m *IpfixClassifyStreamDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.DomainID = buf.DecodeUint32() + m.SrcPort = buf.DecodeUint16() + return nil +} + +// IpfixClassifyStreamDump defines message 'ipfix_classify_stream_dump'. +type IpfixClassifyStreamDump struct{} + +func (m *IpfixClassifyStreamDump) Reset() { *m = IpfixClassifyStreamDump{} } +func (*IpfixClassifyStreamDump) GetMessageName() string { return "ipfix_classify_stream_dump" } +func (*IpfixClassifyStreamDump) GetCrcString() string { return "51077d14" } +func (*IpfixClassifyStreamDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpfixClassifyStreamDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *IpfixClassifyStreamDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *IpfixClassifyStreamDump) Unmarshal(b []byte) error { + return nil +} + +// IpfixClassifyTableAddDel defines message 'ipfix_classify_table_add_del'. +type IpfixClassifyTableAddDel struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + IPVersion ip_types.AddressFamily `binapi:"address_family,name=ip_version" json:"ip_version,omitempty"` + TransportProtocol ip_types.IPProto `binapi:"ip_proto,name=transport_protocol" json:"transport_protocol,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *IpfixClassifyTableAddDel) Reset() { *m = IpfixClassifyTableAddDel{} } +func (*IpfixClassifyTableAddDel) GetMessageName() string { return "ipfix_classify_table_add_del" } +func (*IpfixClassifyTableAddDel) GetCrcString() string { return "3e449bb9" } +func (*IpfixClassifyTableAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpfixClassifyTableAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.TableID + size += 1 // m.IPVersion + size += 1 // m.TransportProtocol + size += 1 // m.IsAdd + return size +} +func (m *IpfixClassifyTableAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.TableID)) + buf.EncodeUint8(uint8(m.IPVersion)) + buf.EncodeUint8(uint8(m.TransportProtocol)) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *IpfixClassifyTableAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.TableID = buf.DecodeUint32() + m.IPVersion = ip_types.AddressFamily(buf.DecodeUint8()) + m.TransportProtocol = ip_types.IPProto(buf.DecodeUint8()) + m.IsAdd = buf.DecodeBool() + return nil +} + +// IpfixClassifyTableAddDelReply defines message 'ipfix_classify_table_add_del_reply'. +type IpfixClassifyTableAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IpfixClassifyTableAddDelReply) Reset() { *m = IpfixClassifyTableAddDelReply{} } +func (*IpfixClassifyTableAddDelReply) GetMessageName() string { + return "ipfix_classify_table_add_del_reply" +} +func (*IpfixClassifyTableAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*IpfixClassifyTableAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpfixClassifyTableAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IpfixClassifyTableAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IpfixClassifyTableAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IpfixClassifyTableDetails defines message 'ipfix_classify_table_details'. +type IpfixClassifyTableDetails struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + IPVersion ip_types.AddressFamily `binapi:"address_family,name=ip_version" json:"ip_version,omitempty"` + TransportProtocol ip_types.IPProto `binapi:"ip_proto,name=transport_protocol" json:"transport_protocol,omitempty"` +} + +func (m *IpfixClassifyTableDetails) Reset() { *m = IpfixClassifyTableDetails{} } +func (*IpfixClassifyTableDetails) GetMessageName() string { return "ipfix_classify_table_details" } +func (*IpfixClassifyTableDetails) GetCrcString() string { return "1af8c28c" } +func (*IpfixClassifyTableDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpfixClassifyTableDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.TableID + size += 1 // m.IPVersion + size += 1 // m.TransportProtocol + return size +} +func (m *IpfixClassifyTableDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.TableID)) + buf.EncodeUint8(uint8(m.IPVersion)) + buf.EncodeUint8(uint8(m.TransportProtocol)) + return buf.Bytes(), nil +} +func (m *IpfixClassifyTableDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.TableID = buf.DecodeUint32() + m.IPVersion = ip_types.AddressFamily(buf.DecodeUint8()) + m.TransportProtocol = ip_types.IPProto(buf.DecodeUint8()) + return nil +} + +// IpfixClassifyTableDump defines message 'ipfix_classify_table_dump'. +type IpfixClassifyTableDump struct{} + +func (m *IpfixClassifyTableDump) Reset() { *m = IpfixClassifyTableDump{} } +func (*IpfixClassifyTableDump) GetMessageName() string { return "ipfix_classify_table_dump" } +func (*IpfixClassifyTableDump) GetCrcString() string { return "51077d14" } +func (*IpfixClassifyTableDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpfixClassifyTableDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *IpfixClassifyTableDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *IpfixClassifyTableDump) Unmarshal(b []byte) error { + return nil +} + +// IpfixExporterDetails defines message 'ipfix_exporter_details'. +type IpfixExporterDetails struct { + CollectorAddress ip_types.Address `binapi:"address,name=collector_address" json:"collector_address,omitempty"` + CollectorPort uint16 `binapi:"u16,name=collector_port" json:"collector_port,omitempty"` + SrcAddress ip_types.Address `binapi:"address,name=src_address" json:"src_address,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + PathMtu uint32 `binapi:"u32,name=path_mtu" json:"path_mtu,omitempty"` + TemplateInterval uint32 `binapi:"u32,name=template_interval" json:"template_interval,omitempty"` + UDPChecksum bool `binapi:"bool,name=udp_checksum" json:"udp_checksum,omitempty"` +} + +func (m *IpfixExporterDetails) Reset() { *m = IpfixExporterDetails{} } +func (*IpfixExporterDetails) GetMessageName() string { return "ipfix_exporter_details" } +func (*IpfixExporterDetails) GetCrcString() string { return "11e07413" } +func (*IpfixExporterDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpfixExporterDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.CollectorAddress.Af + size += 1 * 16 // m.CollectorAddress.Un + size += 2 // m.CollectorPort + size += 1 // m.SrcAddress.Af + size += 1 * 16 // m.SrcAddress.Un + size += 4 // m.VrfID + size += 4 // m.PathMtu + size += 4 // m.TemplateInterval + size += 1 // m.UDPChecksum + return size +} +func (m *IpfixExporterDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.CollectorAddress.Af)) + buf.EncodeBytes(m.CollectorAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint16(uint16(m.CollectorPort)) + buf.EncodeUint8(uint8(m.SrcAddress.Af)) + buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.VrfID)) + buf.EncodeUint32(uint32(m.PathMtu)) + buf.EncodeUint32(uint32(m.TemplateInterval)) + buf.EncodeBool(m.UDPChecksum) + return buf.Bytes(), nil +} +func (m *IpfixExporterDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.CollectorAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.CollectorAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.CollectorPort = buf.DecodeUint16() + m.SrcAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.SrcAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.VrfID = buf.DecodeUint32() + m.PathMtu = buf.DecodeUint32() + m.TemplateInterval = buf.DecodeUint32() + m.UDPChecksum = buf.DecodeBool() + return nil +} + +// IpfixExporterDump defines message 'ipfix_exporter_dump'. +type IpfixExporterDump struct{} + +func (m *IpfixExporterDump) Reset() { *m = IpfixExporterDump{} } +func (*IpfixExporterDump) GetMessageName() string { return "ipfix_exporter_dump" } +func (*IpfixExporterDump) GetCrcString() string { return "51077d14" } +func (*IpfixExporterDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpfixExporterDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *IpfixExporterDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *IpfixExporterDump) Unmarshal(b []byte) error { + return nil +} + +// IpfixFlush defines message 'ipfix_flush'. +type IpfixFlush struct{} + +func (m *IpfixFlush) Reset() { *m = IpfixFlush{} } +func (*IpfixFlush) GetMessageName() string { return "ipfix_flush" } +func (*IpfixFlush) GetCrcString() string { return "51077d14" } +func (*IpfixFlush) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpfixFlush) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *IpfixFlush) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *IpfixFlush) Unmarshal(b []byte) error { + return nil +} + +// IpfixFlushReply defines message 'ipfix_flush_reply'. +type IpfixFlushReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IpfixFlushReply) Reset() { *m = IpfixFlushReply{} } +func (*IpfixFlushReply) GetMessageName() string { return "ipfix_flush_reply" } +func (*IpfixFlushReply) GetCrcString() string { return "e8d4e804" } +func (*IpfixFlushReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpfixFlushReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IpfixFlushReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IpfixFlushReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SetIpfixClassifyStream defines message 'set_ipfix_classify_stream'. +type SetIpfixClassifyStream struct { + DomainID uint32 `binapi:"u32,name=domain_id" json:"domain_id,omitempty"` + SrcPort uint16 `binapi:"u16,name=src_port" json:"src_port,omitempty"` +} + +func (m *SetIpfixClassifyStream) Reset() { *m = SetIpfixClassifyStream{} } +func (*SetIpfixClassifyStream) GetMessageName() string { return "set_ipfix_classify_stream" } +func (*SetIpfixClassifyStream) GetCrcString() string { return "c9cbe053" } +func (*SetIpfixClassifyStream) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SetIpfixClassifyStream) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.DomainID + size += 2 // m.SrcPort + return size +} +func (m *SetIpfixClassifyStream) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.DomainID)) + buf.EncodeUint16(uint16(m.SrcPort)) + return buf.Bytes(), nil +} +func (m *SetIpfixClassifyStream) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.DomainID = buf.DecodeUint32() + m.SrcPort = buf.DecodeUint16() + return nil +} + +// SetIpfixClassifyStreamReply defines message 'set_ipfix_classify_stream_reply'. +type SetIpfixClassifyStreamReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SetIpfixClassifyStreamReply) Reset() { *m = SetIpfixClassifyStreamReply{} } +func (*SetIpfixClassifyStreamReply) GetMessageName() string { return "set_ipfix_classify_stream_reply" } +func (*SetIpfixClassifyStreamReply) GetCrcString() string { return "e8d4e804" } +func (*SetIpfixClassifyStreamReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SetIpfixClassifyStreamReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SetIpfixClassifyStreamReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SetIpfixClassifyStreamReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SetIpfixExporter defines message 'set_ipfix_exporter'. +type SetIpfixExporter struct { + CollectorAddress ip_types.Address `binapi:"address,name=collector_address" json:"collector_address,omitempty"` + CollectorPort uint16 `binapi:"u16,name=collector_port" json:"collector_port,omitempty"` + SrcAddress ip_types.Address `binapi:"address,name=src_address" json:"src_address,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + PathMtu uint32 `binapi:"u32,name=path_mtu" json:"path_mtu,omitempty"` + TemplateInterval uint32 `binapi:"u32,name=template_interval" json:"template_interval,omitempty"` + UDPChecksum bool `binapi:"bool,name=udp_checksum" json:"udp_checksum,omitempty"` +} + +func (m *SetIpfixExporter) Reset() { *m = SetIpfixExporter{} } +func (*SetIpfixExporter) GetMessageName() string { return "set_ipfix_exporter" } +func (*SetIpfixExporter) GetCrcString() string { return "69284e07" } +func (*SetIpfixExporter) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SetIpfixExporter) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.CollectorAddress.Af + size += 1 * 16 // m.CollectorAddress.Un + size += 2 // m.CollectorPort + size += 1 // m.SrcAddress.Af + size += 1 * 16 // m.SrcAddress.Un + size += 4 // m.VrfID + size += 4 // m.PathMtu + size += 4 // m.TemplateInterval + size += 1 // m.UDPChecksum + return size +} +func (m *SetIpfixExporter) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.CollectorAddress.Af)) + buf.EncodeBytes(m.CollectorAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint16(uint16(m.CollectorPort)) + buf.EncodeUint8(uint8(m.SrcAddress.Af)) + buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.VrfID)) + buf.EncodeUint32(uint32(m.PathMtu)) + buf.EncodeUint32(uint32(m.TemplateInterval)) + buf.EncodeBool(m.UDPChecksum) + return buf.Bytes(), nil +} +func (m *SetIpfixExporter) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.CollectorAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.CollectorAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.CollectorPort = buf.DecodeUint16() + m.SrcAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.SrcAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.VrfID = buf.DecodeUint32() + m.PathMtu = buf.DecodeUint32() + m.TemplateInterval = buf.DecodeUint32() + m.UDPChecksum = buf.DecodeBool() + return nil +} + +// SetIpfixExporterReply defines message 'set_ipfix_exporter_reply'. +type SetIpfixExporterReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SetIpfixExporterReply) Reset() { *m = SetIpfixExporterReply{} } +func (*SetIpfixExporterReply) GetMessageName() string { return "set_ipfix_exporter_reply" } +func (*SetIpfixExporterReply) GetCrcString() string { return "e8d4e804" } +func (*SetIpfixExporterReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SetIpfixExporterReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SetIpfixExporterReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SetIpfixExporterReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_ipfix_export_binapi_init() } +func file_ipfix_export_binapi_init() { + api.RegisterMessage((*IpfixClassifyStreamDetails)(nil), "ipfix_classify_stream_details_2903539d") + api.RegisterMessage((*IpfixClassifyStreamDump)(nil), "ipfix_classify_stream_dump_51077d14") + api.RegisterMessage((*IpfixClassifyTableAddDel)(nil), "ipfix_classify_table_add_del_3e449bb9") + api.RegisterMessage((*IpfixClassifyTableAddDelReply)(nil), "ipfix_classify_table_add_del_reply_e8d4e804") + api.RegisterMessage((*IpfixClassifyTableDetails)(nil), "ipfix_classify_table_details_1af8c28c") + api.RegisterMessage((*IpfixClassifyTableDump)(nil), "ipfix_classify_table_dump_51077d14") + api.RegisterMessage((*IpfixExporterDetails)(nil), "ipfix_exporter_details_11e07413") + api.RegisterMessage((*IpfixExporterDump)(nil), "ipfix_exporter_dump_51077d14") + api.RegisterMessage((*IpfixFlush)(nil), "ipfix_flush_51077d14") + api.RegisterMessage((*IpfixFlushReply)(nil), "ipfix_flush_reply_e8d4e804") + api.RegisterMessage((*SetIpfixClassifyStream)(nil), "set_ipfix_classify_stream_c9cbe053") + api.RegisterMessage((*SetIpfixClassifyStreamReply)(nil), "set_ipfix_classify_stream_reply_e8d4e804") + api.RegisterMessage((*SetIpfixExporter)(nil), "set_ipfix_exporter_69284e07") + api.RegisterMessage((*SetIpfixExporterReply)(nil), "set_ipfix_exporter_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*IpfixClassifyStreamDetails)(nil), + (*IpfixClassifyStreamDump)(nil), + (*IpfixClassifyTableAddDel)(nil), + (*IpfixClassifyTableAddDelReply)(nil), + (*IpfixClassifyTableDetails)(nil), + (*IpfixClassifyTableDump)(nil), + (*IpfixExporterDetails)(nil), + (*IpfixExporterDump)(nil), + (*IpfixFlush)(nil), + (*IpfixFlushReply)(nil), + (*SetIpfixClassifyStream)(nil), + (*SetIpfixClassifyStreamReply)(nil), + (*SetIpfixExporter)(nil), + (*SetIpfixExporterReply)(nil), + } +} diff --git a/binapi/ipfix_export/ipfix_export_rest.ba.go b/binapi/ipfix_export/ipfix_export_rest.ba.go new file mode 100644 index 0000000..65407bf --- /dev/null +++ b/binapi/ipfix_export/ipfix_export_rest.ba.go @@ -0,0 +1,97 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ipfix_export + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/ipfix_classify_table_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(IpfixClassifyTableAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IpfixClassifyTableAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ipfix_flush", func(w http.ResponseWriter, req *http.Request) { + var request = new(IpfixFlush) + reply, err := rpc.IpfixFlush(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/set_ipfix_classify_stream", func(w http.ResponseWriter, req *http.Request) { + var request = new(SetIpfixClassifyStream) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SetIpfixClassifyStream(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/set_ipfix_exporter", func(w http.ResponseWriter, req *http.Request) { + var request = new(SetIpfixExporter) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SetIpfixExporter(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/ipfix_export/ipfix_export_rpc.ba.go b/binapi/ipfix_export/ipfix_export_rpc.ba.go new file mode 100644 index 0000000..4c0dd27 --- /dev/null +++ b/binapi/ipfix_export/ipfix_export_rpc.ba.go @@ -0,0 +1,183 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ipfix_export + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service ipfix_export. +type RPCService interface { + IpfixClassifyStreamDump(ctx context.Context, in *IpfixClassifyStreamDump) (RPCService_IpfixClassifyStreamDumpClient, error) + IpfixClassifyTableAddDel(ctx context.Context, in *IpfixClassifyTableAddDel) (*IpfixClassifyTableAddDelReply, error) + IpfixClassifyTableDump(ctx context.Context, in *IpfixClassifyTableDump) (RPCService_IpfixClassifyTableDumpClient, error) + IpfixExporterDump(ctx context.Context, in *IpfixExporterDump) (RPCService_IpfixExporterDumpClient, error) + IpfixFlush(ctx context.Context, in *IpfixFlush) (*IpfixFlushReply, error) + SetIpfixClassifyStream(ctx context.Context, in *SetIpfixClassifyStream) (*SetIpfixClassifyStreamReply, error) + SetIpfixExporter(ctx context.Context, in *SetIpfixExporter) (*SetIpfixExporterReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) IpfixClassifyStreamDump(ctx context.Context, in *IpfixClassifyStreamDump) (RPCService_IpfixClassifyStreamDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IpfixClassifyStreamDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IpfixClassifyStreamDumpClient interface { + Recv() (*IpfixClassifyStreamDetails, error) + api.Stream +} + +type serviceClient_IpfixClassifyStreamDumpClient struct { + api.Stream +} + +func (c *serviceClient_IpfixClassifyStreamDumpClient) Recv() (*IpfixClassifyStreamDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IpfixClassifyStreamDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IpfixClassifyTableAddDel(ctx context.Context, in *IpfixClassifyTableAddDel) (*IpfixClassifyTableAddDelReply, error) { + out := new(IpfixClassifyTableAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpfixClassifyTableDump(ctx context.Context, in *IpfixClassifyTableDump) (RPCService_IpfixClassifyTableDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IpfixClassifyTableDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IpfixClassifyTableDumpClient interface { + Recv() (*IpfixClassifyTableDetails, error) + api.Stream +} + +type serviceClient_IpfixClassifyTableDumpClient struct { + api.Stream +} + +func (c *serviceClient_IpfixClassifyTableDumpClient) Recv() (*IpfixClassifyTableDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IpfixClassifyTableDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IpfixExporterDump(ctx context.Context, in *IpfixExporterDump) (RPCService_IpfixExporterDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IpfixExporterDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IpfixExporterDumpClient interface { + Recv() (*IpfixExporterDetails, error) + api.Stream +} + +type serviceClient_IpfixExporterDumpClient struct { + api.Stream +} + +func (c *serviceClient_IpfixExporterDumpClient) Recv() (*IpfixExporterDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IpfixExporterDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IpfixFlush(ctx context.Context, in *IpfixFlush) (*IpfixFlushReply, error) { + out := new(IpfixFlushReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SetIpfixClassifyStream(ctx context.Context, in *SetIpfixClassifyStream) (*SetIpfixClassifyStreamReply, error) { + out := new(SetIpfixClassifyStreamReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SetIpfixExporter(ctx context.Context, in *SetIpfixExporter) (*SetIpfixExporterReply, error) { + out := new(SetIpfixExporterReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/ipip/ipip.ba.go b/binapi/ipip/ipip.ba.go new file mode 100644 index 0000000..aab72c2 --- /dev/null +++ b/binapi/ipip/ipip.ba.go @@ -0,0 +1,527 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/ipip.api.json + +// Package ipip contains generated bindings for API file ipip.api. +// +// Contents: +// 1 struct +// 10 messages +// +package ipip + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + tunnel_types "git.fd.io/govpp.git/binapi/tunnel_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "ipip" + APIVersion = "2.0.1" + VersionCrc = 0xa095e728 +) + +// IpipTunnel defines type 'ipip_tunnel'. +type IpipTunnel struct { + Instance uint32 `binapi:"u32,name=instance" json:"instance,omitempty"` + Src ip_types.Address `binapi:"address,name=src" json:"src,omitempty"` + Dst ip_types.Address `binapi:"address,name=dst" json:"dst,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + Flags tunnel_types.TunnelEncapDecapFlags `binapi:"tunnel_encap_decap_flags,name=flags" json:"flags,omitempty"` + Mode tunnel_types.TunnelMode `binapi:"tunnel_mode,name=mode" json:"mode,omitempty"` + Dscp ip_types.IPDscp `binapi:"ip_dscp,name=dscp" json:"dscp,omitempty"` +} + +// Ipip6rdAddTunnel defines message 'ipip_6rd_add_tunnel'. +type Ipip6rdAddTunnel struct { + IP6TableID uint32 `binapi:"u32,name=ip6_table_id" json:"ip6_table_id,omitempty"` + IP4TableID uint32 `binapi:"u32,name=ip4_table_id" json:"ip4_table_id,omitempty"` + IP6Prefix ip_types.IP6Prefix `binapi:"ip6_prefix,name=ip6_prefix" json:"ip6_prefix,omitempty"` + IP4Prefix ip_types.IP4Prefix `binapi:"ip4_prefix,name=ip4_prefix" json:"ip4_prefix,omitempty"` + IP4Src ip_types.IP4Address `binapi:"ip4_address,name=ip4_src" json:"ip4_src,omitempty"` + SecurityCheck bool `binapi:"bool,name=security_check" json:"security_check,omitempty"` + TcTos uint8 `binapi:"u8,name=tc_tos" json:"tc_tos,omitempty"` +} + +func (m *Ipip6rdAddTunnel) Reset() { *m = Ipip6rdAddTunnel{} } +func (*Ipip6rdAddTunnel) GetMessageName() string { return "ipip_6rd_add_tunnel" } +func (*Ipip6rdAddTunnel) GetCrcString() string { return "56e93cc0" } +func (*Ipip6rdAddTunnel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ipip6rdAddTunnel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.IP6TableID + size += 4 // m.IP4TableID + size += 1 * 16 // m.IP6Prefix.Address + size += 1 // m.IP6Prefix.Len + size += 1 * 4 // m.IP4Prefix.Address + size += 1 // m.IP4Prefix.Len + size += 1 * 4 // m.IP4Src + size += 1 // m.SecurityCheck + size += 1 // m.TcTos + return size +} +func (m *Ipip6rdAddTunnel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.IP6TableID)) + buf.EncodeUint32(uint32(m.IP4TableID)) + buf.EncodeBytes(m.IP6Prefix.Address[:], 16) + buf.EncodeUint8(uint8(m.IP6Prefix.Len)) + buf.EncodeBytes(m.IP4Prefix.Address[:], 4) + buf.EncodeUint8(uint8(m.IP4Prefix.Len)) + buf.EncodeBytes(m.IP4Src[:], 4) + buf.EncodeBool(m.SecurityCheck) + buf.EncodeUint8(uint8(m.TcTos)) + return buf.Bytes(), nil +} +func (m *Ipip6rdAddTunnel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IP6TableID = buf.DecodeUint32() + m.IP4TableID = buf.DecodeUint32() + copy(m.IP6Prefix.Address[:], buf.DecodeBytes(16)) + m.IP6Prefix.Len = buf.DecodeUint8() + copy(m.IP4Prefix.Address[:], buf.DecodeBytes(4)) + m.IP4Prefix.Len = buf.DecodeUint8() + copy(m.IP4Src[:], buf.DecodeBytes(4)) + m.SecurityCheck = buf.DecodeBool() + m.TcTos = buf.DecodeUint8() + return nil +} + +// Ipip6rdAddTunnelReply defines message 'ipip_6rd_add_tunnel_reply'. +type Ipip6rdAddTunnelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Ipip6rdAddTunnelReply) Reset() { *m = Ipip6rdAddTunnelReply{} } +func (*Ipip6rdAddTunnelReply) GetMessageName() string { return "ipip_6rd_add_tunnel_reply" } +func (*Ipip6rdAddTunnelReply) GetCrcString() string { return "5383d31f" } +func (*Ipip6rdAddTunnelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ipip6rdAddTunnelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *Ipip6rdAddTunnelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Ipip6rdAddTunnelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Ipip6rdDelTunnel defines message 'ipip_6rd_del_tunnel'. +type Ipip6rdDelTunnel struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Ipip6rdDelTunnel) Reset() { *m = Ipip6rdDelTunnel{} } +func (*Ipip6rdDelTunnel) GetMessageName() string { return "ipip_6rd_del_tunnel" } +func (*Ipip6rdDelTunnel) GetCrcString() string { return "f9e6675e" } +func (*Ipip6rdDelTunnel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ipip6rdDelTunnel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *Ipip6rdDelTunnel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Ipip6rdDelTunnel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Ipip6rdDelTunnelReply defines message 'ipip_6rd_del_tunnel_reply'. +type Ipip6rdDelTunnelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Ipip6rdDelTunnelReply) Reset() { *m = Ipip6rdDelTunnelReply{} } +func (*Ipip6rdDelTunnelReply) GetMessageName() string { return "ipip_6rd_del_tunnel_reply" } +func (*Ipip6rdDelTunnelReply) GetCrcString() string { return "e8d4e804" } +func (*Ipip6rdDelTunnelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ipip6rdDelTunnelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Ipip6rdDelTunnelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Ipip6rdDelTunnelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IpipAddTunnel defines message 'ipip_add_tunnel'. +type IpipAddTunnel struct { + Tunnel IpipTunnel `binapi:"ipip_tunnel,name=tunnel" json:"tunnel,omitempty"` +} + +func (m *IpipAddTunnel) Reset() { *m = IpipAddTunnel{} } +func (*IpipAddTunnel) GetMessageName() string { return "ipip_add_tunnel" } +func (*IpipAddTunnel) GetCrcString() string { return "a9decfcd" } +func (*IpipAddTunnel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpipAddTunnel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Tunnel.Instance + size += 1 // m.Tunnel.Src.Af + size += 1 * 16 // m.Tunnel.Src.Un + size += 1 // m.Tunnel.Dst.Af + size += 1 * 16 // m.Tunnel.Dst.Un + size += 4 // m.Tunnel.SwIfIndex + size += 4 // m.Tunnel.TableID + size += 1 // m.Tunnel.Flags + size += 1 // m.Tunnel.Mode + size += 1 // m.Tunnel.Dscp + return size +} +func (m *IpipAddTunnel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Tunnel.Instance)) + buf.EncodeUint8(uint8(m.Tunnel.Src.Af)) + buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Tunnel.Dst.Af)) + buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex)) + buf.EncodeUint32(uint32(m.Tunnel.TableID)) + buf.EncodeUint8(uint8(m.Tunnel.Flags)) + buf.EncodeUint8(uint8(m.Tunnel.Mode)) + buf.EncodeUint8(uint8(m.Tunnel.Dscp)) + return buf.Bytes(), nil +} +func (m *IpipAddTunnel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Tunnel.Instance = buf.DecodeUint32() + m.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Tunnel.TableID = buf.DecodeUint32() + m.Tunnel.Flags = tunnel_types.TunnelEncapDecapFlags(buf.DecodeUint8()) + m.Tunnel.Mode = tunnel_types.TunnelMode(buf.DecodeUint8()) + m.Tunnel.Dscp = ip_types.IPDscp(buf.DecodeUint8()) + return nil +} + +// IpipAddTunnelReply defines message 'ipip_add_tunnel_reply'. +type IpipAddTunnelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *IpipAddTunnelReply) Reset() { *m = IpipAddTunnelReply{} } +func (*IpipAddTunnelReply) GetMessageName() string { return "ipip_add_tunnel_reply" } +func (*IpipAddTunnelReply) GetCrcString() string { return "5383d31f" } +func (*IpipAddTunnelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpipAddTunnelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *IpipAddTunnelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *IpipAddTunnelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// IpipDelTunnel defines message 'ipip_del_tunnel'. +type IpipDelTunnel struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *IpipDelTunnel) Reset() { *m = IpipDelTunnel{} } +func (*IpipDelTunnel) GetMessageName() string { return "ipip_del_tunnel" } +func (*IpipDelTunnel) GetCrcString() string { return "f9e6675e" } +func (*IpipDelTunnel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpipDelTunnel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *IpipDelTunnel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *IpipDelTunnel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// IpipDelTunnelReply defines message 'ipip_del_tunnel_reply'. +type IpipDelTunnelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IpipDelTunnelReply) Reset() { *m = IpipDelTunnelReply{} } +func (*IpipDelTunnelReply) GetMessageName() string { return "ipip_del_tunnel_reply" } +func (*IpipDelTunnelReply) GetCrcString() string { return "e8d4e804" } +func (*IpipDelTunnelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpipDelTunnelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IpipDelTunnelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IpipDelTunnelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IpipTunnelDetails defines message 'ipip_tunnel_details'. +type IpipTunnelDetails struct { + Tunnel IpipTunnel `binapi:"ipip_tunnel,name=tunnel" json:"tunnel,omitempty"` +} + +func (m *IpipTunnelDetails) Reset() { *m = IpipTunnelDetails{} } +func (*IpipTunnelDetails) GetMessageName() string { return "ipip_tunnel_details" } +func (*IpipTunnelDetails) GetCrcString() string { return "53236d75" } +func (*IpipTunnelDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpipTunnelDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Tunnel.Instance + size += 1 // m.Tunnel.Src.Af + size += 1 * 16 // m.Tunnel.Src.Un + size += 1 // m.Tunnel.Dst.Af + size += 1 * 16 // m.Tunnel.Dst.Un + size += 4 // m.Tunnel.SwIfIndex + size += 4 // m.Tunnel.TableID + size += 1 // m.Tunnel.Flags + size += 1 // m.Tunnel.Mode + size += 1 // m.Tunnel.Dscp + return size +} +func (m *IpipTunnelDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Tunnel.Instance)) + buf.EncodeUint8(uint8(m.Tunnel.Src.Af)) + buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Tunnel.Dst.Af)) + buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex)) + buf.EncodeUint32(uint32(m.Tunnel.TableID)) + buf.EncodeUint8(uint8(m.Tunnel.Flags)) + buf.EncodeUint8(uint8(m.Tunnel.Mode)) + buf.EncodeUint8(uint8(m.Tunnel.Dscp)) + return buf.Bytes(), nil +} +func (m *IpipTunnelDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Tunnel.Instance = buf.DecodeUint32() + m.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Tunnel.TableID = buf.DecodeUint32() + m.Tunnel.Flags = tunnel_types.TunnelEncapDecapFlags(buf.DecodeUint8()) + m.Tunnel.Mode = tunnel_types.TunnelMode(buf.DecodeUint8()) + m.Tunnel.Dscp = ip_types.IPDscp(buf.DecodeUint8()) + return nil +} + +// IpipTunnelDump defines message 'ipip_tunnel_dump'. +type IpipTunnelDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *IpipTunnelDump) Reset() { *m = IpipTunnelDump{} } +func (*IpipTunnelDump) GetMessageName() string { return "ipip_tunnel_dump" } +func (*IpipTunnelDump) GetCrcString() string { return "f9e6675e" } +func (*IpipTunnelDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpipTunnelDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *IpipTunnelDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *IpipTunnelDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +func init() { file_ipip_binapi_init() } +func file_ipip_binapi_init() { + api.RegisterMessage((*Ipip6rdAddTunnel)(nil), "ipip_6rd_add_tunnel_56e93cc0") + api.RegisterMessage((*Ipip6rdAddTunnelReply)(nil), "ipip_6rd_add_tunnel_reply_5383d31f") + api.RegisterMessage((*Ipip6rdDelTunnel)(nil), "ipip_6rd_del_tunnel_f9e6675e") + api.RegisterMessage((*Ipip6rdDelTunnelReply)(nil), "ipip_6rd_del_tunnel_reply_e8d4e804") + api.RegisterMessage((*IpipAddTunnel)(nil), "ipip_add_tunnel_a9decfcd") + api.RegisterMessage((*IpipAddTunnelReply)(nil), "ipip_add_tunnel_reply_5383d31f") + api.RegisterMessage((*IpipDelTunnel)(nil), "ipip_del_tunnel_f9e6675e") + api.RegisterMessage((*IpipDelTunnelReply)(nil), "ipip_del_tunnel_reply_e8d4e804") + api.RegisterMessage((*IpipTunnelDetails)(nil), "ipip_tunnel_details_53236d75") + api.RegisterMessage((*IpipTunnelDump)(nil), "ipip_tunnel_dump_f9e6675e") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*Ipip6rdAddTunnel)(nil), + (*Ipip6rdAddTunnelReply)(nil), + (*Ipip6rdDelTunnel)(nil), + (*Ipip6rdDelTunnelReply)(nil), + (*IpipAddTunnel)(nil), + (*IpipAddTunnelReply)(nil), + (*IpipDelTunnel)(nil), + (*IpipDelTunnelReply)(nil), + (*IpipTunnelDetails)(nil), + (*IpipTunnelDump)(nil), + } +} diff --git a/binapi/ipip/ipip_rest.ba.go b/binapi/ipip/ipip_rest.ba.go new file mode 100644 index 0000000..63fe220 --- /dev/null +++ b/binapi/ipip/ipip_rest.ba.go @@ -0,0 +1,106 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ipip + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/ipip_6rd_add_tunnel", func(w http.ResponseWriter, req *http.Request) { + var request = new(Ipip6rdAddTunnel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Ipip6rdAddTunnel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ipip_6rd_del_tunnel", func(w http.ResponseWriter, req *http.Request) { + var request = new(Ipip6rdDelTunnel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Ipip6rdDelTunnel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ipip_add_tunnel", func(w http.ResponseWriter, req *http.Request) { + var request = new(IpipAddTunnel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IpipAddTunnel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ipip_del_tunnel", func(w http.ResponseWriter, req *http.Request) { + var request = new(IpipDelTunnel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IpipDelTunnel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/ipip/ipip_rpc.ba.go b/binapi/ipip/ipip_rpc.ba.go new file mode 100644 index 0000000..bab3b22 --- /dev/null +++ b/binapi/ipip/ipip_rpc.ba.go @@ -0,0 +1,103 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ipip + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service ipip. +type RPCService interface { + Ipip6rdAddTunnel(ctx context.Context, in *Ipip6rdAddTunnel) (*Ipip6rdAddTunnelReply, error) + Ipip6rdDelTunnel(ctx context.Context, in *Ipip6rdDelTunnel) (*Ipip6rdDelTunnelReply, error) + IpipAddTunnel(ctx context.Context, in *IpipAddTunnel) (*IpipAddTunnelReply, error) + IpipDelTunnel(ctx context.Context, in *IpipDelTunnel) (*IpipDelTunnelReply, error) + IpipTunnelDump(ctx context.Context, in *IpipTunnelDump) (RPCService_IpipTunnelDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) Ipip6rdAddTunnel(ctx context.Context, in *Ipip6rdAddTunnel) (*Ipip6rdAddTunnelReply, error) { + out := new(Ipip6rdAddTunnelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ipip6rdDelTunnel(ctx context.Context, in *Ipip6rdDelTunnel) (*Ipip6rdDelTunnelReply, error) { + out := new(Ipip6rdDelTunnelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpipAddTunnel(ctx context.Context, in *IpipAddTunnel) (*IpipAddTunnelReply, error) { + out := new(IpipAddTunnelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpipDelTunnel(ctx context.Context, in *IpipDelTunnel) (*IpipDelTunnelReply, error) { + out := new(IpipDelTunnelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpipTunnelDump(ctx context.Context, in *IpipTunnelDump) (RPCService_IpipTunnelDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IpipTunnelDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IpipTunnelDumpClient interface { + Recv() (*IpipTunnelDetails, error) + api.Stream +} + +type serviceClient_IpipTunnelDumpClient struct { + api.Stream +} + +func (c *serviceClient_IpipTunnelDumpClient) Recv() (*IpipTunnelDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IpipTunnelDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/ipsec/ipsec.ba.go b/binapi/ipsec/ipsec.ba.go new file mode 100644 index 0000000..564c457 --- /dev/null +++ b/binapi/ipsec/ipsec.ba.go @@ -0,0 +1,1682 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/ipsec.api.json + +// Package ipsec contains generated bindings for API file ipsec.api. +// +// Contents: +// 1 enum +// 2 structs +// 30 messages +// +package ipsec + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + ipsec_types "git.fd.io/govpp.git/binapi/ipsec_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "ipsec" + APIVersion = "3.0.2" + VersionCrc = 0x6a839805 +) + +// IpsecSpdAction defines enum 'ipsec_spd_action'. +type IpsecSpdAction uint32 + +const ( + IPSEC_API_SPD_ACTION_BYPASS IpsecSpdAction = 0 + IPSEC_API_SPD_ACTION_DISCARD IpsecSpdAction = 1 + IPSEC_API_SPD_ACTION_RESOLVE IpsecSpdAction = 2 + IPSEC_API_SPD_ACTION_PROTECT IpsecSpdAction = 3 +) + +var ( + IpsecSpdAction_name = map[uint32]string{ + 0: "IPSEC_API_SPD_ACTION_BYPASS", + 1: "IPSEC_API_SPD_ACTION_DISCARD", + 2: "IPSEC_API_SPD_ACTION_RESOLVE", + 3: "IPSEC_API_SPD_ACTION_PROTECT", + } + IpsecSpdAction_value = map[string]uint32{ + "IPSEC_API_SPD_ACTION_BYPASS": 0, + "IPSEC_API_SPD_ACTION_DISCARD": 1, + "IPSEC_API_SPD_ACTION_RESOLVE": 2, + "IPSEC_API_SPD_ACTION_PROTECT": 3, + } +) + +func (x IpsecSpdAction) String() string { + s, ok := IpsecSpdAction_name[uint32(x)] + if ok { + return s + } + return "IpsecSpdAction(" + strconv.Itoa(int(x)) + ")" +} + +// IpsecSpdEntry defines type 'ipsec_spd_entry'. +type IpsecSpdEntry struct { + SpdID uint32 `binapi:"u32,name=spd_id" json:"spd_id,omitempty"` + Priority int32 `binapi:"i32,name=priority" json:"priority,omitempty"` + IsOutbound bool `binapi:"bool,name=is_outbound" json:"is_outbound,omitempty"` + SaID uint32 `binapi:"u32,name=sa_id" json:"sa_id,omitempty"` + Policy IpsecSpdAction `binapi:"ipsec_spd_action,name=policy" json:"policy,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` + RemoteAddressStart ip_types.Address `binapi:"address,name=remote_address_start" json:"remote_address_start,omitempty"` + RemoteAddressStop ip_types.Address `binapi:"address,name=remote_address_stop" json:"remote_address_stop,omitempty"` + LocalAddressStart ip_types.Address `binapi:"address,name=local_address_start" json:"local_address_start,omitempty"` + LocalAddressStop ip_types.Address `binapi:"address,name=local_address_stop" json:"local_address_stop,omitempty"` + RemotePortStart uint16 `binapi:"u16,name=remote_port_start" json:"remote_port_start,omitempty"` + RemotePortStop uint16 `binapi:"u16,name=remote_port_stop" json:"remote_port_stop,omitempty"` + LocalPortStart uint16 `binapi:"u16,name=local_port_start" json:"local_port_start,omitempty"` + LocalPortStop uint16 `binapi:"u16,name=local_port_stop" json:"local_port_stop,omitempty"` +} + +// IpsecTunnelProtect defines type 'ipsec_tunnel_protect'. +type IpsecTunnelProtect struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Nh ip_types.Address `binapi:"address,name=nh" json:"nh,omitempty"` + SaOut uint32 `binapi:"u32,name=sa_out" json:"sa_out,omitempty"` + NSaIn uint8 `binapi:"u8,name=n_sa_in" json:"-"` + SaIn []uint32 `binapi:"u32[n_sa_in],name=sa_in" json:"sa_in,omitempty"` +} + +// IpsecBackendDetails defines message 'ipsec_backend_details'. +type IpsecBackendDetails struct { + Name string `binapi:"string[128],name=name" json:"name,omitempty"` + Protocol ipsec_types.IpsecProto `binapi:"ipsec_proto,name=protocol" json:"protocol,omitempty"` + Index uint8 `binapi:"u8,name=index" json:"index,omitempty"` + Active bool `binapi:"bool,name=active" json:"active,omitempty"` +} + +func (m *IpsecBackendDetails) Reset() { *m = IpsecBackendDetails{} } +func (*IpsecBackendDetails) GetMessageName() string { return "ipsec_backend_details" } +func (*IpsecBackendDetails) GetCrcString() string { return "ee601c29" } +func (*IpsecBackendDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecBackendDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 128 // m.Name + size += 4 // m.Protocol + size += 1 // m.Index + size += 1 // m.Active + return size +} +func (m *IpsecBackendDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.Name, 128) + buf.EncodeUint32(uint32(m.Protocol)) + buf.EncodeUint8(uint8(m.Index)) + buf.EncodeBool(m.Active) + return buf.Bytes(), nil +} +func (m *IpsecBackendDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Name = buf.DecodeString(128) + m.Protocol = ipsec_types.IpsecProto(buf.DecodeUint32()) + m.Index = buf.DecodeUint8() + m.Active = buf.DecodeBool() + return nil +} + +// IpsecBackendDump defines message 'ipsec_backend_dump'. +type IpsecBackendDump struct{} + +func (m *IpsecBackendDump) Reset() { *m = IpsecBackendDump{} } +func (*IpsecBackendDump) GetMessageName() string { return "ipsec_backend_dump" } +func (*IpsecBackendDump) GetCrcString() string { return "51077d14" } +func (*IpsecBackendDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecBackendDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *IpsecBackendDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *IpsecBackendDump) Unmarshal(b []byte) error { + return nil +} + +// IpsecInterfaceAddDelSpd defines message 'ipsec_interface_add_del_spd'. +type IpsecInterfaceAddDelSpd struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SpdID uint32 `binapi:"u32,name=spd_id" json:"spd_id,omitempty"` +} + +func (m *IpsecInterfaceAddDelSpd) Reset() { *m = IpsecInterfaceAddDelSpd{} } +func (*IpsecInterfaceAddDelSpd) GetMessageName() string { return "ipsec_interface_add_del_spd" } +func (*IpsecInterfaceAddDelSpd) GetCrcString() string { return "80f80cbb" } +func (*IpsecInterfaceAddDelSpd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecInterfaceAddDelSpd) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.SwIfIndex + size += 4 // m.SpdID + return size +} +func (m *IpsecInterfaceAddDelSpd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.SpdID)) + return buf.Bytes(), nil +} +func (m *IpsecInterfaceAddDelSpd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.SpdID = buf.DecodeUint32() + return nil +} + +// IpsecInterfaceAddDelSpdReply defines message 'ipsec_interface_add_del_spd_reply'. +type IpsecInterfaceAddDelSpdReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IpsecInterfaceAddDelSpdReply) Reset() { *m = IpsecInterfaceAddDelSpdReply{} } +func (*IpsecInterfaceAddDelSpdReply) GetMessageName() string { + return "ipsec_interface_add_del_spd_reply" +} +func (*IpsecInterfaceAddDelSpdReply) GetCrcString() string { return "e8d4e804" } +func (*IpsecInterfaceAddDelSpdReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecInterfaceAddDelSpdReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IpsecInterfaceAddDelSpdReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IpsecInterfaceAddDelSpdReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IpsecSaDetails defines message 'ipsec_sa_details'. +type IpsecSaDetails struct { + Entry ipsec_types.IpsecSadEntry `binapi:"ipsec_sad_entry,name=entry" json:"entry,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Salt uint32 `binapi:"u32,name=salt" json:"salt,omitempty"` + SeqOutbound uint64 `binapi:"u64,name=seq_outbound" json:"seq_outbound,omitempty"` + LastSeqInbound uint64 `binapi:"u64,name=last_seq_inbound" json:"last_seq_inbound,omitempty"` + ReplayWindow uint64 `binapi:"u64,name=replay_window" json:"replay_window,omitempty"` + StatIndex uint32 `binapi:"u32,name=stat_index" json:"stat_index,omitempty"` +} + +func (m *IpsecSaDetails) Reset() { *m = IpsecSaDetails{} } +func (*IpsecSaDetails) GetMessageName() string { return "ipsec_sa_details" } +func (*IpsecSaDetails) GetCrcString() string { return "b30c7f41" } +func (*IpsecSaDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecSaDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Entry.SadID + size += 4 // m.Entry.Spi + size += 4 // m.Entry.Protocol + size += 4 // m.Entry.CryptoAlgorithm + size += 1 // m.Entry.CryptoKey.Length + size += 1 * 128 // m.Entry.CryptoKey.Data + size += 4 // m.Entry.IntegrityAlgorithm + size += 1 // m.Entry.IntegrityKey.Length + size += 1 * 128 // m.Entry.IntegrityKey.Data + size += 4 // m.Entry.Flags + size += 1 // m.Entry.TunnelSrc.Af + size += 1 * 16 // m.Entry.TunnelSrc.Un + size += 1 // m.Entry.TunnelDst.Af + size += 1 * 16 // m.Entry.TunnelDst.Un + size += 4 // m.Entry.TxTableID + size += 4 // m.Entry.Salt + size += 2 // m.Entry.UDPSrcPort + size += 2 // m.Entry.UDPDstPort + size += 4 // m.SwIfIndex + size += 4 // m.Salt + size += 8 // m.SeqOutbound + size += 8 // m.LastSeqInbound + size += 8 // m.ReplayWindow + size += 4 // m.StatIndex + return size +} +func (m *IpsecSaDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Entry.SadID)) + buf.EncodeUint32(uint32(m.Entry.Spi)) + buf.EncodeUint32(uint32(m.Entry.Protocol)) + buf.EncodeUint32(uint32(m.Entry.CryptoAlgorithm)) + buf.EncodeUint8(uint8(m.Entry.CryptoKey.Length)) + buf.EncodeBytes(m.Entry.CryptoKey.Data[:], 128) + buf.EncodeUint32(uint32(m.Entry.IntegrityAlgorithm)) + buf.EncodeUint8(uint8(m.Entry.IntegrityKey.Length)) + buf.EncodeBytes(m.Entry.IntegrityKey.Data[:], 128) + buf.EncodeUint32(uint32(m.Entry.Flags)) + buf.EncodeUint8(uint8(m.Entry.TunnelSrc.Af)) + buf.EncodeBytes(m.Entry.TunnelSrc.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Entry.TunnelDst.Af)) + buf.EncodeBytes(m.Entry.TunnelDst.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.Entry.TxTableID)) + buf.EncodeUint32(uint32(m.Entry.Salt)) + buf.EncodeUint16(uint16(m.Entry.UDPSrcPort)) + buf.EncodeUint16(uint16(m.Entry.UDPDstPort)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.Salt)) + buf.EncodeUint64(uint64(m.SeqOutbound)) + buf.EncodeUint64(uint64(m.LastSeqInbound)) + buf.EncodeUint64(uint64(m.ReplayWindow)) + buf.EncodeUint32(uint32(m.StatIndex)) + return buf.Bytes(), nil +} +func (m *IpsecSaDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Entry.SadID = buf.DecodeUint32() + m.Entry.Spi = buf.DecodeUint32() + m.Entry.Protocol = ipsec_types.IpsecProto(buf.DecodeUint32()) + m.Entry.CryptoAlgorithm = ipsec_types.IpsecCryptoAlg(buf.DecodeUint32()) + m.Entry.CryptoKey.Length = buf.DecodeUint8() + copy(m.Entry.CryptoKey.Data[:], buf.DecodeBytes(128)) + m.Entry.IntegrityAlgorithm = ipsec_types.IpsecIntegAlg(buf.DecodeUint32()) + m.Entry.IntegrityKey.Length = buf.DecodeUint8() + copy(m.Entry.IntegrityKey.Data[:], buf.DecodeBytes(128)) + m.Entry.Flags = ipsec_types.IpsecSadFlags(buf.DecodeUint32()) + m.Entry.TunnelSrc.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.TunnelSrc.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.TunnelDst.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.TunnelDst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.TxTableID = buf.DecodeUint32() + m.Entry.Salt = buf.DecodeUint32() + m.Entry.UDPSrcPort = buf.DecodeUint16() + m.Entry.UDPDstPort = buf.DecodeUint16() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Salt = buf.DecodeUint32() + m.SeqOutbound = buf.DecodeUint64() + m.LastSeqInbound = buf.DecodeUint64() + m.ReplayWindow = buf.DecodeUint64() + m.StatIndex = buf.DecodeUint32() + return nil +} + +// IpsecSaDump defines message 'ipsec_sa_dump'. +type IpsecSaDump struct { + SaID uint32 `binapi:"u32,name=sa_id" json:"sa_id,omitempty"` +} + +func (m *IpsecSaDump) Reset() { *m = IpsecSaDump{} } +func (*IpsecSaDump) GetMessageName() string { return "ipsec_sa_dump" } +func (*IpsecSaDump) GetCrcString() string { return "2076c2f4" } +func (*IpsecSaDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecSaDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SaID + return size +} +func (m *IpsecSaDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SaID)) + return buf.Bytes(), nil +} +func (m *IpsecSaDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SaID = buf.DecodeUint32() + return nil +} + +// IpsecSadEntryAddDel defines message 'ipsec_sad_entry_add_del'. +type IpsecSadEntryAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Entry ipsec_types.IpsecSadEntry `binapi:"ipsec_sad_entry,name=entry" json:"entry,omitempty"` +} + +func (m *IpsecSadEntryAddDel) Reset() { *m = IpsecSadEntryAddDel{} } +func (*IpsecSadEntryAddDel) GetMessageName() string { return "ipsec_sad_entry_add_del" } +func (*IpsecSadEntryAddDel) GetCrcString() string { return "b8def364" } +func (*IpsecSadEntryAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecSadEntryAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Entry.SadID + size += 4 // m.Entry.Spi + size += 4 // m.Entry.Protocol + size += 4 // m.Entry.CryptoAlgorithm + size += 1 // m.Entry.CryptoKey.Length + size += 1 * 128 // m.Entry.CryptoKey.Data + size += 4 // m.Entry.IntegrityAlgorithm + size += 1 // m.Entry.IntegrityKey.Length + size += 1 * 128 // m.Entry.IntegrityKey.Data + size += 4 // m.Entry.Flags + size += 1 // m.Entry.TunnelSrc.Af + size += 1 * 16 // m.Entry.TunnelSrc.Un + size += 1 // m.Entry.TunnelDst.Af + size += 1 * 16 // m.Entry.TunnelDst.Un + size += 4 // m.Entry.TxTableID + size += 4 // m.Entry.Salt + size += 2 // m.Entry.UDPSrcPort + size += 2 // m.Entry.UDPDstPort + return size +} +func (m *IpsecSadEntryAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Entry.SadID)) + buf.EncodeUint32(uint32(m.Entry.Spi)) + buf.EncodeUint32(uint32(m.Entry.Protocol)) + buf.EncodeUint32(uint32(m.Entry.CryptoAlgorithm)) + buf.EncodeUint8(uint8(m.Entry.CryptoKey.Length)) + buf.EncodeBytes(m.Entry.CryptoKey.Data[:], 128) + buf.EncodeUint32(uint32(m.Entry.IntegrityAlgorithm)) + buf.EncodeUint8(uint8(m.Entry.IntegrityKey.Length)) + buf.EncodeBytes(m.Entry.IntegrityKey.Data[:], 128) + buf.EncodeUint32(uint32(m.Entry.Flags)) + buf.EncodeUint8(uint8(m.Entry.TunnelSrc.Af)) + buf.EncodeBytes(m.Entry.TunnelSrc.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Entry.TunnelDst.Af)) + buf.EncodeBytes(m.Entry.TunnelDst.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.Entry.TxTableID)) + buf.EncodeUint32(uint32(m.Entry.Salt)) + buf.EncodeUint16(uint16(m.Entry.UDPSrcPort)) + buf.EncodeUint16(uint16(m.Entry.UDPDstPort)) + return buf.Bytes(), nil +} +func (m *IpsecSadEntryAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Entry.SadID = buf.DecodeUint32() + m.Entry.Spi = buf.DecodeUint32() + m.Entry.Protocol = ipsec_types.IpsecProto(buf.DecodeUint32()) + m.Entry.CryptoAlgorithm = ipsec_types.IpsecCryptoAlg(buf.DecodeUint32()) + m.Entry.CryptoKey.Length = buf.DecodeUint8() + copy(m.Entry.CryptoKey.Data[:], buf.DecodeBytes(128)) + m.Entry.IntegrityAlgorithm = ipsec_types.IpsecIntegAlg(buf.DecodeUint32()) + m.Entry.IntegrityKey.Length = buf.DecodeUint8() + copy(m.Entry.IntegrityKey.Data[:], buf.DecodeBytes(128)) + m.Entry.Flags = ipsec_types.IpsecSadFlags(buf.DecodeUint32()) + m.Entry.TunnelSrc.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.TunnelSrc.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.TunnelDst.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.TunnelDst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.TxTableID = buf.DecodeUint32() + m.Entry.Salt = buf.DecodeUint32() + m.Entry.UDPSrcPort = buf.DecodeUint16() + m.Entry.UDPDstPort = buf.DecodeUint16() + return nil +} + +// IpsecSadEntryAddDelReply defines message 'ipsec_sad_entry_add_del_reply'. +type IpsecSadEntryAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + StatIndex uint32 `binapi:"u32,name=stat_index" json:"stat_index,omitempty"` +} + +func (m *IpsecSadEntryAddDelReply) Reset() { *m = IpsecSadEntryAddDelReply{} } +func (*IpsecSadEntryAddDelReply) GetMessageName() string { return "ipsec_sad_entry_add_del_reply" } +func (*IpsecSadEntryAddDelReply) GetCrcString() string { return "9ffac24b" } +func (*IpsecSadEntryAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecSadEntryAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.StatIndex + return size +} +func (m *IpsecSadEntryAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.StatIndex)) + return buf.Bytes(), nil +} +func (m *IpsecSadEntryAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.StatIndex = buf.DecodeUint32() + return nil +} + +// IpsecSelectBackend defines message 'ipsec_select_backend'. +type IpsecSelectBackend struct { + Protocol ipsec_types.IpsecProto `binapi:"ipsec_proto,name=protocol" json:"protocol,omitempty"` + Index uint8 `binapi:"u8,name=index" json:"index,omitempty"` +} + +func (m *IpsecSelectBackend) Reset() { *m = IpsecSelectBackend{} } +func (*IpsecSelectBackend) GetMessageName() string { return "ipsec_select_backend" } +func (*IpsecSelectBackend) GetCrcString() string { return "5bcfd3b7" } +func (*IpsecSelectBackend) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecSelectBackend) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Protocol + size += 1 // m.Index + return size +} +func (m *IpsecSelectBackend) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Protocol)) + buf.EncodeUint8(uint8(m.Index)) + return buf.Bytes(), nil +} +func (m *IpsecSelectBackend) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Protocol = ipsec_types.IpsecProto(buf.DecodeUint32()) + m.Index = buf.DecodeUint8() + return nil +} + +// IpsecSelectBackendReply defines message 'ipsec_select_backend_reply'. +type IpsecSelectBackendReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IpsecSelectBackendReply) Reset() { *m = IpsecSelectBackendReply{} } +func (*IpsecSelectBackendReply) GetMessageName() string { return "ipsec_select_backend_reply" } +func (*IpsecSelectBackendReply) GetCrcString() string { return "e8d4e804" } +func (*IpsecSelectBackendReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecSelectBackendReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IpsecSelectBackendReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IpsecSelectBackendReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IpsecSpdAddDel defines message 'ipsec_spd_add_del'. +type IpsecSpdAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SpdID uint32 `binapi:"u32,name=spd_id" json:"spd_id,omitempty"` +} + +func (m *IpsecSpdAddDel) Reset() { *m = IpsecSpdAddDel{} } +func (*IpsecSpdAddDel) GetMessageName() string { return "ipsec_spd_add_del" } +func (*IpsecSpdAddDel) GetCrcString() string { return "20e89a95" } +func (*IpsecSpdAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecSpdAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.SpdID + return size +} +func (m *IpsecSpdAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.SpdID)) + return buf.Bytes(), nil +} +func (m *IpsecSpdAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.SpdID = buf.DecodeUint32() + return nil +} + +// IpsecSpdAddDelReply defines message 'ipsec_spd_add_del_reply'. +type IpsecSpdAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IpsecSpdAddDelReply) Reset() { *m = IpsecSpdAddDelReply{} } +func (*IpsecSpdAddDelReply) GetMessageName() string { return "ipsec_spd_add_del_reply" } +func (*IpsecSpdAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*IpsecSpdAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecSpdAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IpsecSpdAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IpsecSpdAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IpsecSpdDetails defines message 'ipsec_spd_details'. +type IpsecSpdDetails struct { + Entry IpsecSpdEntry `binapi:"ipsec_spd_entry,name=entry" json:"entry,omitempty"` +} + +func (m *IpsecSpdDetails) Reset() { *m = IpsecSpdDetails{} } +func (*IpsecSpdDetails) GetMessageName() string { return "ipsec_spd_details" } +func (*IpsecSpdDetails) GetCrcString() string { return "f2222790" } +func (*IpsecSpdDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecSpdDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Entry.SpdID + size += 4 // m.Entry.Priority + size += 1 // m.Entry.IsOutbound + size += 4 // m.Entry.SaID + size += 4 // m.Entry.Policy + size += 1 // m.Entry.Protocol + size += 1 // m.Entry.RemoteAddressStart.Af + size += 1 * 16 // m.Entry.RemoteAddressStart.Un + size += 1 // m.Entry.RemoteAddressStop.Af + size += 1 * 16 // m.Entry.RemoteAddressStop.Un + size += 1 // m.Entry.LocalAddressStart.Af + size += 1 * 16 // m.Entry.LocalAddressStart.Un + size += 1 // m.Entry.LocalAddressStop.Af + size += 1 * 16 // m.Entry.LocalAddressStop.Un + size += 2 // m.Entry.RemotePortStart + size += 2 // m.Entry.RemotePortStop + size += 2 // m.Entry.LocalPortStart + size += 2 // m.Entry.LocalPortStop + return size +} +func (m *IpsecSpdDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Entry.SpdID)) + buf.EncodeUint32(uint32(m.Entry.Priority)) + buf.EncodeBool(m.Entry.IsOutbound) + buf.EncodeUint32(uint32(m.Entry.SaID)) + buf.EncodeUint32(uint32(m.Entry.Policy)) + buf.EncodeUint8(uint8(m.Entry.Protocol)) + buf.EncodeUint8(uint8(m.Entry.RemoteAddressStart.Af)) + buf.EncodeBytes(m.Entry.RemoteAddressStart.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Entry.RemoteAddressStop.Af)) + buf.EncodeBytes(m.Entry.RemoteAddressStop.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Entry.LocalAddressStart.Af)) + buf.EncodeBytes(m.Entry.LocalAddressStart.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Entry.LocalAddressStop.Af)) + buf.EncodeBytes(m.Entry.LocalAddressStop.Un.XXX_UnionData[:], 0) + buf.EncodeUint16(uint16(m.Entry.RemotePortStart)) + buf.EncodeUint16(uint16(m.Entry.RemotePortStop)) + buf.EncodeUint16(uint16(m.Entry.LocalPortStart)) + buf.EncodeUint16(uint16(m.Entry.LocalPortStop)) + return buf.Bytes(), nil +} +func (m *IpsecSpdDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Entry.SpdID = buf.DecodeUint32() + m.Entry.Priority = int32(buf.DecodeUint32()) + m.Entry.IsOutbound = buf.DecodeBool() + m.Entry.SaID = buf.DecodeUint32() + m.Entry.Policy = IpsecSpdAction(buf.DecodeUint32()) + m.Entry.Protocol = buf.DecodeUint8() + m.Entry.RemoteAddressStart.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.RemoteAddressStart.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.RemoteAddressStop.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.RemoteAddressStop.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.LocalAddressStart.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.LocalAddressStart.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.LocalAddressStop.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.LocalAddressStop.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.RemotePortStart = buf.DecodeUint16() + m.Entry.RemotePortStop = buf.DecodeUint16() + m.Entry.LocalPortStart = buf.DecodeUint16() + m.Entry.LocalPortStop = buf.DecodeUint16() + return nil +} + +// IpsecSpdDump defines message 'ipsec_spd_dump'. +type IpsecSpdDump struct { + SpdID uint32 `binapi:"u32,name=spd_id" json:"spd_id,omitempty"` + SaID uint32 `binapi:"u32,name=sa_id" json:"sa_id,omitempty"` +} + +func (m *IpsecSpdDump) Reset() { *m = IpsecSpdDump{} } +func (*IpsecSpdDump) GetMessageName() string { return "ipsec_spd_dump" } +func (*IpsecSpdDump) GetCrcString() string { return "afefbf7d" } +func (*IpsecSpdDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecSpdDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SpdID + size += 4 // m.SaID + return size +} +func (m *IpsecSpdDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SpdID)) + buf.EncodeUint32(uint32(m.SaID)) + return buf.Bytes(), nil +} +func (m *IpsecSpdDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SpdID = buf.DecodeUint32() + m.SaID = buf.DecodeUint32() + return nil +} + +// IpsecSpdEntryAddDel defines message 'ipsec_spd_entry_add_del'. +type IpsecSpdEntryAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Entry IpsecSpdEntry `binapi:"ipsec_spd_entry,name=entry" json:"entry,omitempty"` +} + +func (m *IpsecSpdEntryAddDel) Reset() { *m = IpsecSpdEntryAddDel{} } +func (*IpsecSpdEntryAddDel) GetMessageName() string { return "ipsec_spd_entry_add_del" } +func (*IpsecSpdEntryAddDel) GetCrcString() string { return "9f384b8d" } +func (*IpsecSpdEntryAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecSpdEntryAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Entry.SpdID + size += 4 // m.Entry.Priority + size += 1 // m.Entry.IsOutbound + size += 4 // m.Entry.SaID + size += 4 // m.Entry.Policy + size += 1 // m.Entry.Protocol + size += 1 // m.Entry.RemoteAddressStart.Af + size += 1 * 16 // m.Entry.RemoteAddressStart.Un + size += 1 // m.Entry.RemoteAddressStop.Af + size += 1 * 16 // m.Entry.RemoteAddressStop.Un + size += 1 // m.Entry.LocalAddressStart.Af + size += 1 * 16 // m.Entry.LocalAddressStart.Un + size += 1 // m.Entry.LocalAddressStop.Af + size += 1 * 16 // m.Entry.LocalAddressStop.Un + size += 2 // m.Entry.RemotePortStart + size += 2 // m.Entry.RemotePortStop + size += 2 // m.Entry.LocalPortStart + size += 2 // m.Entry.LocalPortStop + return size +} +func (m *IpsecSpdEntryAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Entry.SpdID)) + buf.EncodeUint32(uint32(m.Entry.Priority)) + buf.EncodeBool(m.Entry.IsOutbound) + buf.EncodeUint32(uint32(m.Entry.SaID)) + buf.EncodeUint32(uint32(m.Entry.Policy)) + buf.EncodeUint8(uint8(m.Entry.Protocol)) + buf.EncodeUint8(uint8(m.Entry.RemoteAddressStart.Af)) + buf.EncodeBytes(m.Entry.RemoteAddressStart.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Entry.RemoteAddressStop.Af)) + buf.EncodeBytes(m.Entry.RemoteAddressStop.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Entry.LocalAddressStart.Af)) + buf.EncodeBytes(m.Entry.LocalAddressStart.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Entry.LocalAddressStop.Af)) + buf.EncodeBytes(m.Entry.LocalAddressStop.Un.XXX_UnionData[:], 0) + buf.EncodeUint16(uint16(m.Entry.RemotePortStart)) + buf.EncodeUint16(uint16(m.Entry.RemotePortStop)) + buf.EncodeUint16(uint16(m.Entry.LocalPortStart)) + buf.EncodeUint16(uint16(m.Entry.LocalPortStop)) + return buf.Bytes(), nil +} +func (m *IpsecSpdEntryAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Entry.SpdID = buf.DecodeUint32() + m.Entry.Priority = int32(buf.DecodeUint32()) + m.Entry.IsOutbound = buf.DecodeBool() + m.Entry.SaID = buf.DecodeUint32() + m.Entry.Policy = IpsecSpdAction(buf.DecodeUint32()) + m.Entry.Protocol = buf.DecodeUint8() + m.Entry.RemoteAddressStart.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.RemoteAddressStart.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.RemoteAddressStop.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.RemoteAddressStop.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.LocalAddressStart.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.LocalAddressStart.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.LocalAddressStop.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.LocalAddressStop.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.RemotePortStart = buf.DecodeUint16() + m.Entry.RemotePortStop = buf.DecodeUint16() + m.Entry.LocalPortStart = buf.DecodeUint16() + m.Entry.LocalPortStop = buf.DecodeUint16() + return nil +} + +// IpsecSpdEntryAddDelReply defines message 'ipsec_spd_entry_add_del_reply'. +type IpsecSpdEntryAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + StatIndex uint32 `binapi:"u32,name=stat_index" json:"stat_index,omitempty"` +} + +func (m *IpsecSpdEntryAddDelReply) Reset() { *m = IpsecSpdEntryAddDelReply{} } +func (*IpsecSpdEntryAddDelReply) GetMessageName() string { return "ipsec_spd_entry_add_del_reply" } +func (*IpsecSpdEntryAddDelReply) GetCrcString() string { return "9ffac24b" } +func (*IpsecSpdEntryAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecSpdEntryAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.StatIndex + return size +} +func (m *IpsecSpdEntryAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.StatIndex)) + return buf.Bytes(), nil +} +func (m *IpsecSpdEntryAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.StatIndex = buf.DecodeUint32() + return nil +} + +// IpsecSpdInterfaceDetails defines message 'ipsec_spd_interface_details'. +type IpsecSpdInterfaceDetails struct { + SpdIndex uint32 `binapi:"u32,name=spd_index" json:"spd_index,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *IpsecSpdInterfaceDetails) Reset() { *m = IpsecSpdInterfaceDetails{} } +func (*IpsecSpdInterfaceDetails) GetMessageName() string { return "ipsec_spd_interface_details" } +func (*IpsecSpdInterfaceDetails) GetCrcString() string { return "7a0bcf3e" } +func (*IpsecSpdInterfaceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecSpdInterfaceDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SpdIndex + size += 4 // m.SwIfIndex + return size +} +func (m *IpsecSpdInterfaceDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SpdIndex)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *IpsecSpdInterfaceDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SpdIndex = buf.DecodeUint32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// IpsecSpdInterfaceDump defines message 'ipsec_spd_interface_dump'. +type IpsecSpdInterfaceDump struct { + SpdIndex uint32 `binapi:"u32,name=spd_index" json:"spd_index,omitempty"` + SpdIndexValid uint8 `binapi:"u8,name=spd_index_valid" json:"spd_index_valid,omitempty"` +} + +func (m *IpsecSpdInterfaceDump) Reset() { *m = IpsecSpdInterfaceDump{} } +func (*IpsecSpdInterfaceDump) GetMessageName() string { return "ipsec_spd_interface_dump" } +func (*IpsecSpdInterfaceDump) GetCrcString() string { return "8971de19" } +func (*IpsecSpdInterfaceDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecSpdInterfaceDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SpdIndex + size += 1 // m.SpdIndexValid + return size +} +func (m *IpsecSpdInterfaceDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SpdIndex)) + buf.EncodeUint8(uint8(m.SpdIndexValid)) + return buf.Bytes(), nil +} +func (m *IpsecSpdInterfaceDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SpdIndex = buf.DecodeUint32() + m.SpdIndexValid = buf.DecodeUint8() + return nil +} + +// IpsecSpdsDetails defines message 'ipsec_spds_details'. +type IpsecSpdsDetails struct { + SpdID uint32 `binapi:"u32,name=spd_id" json:"spd_id,omitempty"` + Npolicies uint32 `binapi:"u32,name=npolicies" json:"npolicies,omitempty"` +} + +func (m *IpsecSpdsDetails) Reset() { *m = IpsecSpdsDetails{} } +func (*IpsecSpdsDetails) GetMessageName() string { return "ipsec_spds_details" } +func (*IpsecSpdsDetails) GetCrcString() string { return "a04bb254" } +func (*IpsecSpdsDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecSpdsDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SpdID + size += 4 // m.Npolicies + return size +} +func (m *IpsecSpdsDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SpdID)) + buf.EncodeUint32(uint32(m.Npolicies)) + return buf.Bytes(), nil +} +func (m *IpsecSpdsDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SpdID = buf.DecodeUint32() + m.Npolicies = buf.DecodeUint32() + return nil +} + +// IpsecSpdsDump defines message 'ipsec_spds_dump'. +type IpsecSpdsDump struct{} + +func (m *IpsecSpdsDump) Reset() { *m = IpsecSpdsDump{} } +func (*IpsecSpdsDump) GetMessageName() string { return "ipsec_spds_dump" } +func (*IpsecSpdsDump) GetCrcString() string { return "51077d14" } +func (*IpsecSpdsDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecSpdsDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *IpsecSpdsDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *IpsecSpdsDump) Unmarshal(b []byte) error { + return nil +} + +// IpsecTunnelIfAddDel defines message 'ipsec_tunnel_if_add_del'. +type IpsecTunnelIfAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Esn bool `binapi:"bool,name=esn" json:"esn,omitempty"` + AntiReplay bool `binapi:"bool,name=anti_replay" json:"anti_replay,omitempty"` + LocalIP ip_types.Address `binapi:"address,name=local_ip" json:"local_ip,omitempty"` + RemoteIP ip_types.Address `binapi:"address,name=remote_ip" json:"remote_ip,omitempty"` + LocalSpi uint32 `binapi:"u32,name=local_spi" json:"local_spi,omitempty"` + RemoteSpi uint32 `binapi:"u32,name=remote_spi" json:"remote_spi,omitempty"` + CryptoAlg uint8 `binapi:"u8,name=crypto_alg" json:"crypto_alg,omitempty"` + LocalCryptoKeyLen uint8 `binapi:"u8,name=local_crypto_key_len" json:"local_crypto_key_len,omitempty"` + LocalCryptoKey []byte `binapi:"u8[128],name=local_crypto_key" json:"local_crypto_key,omitempty"` + RemoteCryptoKeyLen uint8 `binapi:"u8,name=remote_crypto_key_len" json:"remote_crypto_key_len,omitempty"` + RemoteCryptoKey []byte `binapi:"u8[128],name=remote_crypto_key" json:"remote_crypto_key,omitempty"` + IntegAlg uint8 `binapi:"u8,name=integ_alg" json:"integ_alg,omitempty"` + LocalIntegKeyLen uint8 `binapi:"u8,name=local_integ_key_len" json:"local_integ_key_len,omitempty"` + LocalIntegKey []byte `binapi:"u8[128],name=local_integ_key" json:"local_integ_key,omitempty"` + RemoteIntegKeyLen uint8 `binapi:"u8,name=remote_integ_key_len" json:"remote_integ_key_len,omitempty"` + RemoteIntegKey []byte `binapi:"u8[128],name=remote_integ_key" json:"remote_integ_key,omitempty"` + Renumber bool `binapi:"bool,name=renumber" json:"renumber,omitempty"` + ShowInstance uint32 `binapi:"u32,name=show_instance" json:"show_instance,omitempty"` + UDPEncap bool `binapi:"bool,name=udp_encap" json:"udp_encap,omitempty"` + TxTableID uint32 `binapi:"u32,name=tx_table_id" json:"tx_table_id,omitempty"` + Salt uint32 `binapi:"u32,name=salt" json:"salt,omitempty"` +} + +func (m *IpsecTunnelIfAddDel) Reset() { *m = IpsecTunnelIfAddDel{} } +func (*IpsecTunnelIfAddDel) GetMessageName() string { return "ipsec_tunnel_if_add_del" } +func (*IpsecTunnelIfAddDel) GetCrcString() string { return "2b135e68" } +func (*IpsecTunnelIfAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecTunnelIfAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.Esn + size += 1 // m.AntiReplay + size += 1 // m.LocalIP.Af + size += 1 * 16 // m.LocalIP.Un + size += 1 // m.RemoteIP.Af + size += 1 * 16 // m.RemoteIP.Un + size += 4 // m.LocalSpi + size += 4 // m.RemoteSpi + size += 1 // m.CryptoAlg + size += 1 // m.LocalCryptoKeyLen + size += 1 * 128 // m.LocalCryptoKey + size += 1 // m.RemoteCryptoKeyLen + size += 1 * 128 // m.RemoteCryptoKey + size += 1 // m.IntegAlg + size += 1 // m.LocalIntegKeyLen + size += 1 * 128 // m.LocalIntegKey + size += 1 // m.RemoteIntegKeyLen + size += 1 * 128 // m.RemoteIntegKey + size += 1 // m.Renumber + size += 4 // m.ShowInstance + size += 1 // m.UDPEncap + size += 4 // m.TxTableID + size += 4 // m.Salt + return size +} +func (m *IpsecTunnelIfAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeBool(m.Esn) + buf.EncodeBool(m.AntiReplay) + buf.EncodeUint8(uint8(m.LocalIP.Af)) + buf.EncodeBytes(m.LocalIP.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.RemoteIP.Af)) + buf.EncodeBytes(m.RemoteIP.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.LocalSpi)) + buf.EncodeUint32(uint32(m.RemoteSpi)) + buf.EncodeUint8(uint8(m.CryptoAlg)) + buf.EncodeUint8(uint8(m.LocalCryptoKeyLen)) + buf.EncodeBytes(m.LocalCryptoKey[:], 128) + buf.EncodeUint8(uint8(m.RemoteCryptoKeyLen)) + buf.EncodeBytes(m.RemoteCryptoKey[:], 128) + buf.EncodeUint8(uint8(m.IntegAlg)) + buf.EncodeUint8(uint8(m.LocalIntegKeyLen)) + buf.EncodeBytes(m.LocalIntegKey[:], 128) + buf.EncodeUint8(uint8(m.RemoteIntegKeyLen)) + buf.EncodeBytes(m.RemoteIntegKey[:], 128) + buf.EncodeBool(m.Renumber) + buf.EncodeUint32(uint32(m.ShowInstance)) + buf.EncodeBool(m.UDPEncap) + buf.EncodeUint32(uint32(m.TxTableID)) + buf.EncodeUint32(uint32(m.Salt)) + return buf.Bytes(), nil +} +func (m *IpsecTunnelIfAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Esn = buf.DecodeBool() + m.AntiReplay = buf.DecodeBool() + m.LocalIP.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.LocalIP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.RemoteIP.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.RemoteIP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.LocalSpi = buf.DecodeUint32() + m.RemoteSpi = buf.DecodeUint32() + m.CryptoAlg = buf.DecodeUint8() + m.LocalCryptoKeyLen = buf.DecodeUint8() + copy(m.LocalCryptoKey[:], buf.DecodeBytes(128)) + m.RemoteCryptoKeyLen = buf.DecodeUint8() + copy(m.RemoteCryptoKey[:], buf.DecodeBytes(128)) + m.IntegAlg = buf.DecodeUint8() + m.LocalIntegKeyLen = buf.DecodeUint8() + copy(m.LocalIntegKey[:], buf.DecodeBytes(128)) + m.RemoteIntegKeyLen = buf.DecodeUint8() + copy(m.RemoteIntegKey[:], buf.DecodeBytes(128)) + m.Renumber = buf.DecodeBool() + m.ShowInstance = buf.DecodeUint32() + m.UDPEncap = buf.DecodeBool() + m.TxTableID = buf.DecodeUint32() + m.Salt = buf.DecodeUint32() + return nil +} + +// IpsecTunnelIfAddDelReply defines message 'ipsec_tunnel_if_add_del_reply'. +type IpsecTunnelIfAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *IpsecTunnelIfAddDelReply) Reset() { *m = IpsecTunnelIfAddDelReply{} } +func (*IpsecTunnelIfAddDelReply) GetMessageName() string { return "ipsec_tunnel_if_add_del_reply" } +func (*IpsecTunnelIfAddDelReply) GetCrcString() string { return "5383d31f" } +func (*IpsecTunnelIfAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecTunnelIfAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *IpsecTunnelIfAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *IpsecTunnelIfAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// IpsecTunnelIfSetSa defines message 'ipsec_tunnel_if_set_sa'. +type IpsecTunnelIfSetSa struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SaID uint32 `binapi:"u32,name=sa_id" json:"sa_id,omitempty"` + IsOutbound uint8 `binapi:"u8,name=is_outbound" json:"is_outbound,omitempty"` +} + +func (m *IpsecTunnelIfSetSa) Reset() { *m = IpsecTunnelIfSetSa{} } +func (*IpsecTunnelIfSetSa) GetMessageName() string { return "ipsec_tunnel_if_set_sa" } +func (*IpsecTunnelIfSetSa) GetCrcString() string { return "f2f87112" } +func (*IpsecTunnelIfSetSa) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecTunnelIfSetSa) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.SaID + size += 1 // m.IsOutbound + return size +} +func (m *IpsecTunnelIfSetSa) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.SaID)) + buf.EncodeUint8(uint8(m.IsOutbound)) + return buf.Bytes(), nil +} +func (m *IpsecTunnelIfSetSa) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.SaID = buf.DecodeUint32() + m.IsOutbound = buf.DecodeUint8() + return nil +} + +// IpsecTunnelIfSetSaReply defines message 'ipsec_tunnel_if_set_sa_reply'. +type IpsecTunnelIfSetSaReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IpsecTunnelIfSetSaReply) Reset() { *m = IpsecTunnelIfSetSaReply{} } +func (*IpsecTunnelIfSetSaReply) GetMessageName() string { return "ipsec_tunnel_if_set_sa_reply" } +func (*IpsecTunnelIfSetSaReply) GetCrcString() string { return "e8d4e804" } +func (*IpsecTunnelIfSetSaReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecTunnelIfSetSaReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IpsecTunnelIfSetSaReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IpsecTunnelIfSetSaReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IpsecTunnelProtectDel defines message 'ipsec_tunnel_protect_del'. +type IpsecTunnelProtectDel struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Nh ip_types.Address `binapi:"address,name=nh" json:"nh,omitempty"` +} + +func (m *IpsecTunnelProtectDel) Reset() { *m = IpsecTunnelProtectDel{} } +func (*IpsecTunnelProtectDel) GetMessageName() string { return "ipsec_tunnel_protect_del" } +func (*IpsecTunnelProtectDel) GetCrcString() string { return "ddd2ba36" } +func (*IpsecTunnelProtectDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecTunnelProtectDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Nh.Af + size += 1 * 16 // m.Nh.Un + return size +} +func (m *IpsecTunnelProtectDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.Nh.Af)) + buf.EncodeBytes(m.Nh.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *IpsecTunnelProtectDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Nh.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Nh.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// IpsecTunnelProtectDelReply defines message 'ipsec_tunnel_protect_del_reply'. +type IpsecTunnelProtectDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IpsecTunnelProtectDelReply) Reset() { *m = IpsecTunnelProtectDelReply{} } +func (*IpsecTunnelProtectDelReply) GetMessageName() string { return "ipsec_tunnel_protect_del_reply" } +func (*IpsecTunnelProtectDelReply) GetCrcString() string { return "e8d4e804" } +func (*IpsecTunnelProtectDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecTunnelProtectDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IpsecTunnelProtectDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IpsecTunnelProtectDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IpsecTunnelProtectDetails defines message 'ipsec_tunnel_protect_details'. +type IpsecTunnelProtectDetails struct { + Tun IpsecTunnelProtect `binapi:"ipsec_tunnel_protect,name=tun" json:"tun,omitempty"` +} + +func (m *IpsecTunnelProtectDetails) Reset() { *m = IpsecTunnelProtectDetails{} } +func (*IpsecTunnelProtectDetails) GetMessageName() string { return "ipsec_tunnel_protect_details" } +func (*IpsecTunnelProtectDetails) GetCrcString() string { return "ac6c823b" } +func (*IpsecTunnelProtectDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecTunnelProtectDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Tun.SwIfIndex + size += 1 // m.Tun.Nh.Af + size += 1 * 16 // m.Tun.Nh.Un + size += 4 // m.Tun.SaOut + size += 1 // m.Tun.NSaIn + size += 4 * len(m.Tun.SaIn) // m.Tun.SaIn + return size +} +func (m *IpsecTunnelProtectDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Tun.SwIfIndex)) + buf.EncodeUint8(uint8(m.Tun.Nh.Af)) + buf.EncodeBytes(m.Tun.Nh.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.Tun.SaOut)) + buf.EncodeUint8(uint8(len(m.Tun.SaIn))) + for i := 0; i < len(m.Tun.SaIn); i++ { + var x uint32 + if i < len(m.Tun.SaIn) { + x = uint32(m.Tun.SaIn[i]) + } + buf.EncodeUint32(uint32(x)) + } + return buf.Bytes(), nil +} +func (m *IpsecTunnelProtectDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Tun.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Tun.Nh.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Tun.Nh.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Tun.SaOut = buf.DecodeUint32() + m.Tun.NSaIn = buf.DecodeUint8() + m.Tun.SaIn = make([]uint32, m.Tun.NSaIn) + for i := 0; i < len(m.Tun.SaIn); i++ { + m.Tun.SaIn[i] = buf.DecodeUint32() + } + return nil +} + +// IpsecTunnelProtectDump defines message 'ipsec_tunnel_protect_dump'. +type IpsecTunnelProtectDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *IpsecTunnelProtectDump) Reset() { *m = IpsecTunnelProtectDump{} } +func (*IpsecTunnelProtectDump) GetMessageName() string { return "ipsec_tunnel_protect_dump" } +func (*IpsecTunnelProtectDump) GetCrcString() string { return "f9e6675e" } +func (*IpsecTunnelProtectDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecTunnelProtectDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *IpsecTunnelProtectDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *IpsecTunnelProtectDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// IpsecTunnelProtectUpdate defines message 'ipsec_tunnel_protect_update'. +type IpsecTunnelProtectUpdate struct { + Tunnel IpsecTunnelProtect `binapi:"ipsec_tunnel_protect,name=tunnel" json:"tunnel,omitempty"` +} + +func (m *IpsecTunnelProtectUpdate) Reset() { *m = IpsecTunnelProtectUpdate{} } +func (*IpsecTunnelProtectUpdate) GetMessageName() string { return "ipsec_tunnel_protect_update" } +func (*IpsecTunnelProtectUpdate) GetCrcString() string { return "143f155d" } +func (*IpsecTunnelProtectUpdate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecTunnelProtectUpdate) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Tunnel.SwIfIndex + size += 1 // m.Tunnel.Nh.Af + size += 1 * 16 // m.Tunnel.Nh.Un + size += 4 // m.Tunnel.SaOut + size += 1 // m.Tunnel.NSaIn + size += 4 * len(m.Tunnel.SaIn) // m.Tunnel.SaIn + return size +} +func (m *IpsecTunnelProtectUpdate) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex)) + buf.EncodeUint8(uint8(m.Tunnel.Nh.Af)) + buf.EncodeBytes(m.Tunnel.Nh.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.Tunnel.SaOut)) + buf.EncodeUint8(uint8(len(m.Tunnel.SaIn))) + for i := 0; i < len(m.Tunnel.SaIn); i++ { + var x uint32 + if i < len(m.Tunnel.SaIn) { + x = uint32(m.Tunnel.SaIn[i]) + } + buf.EncodeUint32(uint32(x)) + } + return buf.Bytes(), nil +} +func (m *IpsecTunnelProtectUpdate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Tunnel.Nh.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Tunnel.Nh.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Tunnel.SaOut = buf.DecodeUint32() + m.Tunnel.NSaIn = buf.DecodeUint8() + m.Tunnel.SaIn = make([]uint32, m.Tunnel.NSaIn) + for i := 0; i < len(m.Tunnel.SaIn); i++ { + m.Tunnel.SaIn[i] = buf.DecodeUint32() + } + return nil +} + +// IpsecTunnelProtectUpdateReply defines message 'ipsec_tunnel_protect_update_reply'. +type IpsecTunnelProtectUpdateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IpsecTunnelProtectUpdateReply) Reset() { *m = IpsecTunnelProtectUpdateReply{} } +func (*IpsecTunnelProtectUpdateReply) GetMessageName() string { + return "ipsec_tunnel_protect_update_reply" +} +func (*IpsecTunnelProtectUpdateReply) GetCrcString() string { return "e8d4e804" } +func (*IpsecTunnelProtectUpdateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecTunnelProtectUpdateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IpsecTunnelProtectUpdateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IpsecTunnelProtectUpdateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_ipsec_binapi_init() } +func file_ipsec_binapi_init() { + api.RegisterMessage((*IpsecBackendDetails)(nil), "ipsec_backend_details_ee601c29") + api.RegisterMessage((*IpsecBackendDump)(nil), "ipsec_backend_dump_51077d14") + api.RegisterMessage((*IpsecInterfaceAddDelSpd)(nil), "ipsec_interface_add_del_spd_80f80cbb") + api.RegisterMessage((*IpsecInterfaceAddDelSpdReply)(nil), "ipsec_interface_add_del_spd_reply_e8d4e804") + api.RegisterMessage((*IpsecSaDetails)(nil), "ipsec_sa_details_b30c7f41") + api.RegisterMessage((*IpsecSaDump)(nil), "ipsec_sa_dump_2076c2f4") + api.RegisterMessage((*IpsecSadEntryAddDel)(nil), "ipsec_sad_entry_add_del_b8def364") + api.RegisterMessage((*IpsecSadEntryAddDelReply)(nil), "ipsec_sad_entry_add_del_reply_9ffac24b") + api.RegisterMessage((*IpsecSelectBackend)(nil), "ipsec_select_backend_5bcfd3b7") + api.RegisterMessage((*IpsecSelectBackendReply)(nil), "ipsec_select_backend_reply_e8d4e804") + api.RegisterMessage((*IpsecSpdAddDel)(nil), "ipsec_spd_add_del_20e89a95") + api.RegisterMessage((*IpsecSpdAddDelReply)(nil), "ipsec_spd_add_del_reply_e8d4e804") + api.RegisterMessage((*IpsecSpdDetails)(nil), "ipsec_spd_details_f2222790") + api.RegisterMessage((*IpsecSpdDump)(nil), "ipsec_spd_dump_afefbf7d") + api.RegisterMessage((*IpsecSpdEntryAddDel)(nil), "ipsec_spd_entry_add_del_9f384b8d") + api.RegisterMessage((*IpsecSpdEntryAddDelReply)(nil), "ipsec_spd_entry_add_del_reply_9ffac24b") + api.RegisterMessage((*IpsecSpdInterfaceDetails)(nil), "ipsec_spd_interface_details_7a0bcf3e") + api.RegisterMessage((*IpsecSpdInterfaceDump)(nil), "ipsec_spd_interface_dump_8971de19") + api.RegisterMessage((*IpsecSpdsDetails)(nil), "ipsec_spds_details_a04bb254") + api.RegisterMessage((*IpsecSpdsDump)(nil), "ipsec_spds_dump_51077d14") + api.RegisterMessage((*IpsecTunnelIfAddDel)(nil), "ipsec_tunnel_if_add_del_2b135e68") + api.RegisterMessage((*IpsecTunnelIfAddDelReply)(nil), "ipsec_tunnel_if_add_del_reply_5383d31f") + api.RegisterMessage((*IpsecTunnelIfSetSa)(nil), "ipsec_tunnel_if_set_sa_f2f87112") + api.RegisterMessage((*IpsecTunnelIfSetSaReply)(nil), "ipsec_tunnel_if_set_sa_reply_e8d4e804") + api.RegisterMessage((*IpsecTunnelProtectDel)(nil), "ipsec_tunnel_protect_del_ddd2ba36") + api.RegisterMessage((*IpsecTunnelProtectDelReply)(nil), "ipsec_tunnel_protect_del_reply_e8d4e804") + api.RegisterMessage((*IpsecTunnelProtectDetails)(nil), "ipsec_tunnel_protect_details_ac6c823b") + api.RegisterMessage((*IpsecTunnelProtectDump)(nil), "ipsec_tunnel_protect_dump_f9e6675e") + api.RegisterMessage((*IpsecTunnelProtectUpdate)(nil), "ipsec_tunnel_protect_update_143f155d") + api.RegisterMessage((*IpsecTunnelProtectUpdateReply)(nil), "ipsec_tunnel_protect_update_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*IpsecBackendDetails)(nil), + (*IpsecBackendDump)(nil), + (*IpsecInterfaceAddDelSpd)(nil), + (*IpsecInterfaceAddDelSpdReply)(nil), + (*IpsecSaDetails)(nil), + (*IpsecSaDump)(nil), + (*IpsecSadEntryAddDel)(nil), + (*IpsecSadEntryAddDelReply)(nil), + (*IpsecSelectBackend)(nil), + (*IpsecSelectBackendReply)(nil), + (*IpsecSpdAddDel)(nil), + (*IpsecSpdAddDelReply)(nil), + (*IpsecSpdDetails)(nil), + (*IpsecSpdDump)(nil), + (*IpsecSpdEntryAddDel)(nil), + (*IpsecSpdEntryAddDelReply)(nil), + (*IpsecSpdInterfaceDetails)(nil), + (*IpsecSpdInterfaceDump)(nil), + (*IpsecSpdsDetails)(nil), + (*IpsecSpdsDump)(nil), + (*IpsecTunnelIfAddDel)(nil), + (*IpsecTunnelIfAddDelReply)(nil), + (*IpsecTunnelIfSetSa)(nil), + (*IpsecTunnelIfSetSaReply)(nil), + (*IpsecTunnelProtectDel)(nil), + (*IpsecTunnelProtectDelReply)(nil), + (*IpsecTunnelProtectDetails)(nil), + (*IpsecTunnelProtectDump)(nil), + (*IpsecTunnelProtectUpdate)(nil), + (*IpsecTunnelProtectUpdateReply)(nil), + } +} diff --git a/binapi/ipsec/ipsec_rest.ba.go b/binapi/ipsec/ipsec_rest.ba.go new file mode 100644 index 0000000..166ebcd --- /dev/null +++ b/binapi/ipsec/ipsec_rest.ba.go @@ -0,0 +1,221 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ipsec + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/ipsec_interface_add_del_spd", func(w http.ResponseWriter, req *http.Request) { + var request = new(IpsecInterfaceAddDelSpd) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IpsecInterfaceAddDelSpd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ipsec_sad_entry_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(IpsecSadEntryAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IpsecSadEntryAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ipsec_select_backend", func(w http.ResponseWriter, req *http.Request) { + var request = new(IpsecSelectBackend) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IpsecSelectBackend(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ipsec_spd_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(IpsecSpdAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IpsecSpdAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ipsec_spd_entry_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(IpsecSpdEntryAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IpsecSpdEntryAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ipsec_tunnel_if_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(IpsecTunnelIfAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IpsecTunnelIfAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ipsec_tunnel_if_set_sa", func(w http.ResponseWriter, req *http.Request) { + var request = new(IpsecTunnelIfSetSa) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IpsecTunnelIfSetSa(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ipsec_tunnel_protect_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(IpsecTunnelProtectDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IpsecTunnelProtectDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ipsec_tunnel_protect_update", func(w http.ResponseWriter, req *http.Request) { + var request = new(IpsecTunnelProtectUpdate) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IpsecTunnelProtectUpdate(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/ipsec/ipsec_rpc.ba.go b/binapi/ipsec/ipsec_rpc.ba.go new file mode 100644 index 0000000..c2d2af8 --- /dev/null +++ b/binapi/ipsec/ipsec_rpc.ba.go @@ -0,0 +1,353 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ipsec + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service ipsec. +type RPCService interface { + IpsecBackendDump(ctx context.Context, in *IpsecBackendDump) (RPCService_IpsecBackendDumpClient, error) + IpsecInterfaceAddDelSpd(ctx context.Context, in *IpsecInterfaceAddDelSpd) (*IpsecInterfaceAddDelSpdReply, error) + IpsecSaDump(ctx context.Context, in *IpsecSaDump) (RPCService_IpsecSaDumpClient, error) + IpsecSadEntryAddDel(ctx context.Context, in *IpsecSadEntryAddDel) (*IpsecSadEntryAddDelReply, error) + IpsecSelectBackend(ctx context.Context, in *IpsecSelectBackend) (*IpsecSelectBackendReply, error) + IpsecSpdAddDel(ctx context.Context, in *IpsecSpdAddDel) (*IpsecSpdAddDelReply, error) + IpsecSpdDump(ctx context.Context, in *IpsecSpdDump) (RPCService_IpsecSpdDumpClient, error) + IpsecSpdEntryAddDel(ctx context.Context, in *IpsecSpdEntryAddDel) (*IpsecSpdEntryAddDelReply, error) + IpsecSpdInterfaceDump(ctx context.Context, in *IpsecSpdInterfaceDump) (RPCService_IpsecSpdInterfaceDumpClient, error) + IpsecSpdsDump(ctx context.Context, in *IpsecSpdsDump) (RPCService_IpsecSpdsDumpClient, error) + IpsecTunnelIfAddDel(ctx context.Context, in *IpsecTunnelIfAddDel) (*IpsecTunnelIfAddDelReply, error) + IpsecTunnelIfSetSa(ctx context.Context, in *IpsecTunnelIfSetSa) (*IpsecTunnelIfSetSaReply, error) + IpsecTunnelProtectDel(ctx context.Context, in *IpsecTunnelProtectDel) (*IpsecTunnelProtectDelReply, error) + IpsecTunnelProtectDump(ctx context.Context, in *IpsecTunnelProtectDump) (RPCService_IpsecTunnelProtectDumpClient, error) + IpsecTunnelProtectUpdate(ctx context.Context, in *IpsecTunnelProtectUpdate) (*IpsecTunnelProtectUpdateReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) IpsecBackendDump(ctx context.Context, in *IpsecBackendDump) (RPCService_IpsecBackendDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IpsecBackendDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IpsecBackendDumpClient interface { + Recv() (*IpsecBackendDetails, error) + api.Stream +} + +type serviceClient_IpsecBackendDumpClient struct { + api.Stream +} + +func (c *serviceClient_IpsecBackendDumpClient) Recv() (*IpsecBackendDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IpsecBackendDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IpsecInterfaceAddDelSpd(ctx context.Context, in *IpsecInterfaceAddDelSpd) (*IpsecInterfaceAddDelSpdReply, error) { + out := new(IpsecInterfaceAddDelSpdReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSaDump(ctx context.Context, in *IpsecSaDump) (RPCService_IpsecSaDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IpsecSaDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IpsecSaDumpClient interface { + Recv() (*IpsecSaDetails, error) + api.Stream +} + +type serviceClient_IpsecSaDumpClient struct { + api.Stream +} + +func (c *serviceClient_IpsecSaDumpClient) Recv() (*IpsecSaDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IpsecSaDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IpsecSadEntryAddDel(ctx context.Context, in *IpsecSadEntryAddDel) (*IpsecSadEntryAddDelReply, error) { + out := new(IpsecSadEntryAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSelectBackend(ctx context.Context, in *IpsecSelectBackend) (*IpsecSelectBackendReply, error) { + out := new(IpsecSelectBackendReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSpdAddDel(ctx context.Context, in *IpsecSpdAddDel) (*IpsecSpdAddDelReply, error) { + out := new(IpsecSpdAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSpdDump(ctx context.Context, in *IpsecSpdDump) (RPCService_IpsecSpdDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IpsecSpdDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IpsecSpdDumpClient interface { + Recv() (*IpsecSpdDetails, error) + api.Stream +} + +type serviceClient_IpsecSpdDumpClient struct { + api.Stream +} + +func (c *serviceClient_IpsecSpdDumpClient) Recv() (*IpsecSpdDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IpsecSpdDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IpsecSpdEntryAddDel(ctx context.Context, in *IpsecSpdEntryAddDel) (*IpsecSpdEntryAddDelReply, error) { + out := new(IpsecSpdEntryAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSpdInterfaceDump(ctx context.Context, in *IpsecSpdInterfaceDump) (RPCService_IpsecSpdInterfaceDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IpsecSpdInterfaceDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IpsecSpdInterfaceDumpClient interface { + Recv() (*IpsecSpdInterfaceDetails, error) + api.Stream +} + +type serviceClient_IpsecSpdInterfaceDumpClient struct { + api.Stream +} + +func (c *serviceClient_IpsecSpdInterfaceDumpClient) Recv() (*IpsecSpdInterfaceDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IpsecSpdInterfaceDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IpsecSpdsDump(ctx context.Context, in *IpsecSpdsDump) (RPCService_IpsecSpdsDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IpsecSpdsDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IpsecSpdsDumpClient interface { + Recv() (*IpsecSpdsDetails, error) + api.Stream +} + +type serviceClient_IpsecSpdsDumpClient struct { + api.Stream +} + +func (c *serviceClient_IpsecSpdsDumpClient) Recv() (*IpsecSpdsDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IpsecSpdsDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IpsecTunnelIfAddDel(ctx context.Context, in *IpsecTunnelIfAddDel) (*IpsecTunnelIfAddDelReply, error) { + out := new(IpsecTunnelIfAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecTunnelIfSetSa(ctx context.Context, in *IpsecTunnelIfSetSa) (*IpsecTunnelIfSetSaReply, error) { + out := new(IpsecTunnelIfSetSaReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecTunnelProtectDel(ctx context.Context, in *IpsecTunnelProtectDel) (*IpsecTunnelProtectDelReply, error) { + out := new(IpsecTunnelProtectDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecTunnelProtectDump(ctx context.Context, in *IpsecTunnelProtectDump) (RPCService_IpsecTunnelProtectDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IpsecTunnelProtectDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_IpsecTunnelProtectDumpClient interface { + Recv() (*IpsecTunnelProtectDetails, error) + api.Stream +} + +type serviceClient_IpsecTunnelProtectDumpClient struct { + api.Stream +} + +func (c *serviceClient_IpsecTunnelProtectDumpClient) Recv() (*IpsecTunnelProtectDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IpsecTunnelProtectDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IpsecTunnelProtectUpdate(ctx context.Context, in *IpsecTunnelProtectUpdate) (*IpsecTunnelProtectUpdateReply, error) { + out := new(IpsecTunnelProtectUpdateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/ipsec_types/ipsec_types.ba.go b/binapi/ipsec_types/ipsec_types.ba.go new file mode 100644 index 0000000..c1d80aa --- /dev/null +++ b/binapi/ipsec_types/ipsec_types.ba.go @@ -0,0 +1,236 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/ipsec_types.api.json + +// Package ipsec_types contains generated bindings for API file ipsec_types.api. +// +// Contents: +// 4 enums +// 2 structs +// +package ipsec_types + +import ( + api "git.fd.io/govpp.git/api" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +// IpsecCryptoAlg defines enum 'ipsec_crypto_alg'. +type IpsecCryptoAlg uint32 + +const ( + IPSEC_API_CRYPTO_ALG_NONE IpsecCryptoAlg = 0 + IPSEC_API_CRYPTO_ALG_AES_CBC_128 IpsecCryptoAlg = 1 + IPSEC_API_CRYPTO_ALG_AES_CBC_192 IpsecCryptoAlg = 2 + IPSEC_API_CRYPTO_ALG_AES_CBC_256 IpsecCryptoAlg = 3 + IPSEC_API_CRYPTO_ALG_AES_CTR_128 IpsecCryptoAlg = 4 + IPSEC_API_CRYPTO_ALG_AES_CTR_192 IpsecCryptoAlg = 5 + IPSEC_API_CRYPTO_ALG_AES_CTR_256 IpsecCryptoAlg = 6 + IPSEC_API_CRYPTO_ALG_AES_GCM_128 IpsecCryptoAlg = 7 + IPSEC_API_CRYPTO_ALG_AES_GCM_192 IpsecCryptoAlg = 8 + IPSEC_API_CRYPTO_ALG_AES_GCM_256 IpsecCryptoAlg = 9 + IPSEC_API_CRYPTO_ALG_DES_CBC IpsecCryptoAlg = 10 + IPSEC_API_CRYPTO_ALG_3DES_CBC IpsecCryptoAlg = 11 +) + +var ( + IpsecCryptoAlg_name = map[uint32]string{ + 0: "IPSEC_API_CRYPTO_ALG_NONE", + 1: "IPSEC_API_CRYPTO_ALG_AES_CBC_128", + 2: "IPSEC_API_CRYPTO_ALG_AES_CBC_192", + 3: "IPSEC_API_CRYPTO_ALG_AES_CBC_256", + 4: "IPSEC_API_CRYPTO_ALG_AES_CTR_128", + 5: "IPSEC_API_CRYPTO_ALG_AES_CTR_192", + 6: "IPSEC_API_CRYPTO_ALG_AES_CTR_256", + 7: "IPSEC_API_CRYPTO_ALG_AES_GCM_128", + 8: "IPSEC_API_CRYPTO_ALG_AES_GCM_192", + 9: "IPSEC_API_CRYPTO_ALG_AES_GCM_256", + 10: "IPSEC_API_CRYPTO_ALG_DES_CBC", + 11: "IPSEC_API_CRYPTO_ALG_3DES_CBC", + } + IpsecCryptoAlg_value = map[string]uint32{ + "IPSEC_API_CRYPTO_ALG_NONE": 0, + "IPSEC_API_CRYPTO_ALG_AES_CBC_128": 1, + "IPSEC_API_CRYPTO_ALG_AES_CBC_192": 2, + "IPSEC_API_CRYPTO_ALG_AES_CBC_256": 3, + "IPSEC_API_CRYPTO_ALG_AES_CTR_128": 4, + "IPSEC_API_CRYPTO_ALG_AES_CTR_192": 5, + "IPSEC_API_CRYPTO_ALG_AES_CTR_256": 6, + "IPSEC_API_CRYPTO_ALG_AES_GCM_128": 7, + "IPSEC_API_CRYPTO_ALG_AES_GCM_192": 8, + "IPSEC_API_CRYPTO_ALG_AES_GCM_256": 9, + "IPSEC_API_CRYPTO_ALG_DES_CBC": 10, + "IPSEC_API_CRYPTO_ALG_3DES_CBC": 11, + } +) + +func (x IpsecCryptoAlg) String() string { + s, ok := IpsecCryptoAlg_name[uint32(x)] + if ok { + return s + } + return "IpsecCryptoAlg(" + strconv.Itoa(int(x)) + ")" +} + +// IpsecIntegAlg defines enum 'ipsec_integ_alg'. +type IpsecIntegAlg uint32 + +const ( + IPSEC_API_INTEG_ALG_NONE IpsecIntegAlg = 0 + IPSEC_API_INTEG_ALG_MD5_96 IpsecIntegAlg = 1 + IPSEC_API_INTEG_ALG_SHA1_96 IpsecIntegAlg = 2 + IPSEC_API_INTEG_ALG_SHA_256_96 IpsecIntegAlg = 3 + IPSEC_API_INTEG_ALG_SHA_256_128 IpsecIntegAlg = 4 + IPSEC_API_INTEG_ALG_SHA_384_192 IpsecIntegAlg = 5 + IPSEC_API_INTEG_ALG_SHA_512_256 IpsecIntegAlg = 6 +) + +var ( + IpsecIntegAlg_name = map[uint32]string{ + 0: "IPSEC_API_INTEG_ALG_NONE", + 1: "IPSEC_API_INTEG_ALG_MD5_96", + 2: "IPSEC_API_INTEG_ALG_SHA1_96", + 3: "IPSEC_API_INTEG_ALG_SHA_256_96", + 4: "IPSEC_API_INTEG_ALG_SHA_256_128", + 5: "IPSEC_API_INTEG_ALG_SHA_384_192", + 6: "IPSEC_API_INTEG_ALG_SHA_512_256", + } + IpsecIntegAlg_value = map[string]uint32{ + "IPSEC_API_INTEG_ALG_NONE": 0, + "IPSEC_API_INTEG_ALG_MD5_96": 1, + "IPSEC_API_INTEG_ALG_SHA1_96": 2, + "IPSEC_API_INTEG_ALG_SHA_256_96": 3, + "IPSEC_API_INTEG_ALG_SHA_256_128": 4, + "IPSEC_API_INTEG_ALG_SHA_384_192": 5, + "IPSEC_API_INTEG_ALG_SHA_512_256": 6, + } +) + +func (x IpsecIntegAlg) String() string { + s, ok := IpsecIntegAlg_name[uint32(x)] + if ok { + return s + } + return "IpsecIntegAlg(" + strconv.Itoa(int(x)) + ")" +} + +// IpsecProto defines enum 'ipsec_proto'. +type IpsecProto uint32 + +const ( + IPSEC_API_PROTO_ESP IpsecProto = 50 + IPSEC_API_PROTO_AH IpsecProto = 51 +) + +var ( + IpsecProto_name = map[uint32]string{ + 50: "IPSEC_API_PROTO_ESP", + 51: "IPSEC_API_PROTO_AH", + } + IpsecProto_value = map[string]uint32{ + "IPSEC_API_PROTO_ESP": 50, + "IPSEC_API_PROTO_AH": 51, + } +) + +func (x IpsecProto) String() string { + s, ok := IpsecProto_name[uint32(x)] + if ok { + return s + } + return "IpsecProto(" + strconv.Itoa(int(x)) + ")" +} + +// IpsecSadFlags defines enum 'ipsec_sad_flags'. +type IpsecSadFlags uint32 + +const ( + IPSEC_API_SAD_FLAG_NONE IpsecSadFlags = 0 + IPSEC_API_SAD_FLAG_USE_ESN IpsecSadFlags = 1 + IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY IpsecSadFlags = 2 + IPSEC_API_SAD_FLAG_IS_TUNNEL IpsecSadFlags = 4 + IPSEC_API_SAD_FLAG_IS_TUNNEL_V6 IpsecSadFlags = 8 + IPSEC_API_SAD_FLAG_UDP_ENCAP IpsecSadFlags = 16 + IPSEC_API_SAD_FLAG_IS_INBOUND IpsecSadFlags = 64 +) + +var ( + IpsecSadFlags_name = map[uint32]string{ + 0: "IPSEC_API_SAD_FLAG_NONE", + 1: "IPSEC_API_SAD_FLAG_USE_ESN", + 2: "IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY", + 4: "IPSEC_API_SAD_FLAG_IS_TUNNEL", + 8: "IPSEC_API_SAD_FLAG_IS_TUNNEL_V6", + 16: "IPSEC_API_SAD_FLAG_UDP_ENCAP", + 64: "IPSEC_API_SAD_FLAG_IS_INBOUND", + } + IpsecSadFlags_value = map[string]uint32{ + "IPSEC_API_SAD_FLAG_NONE": 0, + "IPSEC_API_SAD_FLAG_USE_ESN": 1, + "IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY": 2, + "IPSEC_API_SAD_FLAG_IS_TUNNEL": 4, + "IPSEC_API_SAD_FLAG_IS_TUNNEL_V6": 8, + "IPSEC_API_SAD_FLAG_UDP_ENCAP": 16, + "IPSEC_API_SAD_FLAG_IS_INBOUND": 64, + } +) + +func (x IpsecSadFlags) String() string { + s, ok := IpsecSadFlags_name[uint32(x)] + if ok { + return s + } + str := func(n uint32) string { + s, ok := IpsecSadFlags_name[uint32(n)] + if ok { + return s + } + return "IpsecSadFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint32(0); i <= 32; i++ { + val := uint32(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint32(x)) + } + return s +} + +// IpsecSadEntry defines type 'ipsec_sad_entry'. +type IpsecSadEntry struct { + SadID uint32 `binapi:"u32,name=sad_id" json:"sad_id,omitempty"` + Spi uint32 `binapi:"u32,name=spi" json:"spi,omitempty"` + Protocol IpsecProto `binapi:"ipsec_proto,name=protocol" json:"protocol,omitempty"` + CryptoAlgorithm IpsecCryptoAlg `binapi:"ipsec_crypto_alg,name=crypto_algorithm" json:"crypto_algorithm,omitempty"` + CryptoKey Key `binapi:"key,name=crypto_key" json:"crypto_key,omitempty"` + IntegrityAlgorithm IpsecIntegAlg `binapi:"ipsec_integ_alg,name=integrity_algorithm" json:"integrity_algorithm,omitempty"` + IntegrityKey Key `binapi:"key,name=integrity_key" json:"integrity_key,omitempty"` + Flags IpsecSadFlags `binapi:"ipsec_sad_flags,name=flags" json:"flags,omitempty"` + TunnelSrc ip_types.Address `binapi:"address,name=tunnel_src" json:"tunnel_src,omitempty"` + TunnelDst ip_types.Address `binapi:"address,name=tunnel_dst" json:"tunnel_dst,omitempty"` + TxTableID uint32 `binapi:"u32,name=tx_table_id" json:"tx_table_id,omitempty"` + Salt uint32 `binapi:"u32,name=salt" json:"salt,omitempty"` + UDPSrcPort uint16 `binapi:"u16,name=udp_src_port,default=%!s(float64=4500)" json:"udp_src_port,omitempty"` + UDPDstPort uint16 `binapi:"u16,name=udp_dst_port,default=%!s(float64=4500)" json:"udp_dst_port,omitempty"` +} + +// Key defines type 'key'. +type Key struct { + Length uint8 `binapi:"u8,name=length" json:"length,omitempty"` + Data []byte `binapi:"u8[128],name=data" json:"data,omitempty"` +} diff --git a/binapi/l2/l2.ba.go b/binapi/l2/l2.ba.go new file mode 100644 index 0000000..0eb75f2 --- /dev/null +++ b/binapi/l2/l2.ba.go @@ -0,0 +1,2594 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/l2.api.json + +// Package l2 contains generated bindings for API file l2.api. +// +// Contents: +// 3 enums +// 3 structs +// 54 messages +// +package l2 + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "l2" + APIVersion = "3.0.0" + VersionCrc = 0x58ce8a6b +) + +// BdFlags defines enum 'bd_flags'. +type BdFlags uint32 + +const ( + BRIDGE_API_FLAG_NONE BdFlags = 0 + BRIDGE_API_FLAG_LEARN BdFlags = 1 + BRIDGE_API_FLAG_FWD BdFlags = 2 + BRIDGE_API_FLAG_FLOOD BdFlags = 4 + BRIDGE_API_FLAG_UU_FLOOD BdFlags = 8 + BRIDGE_API_FLAG_ARP_TERM BdFlags = 16 + BRIDGE_API_FLAG_ARP_UFWD BdFlags = 32 +) + +var ( + BdFlags_name = map[uint32]string{ + 0: "BRIDGE_API_FLAG_NONE", + 1: "BRIDGE_API_FLAG_LEARN", + 2: "BRIDGE_API_FLAG_FWD", + 4: "BRIDGE_API_FLAG_FLOOD", + 8: "BRIDGE_API_FLAG_UU_FLOOD", + 16: "BRIDGE_API_FLAG_ARP_TERM", + 32: "BRIDGE_API_FLAG_ARP_UFWD", + } + BdFlags_value = map[string]uint32{ + "BRIDGE_API_FLAG_NONE": 0, + "BRIDGE_API_FLAG_LEARN": 1, + "BRIDGE_API_FLAG_FWD": 2, + "BRIDGE_API_FLAG_FLOOD": 4, + "BRIDGE_API_FLAG_UU_FLOOD": 8, + "BRIDGE_API_FLAG_ARP_TERM": 16, + "BRIDGE_API_FLAG_ARP_UFWD": 32, + } +) + +func (x BdFlags) String() string { + s, ok := BdFlags_name[uint32(x)] + if ok { + return s + } + str := func(n uint32) string { + s, ok := BdFlags_name[uint32(n)] + if ok { + return s + } + return "BdFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint32(0); i <= 32; i++ { + val := uint32(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint32(x)) + } + return s +} + +// L2PortType defines enum 'l2_port_type'. +type L2PortType uint32 + +const ( + L2_API_PORT_TYPE_NORMAL L2PortType = 0 + L2_API_PORT_TYPE_BVI L2PortType = 1 + L2_API_PORT_TYPE_UU_FWD L2PortType = 2 +) + +var ( + L2PortType_name = map[uint32]string{ + 0: "L2_API_PORT_TYPE_NORMAL", + 1: "L2_API_PORT_TYPE_BVI", + 2: "L2_API_PORT_TYPE_UU_FWD", + } + L2PortType_value = map[string]uint32{ + "L2_API_PORT_TYPE_NORMAL": 0, + "L2_API_PORT_TYPE_BVI": 1, + "L2_API_PORT_TYPE_UU_FWD": 2, + } +) + +func (x L2PortType) String() string { + s, ok := L2PortType_name[uint32(x)] + if ok { + return s + } + return "L2PortType(" + strconv.Itoa(int(x)) + ")" +} + +// MacEventAction defines enum 'mac_event_action'. +type MacEventAction uint32 + +const ( + MAC_EVENT_ACTION_API_ADD MacEventAction = 0 + MAC_EVENT_ACTION_API_DELETE MacEventAction = 1 + MAC_EVENT_ACTION_API_MOVE MacEventAction = 2 +) + +var ( + MacEventAction_name = map[uint32]string{ + 0: "MAC_EVENT_ACTION_API_ADD", + 1: "MAC_EVENT_ACTION_API_DELETE", + 2: "MAC_EVENT_ACTION_API_MOVE", + } + MacEventAction_value = map[string]uint32{ + "MAC_EVENT_ACTION_API_ADD": 0, + "MAC_EVENT_ACTION_API_DELETE": 1, + "MAC_EVENT_ACTION_API_MOVE": 2, + } +) + +func (x MacEventAction) String() string { + s, ok := MacEventAction_name[uint32(x)] + if ok { + return s + } + return "MacEventAction(" + strconv.Itoa(int(x)) + ")" +} + +// BdIPMac defines type 'bd_ip_mac'. +type BdIPMac struct { + BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` + IP ip_types.Address `binapi:"address,name=ip" json:"ip,omitempty"` + Mac ethernet_types.MacAddress `binapi:"mac_address,name=mac" json:"mac,omitempty"` +} + +// BridgeDomainSwIf defines type 'bridge_domain_sw_if'. +type BridgeDomainSwIf struct { + Context uint32 `binapi:"u32,name=context" json:"context,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Shg uint8 `binapi:"u8,name=shg" json:"shg,omitempty"` +} + +// MacEntry defines type 'mac_entry'. +type MacEntry struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + MacAddr ethernet_types.MacAddress `binapi:"mac_address,name=mac_addr" json:"mac_addr,omitempty"` + Action MacEventAction `binapi:"mac_event_action,name=action" json:"action,omitempty"` + Flags uint8 `binapi:"u8,name=flags" json:"flags,omitempty"` +} + +// BdIPMacAddDel defines message 'bd_ip_mac_add_del'. +type BdIPMacAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Entry BdIPMac `binapi:"bd_ip_mac,name=entry" json:"entry,omitempty"` +} + +func (m *BdIPMacAddDel) Reset() { *m = BdIPMacAddDel{} } +func (*BdIPMacAddDel) GetMessageName() string { return "bd_ip_mac_add_del" } +func (*BdIPMacAddDel) GetCrcString() string { return "5f2b84e2" } +func (*BdIPMacAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BdIPMacAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Entry.BdID + size += 1 // m.Entry.IP.Af + size += 1 * 16 // m.Entry.IP.Un + size += 1 * 6 // m.Entry.Mac + return size +} +func (m *BdIPMacAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Entry.BdID)) + buf.EncodeUint8(uint8(m.Entry.IP.Af)) + buf.EncodeBytes(m.Entry.IP.Un.XXX_UnionData[:], 0) + buf.EncodeBytes(m.Entry.Mac[:], 6) + return buf.Bytes(), nil +} +func (m *BdIPMacAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Entry.BdID = buf.DecodeUint32() + m.Entry.IP.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.IP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + copy(m.Entry.Mac[:], buf.DecodeBytes(6)) + return nil +} + +// BdIPMacAddDelReply defines message 'bd_ip_mac_add_del_reply'. +type BdIPMacAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BdIPMacAddDelReply) Reset() { *m = BdIPMacAddDelReply{} } +func (*BdIPMacAddDelReply) GetMessageName() string { return "bd_ip_mac_add_del_reply" } +func (*BdIPMacAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*BdIPMacAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BdIPMacAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BdIPMacAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BdIPMacAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BdIPMacDetails defines message 'bd_ip_mac_details'. +type BdIPMacDetails struct { + Entry BdIPMac `binapi:"bd_ip_mac,name=entry" json:"entry,omitempty"` +} + +func (m *BdIPMacDetails) Reset() { *m = BdIPMacDetails{} } +func (*BdIPMacDetails) GetMessageName() string { return "bd_ip_mac_details" } +func (*BdIPMacDetails) GetCrcString() string { return "a52f8044" } +func (*BdIPMacDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BdIPMacDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Entry.BdID + size += 1 // m.Entry.IP.Af + size += 1 * 16 // m.Entry.IP.Un + size += 1 * 6 // m.Entry.Mac + return size +} +func (m *BdIPMacDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Entry.BdID)) + buf.EncodeUint8(uint8(m.Entry.IP.Af)) + buf.EncodeBytes(m.Entry.IP.Un.XXX_UnionData[:], 0) + buf.EncodeBytes(m.Entry.Mac[:], 6) + return buf.Bytes(), nil +} +func (m *BdIPMacDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Entry.BdID = buf.DecodeUint32() + m.Entry.IP.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.IP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + copy(m.Entry.Mac[:], buf.DecodeBytes(6)) + return nil +} + +// BdIPMacDump defines message 'bd_ip_mac_dump'. +type BdIPMacDump struct { + BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` +} + +func (m *BdIPMacDump) Reset() { *m = BdIPMacDump{} } +func (*BdIPMacDump) GetMessageName() string { return "bd_ip_mac_dump" } +func (*BdIPMacDump) GetCrcString() string { return "c25fdce6" } +func (*BdIPMacDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BdIPMacDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.BdID + return size +} +func (m *BdIPMacDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.BdID)) + return buf.Bytes(), nil +} +func (m *BdIPMacDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BdID = buf.DecodeUint32() + return nil +} + +// BdIPMacFlush defines message 'bd_ip_mac_flush'. +type BdIPMacFlush struct { + BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` +} + +func (m *BdIPMacFlush) Reset() { *m = BdIPMacFlush{} } +func (*BdIPMacFlush) GetMessageName() string { return "bd_ip_mac_flush" } +func (*BdIPMacFlush) GetCrcString() string { return "c25fdce6" } +func (*BdIPMacFlush) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BdIPMacFlush) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.BdID + return size +} +func (m *BdIPMacFlush) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.BdID)) + return buf.Bytes(), nil +} +func (m *BdIPMacFlush) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BdID = buf.DecodeUint32() + return nil +} + +// BdIPMacFlushReply defines message 'bd_ip_mac_flush_reply'. +type BdIPMacFlushReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BdIPMacFlushReply) Reset() { *m = BdIPMacFlushReply{} } +func (*BdIPMacFlushReply) GetMessageName() string { return "bd_ip_mac_flush_reply" } +func (*BdIPMacFlushReply) GetCrcString() string { return "e8d4e804" } +func (*BdIPMacFlushReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BdIPMacFlushReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BdIPMacFlushReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BdIPMacFlushReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BridgeDomainAddDel defines message 'bridge_domain_add_del'. +type BridgeDomainAddDel struct { + BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` + Flood bool `binapi:"bool,name=flood" json:"flood,omitempty"` + UuFlood bool `binapi:"bool,name=uu_flood" json:"uu_flood,omitempty"` + Forward bool `binapi:"bool,name=forward" json:"forward,omitempty"` + Learn bool `binapi:"bool,name=learn" json:"learn,omitempty"` + ArpTerm bool `binapi:"bool,name=arp_term" json:"arp_term,omitempty"` + ArpUfwd bool `binapi:"bool,name=arp_ufwd" json:"arp_ufwd,omitempty"` + MacAge uint8 `binapi:"u8,name=mac_age" json:"mac_age,omitempty"` + BdTag string `binapi:"string[64],name=bd_tag" json:"bd_tag,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` +} + +func (m *BridgeDomainAddDel) Reset() { *m = BridgeDomainAddDel{} } +func (*BridgeDomainAddDel) GetMessageName() string { return "bridge_domain_add_del" } +func (*BridgeDomainAddDel) GetCrcString() string { return "600b7170" } +func (*BridgeDomainAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BridgeDomainAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.BdID + size += 1 // m.Flood + size += 1 // m.UuFlood + size += 1 // m.Forward + size += 1 // m.Learn + size += 1 // m.ArpTerm + size += 1 // m.ArpUfwd + size += 1 // m.MacAge + size += 64 // m.BdTag + size += 1 // m.IsAdd + return size +} +func (m *BridgeDomainAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.BdID)) + buf.EncodeBool(m.Flood) + buf.EncodeBool(m.UuFlood) + buf.EncodeBool(m.Forward) + buf.EncodeBool(m.Learn) + buf.EncodeBool(m.ArpTerm) + buf.EncodeBool(m.ArpUfwd) + buf.EncodeUint8(uint8(m.MacAge)) + buf.EncodeString(m.BdTag, 64) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *BridgeDomainAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BdID = buf.DecodeUint32() + m.Flood = buf.DecodeBool() + m.UuFlood = buf.DecodeBool() + m.Forward = buf.DecodeBool() + m.Learn = buf.DecodeBool() + m.ArpTerm = buf.DecodeBool() + m.ArpUfwd = buf.DecodeBool() + m.MacAge = buf.DecodeUint8() + m.BdTag = buf.DecodeString(64) + m.IsAdd = buf.DecodeBool() + return nil +} + +// BridgeDomainAddDelReply defines message 'bridge_domain_add_del_reply'. +type BridgeDomainAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BridgeDomainAddDelReply) Reset() { *m = BridgeDomainAddDelReply{} } +func (*BridgeDomainAddDelReply) GetMessageName() string { return "bridge_domain_add_del_reply" } +func (*BridgeDomainAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*BridgeDomainAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BridgeDomainAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BridgeDomainAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BridgeDomainAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BridgeDomainDetails defines message 'bridge_domain_details'. +type BridgeDomainDetails struct { + BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` + Flood bool `binapi:"bool,name=flood" json:"flood,omitempty"` + UuFlood bool `binapi:"bool,name=uu_flood" json:"uu_flood,omitempty"` + Forward bool `binapi:"bool,name=forward" json:"forward,omitempty"` + Learn bool `binapi:"bool,name=learn" json:"learn,omitempty"` + ArpTerm bool `binapi:"bool,name=arp_term" json:"arp_term,omitempty"` + ArpUfwd bool `binapi:"bool,name=arp_ufwd" json:"arp_ufwd,omitempty"` + MacAge uint8 `binapi:"u8,name=mac_age" json:"mac_age,omitempty"` + BdTag string `binapi:"string[64],name=bd_tag" json:"bd_tag,omitempty"` + BviSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=bvi_sw_if_index" json:"bvi_sw_if_index,omitempty"` + UuFwdSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=uu_fwd_sw_if_index" json:"uu_fwd_sw_if_index,omitempty"` + NSwIfs uint32 `binapi:"u32,name=n_sw_ifs" json:"-"` + SwIfDetails []BridgeDomainSwIf `binapi:"bridge_domain_sw_if[n_sw_ifs],name=sw_if_details" json:"sw_if_details,omitempty"` +} + +func (m *BridgeDomainDetails) Reset() { *m = BridgeDomainDetails{} } +func (*BridgeDomainDetails) GetMessageName() string { return "bridge_domain_details" } +func (*BridgeDomainDetails) GetCrcString() string { return "979f549d" } +func (*BridgeDomainDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BridgeDomainDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.BdID + size += 1 // m.Flood + size += 1 // m.UuFlood + size += 1 // m.Forward + size += 1 // m.Learn + size += 1 // m.ArpTerm + size += 1 // m.ArpUfwd + size += 1 // m.MacAge + size += 64 // m.BdTag + size += 4 // m.BviSwIfIndex + size += 4 // m.UuFwdSwIfIndex + size += 4 // m.NSwIfs + for j1 := 0; j1 < len(m.SwIfDetails); j1++ { + var s1 BridgeDomainSwIf + _ = s1 + if j1 < len(m.SwIfDetails) { + s1 = m.SwIfDetails[j1] + } + size += 4 // s1.Context + size += 4 // s1.SwIfIndex + size += 1 // s1.Shg + } + return size +} +func (m *BridgeDomainDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.BdID)) + buf.EncodeBool(m.Flood) + buf.EncodeBool(m.UuFlood) + buf.EncodeBool(m.Forward) + buf.EncodeBool(m.Learn) + buf.EncodeBool(m.ArpTerm) + buf.EncodeBool(m.ArpUfwd) + buf.EncodeUint8(uint8(m.MacAge)) + buf.EncodeString(m.BdTag, 64) + buf.EncodeUint32(uint32(m.BviSwIfIndex)) + buf.EncodeUint32(uint32(m.UuFwdSwIfIndex)) + buf.EncodeUint32(uint32(len(m.SwIfDetails))) + for j0 := 0; j0 < len(m.SwIfDetails); j0++ { + var v0 BridgeDomainSwIf + if j0 < len(m.SwIfDetails) { + v0 = m.SwIfDetails[j0] + } + buf.EncodeUint32(uint32(v0.Context)) + buf.EncodeUint32(uint32(v0.SwIfIndex)) + buf.EncodeUint8(uint8(v0.Shg)) + } + return buf.Bytes(), nil +} +func (m *BridgeDomainDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BdID = buf.DecodeUint32() + m.Flood = buf.DecodeBool() + m.UuFlood = buf.DecodeBool() + m.Forward = buf.DecodeBool() + m.Learn = buf.DecodeBool() + m.ArpTerm = buf.DecodeBool() + m.ArpUfwd = buf.DecodeBool() + m.MacAge = buf.DecodeUint8() + m.BdTag = buf.DecodeString(64) + m.BviSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.UuFwdSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.NSwIfs = buf.DecodeUint32() + m.SwIfDetails = make([]BridgeDomainSwIf, int(m.NSwIfs)) + for j0 := 0; j0 < len(m.SwIfDetails); j0++ { + m.SwIfDetails[j0].Context = buf.DecodeUint32() + m.SwIfDetails[j0].SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.SwIfDetails[j0].Shg = buf.DecodeUint8() + } + return nil +} + +// BridgeDomainDump defines message 'bridge_domain_dump'. +type BridgeDomainDump struct { + BdID uint32 `binapi:"u32,name=bd_id,default=%!s(float64=4.294967295e+09)" json:"bd_id,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"` +} + +func (m *BridgeDomainDump) Reset() { *m = BridgeDomainDump{} } +func (*BridgeDomainDump) GetMessageName() string { return "bridge_domain_dump" } +func (*BridgeDomainDump) GetCrcString() string { return "74396a43" } +func (*BridgeDomainDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BridgeDomainDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.BdID + size += 4 // m.SwIfIndex + return size +} +func (m *BridgeDomainDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.BdID)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *BridgeDomainDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BdID = buf.DecodeUint32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// BridgeDomainSetMacAge defines message 'bridge_domain_set_mac_age'. +type BridgeDomainSetMacAge struct { + BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` + MacAge uint8 `binapi:"u8,name=mac_age" json:"mac_age,omitempty"` +} + +func (m *BridgeDomainSetMacAge) Reset() { *m = BridgeDomainSetMacAge{} } +func (*BridgeDomainSetMacAge) GetMessageName() string { return "bridge_domain_set_mac_age" } +func (*BridgeDomainSetMacAge) GetCrcString() string { return "b537ad7b" } +func (*BridgeDomainSetMacAge) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BridgeDomainSetMacAge) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.BdID + size += 1 // m.MacAge + return size +} +func (m *BridgeDomainSetMacAge) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.BdID)) + buf.EncodeUint8(uint8(m.MacAge)) + return buf.Bytes(), nil +} +func (m *BridgeDomainSetMacAge) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BdID = buf.DecodeUint32() + m.MacAge = buf.DecodeUint8() + return nil +} + +// BridgeDomainSetMacAgeReply defines message 'bridge_domain_set_mac_age_reply'. +type BridgeDomainSetMacAgeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BridgeDomainSetMacAgeReply) Reset() { *m = BridgeDomainSetMacAgeReply{} } +func (*BridgeDomainSetMacAgeReply) GetMessageName() string { return "bridge_domain_set_mac_age_reply" } +func (*BridgeDomainSetMacAgeReply) GetCrcString() string { return "e8d4e804" } +func (*BridgeDomainSetMacAgeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BridgeDomainSetMacAgeReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BridgeDomainSetMacAgeReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BridgeDomainSetMacAgeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BridgeFlags defines message 'bridge_flags'. +type BridgeFlags struct { + BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` + IsSet bool `binapi:"bool,name=is_set" json:"is_set,omitempty"` + Flags BdFlags `binapi:"bd_flags,name=flags" json:"flags,omitempty"` +} + +func (m *BridgeFlags) Reset() { *m = BridgeFlags{} } +func (*BridgeFlags) GetMessageName() string { return "bridge_flags" } +func (*BridgeFlags) GetCrcString() string { return "1b0c5fbd" } +func (*BridgeFlags) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BridgeFlags) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.BdID + size += 1 // m.IsSet + size += 4 // m.Flags + return size +} +func (m *BridgeFlags) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.BdID)) + buf.EncodeBool(m.IsSet) + buf.EncodeUint32(uint32(m.Flags)) + return buf.Bytes(), nil +} +func (m *BridgeFlags) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BdID = buf.DecodeUint32() + m.IsSet = buf.DecodeBool() + m.Flags = BdFlags(buf.DecodeUint32()) + return nil +} + +// BridgeFlagsReply defines message 'bridge_flags_reply'. +type BridgeFlagsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ResultingFeatureBitmap uint32 `binapi:"u32,name=resulting_feature_bitmap" json:"resulting_feature_bitmap,omitempty"` +} + +func (m *BridgeFlagsReply) Reset() { *m = BridgeFlagsReply{} } +func (*BridgeFlagsReply) GetMessageName() string { return "bridge_flags_reply" } +func (*BridgeFlagsReply) GetCrcString() string { return "29b2a2b3" } +func (*BridgeFlagsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BridgeFlagsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.ResultingFeatureBitmap + return size +} +func (m *BridgeFlagsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.ResultingFeatureBitmap)) + return buf.Bytes(), nil +} +func (m *BridgeFlagsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.ResultingFeatureBitmap = buf.DecodeUint32() + return nil +} + +// BviCreate defines message 'bvi_create'. +type BviCreate struct { + Mac ethernet_types.MacAddress `binapi:"mac_address,name=mac" json:"mac,omitempty"` + UserInstance uint32 `binapi:"u32,name=user_instance,default=%!s(float64=4.294967295e+09)" json:"user_instance,omitempty"` +} + +func (m *BviCreate) Reset() { *m = BviCreate{} } +func (*BviCreate) GetMessageName() string { return "bvi_create" } +func (*BviCreate) GetCrcString() string { return "f5398559" } +func (*BviCreate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BviCreate) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 6 // m.Mac + size += 4 // m.UserInstance + return size +} +func (m *BviCreate) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.Mac[:], 6) + buf.EncodeUint32(uint32(m.UserInstance)) + return buf.Bytes(), nil +} +func (m *BviCreate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.Mac[:], buf.DecodeBytes(6)) + m.UserInstance = buf.DecodeUint32() + return nil +} + +// BviCreateReply defines message 'bvi_create_reply'. +type BviCreateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *BviCreateReply) Reset() { *m = BviCreateReply{} } +func (*BviCreateReply) GetMessageName() string { return "bvi_create_reply" } +func (*BviCreateReply) GetCrcString() string { return "5383d31f" } +func (*BviCreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BviCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *BviCreateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *BviCreateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// BviDelete defines message 'bvi_delete'. +type BviDelete struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *BviDelete) Reset() { *m = BviDelete{} } +func (*BviDelete) GetMessageName() string { return "bvi_delete" } +func (*BviDelete) GetCrcString() string { return "f9e6675e" } +func (*BviDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BviDelete) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *BviDelete) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *BviDelete) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// BviDeleteReply defines message 'bvi_delete_reply'. +type BviDeleteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BviDeleteReply) Reset() { *m = BviDeleteReply{} } +func (*BviDeleteReply) GetMessageName() string { return "bvi_delete_reply" } +func (*BviDeleteReply) GetCrcString() string { return "e8d4e804" } +func (*BviDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BviDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BviDeleteReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BviDeleteReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// L2ArpTermEvent defines message 'l2_arp_term_event'. +type L2ArpTermEvent struct { + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + IP ip_types.Address `binapi:"address,name=ip" json:"ip,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Mac ethernet_types.MacAddress `binapi:"mac_address,name=mac" json:"mac,omitempty"` +} + +func (m *L2ArpTermEvent) Reset() { *m = L2ArpTermEvent{} } +func (*L2ArpTermEvent) GetMessageName() string { return "l2_arp_term_event" } +func (*L2ArpTermEvent) GetCrcString() string { return "85ff71ea" } +func (*L2ArpTermEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +func (m *L2ArpTermEvent) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.PID + size += 1 // m.IP.Af + size += 1 * 16 // m.IP.Un + size += 4 // m.SwIfIndex + size += 1 * 6 // m.Mac + return size +} +func (m *L2ArpTermEvent) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.PID)) + buf.EncodeUint8(uint8(m.IP.Af)) + buf.EncodeBytes(m.IP.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBytes(m.Mac[:], 6) + return buf.Bytes(), nil +} +func (m *L2ArpTermEvent) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PID = buf.DecodeUint32() + m.IP.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.IP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + copy(m.Mac[:], buf.DecodeBytes(6)) + return nil +} + +// L2FibClearTable defines message 'l2_fib_clear_table'. +type L2FibClearTable struct{} + +func (m *L2FibClearTable) Reset() { *m = L2FibClearTable{} } +func (*L2FibClearTable) GetMessageName() string { return "l2_fib_clear_table" } +func (*L2FibClearTable) GetCrcString() string { return "51077d14" } +func (*L2FibClearTable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *L2FibClearTable) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *L2FibClearTable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *L2FibClearTable) Unmarshal(b []byte) error { + return nil +} + +// L2FibClearTableReply defines message 'l2_fib_clear_table_reply'. +type L2FibClearTableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *L2FibClearTableReply) Reset() { *m = L2FibClearTableReply{} } +func (*L2FibClearTableReply) GetMessageName() string { return "l2_fib_clear_table_reply" } +func (*L2FibClearTableReply) GetCrcString() string { return "e8d4e804" } +func (*L2FibClearTableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *L2FibClearTableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *L2FibClearTableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *L2FibClearTableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// L2FibTableDetails defines message 'l2_fib_table_details'. +type L2FibTableDetails struct { + BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` + Mac ethernet_types.MacAddress `binapi:"mac_address,name=mac" json:"mac,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + StaticMac bool `binapi:"bool,name=static_mac" json:"static_mac,omitempty"` + FilterMac bool `binapi:"bool,name=filter_mac" json:"filter_mac,omitempty"` + BviMac bool `binapi:"bool,name=bvi_mac" json:"bvi_mac,omitempty"` +} + +func (m *L2FibTableDetails) Reset() { *m = L2FibTableDetails{} } +func (*L2FibTableDetails) GetMessageName() string { return "l2_fib_table_details" } +func (*L2FibTableDetails) GetCrcString() string { return "e8d2fc72" } +func (*L2FibTableDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *L2FibTableDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.BdID + size += 1 * 6 // m.Mac + size += 4 // m.SwIfIndex + size += 1 // m.StaticMac + size += 1 // m.FilterMac + size += 1 // m.BviMac + return size +} +func (m *L2FibTableDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.BdID)) + buf.EncodeBytes(m.Mac[:], 6) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.StaticMac) + buf.EncodeBool(m.FilterMac) + buf.EncodeBool(m.BviMac) + return buf.Bytes(), nil +} +func (m *L2FibTableDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BdID = buf.DecodeUint32() + copy(m.Mac[:], buf.DecodeBytes(6)) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.StaticMac = buf.DecodeBool() + m.FilterMac = buf.DecodeBool() + m.BviMac = buf.DecodeBool() + return nil +} + +// L2FibTableDump defines message 'l2_fib_table_dump'. +type L2FibTableDump struct { + BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` +} + +func (m *L2FibTableDump) Reset() { *m = L2FibTableDump{} } +func (*L2FibTableDump) GetMessageName() string { return "l2_fib_table_dump" } +func (*L2FibTableDump) GetCrcString() string { return "c25fdce6" } +func (*L2FibTableDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *L2FibTableDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.BdID + return size +} +func (m *L2FibTableDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.BdID)) + return buf.Bytes(), nil +} +func (m *L2FibTableDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BdID = buf.DecodeUint32() + return nil +} + +// L2Flags defines message 'l2_flags'. +type L2Flags struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsSet bool `binapi:"bool,name=is_set" json:"is_set,omitempty"` + FeatureBitmap uint32 `binapi:"u32,name=feature_bitmap" json:"feature_bitmap,omitempty"` +} + +func (m *L2Flags) Reset() { *m = L2Flags{} } +func (*L2Flags) GetMessageName() string { return "l2_flags" } +func (*L2Flags) GetCrcString() string { return "fc41cfe8" } +func (*L2Flags) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *L2Flags) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.IsSet + size += 4 // m.FeatureBitmap + return size +} +func (m *L2Flags) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsSet) + buf.EncodeUint32(uint32(m.FeatureBitmap)) + return buf.Bytes(), nil +} +func (m *L2Flags) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsSet = buf.DecodeBool() + m.FeatureBitmap = buf.DecodeUint32() + return nil +} + +// L2FlagsReply defines message 'l2_flags_reply'. +type L2FlagsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ResultingFeatureBitmap uint32 `binapi:"u32,name=resulting_feature_bitmap" json:"resulting_feature_bitmap,omitempty"` +} + +func (m *L2FlagsReply) Reset() { *m = L2FlagsReply{} } +func (*L2FlagsReply) GetMessageName() string { return "l2_flags_reply" } +func (*L2FlagsReply) GetCrcString() string { return "29b2a2b3" } +func (*L2FlagsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *L2FlagsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.ResultingFeatureBitmap + return size +} +func (m *L2FlagsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.ResultingFeatureBitmap)) + return buf.Bytes(), nil +} +func (m *L2FlagsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.ResultingFeatureBitmap = buf.DecodeUint32() + return nil +} + +// L2InterfaceEfpFilter defines message 'l2_interface_efp_filter'. +type L2InterfaceEfpFilter struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + EnableDisable bool `binapi:"bool,name=enable_disable,default=true" json:"enable_disable,omitempty"` +} + +func (m *L2InterfaceEfpFilter) Reset() { *m = L2InterfaceEfpFilter{} } +func (*L2InterfaceEfpFilter) GetMessageName() string { return "l2_interface_efp_filter" } +func (*L2InterfaceEfpFilter) GetCrcString() string { return "5501adee" } +func (*L2InterfaceEfpFilter) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *L2InterfaceEfpFilter) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.EnableDisable + return size +} +func (m *L2InterfaceEfpFilter) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.EnableDisable) + return buf.Bytes(), nil +} +func (m *L2InterfaceEfpFilter) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.EnableDisable = buf.DecodeBool() + return nil +} + +// L2InterfaceEfpFilterReply defines message 'l2_interface_efp_filter_reply'. +type L2InterfaceEfpFilterReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *L2InterfaceEfpFilterReply) Reset() { *m = L2InterfaceEfpFilterReply{} } +func (*L2InterfaceEfpFilterReply) GetMessageName() string { return "l2_interface_efp_filter_reply" } +func (*L2InterfaceEfpFilterReply) GetCrcString() string { return "e8d4e804" } +func (*L2InterfaceEfpFilterReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *L2InterfaceEfpFilterReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *L2InterfaceEfpFilterReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *L2InterfaceEfpFilterReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// L2InterfacePbbTagRewrite defines message 'l2_interface_pbb_tag_rewrite'. +type L2InterfacePbbTagRewrite struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + VtrOp uint32 `binapi:"u32,name=vtr_op" json:"vtr_op,omitempty"` + OuterTag uint16 `binapi:"u16,name=outer_tag" json:"outer_tag,omitempty"` + BDmac ethernet_types.MacAddress `binapi:"mac_address,name=b_dmac" json:"b_dmac,omitempty"` + BSmac ethernet_types.MacAddress `binapi:"mac_address,name=b_smac" json:"b_smac,omitempty"` + BVlanid uint16 `binapi:"u16,name=b_vlanid" json:"b_vlanid,omitempty"` + ISid uint32 `binapi:"u32,name=i_sid" json:"i_sid,omitempty"` +} + +func (m *L2InterfacePbbTagRewrite) Reset() { *m = L2InterfacePbbTagRewrite{} } +func (*L2InterfacePbbTagRewrite) GetMessageName() string { return "l2_interface_pbb_tag_rewrite" } +func (*L2InterfacePbbTagRewrite) GetCrcString() string { return "612efa5a" } +func (*L2InterfacePbbTagRewrite) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *L2InterfacePbbTagRewrite) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.VtrOp + size += 2 // m.OuterTag + size += 1 * 6 // m.BDmac + size += 1 * 6 // m.BSmac + size += 2 // m.BVlanid + size += 4 // m.ISid + return size +} +func (m *L2InterfacePbbTagRewrite) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.VtrOp)) + buf.EncodeUint16(uint16(m.OuterTag)) + buf.EncodeBytes(m.BDmac[:], 6) + buf.EncodeBytes(m.BSmac[:], 6) + buf.EncodeUint16(uint16(m.BVlanid)) + buf.EncodeUint32(uint32(m.ISid)) + return buf.Bytes(), nil +} +func (m *L2InterfacePbbTagRewrite) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.VtrOp = buf.DecodeUint32() + m.OuterTag = buf.DecodeUint16() + copy(m.BDmac[:], buf.DecodeBytes(6)) + copy(m.BSmac[:], buf.DecodeBytes(6)) + m.BVlanid = buf.DecodeUint16() + m.ISid = buf.DecodeUint32() + return nil +} + +// L2InterfacePbbTagRewriteReply defines message 'l2_interface_pbb_tag_rewrite_reply'. +type L2InterfacePbbTagRewriteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *L2InterfacePbbTagRewriteReply) Reset() { *m = L2InterfacePbbTagRewriteReply{} } +func (*L2InterfacePbbTagRewriteReply) GetMessageName() string { + return "l2_interface_pbb_tag_rewrite_reply" +} +func (*L2InterfacePbbTagRewriteReply) GetCrcString() string { return "e8d4e804" } +func (*L2InterfacePbbTagRewriteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *L2InterfacePbbTagRewriteReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *L2InterfacePbbTagRewriteReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *L2InterfacePbbTagRewriteReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// L2InterfaceVlanTagRewrite defines message 'l2_interface_vlan_tag_rewrite'. +type L2InterfaceVlanTagRewrite struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + VtrOp uint32 `binapi:"u32,name=vtr_op" json:"vtr_op,omitempty"` + PushDot1q uint32 `binapi:"u32,name=push_dot1q" json:"push_dot1q,omitempty"` + Tag1 uint32 `binapi:"u32,name=tag1" json:"tag1,omitempty"` + Tag2 uint32 `binapi:"u32,name=tag2" json:"tag2,omitempty"` +} + +func (m *L2InterfaceVlanTagRewrite) Reset() { *m = L2InterfaceVlanTagRewrite{} } +func (*L2InterfaceVlanTagRewrite) GetMessageName() string { return "l2_interface_vlan_tag_rewrite" } +func (*L2InterfaceVlanTagRewrite) GetCrcString() string { return "62cc0bbc" } +func (*L2InterfaceVlanTagRewrite) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *L2InterfaceVlanTagRewrite) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.VtrOp + size += 4 // m.PushDot1q + size += 4 // m.Tag1 + size += 4 // m.Tag2 + return size +} +func (m *L2InterfaceVlanTagRewrite) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.VtrOp)) + buf.EncodeUint32(uint32(m.PushDot1q)) + buf.EncodeUint32(uint32(m.Tag1)) + buf.EncodeUint32(uint32(m.Tag2)) + return buf.Bytes(), nil +} +func (m *L2InterfaceVlanTagRewrite) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.VtrOp = buf.DecodeUint32() + m.PushDot1q = buf.DecodeUint32() + m.Tag1 = buf.DecodeUint32() + m.Tag2 = buf.DecodeUint32() + return nil +} + +// L2InterfaceVlanTagRewriteReply defines message 'l2_interface_vlan_tag_rewrite_reply'. +type L2InterfaceVlanTagRewriteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *L2InterfaceVlanTagRewriteReply) Reset() { *m = L2InterfaceVlanTagRewriteReply{} } +func (*L2InterfaceVlanTagRewriteReply) GetMessageName() string { + return "l2_interface_vlan_tag_rewrite_reply" +} +func (*L2InterfaceVlanTagRewriteReply) GetCrcString() string { return "e8d4e804" } +func (*L2InterfaceVlanTagRewriteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *L2InterfaceVlanTagRewriteReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *L2InterfaceVlanTagRewriteReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *L2InterfaceVlanTagRewriteReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// L2MacsEvent defines message 'l2_macs_event'. +type L2MacsEvent struct { + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + NMacs uint32 `binapi:"u32,name=n_macs" json:"-"` + Mac []MacEntry `binapi:"mac_entry[n_macs],name=mac" json:"mac,omitempty"` +} + +func (m *L2MacsEvent) Reset() { *m = L2MacsEvent{} } +func (*L2MacsEvent) GetMessageName() string { return "l2_macs_event" } +func (*L2MacsEvent) GetCrcString() string { return "2eadfc8b" } +func (*L2MacsEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +func (m *L2MacsEvent) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.PID + size += 4 // m.NMacs + for j1 := 0; j1 < len(m.Mac); j1++ { + var s1 MacEntry + _ = s1 + if j1 < len(m.Mac) { + s1 = m.Mac[j1] + } + size += 4 // s1.SwIfIndex + size += 1 * 6 // s1.MacAddr + size += 4 // s1.Action + size += 1 // s1.Flags + } + return size +} +func (m *L2MacsEvent) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.PID)) + buf.EncodeUint32(uint32(len(m.Mac))) + for j0 := 0; j0 < len(m.Mac); j0++ { + var v0 MacEntry + if j0 < len(m.Mac) { + v0 = m.Mac[j0] + } + buf.EncodeUint32(uint32(v0.SwIfIndex)) + buf.EncodeBytes(v0.MacAddr[:], 6) + buf.EncodeUint32(uint32(v0.Action)) + buf.EncodeUint8(uint8(v0.Flags)) + } + return buf.Bytes(), nil +} +func (m *L2MacsEvent) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PID = buf.DecodeUint32() + m.NMacs = buf.DecodeUint32() + m.Mac = make([]MacEntry, int(m.NMacs)) + for j0 := 0; j0 < len(m.Mac); j0++ { + m.Mac[j0].SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + copy(m.Mac[j0].MacAddr[:], buf.DecodeBytes(6)) + m.Mac[j0].Action = MacEventAction(buf.DecodeUint32()) + m.Mac[j0].Flags = buf.DecodeUint8() + } + return nil +} + +// L2PatchAddDel defines message 'l2_patch_add_del'. +type L2PatchAddDel struct { + RxSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=rx_sw_if_index" json:"rx_sw_if_index,omitempty"` + TxSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=tx_sw_if_index" json:"tx_sw_if_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` +} + +func (m *L2PatchAddDel) Reset() { *m = L2PatchAddDel{} } +func (*L2PatchAddDel) GetMessageName() string { return "l2_patch_add_del" } +func (*L2PatchAddDel) GetCrcString() string { return "522f3445" } +func (*L2PatchAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *L2PatchAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.RxSwIfIndex + size += 4 // m.TxSwIfIndex + size += 1 // m.IsAdd + return size +} +func (m *L2PatchAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.RxSwIfIndex)) + buf.EncodeUint32(uint32(m.TxSwIfIndex)) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *L2PatchAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.RxSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.TxSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsAdd = buf.DecodeBool() + return nil +} + +// L2PatchAddDelReply defines message 'l2_patch_add_del_reply'. +type L2PatchAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *L2PatchAddDelReply) Reset() { *m = L2PatchAddDelReply{} } +func (*L2PatchAddDelReply) GetMessageName() string { return "l2_patch_add_del_reply" } +func (*L2PatchAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*L2PatchAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *L2PatchAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *L2PatchAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *L2PatchAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// L2XconnectDetails defines message 'l2_xconnect_details'. +type L2XconnectDetails struct { + RxSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=rx_sw_if_index" json:"rx_sw_if_index,omitempty"` + TxSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=tx_sw_if_index" json:"tx_sw_if_index,omitempty"` +} + +func (m *L2XconnectDetails) Reset() { *m = L2XconnectDetails{} } +func (*L2XconnectDetails) GetMessageName() string { return "l2_xconnect_details" } +func (*L2XconnectDetails) GetCrcString() string { return "c8aa6b37" } +func (*L2XconnectDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *L2XconnectDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.RxSwIfIndex + size += 4 // m.TxSwIfIndex + return size +} +func (m *L2XconnectDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.RxSwIfIndex)) + buf.EncodeUint32(uint32(m.TxSwIfIndex)) + return buf.Bytes(), nil +} +func (m *L2XconnectDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.RxSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.TxSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// L2XconnectDump defines message 'l2_xconnect_dump'. +type L2XconnectDump struct{} + +func (m *L2XconnectDump) Reset() { *m = L2XconnectDump{} } +func (*L2XconnectDump) GetMessageName() string { return "l2_xconnect_dump" } +func (*L2XconnectDump) GetCrcString() string { return "51077d14" } +func (*L2XconnectDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *L2XconnectDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *L2XconnectDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *L2XconnectDump) Unmarshal(b []byte) error { + return nil +} + +// L2fibAddDel defines message 'l2fib_add_del'. +type L2fibAddDel struct { + Mac ethernet_types.MacAddress `binapi:"mac_address,name=mac" json:"mac,omitempty"` + BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + StaticMac bool `binapi:"bool,name=static_mac" json:"static_mac,omitempty"` + FilterMac bool `binapi:"bool,name=filter_mac" json:"filter_mac,omitempty"` + BviMac bool `binapi:"bool,name=bvi_mac" json:"bvi_mac,omitempty"` +} + +func (m *L2fibAddDel) Reset() { *m = L2fibAddDel{} } +func (*L2fibAddDel) GetMessageName() string { return "l2fib_add_del" } +func (*L2fibAddDel) GetCrcString() string { return "f29d796c" } +func (*L2fibAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *L2fibAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 6 // m.Mac + size += 4 // m.BdID + size += 4 // m.SwIfIndex + size += 1 // m.IsAdd + size += 1 // m.StaticMac + size += 1 // m.FilterMac + size += 1 // m.BviMac + return size +} +func (m *L2fibAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.Mac[:], 6) + buf.EncodeUint32(uint32(m.BdID)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsAdd) + buf.EncodeBool(m.StaticMac) + buf.EncodeBool(m.FilterMac) + buf.EncodeBool(m.BviMac) + return buf.Bytes(), nil +} +func (m *L2fibAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.Mac[:], buf.DecodeBytes(6)) + m.BdID = buf.DecodeUint32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsAdd = buf.DecodeBool() + m.StaticMac = buf.DecodeBool() + m.FilterMac = buf.DecodeBool() + m.BviMac = buf.DecodeBool() + return nil +} + +// L2fibAddDelReply defines message 'l2fib_add_del_reply'. +type L2fibAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *L2fibAddDelReply) Reset() { *m = L2fibAddDelReply{} } +func (*L2fibAddDelReply) GetMessageName() string { return "l2fib_add_del_reply" } +func (*L2fibAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*L2fibAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *L2fibAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *L2fibAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *L2fibAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// L2fibFlushAll defines message 'l2fib_flush_all'. +type L2fibFlushAll struct{} + +func (m *L2fibFlushAll) Reset() { *m = L2fibFlushAll{} } +func (*L2fibFlushAll) GetMessageName() string { return "l2fib_flush_all" } +func (*L2fibFlushAll) GetCrcString() string { return "51077d14" } +func (*L2fibFlushAll) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *L2fibFlushAll) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *L2fibFlushAll) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *L2fibFlushAll) Unmarshal(b []byte) error { + return nil +} + +// L2fibFlushAllReply defines message 'l2fib_flush_all_reply'. +type L2fibFlushAllReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *L2fibFlushAllReply) Reset() { *m = L2fibFlushAllReply{} } +func (*L2fibFlushAllReply) GetMessageName() string { return "l2fib_flush_all_reply" } +func (*L2fibFlushAllReply) GetCrcString() string { return "e8d4e804" } +func (*L2fibFlushAllReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *L2fibFlushAllReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *L2fibFlushAllReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *L2fibFlushAllReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// L2fibFlushBd defines message 'l2fib_flush_bd'. +type L2fibFlushBd struct { + BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` +} + +func (m *L2fibFlushBd) Reset() { *m = L2fibFlushBd{} } +func (*L2fibFlushBd) GetMessageName() string { return "l2fib_flush_bd" } +func (*L2fibFlushBd) GetCrcString() string { return "c25fdce6" } +func (*L2fibFlushBd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *L2fibFlushBd) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.BdID + return size +} +func (m *L2fibFlushBd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.BdID)) + return buf.Bytes(), nil +} +func (m *L2fibFlushBd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BdID = buf.DecodeUint32() + return nil +} + +// L2fibFlushBdReply defines message 'l2fib_flush_bd_reply'. +type L2fibFlushBdReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *L2fibFlushBdReply) Reset() { *m = L2fibFlushBdReply{} } +func (*L2fibFlushBdReply) GetMessageName() string { return "l2fib_flush_bd_reply" } +func (*L2fibFlushBdReply) GetCrcString() string { return "e8d4e804" } +func (*L2fibFlushBdReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *L2fibFlushBdReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *L2fibFlushBdReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *L2fibFlushBdReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// L2fibFlushInt defines message 'l2fib_flush_int'. +type L2fibFlushInt struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *L2fibFlushInt) Reset() { *m = L2fibFlushInt{} } +func (*L2fibFlushInt) GetMessageName() string { return "l2fib_flush_int" } +func (*L2fibFlushInt) GetCrcString() string { return "f9e6675e" } +func (*L2fibFlushInt) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *L2fibFlushInt) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *L2fibFlushInt) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *L2fibFlushInt) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// L2fibFlushIntReply defines message 'l2fib_flush_int_reply'. +type L2fibFlushIntReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *L2fibFlushIntReply) Reset() { *m = L2fibFlushIntReply{} } +func (*L2fibFlushIntReply) GetMessageName() string { return "l2fib_flush_int_reply" } +func (*L2fibFlushIntReply) GetCrcString() string { return "e8d4e804" } +func (*L2fibFlushIntReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *L2fibFlushIntReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *L2fibFlushIntReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *L2fibFlushIntReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceSetL2Bridge defines message 'sw_interface_set_l2_bridge'. +type SwInterfaceSetL2Bridge struct { + RxSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=rx_sw_if_index" json:"rx_sw_if_index,omitempty"` + BdID uint32 `binapi:"u32,name=bd_id" json:"bd_id,omitempty"` + PortType L2PortType `binapi:"l2_port_type,name=port_type" json:"port_type,omitempty"` + Shg uint8 `binapi:"u8,name=shg" json:"shg,omitempty"` + Enable bool `binapi:"bool,name=enable,default=true" json:"enable,omitempty"` +} + +func (m *SwInterfaceSetL2Bridge) Reset() { *m = SwInterfaceSetL2Bridge{} } +func (*SwInterfaceSetL2Bridge) GetMessageName() string { return "sw_interface_set_l2_bridge" } +func (*SwInterfaceSetL2Bridge) GetCrcString() string { return "2e483cd0" } +func (*SwInterfaceSetL2Bridge) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetL2Bridge) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.RxSwIfIndex + size += 4 // m.BdID + size += 4 // m.PortType + size += 1 // m.Shg + size += 1 // m.Enable + return size +} +func (m *SwInterfaceSetL2Bridge) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.RxSwIfIndex)) + buf.EncodeUint32(uint32(m.BdID)) + buf.EncodeUint32(uint32(m.PortType)) + buf.EncodeUint8(uint8(m.Shg)) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetL2Bridge) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.RxSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.BdID = buf.DecodeUint32() + m.PortType = L2PortType(buf.DecodeUint32()) + m.Shg = buf.DecodeUint8() + m.Enable = buf.DecodeBool() + return nil +} + +// SwInterfaceSetL2BridgeReply defines message 'sw_interface_set_l2_bridge_reply'. +type SwInterfaceSetL2BridgeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetL2BridgeReply) Reset() { *m = SwInterfaceSetL2BridgeReply{} } +func (*SwInterfaceSetL2BridgeReply) GetMessageName() string { + return "sw_interface_set_l2_bridge_reply" +} +func (*SwInterfaceSetL2BridgeReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetL2BridgeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetL2BridgeReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetL2BridgeReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetL2BridgeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceSetL2Xconnect defines message 'sw_interface_set_l2_xconnect'. +type SwInterfaceSetL2Xconnect struct { + RxSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=rx_sw_if_index" json:"rx_sw_if_index,omitempty"` + TxSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=tx_sw_if_index" json:"tx_sw_if_index,omitempty"` + Enable bool `binapi:"bool,name=enable,default=true" json:"enable,omitempty"` +} + +func (m *SwInterfaceSetL2Xconnect) Reset() { *m = SwInterfaceSetL2Xconnect{} } +func (*SwInterfaceSetL2Xconnect) GetMessageName() string { return "sw_interface_set_l2_xconnect" } +func (*SwInterfaceSetL2Xconnect) GetCrcString() string { return "1aaa2dbb" } +func (*SwInterfaceSetL2Xconnect) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetL2Xconnect) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.RxSwIfIndex + size += 4 // m.TxSwIfIndex + size += 1 // m.Enable + return size +} +func (m *SwInterfaceSetL2Xconnect) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.RxSwIfIndex)) + buf.EncodeUint32(uint32(m.TxSwIfIndex)) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetL2Xconnect) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.RxSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.TxSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Enable = buf.DecodeBool() + return nil +} + +// SwInterfaceSetL2XconnectReply defines message 'sw_interface_set_l2_xconnect_reply'. +type SwInterfaceSetL2XconnectReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetL2XconnectReply) Reset() { *m = SwInterfaceSetL2XconnectReply{} } +func (*SwInterfaceSetL2XconnectReply) GetMessageName() string { + return "sw_interface_set_l2_xconnect_reply" +} +func (*SwInterfaceSetL2XconnectReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetL2XconnectReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetL2XconnectReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetL2XconnectReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetL2XconnectReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceSetVpath defines message 'sw_interface_set_vpath'. +type SwInterfaceSetVpath struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Enable bool `binapi:"bool,name=enable,default=%!s(float64=4.294967295e+09)" json:"enable,omitempty"` +} + +func (m *SwInterfaceSetVpath) Reset() { *m = SwInterfaceSetVpath{} } +func (*SwInterfaceSetVpath) GetMessageName() string { return "sw_interface_set_vpath" } +func (*SwInterfaceSetVpath) GetCrcString() string { return "ae6cfcfb" } +func (*SwInterfaceSetVpath) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetVpath) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Enable + return size +} +func (m *SwInterfaceSetVpath) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetVpath) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Enable = buf.DecodeBool() + return nil +} + +// SwInterfaceSetVpathReply defines message 'sw_interface_set_vpath_reply'. +type SwInterfaceSetVpathReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetVpathReply) Reset() { *m = SwInterfaceSetVpathReply{} } +func (*SwInterfaceSetVpathReply) GetMessageName() string { return "sw_interface_set_vpath_reply" } +func (*SwInterfaceSetVpathReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetVpathReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetVpathReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetVpathReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetVpathReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// WantL2ArpTermEvents defines message 'want_l2_arp_term_events'. +type WantL2ArpTermEvents struct { + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` +} + +func (m *WantL2ArpTermEvents) Reset() { *m = WantL2ArpTermEvents{} } +func (*WantL2ArpTermEvents) GetMessageName() string { return "want_l2_arp_term_events" } +func (*WantL2ArpTermEvents) GetCrcString() string { return "3ec6d6c2" } +func (*WantL2ArpTermEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WantL2ArpTermEvents) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Enable + size += 4 // m.PID + return size +} +func (m *WantL2ArpTermEvents) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.Enable) + buf.EncodeUint32(uint32(m.PID)) + return buf.Bytes(), nil +} +func (m *WantL2ArpTermEvents) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Enable = buf.DecodeBool() + m.PID = buf.DecodeUint32() + return nil +} + +// WantL2ArpTermEventsReply defines message 'want_l2_arp_term_events_reply'. +type WantL2ArpTermEventsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WantL2ArpTermEventsReply) Reset() { *m = WantL2ArpTermEventsReply{} } +func (*WantL2ArpTermEventsReply) GetMessageName() string { return "want_l2_arp_term_events_reply" } +func (*WantL2ArpTermEventsReply) GetCrcString() string { return "e8d4e804" } +func (*WantL2ArpTermEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WantL2ArpTermEventsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *WantL2ArpTermEventsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *WantL2ArpTermEventsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// WantL2MacsEvents defines message 'want_l2_macs_events'. +type WantL2MacsEvents struct { + LearnLimit uint32 `binapi:"u32,name=learn_limit,default=%!s(float64=1000)" json:"learn_limit,omitempty"` + ScanDelay uint8 `binapi:"u8,name=scan_delay,default=%!s(float64=10)" json:"scan_delay,omitempty"` + MaxMacsInEvent uint8 `binapi:"u8,name=max_macs_in_event,default=%!s(float64=10)" json:"max_macs_in_event,omitempty"` + EnableDisable bool `binapi:"bool,name=enable_disable,default=true" json:"enable_disable,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` +} + +func (m *WantL2MacsEvents) Reset() { *m = WantL2MacsEvents{} } +func (*WantL2MacsEvents) GetMessageName() string { return "want_l2_macs_events" } +func (*WantL2MacsEvents) GetCrcString() string { return "9aabdfde" } +func (*WantL2MacsEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WantL2MacsEvents) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.LearnLimit + size += 1 // m.ScanDelay + size += 1 // m.MaxMacsInEvent + size += 1 // m.EnableDisable + size += 4 // m.PID + return size +} +func (m *WantL2MacsEvents) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.LearnLimit)) + buf.EncodeUint8(uint8(m.ScanDelay)) + buf.EncodeUint8(uint8(m.MaxMacsInEvent)) + buf.EncodeBool(m.EnableDisable) + buf.EncodeUint32(uint32(m.PID)) + return buf.Bytes(), nil +} +func (m *WantL2MacsEvents) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.LearnLimit = buf.DecodeUint32() + m.ScanDelay = buf.DecodeUint8() + m.MaxMacsInEvent = buf.DecodeUint8() + m.EnableDisable = buf.DecodeBool() + m.PID = buf.DecodeUint32() + return nil +} + +// WantL2MacsEventsReply defines message 'want_l2_macs_events_reply'. +type WantL2MacsEventsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WantL2MacsEventsReply) Reset() { *m = WantL2MacsEventsReply{} } +func (*WantL2MacsEventsReply) GetMessageName() string { return "want_l2_macs_events_reply" } +func (*WantL2MacsEventsReply) GetCrcString() string { return "e8d4e804" } +func (*WantL2MacsEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WantL2MacsEventsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *WantL2MacsEventsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *WantL2MacsEventsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_l2_binapi_init() } +func file_l2_binapi_init() { + api.RegisterMessage((*BdIPMacAddDel)(nil), "bd_ip_mac_add_del_5f2b84e2") + api.RegisterMessage((*BdIPMacAddDelReply)(nil), "bd_ip_mac_add_del_reply_e8d4e804") + api.RegisterMessage((*BdIPMacDetails)(nil), "bd_ip_mac_details_a52f8044") + api.RegisterMessage((*BdIPMacDump)(nil), "bd_ip_mac_dump_c25fdce6") + api.RegisterMessage((*BdIPMacFlush)(nil), "bd_ip_mac_flush_c25fdce6") + api.RegisterMessage((*BdIPMacFlushReply)(nil), "bd_ip_mac_flush_reply_e8d4e804") + api.RegisterMessage((*BridgeDomainAddDel)(nil), "bridge_domain_add_del_600b7170") + api.RegisterMessage((*BridgeDomainAddDelReply)(nil), "bridge_domain_add_del_reply_e8d4e804") + api.RegisterMessage((*BridgeDomainDetails)(nil), "bridge_domain_details_979f549d") + api.RegisterMessage((*BridgeDomainDump)(nil), "bridge_domain_dump_74396a43") + api.RegisterMessage((*BridgeDomainSetMacAge)(nil), "bridge_domain_set_mac_age_b537ad7b") + api.RegisterMessage((*BridgeDomainSetMacAgeReply)(nil), "bridge_domain_set_mac_age_reply_e8d4e804") + api.RegisterMessage((*BridgeFlags)(nil), "bridge_flags_1b0c5fbd") + api.RegisterMessage((*BridgeFlagsReply)(nil), "bridge_flags_reply_29b2a2b3") + api.RegisterMessage((*BviCreate)(nil), "bvi_create_f5398559") + api.RegisterMessage((*BviCreateReply)(nil), "bvi_create_reply_5383d31f") + api.RegisterMessage((*BviDelete)(nil), "bvi_delete_f9e6675e") + api.RegisterMessage((*BviDeleteReply)(nil), "bvi_delete_reply_e8d4e804") + api.RegisterMessage((*L2ArpTermEvent)(nil), "l2_arp_term_event_85ff71ea") + api.RegisterMessage((*L2FibClearTable)(nil), "l2_fib_clear_table_51077d14") + api.RegisterMessage((*L2FibClearTableReply)(nil), "l2_fib_clear_table_reply_e8d4e804") + api.RegisterMessage((*L2FibTableDetails)(nil), "l2_fib_table_details_e8d2fc72") + api.RegisterMessage((*L2FibTableDump)(nil), "l2_fib_table_dump_c25fdce6") + api.RegisterMessage((*L2Flags)(nil), "l2_flags_fc41cfe8") + api.RegisterMessage((*L2FlagsReply)(nil), "l2_flags_reply_29b2a2b3") + api.RegisterMessage((*L2InterfaceEfpFilter)(nil), "l2_interface_efp_filter_5501adee") + api.RegisterMessage((*L2InterfaceEfpFilterReply)(nil), "l2_interface_efp_filter_reply_e8d4e804") + api.RegisterMessage((*L2InterfacePbbTagRewrite)(nil), "l2_interface_pbb_tag_rewrite_612efa5a") + api.RegisterMessage((*L2InterfacePbbTagRewriteReply)(nil), "l2_interface_pbb_tag_rewrite_reply_e8d4e804") + api.RegisterMessage((*L2InterfaceVlanTagRewrite)(nil), "l2_interface_vlan_tag_rewrite_62cc0bbc") + api.RegisterMessage((*L2InterfaceVlanTagRewriteReply)(nil), "l2_interface_vlan_tag_rewrite_reply_e8d4e804") + api.RegisterMessage((*L2MacsEvent)(nil), "l2_macs_event_2eadfc8b") + api.RegisterMessage((*L2PatchAddDel)(nil), "l2_patch_add_del_522f3445") + api.RegisterMessage((*L2PatchAddDelReply)(nil), "l2_patch_add_del_reply_e8d4e804") + api.RegisterMessage((*L2XconnectDetails)(nil), "l2_xconnect_details_c8aa6b37") + api.RegisterMessage((*L2XconnectDump)(nil), "l2_xconnect_dump_51077d14") + api.RegisterMessage((*L2fibAddDel)(nil), "l2fib_add_del_f29d796c") + api.RegisterMessage((*L2fibAddDelReply)(nil), "l2fib_add_del_reply_e8d4e804") + api.RegisterMessage((*L2fibFlushAll)(nil), "l2fib_flush_all_51077d14") + api.RegisterMessage((*L2fibFlushAllReply)(nil), "l2fib_flush_all_reply_e8d4e804") + api.RegisterMessage((*L2fibFlushBd)(nil), "l2fib_flush_bd_c25fdce6") + api.RegisterMessage((*L2fibFlushBdReply)(nil), "l2fib_flush_bd_reply_e8d4e804") + api.RegisterMessage((*L2fibFlushInt)(nil), "l2fib_flush_int_f9e6675e") + api.RegisterMessage((*L2fibFlushIntReply)(nil), "l2fib_flush_int_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSetL2Bridge)(nil), "sw_interface_set_l2_bridge_2e483cd0") + api.RegisterMessage((*SwInterfaceSetL2BridgeReply)(nil), "sw_interface_set_l2_bridge_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSetL2Xconnect)(nil), "sw_interface_set_l2_xconnect_1aaa2dbb") + api.RegisterMessage((*SwInterfaceSetL2XconnectReply)(nil), "sw_interface_set_l2_xconnect_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSetVpath)(nil), "sw_interface_set_vpath_ae6cfcfb") + api.RegisterMessage((*SwInterfaceSetVpathReply)(nil), "sw_interface_set_vpath_reply_e8d4e804") + api.RegisterMessage((*WantL2ArpTermEvents)(nil), "want_l2_arp_term_events_3ec6d6c2") + api.RegisterMessage((*WantL2ArpTermEventsReply)(nil), "want_l2_arp_term_events_reply_e8d4e804") + api.RegisterMessage((*WantL2MacsEvents)(nil), "want_l2_macs_events_9aabdfde") + api.RegisterMessage((*WantL2MacsEventsReply)(nil), "want_l2_macs_events_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*BdIPMacAddDel)(nil), + (*BdIPMacAddDelReply)(nil), + (*BdIPMacDetails)(nil), + (*BdIPMacDump)(nil), + (*BdIPMacFlush)(nil), + (*BdIPMacFlushReply)(nil), + (*BridgeDomainAddDel)(nil), + (*BridgeDomainAddDelReply)(nil), + (*BridgeDomainDetails)(nil), + (*BridgeDomainDump)(nil), + (*BridgeDomainSetMacAge)(nil), + (*BridgeDomainSetMacAgeReply)(nil), + (*BridgeFlags)(nil), + (*BridgeFlagsReply)(nil), + (*BviCreate)(nil), + (*BviCreateReply)(nil), + (*BviDelete)(nil), + (*BviDeleteReply)(nil), + (*L2ArpTermEvent)(nil), + (*L2FibClearTable)(nil), + (*L2FibClearTableReply)(nil), + (*L2FibTableDetails)(nil), + (*L2FibTableDump)(nil), + (*L2Flags)(nil), + (*L2FlagsReply)(nil), + (*L2InterfaceEfpFilter)(nil), + (*L2InterfaceEfpFilterReply)(nil), + (*L2InterfacePbbTagRewrite)(nil), + (*L2InterfacePbbTagRewriteReply)(nil), + (*L2InterfaceVlanTagRewrite)(nil), + (*L2InterfaceVlanTagRewriteReply)(nil), + (*L2MacsEvent)(nil), + (*L2PatchAddDel)(nil), + (*L2PatchAddDelReply)(nil), + (*L2XconnectDetails)(nil), + (*L2XconnectDump)(nil), + (*L2fibAddDel)(nil), + (*L2fibAddDelReply)(nil), + (*L2fibFlushAll)(nil), + (*L2fibFlushAllReply)(nil), + (*L2fibFlushBd)(nil), + (*L2fibFlushBdReply)(nil), + (*L2fibFlushInt)(nil), + (*L2fibFlushIntReply)(nil), + (*SwInterfaceSetL2Bridge)(nil), + (*SwInterfaceSetL2BridgeReply)(nil), + (*SwInterfaceSetL2Xconnect)(nil), + (*SwInterfaceSetL2XconnectReply)(nil), + (*SwInterfaceSetVpath)(nil), + (*SwInterfaceSetVpathReply)(nil), + (*WantL2ArpTermEvents)(nil), + (*WantL2ArpTermEventsReply)(nil), + (*WantL2MacsEvents)(nil), + (*WantL2MacsEventsReply)(nil), + } +} diff --git a/binapi/l2/l2_rest.ba.go b/binapi/l2/l2_rest.ba.go new file mode 100644 index 0000000..f12ab06 --- /dev/null +++ b/binapi/l2/l2_rest.ba.go @@ -0,0 +1,502 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package l2 + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/bd_ip_mac_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(BdIPMacAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BdIPMacAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bd_ip_mac_flush", func(w http.ResponseWriter, req *http.Request) { + var request = new(BdIPMacFlush) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BdIPMacFlush(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bridge_domain_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(BridgeDomainAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BridgeDomainAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bridge_domain_set_mac_age", func(w http.ResponseWriter, req *http.Request) { + var request = new(BridgeDomainSetMacAge) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BridgeDomainSetMacAge(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bridge_flags", func(w http.ResponseWriter, req *http.Request) { + var request = new(BridgeFlags) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BridgeFlags(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bvi_create", func(w http.ResponseWriter, req *http.Request) { + var request = new(BviCreate) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BviCreate(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bvi_delete", func(w http.ResponseWriter, req *http.Request) { + var request = new(BviDelete) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BviDelete(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/l2_fib_clear_table", func(w http.ResponseWriter, req *http.Request) { + var request = new(L2FibClearTable) + reply, err := rpc.L2FibClearTable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/l2_flags", func(w http.ResponseWriter, req *http.Request) { + var request = new(L2Flags) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.L2Flags(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/l2_interface_efp_filter", func(w http.ResponseWriter, req *http.Request) { + var request = new(L2InterfaceEfpFilter) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.L2InterfaceEfpFilter(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/l2_interface_pbb_tag_rewrite", func(w http.ResponseWriter, req *http.Request) { + var request = new(L2InterfacePbbTagRewrite) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.L2InterfacePbbTagRewrite(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/l2_interface_vlan_tag_rewrite", func(w http.ResponseWriter, req *http.Request) { + var request = new(L2InterfaceVlanTagRewrite) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.L2InterfaceVlanTagRewrite(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/l2_patch_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(L2PatchAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.L2PatchAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/l2fib_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(L2fibAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.L2fibAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/l2fib_flush_all", func(w http.ResponseWriter, req *http.Request) { + var request = new(L2fibFlushAll) + reply, err := rpc.L2fibFlushAll(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/l2fib_flush_bd", func(w http.ResponseWriter, req *http.Request) { + var request = new(L2fibFlushBd) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.L2fibFlushBd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/l2fib_flush_int", func(w http.ResponseWriter, req *http.Request) { + var request = new(L2fibFlushInt) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.L2fibFlushInt(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_set_l2_bridge", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceSetL2Bridge) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceSetL2Bridge(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_set_l2_xconnect", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceSetL2Xconnect) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceSetL2Xconnect(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_set_vpath", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceSetVpath) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceSetVpath(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/want_l2_arp_term_events", func(w http.ResponseWriter, req *http.Request) { + var request = new(WantL2ArpTermEvents) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.WantL2ArpTermEvents(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/want_l2_macs_events", func(w http.ResponseWriter, req *http.Request) { + var request = new(WantL2MacsEvents) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.WantL2MacsEvents(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/l2/l2_rpc.ba.go b/binapi/l2/l2_rpc.ba.go new file mode 100644 index 0000000..b319c4e --- /dev/null +++ b/binapi/l2/l2_rpc.ba.go @@ -0,0 +1,403 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package l2 + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service l2. +type RPCService interface { + BdIPMacAddDel(ctx context.Context, in *BdIPMacAddDel) (*BdIPMacAddDelReply, error) + BdIPMacDump(ctx context.Context, in *BdIPMacDump) (RPCService_BdIPMacDumpClient, error) + BdIPMacFlush(ctx context.Context, in *BdIPMacFlush) (*BdIPMacFlushReply, error) + BridgeDomainAddDel(ctx context.Context, in *BridgeDomainAddDel) (*BridgeDomainAddDelReply, error) + BridgeDomainDump(ctx context.Context, in *BridgeDomainDump) (RPCService_BridgeDomainDumpClient, error) + BridgeDomainSetMacAge(ctx context.Context, in *BridgeDomainSetMacAge) (*BridgeDomainSetMacAgeReply, error) + BridgeFlags(ctx context.Context, in *BridgeFlags) (*BridgeFlagsReply, error) + BviCreate(ctx context.Context, in *BviCreate) (*BviCreateReply, error) + BviDelete(ctx context.Context, in *BviDelete) (*BviDeleteReply, error) + L2FibClearTable(ctx context.Context, in *L2FibClearTable) (*L2FibClearTableReply, error) + L2FibTableDump(ctx context.Context, in *L2FibTableDump) (RPCService_L2FibTableDumpClient, error) + L2Flags(ctx context.Context, in *L2Flags) (*L2FlagsReply, error) + L2InterfaceEfpFilter(ctx context.Context, in *L2InterfaceEfpFilter) (*L2InterfaceEfpFilterReply, error) + L2InterfacePbbTagRewrite(ctx context.Context, in *L2InterfacePbbTagRewrite) (*L2InterfacePbbTagRewriteReply, error) + L2InterfaceVlanTagRewrite(ctx context.Context, in *L2InterfaceVlanTagRewrite) (*L2InterfaceVlanTagRewriteReply, error) + L2PatchAddDel(ctx context.Context, in *L2PatchAddDel) (*L2PatchAddDelReply, error) + L2XconnectDump(ctx context.Context, in *L2XconnectDump) (RPCService_L2XconnectDumpClient, error) + L2fibAddDel(ctx context.Context, in *L2fibAddDel) (*L2fibAddDelReply, error) + L2fibFlushAll(ctx context.Context, in *L2fibFlushAll) (*L2fibFlushAllReply, error) + L2fibFlushBd(ctx context.Context, in *L2fibFlushBd) (*L2fibFlushBdReply, error) + L2fibFlushInt(ctx context.Context, in *L2fibFlushInt) (*L2fibFlushIntReply, error) + SwInterfaceSetL2Bridge(ctx context.Context, in *SwInterfaceSetL2Bridge) (*SwInterfaceSetL2BridgeReply, error) + SwInterfaceSetL2Xconnect(ctx context.Context, in *SwInterfaceSetL2Xconnect) (*SwInterfaceSetL2XconnectReply, error) + SwInterfaceSetVpath(ctx context.Context, in *SwInterfaceSetVpath) (*SwInterfaceSetVpathReply, error) + WantL2ArpTermEvents(ctx context.Context, in *WantL2ArpTermEvents) (*WantL2ArpTermEventsReply, error) + WantL2MacsEvents(ctx context.Context, in *WantL2MacsEvents) (*WantL2MacsEventsReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) BdIPMacAddDel(ctx context.Context, in *BdIPMacAddDel) (*BdIPMacAddDelReply, error) { + out := new(BdIPMacAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BdIPMacDump(ctx context.Context, in *BdIPMacDump) (RPCService_BdIPMacDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_BdIPMacDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_BdIPMacDumpClient interface { + Recv() (*BdIPMacDetails, error) + api.Stream +} + +type serviceClient_BdIPMacDumpClient struct { + api.Stream +} + +func (c *serviceClient_BdIPMacDumpClient) Recv() (*BdIPMacDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *BdIPMacDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) BdIPMacFlush(ctx context.Context, in *BdIPMacFlush) (*BdIPMacFlushReply, error) { + out := new(BdIPMacFlushReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BridgeDomainAddDel(ctx context.Context, in *BridgeDomainAddDel) (*BridgeDomainAddDelReply, error) { + out := new(BridgeDomainAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BridgeDomainDump(ctx context.Context, in *BridgeDomainDump) (RPCService_BridgeDomainDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_BridgeDomainDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_BridgeDomainDumpClient interface { + Recv() (*BridgeDomainDetails, error) + api.Stream +} + +type serviceClient_BridgeDomainDumpClient struct { + api.Stream +} + +func (c *serviceClient_BridgeDomainDumpClient) Recv() (*BridgeDomainDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *BridgeDomainDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) BridgeDomainSetMacAge(ctx context.Context, in *BridgeDomainSetMacAge) (*BridgeDomainSetMacAgeReply, error) { + out := new(BridgeDomainSetMacAgeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BridgeFlags(ctx context.Context, in *BridgeFlags) (*BridgeFlagsReply, error) { + out := new(BridgeFlagsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BviCreate(ctx context.Context, in *BviCreate) (*BviCreateReply, error) { + out := new(BviCreateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BviDelete(ctx context.Context, in *BviDelete) (*BviDeleteReply, error) { + out := new(BviDeleteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2FibClearTable(ctx context.Context, in *L2FibClearTable) (*L2FibClearTableReply, error) { + out := new(L2FibClearTableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2FibTableDump(ctx context.Context, in *L2FibTableDump) (RPCService_L2FibTableDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_L2FibTableDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_L2FibTableDumpClient interface { + Recv() (*L2FibTableDetails, error) + api.Stream +} + +type serviceClient_L2FibTableDumpClient struct { + api.Stream +} + +func (c *serviceClient_L2FibTableDumpClient) Recv() (*L2FibTableDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *L2FibTableDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) L2Flags(ctx context.Context, in *L2Flags) (*L2FlagsReply, error) { + out := new(L2FlagsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2InterfaceEfpFilter(ctx context.Context, in *L2InterfaceEfpFilter) (*L2InterfaceEfpFilterReply, error) { + out := new(L2InterfaceEfpFilterReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2InterfacePbbTagRewrite(ctx context.Context, in *L2InterfacePbbTagRewrite) (*L2InterfacePbbTagRewriteReply, error) { + out := new(L2InterfacePbbTagRewriteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2InterfaceVlanTagRewrite(ctx context.Context, in *L2InterfaceVlanTagRewrite) (*L2InterfaceVlanTagRewriteReply, error) { + out := new(L2InterfaceVlanTagRewriteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2PatchAddDel(ctx context.Context, in *L2PatchAddDel) (*L2PatchAddDelReply, error) { + out := new(L2PatchAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2XconnectDump(ctx context.Context, in *L2XconnectDump) (RPCService_L2XconnectDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_L2XconnectDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_L2XconnectDumpClient interface { + Recv() (*L2XconnectDetails, error) + api.Stream +} + +type serviceClient_L2XconnectDumpClient struct { + api.Stream +} + +func (c *serviceClient_L2XconnectDumpClient) Recv() (*L2XconnectDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *L2XconnectDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) L2fibAddDel(ctx context.Context, in *L2fibAddDel) (*L2fibAddDelReply, error) { + out := new(L2fibAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2fibFlushAll(ctx context.Context, in *L2fibFlushAll) (*L2fibFlushAllReply, error) { + out := new(L2fibFlushAllReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2fibFlushBd(ctx context.Context, in *L2fibFlushBd) (*L2fibFlushBdReply, error) { + out := new(L2fibFlushBdReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2fibFlushInt(ctx context.Context, in *L2fibFlushInt) (*L2fibFlushIntReply, error) { + out := new(L2fibFlushIntReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetL2Bridge(ctx context.Context, in *SwInterfaceSetL2Bridge) (*SwInterfaceSetL2BridgeReply, error) { + out := new(SwInterfaceSetL2BridgeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetL2Xconnect(ctx context.Context, in *SwInterfaceSetL2Xconnect) (*SwInterfaceSetL2XconnectReply, error) { + out := new(SwInterfaceSetL2XconnectReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetVpath(ctx context.Context, in *SwInterfaceSetVpath) (*SwInterfaceSetVpathReply, error) { + out := new(SwInterfaceSetVpathReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantL2ArpTermEvents(ctx context.Context, in *WantL2ArpTermEvents) (*WantL2ArpTermEventsReply, error) { + out := new(WantL2ArpTermEventsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantL2MacsEvents(ctx context.Context, in *WantL2MacsEvents) (*WantL2MacsEventsReply, error) { + out := new(WantL2MacsEventsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/l2e/l2e.ba.go b/binapi/l2e/l2e.ba.go new file mode 100644 index 0000000..ebfb464 --- /dev/null +++ b/binapi/l2e/l2e.ba.go @@ -0,0 +1,120 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/l2e.api.json + +// Package l2e contains generated bindings for API file l2e.api. +// +// Contents: +// 2 messages +// +package l2e + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "l2e" + APIVersion = "1.0.0" + VersionCrc = 0x7c918b8 +) + +// L2Emulation defines message 'l2_emulation'. +type L2Emulation struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *L2Emulation) Reset() { *m = L2Emulation{} } +func (*L2Emulation) GetMessageName() string { return "l2_emulation" } +func (*L2Emulation) GetCrcString() string { return "ae6cfcfb" } +func (*L2Emulation) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *L2Emulation) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Enable + return size +} +func (m *L2Emulation) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *L2Emulation) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Enable = buf.DecodeBool() + return nil +} + +// L2EmulationReply defines message 'l2_emulation_reply'. +type L2EmulationReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *L2EmulationReply) Reset() { *m = L2EmulationReply{} } +func (*L2EmulationReply) GetMessageName() string { return "l2_emulation_reply" } +func (*L2EmulationReply) GetCrcString() string { return "e8d4e804" } +func (*L2EmulationReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *L2EmulationReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *L2EmulationReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *L2EmulationReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_l2e_binapi_init() } +func file_l2e_binapi_init() { + api.RegisterMessage((*L2Emulation)(nil), "l2_emulation_ae6cfcfb") + api.RegisterMessage((*L2EmulationReply)(nil), "l2_emulation_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*L2Emulation)(nil), + (*L2EmulationReply)(nil), + } +} diff --git a/binapi/l2e/l2e_rest.ba.go b/binapi/l2e/l2e_rest.ba.go new file mode 100644 index 0000000..23bc249 --- /dev/null +++ b/binapi/l2e/l2e_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package l2e + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/l2_emulation", func(w http.ResponseWriter, req *http.Request) { + var request = new(L2Emulation) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.L2Emulation(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/l2e/l2e_rpc.ba.go b/binapi/l2e/l2e_rpc.ba.go new file mode 100644 index 0000000..e589d28 --- /dev/null +++ b/binapi/l2e/l2e_rpc.ba.go @@ -0,0 +1,30 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package l2e + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service l2e. +type RPCService interface { + L2Emulation(ctx context.Context, in *L2Emulation) (*L2EmulationReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) L2Emulation(ctx context.Context, in *L2Emulation) (*L2EmulationReply, error) { + out := new(L2EmulationReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/l2tp/l2tp.ba.go b/binapi/l2tp/l2tp.ba.go new file mode 100644 index 0000000..d83f7dd --- /dev/null +++ b/binapi/l2tp/l2tp.ba.go @@ -0,0 +1,549 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/l2tp.api.json + +// Package l2tp contains generated bindings for API file l2tp.api. +// +// Contents: +// 1 enum +// 10 messages +// +package l2tp + +import ( + api "git.fd.io/govpp.git/api" + _ "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "l2tp" + APIVersion = "2.0.0" + VersionCrc = 0xb018cef7 +) + +// L2tLookupKey defines enum 'l2t_lookup_key'. +type L2tLookupKey uint8 + +const ( + L2T_LOOKUP_KEY_API_SRC_ADDR L2tLookupKey = 0 + L2T_LOOKUP_KEY_API_DST_ADDR L2tLookupKey = 1 + L2T_LOOKUP_KEY_API_SESSION_ID L2tLookupKey = 2 +) + +var ( + L2tLookupKey_name = map[uint8]string{ + 0: "L2T_LOOKUP_KEY_API_SRC_ADDR", + 1: "L2T_LOOKUP_KEY_API_DST_ADDR", + 2: "L2T_LOOKUP_KEY_API_SESSION_ID", + } + L2tLookupKey_value = map[string]uint8{ + "L2T_LOOKUP_KEY_API_SRC_ADDR": 0, + "L2T_LOOKUP_KEY_API_DST_ADDR": 1, + "L2T_LOOKUP_KEY_API_SESSION_ID": 2, + } +) + +func (x L2tLookupKey) String() string { + s, ok := L2tLookupKey_name[uint8(x)] + if ok { + return s + } + return "L2tLookupKey(" + strconv.Itoa(int(x)) + ")" +} + +// L2tpv3CreateTunnel defines message 'l2tpv3_create_tunnel'. +type L2tpv3CreateTunnel struct { + ClientAddress ip_types.Address `binapi:"address,name=client_address" json:"client_address,omitempty"` + OurAddress ip_types.Address `binapi:"address,name=our_address" json:"our_address,omitempty"` + LocalSessionID uint32 `binapi:"u32,name=local_session_id" json:"local_session_id,omitempty"` + RemoteSessionID uint32 `binapi:"u32,name=remote_session_id" json:"remote_session_id,omitempty"` + LocalCookie uint64 `binapi:"u64,name=local_cookie" json:"local_cookie,omitempty"` + RemoteCookie uint64 `binapi:"u64,name=remote_cookie" json:"remote_cookie,omitempty"` + L2SublayerPresent bool `binapi:"bool,name=l2_sublayer_present" json:"l2_sublayer_present,omitempty"` + EncapVrfID uint32 `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"` +} + +func (m *L2tpv3CreateTunnel) Reset() { *m = L2tpv3CreateTunnel{} } +func (*L2tpv3CreateTunnel) GetMessageName() string { return "l2tpv3_create_tunnel" } +func (*L2tpv3CreateTunnel) GetCrcString() string { return "596892cb" } +func (*L2tpv3CreateTunnel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *L2tpv3CreateTunnel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.ClientAddress.Af + size += 1 * 16 // m.ClientAddress.Un + size += 1 // m.OurAddress.Af + size += 1 * 16 // m.OurAddress.Un + size += 4 // m.LocalSessionID + size += 4 // m.RemoteSessionID + size += 8 // m.LocalCookie + size += 8 // m.RemoteCookie + size += 1 // m.L2SublayerPresent + size += 4 // m.EncapVrfID + return size +} +func (m *L2tpv3CreateTunnel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.ClientAddress.Af)) + buf.EncodeBytes(m.ClientAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.OurAddress.Af)) + buf.EncodeBytes(m.OurAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.LocalSessionID)) + buf.EncodeUint32(uint32(m.RemoteSessionID)) + buf.EncodeUint64(uint64(m.LocalCookie)) + buf.EncodeUint64(uint64(m.RemoteCookie)) + buf.EncodeBool(m.L2SublayerPresent) + buf.EncodeUint32(uint32(m.EncapVrfID)) + return buf.Bytes(), nil +} +func (m *L2tpv3CreateTunnel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ClientAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.ClientAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.OurAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.OurAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.LocalSessionID = buf.DecodeUint32() + m.RemoteSessionID = buf.DecodeUint32() + m.LocalCookie = buf.DecodeUint64() + m.RemoteCookie = buf.DecodeUint64() + m.L2SublayerPresent = buf.DecodeBool() + m.EncapVrfID = buf.DecodeUint32() + return nil +} + +// L2tpv3CreateTunnelReply defines message 'l2tpv3_create_tunnel_reply'. +type L2tpv3CreateTunnelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *L2tpv3CreateTunnelReply) Reset() { *m = L2tpv3CreateTunnelReply{} } +func (*L2tpv3CreateTunnelReply) GetMessageName() string { return "l2tpv3_create_tunnel_reply" } +func (*L2tpv3CreateTunnelReply) GetCrcString() string { return "5383d31f" } +func (*L2tpv3CreateTunnelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *L2tpv3CreateTunnelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *L2tpv3CreateTunnelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *L2tpv3CreateTunnelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// L2tpv3InterfaceEnableDisable defines message 'l2tpv3_interface_enable_disable'. +type L2tpv3InterfaceEnableDisable struct { + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *L2tpv3InterfaceEnableDisable) Reset() { *m = L2tpv3InterfaceEnableDisable{} } +func (*L2tpv3InterfaceEnableDisable) GetMessageName() string { + return "l2tpv3_interface_enable_disable" +} +func (*L2tpv3InterfaceEnableDisable) GetCrcString() string { return "3865946c" } +func (*L2tpv3InterfaceEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *L2tpv3InterfaceEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.EnableDisable + size += 4 // m.SwIfIndex + return size +} +func (m *L2tpv3InterfaceEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.EnableDisable) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *L2tpv3InterfaceEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EnableDisable = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// L2tpv3InterfaceEnableDisableReply defines message 'l2tpv3_interface_enable_disable_reply'. +type L2tpv3InterfaceEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *L2tpv3InterfaceEnableDisableReply) Reset() { *m = L2tpv3InterfaceEnableDisableReply{} } +func (*L2tpv3InterfaceEnableDisableReply) GetMessageName() string { + return "l2tpv3_interface_enable_disable_reply" +} +func (*L2tpv3InterfaceEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*L2tpv3InterfaceEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *L2tpv3InterfaceEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *L2tpv3InterfaceEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *L2tpv3InterfaceEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// L2tpv3SetLookupKey defines message 'l2tpv3_set_lookup_key'. +type L2tpv3SetLookupKey struct { + Key L2tLookupKey `binapi:"l2t_lookup_key,name=key" json:"key,omitempty"` +} + +func (m *L2tpv3SetLookupKey) Reset() { *m = L2tpv3SetLookupKey{} } +func (*L2tpv3SetLookupKey) GetMessageName() string { return "l2tpv3_set_lookup_key" } +func (*L2tpv3SetLookupKey) GetCrcString() string { return "c9892c86" } +func (*L2tpv3SetLookupKey) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *L2tpv3SetLookupKey) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Key + return size +} +func (m *L2tpv3SetLookupKey) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Key)) + return buf.Bytes(), nil +} +func (m *L2tpv3SetLookupKey) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Key = L2tLookupKey(buf.DecodeUint8()) + return nil +} + +// L2tpv3SetLookupKeyReply defines message 'l2tpv3_set_lookup_key_reply'. +type L2tpv3SetLookupKeyReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *L2tpv3SetLookupKeyReply) Reset() { *m = L2tpv3SetLookupKeyReply{} } +func (*L2tpv3SetLookupKeyReply) GetMessageName() string { return "l2tpv3_set_lookup_key_reply" } +func (*L2tpv3SetLookupKeyReply) GetCrcString() string { return "e8d4e804" } +func (*L2tpv3SetLookupKeyReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *L2tpv3SetLookupKeyReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *L2tpv3SetLookupKeyReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *L2tpv3SetLookupKeyReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// L2tpv3SetTunnelCookies defines message 'l2tpv3_set_tunnel_cookies'. +type L2tpv3SetTunnelCookies struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + NewLocalCookie uint64 `binapi:"u64,name=new_local_cookie" json:"new_local_cookie,omitempty"` + NewRemoteCookie uint64 `binapi:"u64,name=new_remote_cookie" json:"new_remote_cookie,omitempty"` +} + +func (m *L2tpv3SetTunnelCookies) Reset() { *m = L2tpv3SetTunnelCookies{} } +func (*L2tpv3SetTunnelCookies) GetMessageName() string { return "l2tpv3_set_tunnel_cookies" } +func (*L2tpv3SetTunnelCookies) GetCrcString() string { return "b3f4faf7" } +func (*L2tpv3SetTunnelCookies) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *L2tpv3SetTunnelCookies) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 8 // m.NewLocalCookie + size += 8 // m.NewRemoteCookie + return size +} +func (m *L2tpv3SetTunnelCookies) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint64(uint64(m.NewLocalCookie)) + buf.EncodeUint64(uint64(m.NewRemoteCookie)) + return buf.Bytes(), nil +} +func (m *L2tpv3SetTunnelCookies) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.NewLocalCookie = buf.DecodeUint64() + m.NewRemoteCookie = buf.DecodeUint64() + return nil +} + +// L2tpv3SetTunnelCookiesReply defines message 'l2tpv3_set_tunnel_cookies_reply'. +type L2tpv3SetTunnelCookiesReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *L2tpv3SetTunnelCookiesReply) Reset() { *m = L2tpv3SetTunnelCookiesReply{} } +func (*L2tpv3SetTunnelCookiesReply) GetMessageName() string { return "l2tpv3_set_tunnel_cookies_reply" } +func (*L2tpv3SetTunnelCookiesReply) GetCrcString() string { return "e8d4e804" } +func (*L2tpv3SetTunnelCookiesReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *L2tpv3SetTunnelCookiesReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *L2tpv3SetTunnelCookiesReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *L2tpv3SetTunnelCookiesReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwIfL2tpv3TunnelDetails defines message 'sw_if_l2tpv3_tunnel_details'. +type SwIfL2tpv3TunnelDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + InterfaceName string `binapi:"string[64],name=interface_name" json:"interface_name,omitempty"` + ClientAddress ip_types.Address `binapi:"address,name=client_address" json:"client_address,omitempty"` + OurAddress ip_types.Address `binapi:"address,name=our_address" json:"our_address,omitempty"` + LocalSessionID uint32 `binapi:"u32,name=local_session_id" json:"local_session_id,omitempty"` + RemoteSessionID uint32 `binapi:"u32,name=remote_session_id" json:"remote_session_id,omitempty"` + LocalCookie []uint64 `binapi:"u64[2],name=local_cookie" json:"local_cookie,omitempty"` + RemoteCookie uint64 `binapi:"u64,name=remote_cookie" json:"remote_cookie,omitempty"` + L2SublayerPresent bool `binapi:"bool,name=l2_sublayer_present" json:"l2_sublayer_present,omitempty"` +} + +func (m *SwIfL2tpv3TunnelDetails) Reset() { *m = SwIfL2tpv3TunnelDetails{} } +func (*SwIfL2tpv3TunnelDetails) GetMessageName() string { return "sw_if_l2tpv3_tunnel_details" } +func (*SwIfL2tpv3TunnelDetails) GetCrcString() string { return "1dab5c7e" } +func (*SwIfL2tpv3TunnelDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwIfL2tpv3TunnelDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 64 // m.InterfaceName + size += 1 // m.ClientAddress.Af + size += 1 * 16 // m.ClientAddress.Un + size += 1 // m.OurAddress.Af + size += 1 * 16 // m.OurAddress.Un + size += 4 // m.LocalSessionID + size += 4 // m.RemoteSessionID + size += 8 * 2 // m.LocalCookie + size += 8 // m.RemoteCookie + size += 1 // m.L2SublayerPresent + return size +} +func (m *SwIfL2tpv3TunnelDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeString(m.InterfaceName, 64) + buf.EncodeUint8(uint8(m.ClientAddress.Af)) + buf.EncodeBytes(m.ClientAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.OurAddress.Af)) + buf.EncodeBytes(m.OurAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.LocalSessionID)) + buf.EncodeUint32(uint32(m.RemoteSessionID)) + for i := 0; i < 2; i++ { + var x uint64 + if i < len(m.LocalCookie) { + x = uint64(m.LocalCookie[i]) + } + buf.EncodeUint64(uint64(x)) + } + buf.EncodeUint64(uint64(m.RemoteCookie)) + buf.EncodeBool(m.L2SublayerPresent) + return buf.Bytes(), nil +} +func (m *SwIfL2tpv3TunnelDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.InterfaceName = buf.DecodeString(64) + m.ClientAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.ClientAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.OurAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.OurAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.LocalSessionID = buf.DecodeUint32() + m.RemoteSessionID = buf.DecodeUint32() + m.LocalCookie = make([]uint64, 2) + for i := 0; i < len(m.LocalCookie); i++ { + m.LocalCookie[i] = buf.DecodeUint64() + } + m.RemoteCookie = buf.DecodeUint64() + m.L2SublayerPresent = buf.DecodeBool() + return nil +} + +// SwIfL2tpv3TunnelDump defines message 'sw_if_l2tpv3_tunnel_dump'. +type SwIfL2tpv3TunnelDump struct{} + +func (m *SwIfL2tpv3TunnelDump) Reset() { *m = SwIfL2tpv3TunnelDump{} } +func (*SwIfL2tpv3TunnelDump) GetMessageName() string { return "sw_if_l2tpv3_tunnel_dump" } +func (*SwIfL2tpv3TunnelDump) GetCrcString() string { return "51077d14" } +func (*SwIfL2tpv3TunnelDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwIfL2tpv3TunnelDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SwIfL2tpv3TunnelDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *SwIfL2tpv3TunnelDump) Unmarshal(b []byte) error { + return nil +} + +func init() { file_l2tp_binapi_init() } +func file_l2tp_binapi_init() { + api.RegisterMessage((*L2tpv3CreateTunnel)(nil), "l2tpv3_create_tunnel_596892cb") + api.RegisterMessage((*L2tpv3CreateTunnelReply)(nil), "l2tpv3_create_tunnel_reply_5383d31f") + api.RegisterMessage((*L2tpv3InterfaceEnableDisable)(nil), "l2tpv3_interface_enable_disable_3865946c") + api.RegisterMessage((*L2tpv3InterfaceEnableDisableReply)(nil), "l2tpv3_interface_enable_disable_reply_e8d4e804") + api.RegisterMessage((*L2tpv3SetLookupKey)(nil), "l2tpv3_set_lookup_key_c9892c86") + api.RegisterMessage((*L2tpv3SetLookupKeyReply)(nil), "l2tpv3_set_lookup_key_reply_e8d4e804") + api.RegisterMessage((*L2tpv3SetTunnelCookies)(nil), "l2tpv3_set_tunnel_cookies_b3f4faf7") + api.RegisterMessage((*L2tpv3SetTunnelCookiesReply)(nil), "l2tpv3_set_tunnel_cookies_reply_e8d4e804") + api.RegisterMessage((*SwIfL2tpv3TunnelDetails)(nil), "sw_if_l2tpv3_tunnel_details_1dab5c7e") + api.RegisterMessage((*SwIfL2tpv3TunnelDump)(nil), "sw_if_l2tpv3_tunnel_dump_51077d14") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*L2tpv3CreateTunnel)(nil), + (*L2tpv3CreateTunnelReply)(nil), + (*L2tpv3InterfaceEnableDisable)(nil), + (*L2tpv3InterfaceEnableDisableReply)(nil), + (*L2tpv3SetLookupKey)(nil), + (*L2tpv3SetLookupKeyReply)(nil), + (*L2tpv3SetTunnelCookies)(nil), + (*L2tpv3SetTunnelCookiesReply)(nil), + (*SwIfL2tpv3TunnelDetails)(nil), + (*SwIfL2tpv3TunnelDump)(nil), + } +} diff --git a/binapi/l2tp/l2tp_rest.ba.go b/binapi/l2tp/l2tp_rest.ba.go new file mode 100644 index 0000000..ac1119f --- /dev/null +++ b/binapi/l2tp/l2tp_rest.ba.go @@ -0,0 +1,106 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package l2tp + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/l2tpv3_create_tunnel", func(w http.ResponseWriter, req *http.Request) { + var request = new(L2tpv3CreateTunnel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.L2tpv3CreateTunnel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/l2tpv3_interface_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(L2tpv3InterfaceEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.L2tpv3InterfaceEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/l2tpv3_set_lookup_key", func(w http.ResponseWriter, req *http.Request) { + var request = new(L2tpv3SetLookupKey) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.L2tpv3SetLookupKey(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/l2tpv3_set_tunnel_cookies", func(w http.ResponseWriter, req *http.Request) { + var request = new(L2tpv3SetTunnelCookies) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.L2tpv3SetTunnelCookies(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/l2tp/l2tp_rpc.ba.go b/binapi/l2tp/l2tp_rpc.ba.go new file mode 100644 index 0000000..9fb250a --- /dev/null +++ b/binapi/l2tp/l2tp_rpc.ba.go @@ -0,0 +1,103 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package l2tp + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service l2tp. +type RPCService interface { + L2tpv3CreateTunnel(ctx context.Context, in *L2tpv3CreateTunnel) (*L2tpv3CreateTunnelReply, error) + L2tpv3InterfaceEnableDisable(ctx context.Context, in *L2tpv3InterfaceEnableDisable) (*L2tpv3InterfaceEnableDisableReply, error) + L2tpv3SetLookupKey(ctx context.Context, in *L2tpv3SetLookupKey) (*L2tpv3SetLookupKeyReply, error) + L2tpv3SetTunnelCookies(ctx context.Context, in *L2tpv3SetTunnelCookies) (*L2tpv3SetTunnelCookiesReply, error) + SwIfL2tpv3TunnelDump(ctx context.Context, in *SwIfL2tpv3TunnelDump) (RPCService_SwIfL2tpv3TunnelDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) L2tpv3CreateTunnel(ctx context.Context, in *L2tpv3CreateTunnel) (*L2tpv3CreateTunnelReply, error) { + out := new(L2tpv3CreateTunnelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2tpv3InterfaceEnableDisable(ctx context.Context, in *L2tpv3InterfaceEnableDisable) (*L2tpv3InterfaceEnableDisableReply, error) { + out := new(L2tpv3InterfaceEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2tpv3SetLookupKey(ctx context.Context, in *L2tpv3SetLookupKey) (*L2tpv3SetLookupKeyReply, error) { + out := new(L2tpv3SetLookupKeyReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2tpv3SetTunnelCookies(ctx context.Context, in *L2tpv3SetTunnelCookies) (*L2tpv3SetTunnelCookiesReply, error) { + out := new(L2tpv3SetTunnelCookiesReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwIfL2tpv3TunnelDump(ctx context.Context, in *SwIfL2tpv3TunnelDump) (RPCService_SwIfL2tpv3TunnelDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SwIfL2tpv3TunnelDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_SwIfL2tpv3TunnelDumpClient interface { + Recv() (*SwIfL2tpv3TunnelDetails, error) + api.Stream +} + +type serviceClient_SwIfL2tpv3TunnelDumpClient struct { + api.Stream +} + +func (c *serviceClient_SwIfL2tpv3TunnelDumpClient) Recv() (*SwIfL2tpv3TunnelDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SwIfL2tpv3TunnelDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/l3xc/l3xc.ba.go b/binapi/l3xc/l3xc.ba.go new file mode 100644 index 0000000..ee9ecb0 --- /dev/null +++ b/binapi/l3xc/l3xc.ba.go @@ -0,0 +1,537 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/l3xc.api.json + +// Package l3xc contains generated bindings for API file l3xc.api. +// +// Contents: +// 1 struct +// 8 messages +// +package l3xc + +import ( + api "git.fd.io/govpp.git/api" + fib_types "git.fd.io/govpp.git/binapi/fib_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + _ "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "l3xc" + APIVersion = "1.0.1" + VersionCrc = 0xaf18effb +) + +// L3xc defines type 'l3xc'. +type L3xc struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` + NPaths uint8 `binapi:"u8,name=n_paths" json:"-"` + Paths []fib_types.FibPath `binapi:"fib_path[n_paths],name=paths" json:"paths,omitempty"` +} + +// L3xcDel defines message 'l3xc_del'. +type L3xcDel struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` +} + +func (m *L3xcDel) Reset() { *m = L3xcDel{} } +func (*L3xcDel) GetMessageName() string { return "l3xc_del" } +func (*L3xcDel) GetCrcString() string { return "e7dbef91" } +func (*L3xcDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *L3xcDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.IsIP6 + return size +} +func (m *L3xcDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsIP6) + return buf.Bytes(), nil +} +func (m *L3xcDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsIP6 = buf.DecodeBool() + return nil +} + +// L3xcDelReply defines message 'l3xc_del_reply'. +type L3xcDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *L3xcDelReply) Reset() { *m = L3xcDelReply{} } +func (*L3xcDelReply) GetMessageName() string { return "l3xc_del_reply" } +func (*L3xcDelReply) GetCrcString() string { return "e8d4e804" } +func (*L3xcDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *L3xcDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *L3xcDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *L3xcDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// L3xcDetails defines message 'l3xc_details'. +type L3xcDetails struct { + L3xc L3xc `binapi:"l3xc,name=l3xc" json:"l3xc,omitempty"` +} + +func (m *L3xcDetails) Reset() { *m = L3xcDetails{} } +func (*L3xcDetails) GetMessageName() string { return "l3xc_details" } +func (*L3xcDetails) GetCrcString() string { return "d4f69627" } +func (*L3xcDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *L3xcDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.L3xc.SwIfIndex + size += 1 // m.L3xc.IsIP6 + size += 1 // m.L3xc.NPaths + for j2 := 0; j2 < len(m.L3xc.Paths); j2++ { + var s2 fib_types.FibPath + _ = s2 + if j2 < len(m.L3xc.Paths) { + s2 = m.L3xc.Paths[j2] + } + size += 4 // s2.SwIfIndex + size += 4 // s2.TableID + size += 4 // s2.RpfID + size += 1 // s2.Weight + size += 1 // s2.Preference + size += 4 // s2.Type + size += 4 // s2.Flags + size += 4 // s2.Proto + size += 1 * 16 // s2.Nh.Address + size += 4 // s2.Nh.ViaLabel + size += 4 // s2.Nh.ObjID + size += 4 // s2.Nh.ClassifyTableIndex + size += 1 // s2.NLabels + for j3 := 0; j3 < 16; j3++ { + var s3 fib_types.FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + size += 1 // s3.IsUniform + size += 4 // s3.Label + size += 1 // s3.TTL + size += 1 // s3.Exp + } + } + return size +} +func (m *L3xcDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.L3xc.SwIfIndex)) + buf.EncodeBool(m.L3xc.IsIP6) + buf.EncodeUint8(uint8(len(m.L3xc.Paths))) + for j1 := 0; j1 < len(m.L3xc.Paths); j1++ { + var v1 fib_types.FibPath + if j1 < len(m.L3xc.Paths) { + v1 = m.L3xc.Paths[j1] + } + buf.EncodeUint32(uint32(v1.SwIfIndex)) + buf.EncodeUint32(uint32(v1.TableID)) + buf.EncodeUint32(uint32(v1.RpfID)) + buf.EncodeUint8(uint8(v1.Weight)) + buf.EncodeUint8(uint8(v1.Preference)) + buf.EncodeUint32(uint32(v1.Type)) + buf.EncodeUint32(uint32(v1.Flags)) + buf.EncodeUint32(uint32(v1.Proto)) + buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v1.Nh.ViaLabel)) + buf.EncodeUint32(uint32(v1.Nh.ObjID)) + buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex)) + buf.EncodeUint8(uint8(v1.NLabels)) + for j2 := 0; j2 < 16; j2++ { + var v2 fib_types.FibMplsLabel + if j2 < len(v1.LabelStack) { + v2 = v1.LabelStack[j2] + } + buf.EncodeUint8(uint8(v2.IsUniform)) + buf.EncodeUint32(uint32(v2.Label)) + buf.EncodeUint8(uint8(v2.TTL)) + buf.EncodeUint8(uint8(v2.Exp)) + } + } + return buf.Bytes(), nil +} +func (m *L3xcDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.L3xc.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.L3xc.IsIP6 = buf.DecodeBool() + m.L3xc.NPaths = buf.DecodeUint8() + m.L3xc.Paths = make([]fib_types.FibPath, int(m.L3xc.NPaths)) + for j1 := 0; j1 < len(m.L3xc.Paths); j1++ { + m.L3xc.Paths[j1].SwIfIndex = buf.DecodeUint32() + m.L3xc.Paths[j1].TableID = buf.DecodeUint32() + m.L3xc.Paths[j1].RpfID = buf.DecodeUint32() + m.L3xc.Paths[j1].Weight = buf.DecodeUint8() + m.L3xc.Paths[j1].Preference = buf.DecodeUint8() + m.L3xc.Paths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.L3xc.Paths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.L3xc.Paths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.L3xc.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.L3xc.Paths[j1].Nh.ViaLabel = buf.DecodeUint32() + m.L3xc.Paths[j1].Nh.ObjID = buf.DecodeUint32() + m.L3xc.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.L3xc.Paths[j1].NLabels = buf.DecodeUint8() + for j2 := 0; j2 < 16; j2++ { + m.L3xc.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() + m.L3xc.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32() + m.L3xc.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8() + m.L3xc.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8() + } + } + return nil +} + +// L3xcDump defines message 'l3xc_dump'. +type L3xcDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *L3xcDump) Reset() { *m = L3xcDump{} } +func (*L3xcDump) GetMessageName() string { return "l3xc_dump" } +func (*L3xcDump) GetCrcString() string { return "f9e6675e" } +func (*L3xcDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *L3xcDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *L3xcDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *L3xcDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// L3xcPluginGetVersion defines message 'l3xc_plugin_get_version'. +type L3xcPluginGetVersion struct{} + +func (m *L3xcPluginGetVersion) Reset() { *m = L3xcPluginGetVersion{} } +func (*L3xcPluginGetVersion) GetMessageName() string { return "l3xc_plugin_get_version" } +func (*L3xcPluginGetVersion) GetCrcString() string { return "51077d14" } +func (*L3xcPluginGetVersion) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *L3xcPluginGetVersion) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *L3xcPluginGetVersion) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *L3xcPluginGetVersion) Unmarshal(b []byte) error { + return nil +} + +// L3xcPluginGetVersionReply defines message 'l3xc_plugin_get_version_reply'. +type L3xcPluginGetVersionReply struct { + Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` + Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` +} + +func (m *L3xcPluginGetVersionReply) Reset() { *m = L3xcPluginGetVersionReply{} } +func (*L3xcPluginGetVersionReply) GetMessageName() string { return "l3xc_plugin_get_version_reply" } +func (*L3xcPluginGetVersionReply) GetCrcString() string { return "9b32cf86" } +func (*L3xcPluginGetVersionReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *L3xcPluginGetVersionReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Major + size += 4 // m.Minor + return size +} +func (m *L3xcPluginGetVersionReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Major)) + buf.EncodeUint32(uint32(m.Minor)) + return buf.Bytes(), nil +} +func (m *L3xcPluginGetVersionReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Major = buf.DecodeUint32() + m.Minor = buf.DecodeUint32() + return nil +} + +// L3xcUpdate defines message 'l3xc_update'. +type L3xcUpdate struct { + L3xc L3xc `binapi:"l3xc,name=l3xc" json:"l3xc,omitempty"` +} + +func (m *L3xcUpdate) Reset() { *m = L3xcUpdate{} } +func (*L3xcUpdate) GetMessageName() string { return "l3xc_update" } +func (*L3xcUpdate) GetCrcString() string { return "0787b1d3" } +func (*L3xcUpdate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *L3xcUpdate) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.L3xc.SwIfIndex + size += 1 // m.L3xc.IsIP6 + size += 1 // m.L3xc.NPaths + for j2 := 0; j2 < len(m.L3xc.Paths); j2++ { + var s2 fib_types.FibPath + _ = s2 + if j2 < len(m.L3xc.Paths) { + s2 = m.L3xc.Paths[j2] + } + size += 4 // s2.SwIfIndex + size += 4 // s2.TableID + size += 4 // s2.RpfID + size += 1 // s2.Weight + size += 1 // s2.Preference + size += 4 // s2.Type + size += 4 // s2.Flags + size += 4 // s2.Proto + size += 1 * 16 // s2.Nh.Address + size += 4 // s2.Nh.ViaLabel + size += 4 // s2.Nh.ObjID + size += 4 // s2.Nh.ClassifyTableIndex + size += 1 // s2.NLabels + for j3 := 0; j3 < 16; j3++ { + var s3 fib_types.FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + size += 1 // s3.IsUniform + size += 4 // s3.Label + size += 1 // s3.TTL + size += 1 // s3.Exp + } + } + return size +} +func (m *L3xcUpdate) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.L3xc.SwIfIndex)) + buf.EncodeBool(m.L3xc.IsIP6) + buf.EncodeUint8(uint8(len(m.L3xc.Paths))) + for j1 := 0; j1 < len(m.L3xc.Paths); j1++ { + var v1 fib_types.FibPath + if j1 < len(m.L3xc.Paths) { + v1 = m.L3xc.Paths[j1] + } + buf.EncodeUint32(uint32(v1.SwIfIndex)) + buf.EncodeUint32(uint32(v1.TableID)) + buf.EncodeUint32(uint32(v1.RpfID)) + buf.EncodeUint8(uint8(v1.Weight)) + buf.EncodeUint8(uint8(v1.Preference)) + buf.EncodeUint32(uint32(v1.Type)) + buf.EncodeUint32(uint32(v1.Flags)) + buf.EncodeUint32(uint32(v1.Proto)) + buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v1.Nh.ViaLabel)) + buf.EncodeUint32(uint32(v1.Nh.ObjID)) + buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex)) + buf.EncodeUint8(uint8(v1.NLabels)) + for j2 := 0; j2 < 16; j2++ { + var v2 fib_types.FibMplsLabel + if j2 < len(v1.LabelStack) { + v2 = v1.LabelStack[j2] + } + buf.EncodeUint8(uint8(v2.IsUniform)) + buf.EncodeUint32(uint32(v2.Label)) + buf.EncodeUint8(uint8(v2.TTL)) + buf.EncodeUint8(uint8(v2.Exp)) + } + } + return buf.Bytes(), nil +} +func (m *L3xcUpdate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.L3xc.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.L3xc.IsIP6 = buf.DecodeBool() + m.L3xc.NPaths = buf.DecodeUint8() + m.L3xc.Paths = make([]fib_types.FibPath, int(m.L3xc.NPaths)) + for j1 := 0; j1 < len(m.L3xc.Paths); j1++ { + m.L3xc.Paths[j1].SwIfIndex = buf.DecodeUint32() + m.L3xc.Paths[j1].TableID = buf.DecodeUint32() + m.L3xc.Paths[j1].RpfID = buf.DecodeUint32() + m.L3xc.Paths[j1].Weight = buf.DecodeUint8() + m.L3xc.Paths[j1].Preference = buf.DecodeUint8() + m.L3xc.Paths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.L3xc.Paths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.L3xc.Paths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.L3xc.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.L3xc.Paths[j1].Nh.ViaLabel = buf.DecodeUint32() + m.L3xc.Paths[j1].Nh.ObjID = buf.DecodeUint32() + m.L3xc.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.L3xc.Paths[j1].NLabels = buf.DecodeUint8() + for j2 := 0; j2 < 16; j2++ { + m.L3xc.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() + m.L3xc.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32() + m.L3xc.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8() + m.L3xc.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8() + } + } + return nil +} + +// L3xcUpdateReply defines message 'l3xc_update_reply'. +type L3xcUpdateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` +} + +func (m *L3xcUpdateReply) Reset() { *m = L3xcUpdateReply{} } +func (*L3xcUpdateReply) GetMessageName() string { return "l3xc_update_reply" } +func (*L3xcUpdateReply) GetCrcString() string { return "1992deab" } +func (*L3xcUpdateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *L3xcUpdateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.StatsIndex + return size +} +func (m *L3xcUpdateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.StatsIndex)) + return buf.Bytes(), nil +} +func (m *L3xcUpdateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.StatsIndex = buf.DecodeUint32() + return nil +} + +func init() { file_l3xc_binapi_init() } +func file_l3xc_binapi_init() { + api.RegisterMessage((*L3xcDel)(nil), "l3xc_del_e7dbef91") + api.RegisterMessage((*L3xcDelReply)(nil), "l3xc_del_reply_e8d4e804") + api.RegisterMessage((*L3xcDetails)(nil), "l3xc_details_d4f69627") + api.RegisterMessage((*L3xcDump)(nil), "l3xc_dump_f9e6675e") + api.RegisterMessage((*L3xcPluginGetVersion)(nil), "l3xc_plugin_get_version_51077d14") + api.RegisterMessage((*L3xcPluginGetVersionReply)(nil), "l3xc_plugin_get_version_reply_9b32cf86") + api.RegisterMessage((*L3xcUpdate)(nil), "l3xc_update_0787b1d3") + api.RegisterMessage((*L3xcUpdateReply)(nil), "l3xc_update_reply_1992deab") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*L3xcDel)(nil), + (*L3xcDelReply)(nil), + (*L3xcDetails)(nil), + (*L3xcDump)(nil), + (*L3xcPluginGetVersion)(nil), + (*L3xcPluginGetVersionReply)(nil), + (*L3xcUpdate)(nil), + (*L3xcUpdateReply)(nil), + } +} diff --git a/binapi/l3xc/l3xc_rest.ba.go b/binapi/l3xc/l3xc_rest.ba.go new file mode 100644 index 0000000..2b2c9ba --- /dev/null +++ b/binapi/l3xc/l3xc_rest.ba.go @@ -0,0 +1,74 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package l3xc + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/l3xc_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(L3xcDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.L3xcDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/l3xc_plugin_get_version", func(w http.ResponseWriter, req *http.Request) { + var request = new(L3xcPluginGetVersion) + reply, err := rpc.L3xcPluginGetVersion(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/l3xc_update", func(w http.ResponseWriter, req *http.Request) { + var request = new(L3xcUpdate) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.L3xcUpdate(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/l3xc/l3xc_rpc.ba.go b/binapi/l3xc/l3xc_rpc.ba.go new file mode 100644 index 0000000..74940a2 --- /dev/null +++ b/binapi/l3xc/l3xc_rpc.ba.go @@ -0,0 +1,93 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package l3xc + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service l3xc. +type RPCService interface { + L3xcDel(ctx context.Context, in *L3xcDel) (*L3xcDelReply, error) + L3xcDump(ctx context.Context, in *L3xcDump) (RPCService_L3xcDumpClient, error) + L3xcPluginGetVersion(ctx context.Context, in *L3xcPluginGetVersion) (*L3xcPluginGetVersionReply, error) + L3xcUpdate(ctx context.Context, in *L3xcUpdate) (*L3xcUpdateReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) L3xcDel(ctx context.Context, in *L3xcDel) (*L3xcDelReply, error) { + out := new(L3xcDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L3xcDump(ctx context.Context, in *L3xcDump) (RPCService_L3xcDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_L3xcDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_L3xcDumpClient interface { + Recv() (*L3xcDetails, error) + api.Stream +} + +type serviceClient_L3xcDumpClient struct { + api.Stream +} + +func (c *serviceClient_L3xcDumpClient) Recv() (*L3xcDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *L3xcDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) L3xcPluginGetVersion(ctx context.Context, in *L3xcPluginGetVersion) (*L3xcPluginGetVersionReply, error) { + out := new(L3xcPluginGetVersionReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L3xcUpdate(ctx context.Context, in *L3xcUpdate) (*L3xcUpdateReply, error) { + out := new(L3xcUpdateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/lacp/lacp.ba.go b/binapi/lacp/lacp.ba.go new file mode 100644 index 0000000..92fd933 --- /dev/null +++ b/binapi/lacp/lacp.ba.go @@ -0,0 +1,183 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/lacp.api.json + +// Package lacp contains generated bindings for API file lacp.api. +// +// Contents: +// 2 messages +// +package lacp + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "lacp" + APIVersion = "2.0.0" + VersionCrc = 0x461bf09e +) + +// SwInterfaceLacpDetails defines message 'sw_interface_lacp_details'. +type SwInterfaceLacpDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + InterfaceName string `binapi:"string[64],name=interface_name" json:"interface_name,omitempty"` + RxState uint32 `binapi:"u32,name=rx_state" json:"rx_state,omitempty"` + TxState uint32 `binapi:"u32,name=tx_state" json:"tx_state,omitempty"` + MuxState uint32 `binapi:"u32,name=mux_state" json:"mux_state,omitempty"` + PtxState uint32 `binapi:"u32,name=ptx_state" json:"ptx_state,omitempty"` + BondInterfaceName string `binapi:"string[64],name=bond_interface_name" json:"bond_interface_name,omitempty"` + ActorSystemPriority uint16 `binapi:"u16,name=actor_system_priority" json:"actor_system_priority,omitempty"` + ActorSystem ethernet_types.MacAddress `binapi:"mac_address,name=actor_system" json:"actor_system,omitempty"` + ActorKey uint16 `binapi:"u16,name=actor_key" json:"actor_key,omitempty"` + ActorPortPriority uint16 `binapi:"u16,name=actor_port_priority" json:"actor_port_priority,omitempty"` + ActorPortNumber uint16 `binapi:"u16,name=actor_port_number" json:"actor_port_number,omitempty"` + ActorState uint8 `binapi:"u8,name=actor_state" json:"actor_state,omitempty"` + PartnerSystemPriority uint16 `binapi:"u16,name=partner_system_priority" json:"partner_system_priority,omitempty"` + PartnerSystem ethernet_types.MacAddress `binapi:"mac_address,name=partner_system" json:"partner_system,omitempty"` + PartnerKey uint16 `binapi:"u16,name=partner_key" json:"partner_key,omitempty"` + PartnerPortPriority uint16 `binapi:"u16,name=partner_port_priority" json:"partner_port_priority,omitempty"` + PartnerPortNumber uint16 `binapi:"u16,name=partner_port_number" json:"partner_port_number,omitempty"` + PartnerState uint8 `binapi:"u8,name=partner_state" json:"partner_state,omitempty"` +} + +func (m *SwInterfaceLacpDetails) Reset() { *m = SwInterfaceLacpDetails{} } +func (*SwInterfaceLacpDetails) GetMessageName() string { return "sw_interface_lacp_details" } +func (*SwInterfaceLacpDetails) GetCrcString() string { return "745ae0ba" } +func (*SwInterfaceLacpDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceLacpDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 64 // m.InterfaceName + size += 4 // m.RxState + size += 4 // m.TxState + size += 4 // m.MuxState + size += 4 // m.PtxState + size += 64 // m.BondInterfaceName + size += 2 // m.ActorSystemPriority + size += 1 * 6 // m.ActorSystem + size += 2 // m.ActorKey + size += 2 // m.ActorPortPriority + size += 2 // m.ActorPortNumber + size += 1 // m.ActorState + size += 2 // m.PartnerSystemPriority + size += 1 * 6 // m.PartnerSystem + size += 2 // m.PartnerKey + size += 2 // m.PartnerPortPriority + size += 2 // m.PartnerPortNumber + size += 1 // m.PartnerState + return size +} +func (m *SwInterfaceLacpDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeString(m.InterfaceName, 64) + buf.EncodeUint32(uint32(m.RxState)) + buf.EncodeUint32(uint32(m.TxState)) + buf.EncodeUint32(uint32(m.MuxState)) + buf.EncodeUint32(uint32(m.PtxState)) + buf.EncodeString(m.BondInterfaceName, 64) + buf.EncodeUint16(uint16(m.ActorSystemPriority)) + buf.EncodeBytes(m.ActorSystem[:], 6) + buf.EncodeUint16(uint16(m.ActorKey)) + buf.EncodeUint16(uint16(m.ActorPortPriority)) + buf.EncodeUint16(uint16(m.ActorPortNumber)) + buf.EncodeUint8(uint8(m.ActorState)) + buf.EncodeUint16(uint16(m.PartnerSystemPriority)) + buf.EncodeBytes(m.PartnerSystem[:], 6) + buf.EncodeUint16(uint16(m.PartnerKey)) + buf.EncodeUint16(uint16(m.PartnerPortPriority)) + buf.EncodeUint16(uint16(m.PartnerPortNumber)) + buf.EncodeUint8(uint8(m.PartnerState)) + return buf.Bytes(), nil +} +func (m *SwInterfaceLacpDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.InterfaceName = buf.DecodeString(64) + m.RxState = buf.DecodeUint32() + m.TxState = buf.DecodeUint32() + m.MuxState = buf.DecodeUint32() + m.PtxState = buf.DecodeUint32() + m.BondInterfaceName = buf.DecodeString(64) + m.ActorSystemPriority = buf.DecodeUint16() + copy(m.ActorSystem[:], buf.DecodeBytes(6)) + m.ActorKey = buf.DecodeUint16() + m.ActorPortPriority = buf.DecodeUint16() + m.ActorPortNumber = buf.DecodeUint16() + m.ActorState = buf.DecodeUint8() + m.PartnerSystemPriority = buf.DecodeUint16() + copy(m.PartnerSystem[:], buf.DecodeBytes(6)) + m.PartnerKey = buf.DecodeUint16() + m.PartnerPortPriority = buf.DecodeUint16() + m.PartnerPortNumber = buf.DecodeUint16() + m.PartnerState = buf.DecodeUint8() + return nil +} + +// SwInterfaceLacpDump defines message 'sw_interface_lacp_dump'. +type SwInterfaceLacpDump struct{} + +func (m *SwInterfaceLacpDump) Reset() { *m = SwInterfaceLacpDump{} } +func (*SwInterfaceLacpDump) GetMessageName() string { return "sw_interface_lacp_dump" } +func (*SwInterfaceLacpDump) GetCrcString() string { return "51077d14" } +func (*SwInterfaceLacpDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceLacpDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SwInterfaceLacpDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *SwInterfaceLacpDump) Unmarshal(b []byte) error { + return nil +} + +func init() { file_lacp_binapi_init() } +func file_lacp_binapi_init() { + api.RegisterMessage((*SwInterfaceLacpDetails)(nil), "sw_interface_lacp_details_745ae0ba") + api.RegisterMessage((*SwInterfaceLacpDump)(nil), "sw_interface_lacp_dump_51077d14") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SwInterfaceLacpDetails)(nil), + (*SwInterfaceLacpDump)(nil), + } +} diff --git a/binapi/lacp/lacp_rest.ba.go b/binapi/lacp/lacp_rest.ba.go new file mode 100644 index 0000000..3512a0d --- /dev/null +++ b/binapi/lacp/lacp_rest.ba.go @@ -0,0 +1,12 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package lacp + +import ( + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/lacp/lacp_rpc.ba.go b/binapi/lacp/lacp_rpc.ba.go new file mode 100644 index 0000000..00a00b5 --- /dev/null +++ b/binapi/lacp/lacp_rpc.ba.go @@ -0,0 +1,63 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package lacp + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service lacp. +type RPCService interface { + SwInterfaceLacpDump(ctx context.Context, in *SwInterfaceLacpDump) (RPCService_SwInterfaceLacpDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) SwInterfaceLacpDump(ctx context.Context, in *SwInterfaceLacpDump) (RPCService_SwInterfaceLacpDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SwInterfaceLacpDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_SwInterfaceLacpDumpClient interface { + Recv() (*SwInterfaceLacpDetails, error) + api.Stream +} + +type serviceClient_SwInterfaceLacpDumpClient struct { + api.Stream +} + +func (c *serviceClient_SwInterfaceLacpDumpClient) Recv() (*SwInterfaceLacpDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SwInterfaceLacpDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/lb/lb.ba.go b/binapi/lb/lb.ba.go new file mode 100644 index 0000000..018ae4d --- /dev/null +++ b/binapi/lb/lb.ba.go @@ -0,0 +1,849 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/lb.api.json + +// Package lb contains generated bindings for API file lb.api. +// +// Contents: +// 16 messages +// +package lb + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + lb_types "git.fd.io/govpp.git/binapi/lb_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "lb" + APIVersion = "1.0.0" + VersionCrc = 0x5e4e85b1 +) + +// LbAddDelAs defines message 'lb_add_del_as'. +type LbAddDelAs struct { + Pfx ip_types.AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol,default=%!s(float64=255)" json:"protocol,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + AsAddress ip_types.Address `binapi:"address,name=as_address" json:"as_address,omitempty"` + IsDel bool `binapi:"bool,name=is_del" json:"is_del,omitempty"` + IsFlush bool `binapi:"bool,name=is_flush" json:"is_flush,omitempty"` +} + +func (m *LbAddDelAs) Reset() { *m = LbAddDelAs{} } +func (*LbAddDelAs) GetMessageName() string { return "lb_add_del_as" } +func (*LbAddDelAs) GetCrcString() string { return "78628987" } +func (*LbAddDelAs) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LbAddDelAs) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Pfx.Address.Af + size += 1 * 16 // m.Pfx.Address.Un + size += 1 // m.Pfx.Len + size += 1 // m.Protocol + size += 2 // m.Port + size += 1 // m.AsAddress.Af + size += 1 * 16 // m.AsAddress.Un + size += 1 // m.IsDel + size += 1 // m.IsFlush + return size +} +func (m *LbAddDelAs) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Pfx.Address.Af)) + buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Pfx.Len)) + buf.EncodeUint8(uint8(m.Protocol)) + buf.EncodeUint16(uint16(m.Port)) + buf.EncodeUint8(uint8(m.AsAddress.Af)) + buf.EncodeBytes(m.AsAddress.Un.XXX_UnionData[:], 0) + buf.EncodeBool(m.IsDel) + buf.EncodeBool(m.IsFlush) + return buf.Bytes(), nil +} +func (m *LbAddDelAs) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Pfx.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Pfx.Len = buf.DecodeUint8() + m.Protocol = buf.DecodeUint8() + m.Port = buf.DecodeUint16() + m.AsAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.AsAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.IsDel = buf.DecodeBool() + m.IsFlush = buf.DecodeBool() + return nil +} + +// LbAddDelAsReply defines message 'lb_add_del_as_reply'. +type LbAddDelAsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LbAddDelAsReply) Reset() { *m = LbAddDelAsReply{} } +func (*LbAddDelAsReply) GetMessageName() string { return "lb_add_del_as_reply" } +func (*LbAddDelAsReply) GetCrcString() string { return "e8d4e804" } +func (*LbAddDelAsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LbAddDelAsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *LbAddDelAsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *LbAddDelAsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// LbAddDelIntfNat4 defines message 'lb_add_del_intf_nat4'. +type LbAddDelIntfNat4 struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *LbAddDelIntfNat4) Reset() { *m = LbAddDelIntfNat4{} } +func (*LbAddDelIntfNat4) GetMessageName() string { return "lb_add_del_intf_nat4" } +func (*LbAddDelIntfNat4) GetCrcString() string { return "47d6e753" } +func (*LbAddDelIntfNat4) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LbAddDelIntfNat4) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.SwIfIndex + return size +} +func (m *LbAddDelIntfNat4) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *LbAddDelIntfNat4) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// LbAddDelIntfNat4Reply defines message 'lb_add_del_intf_nat4_reply'. +type LbAddDelIntfNat4Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LbAddDelIntfNat4Reply) Reset() { *m = LbAddDelIntfNat4Reply{} } +func (*LbAddDelIntfNat4Reply) GetMessageName() string { return "lb_add_del_intf_nat4_reply" } +func (*LbAddDelIntfNat4Reply) GetCrcString() string { return "e8d4e804" } +func (*LbAddDelIntfNat4Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LbAddDelIntfNat4Reply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *LbAddDelIntfNat4Reply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *LbAddDelIntfNat4Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// LbAddDelIntfNat6 defines message 'lb_add_del_intf_nat6'. +type LbAddDelIntfNat6 struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *LbAddDelIntfNat6) Reset() { *m = LbAddDelIntfNat6{} } +func (*LbAddDelIntfNat6) GetMessageName() string { return "lb_add_del_intf_nat6" } +func (*LbAddDelIntfNat6) GetCrcString() string { return "47d6e753" } +func (*LbAddDelIntfNat6) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LbAddDelIntfNat6) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.SwIfIndex + return size +} +func (m *LbAddDelIntfNat6) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *LbAddDelIntfNat6) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// LbAddDelIntfNat6Reply defines message 'lb_add_del_intf_nat6_reply'. +type LbAddDelIntfNat6Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LbAddDelIntfNat6Reply) Reset() { *m = LbAddDelIntfNat6Reply{} } +func (*LbAddDelIntfNat6Reply) GetMessageName() string { return "lb_add_del_intf_nat6_reply" } +func (*LbAddDelIntfNat6Reply) GetCrcString() string { return "e8d4e804" } +func (*LbAddDelIntfNat6Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LbAddDelIntfNat6Reply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *LbAddDelIntfNat6Reply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *LbAddDelIntfNat6Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// LbAddDelVip defines message 'lb_add_del_vip'. +type LbAddDelVip struct { + Pfx ip_types.AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol,default=%!s(float64=255)" json:"protocol,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + Encap lb_types.LbEncapType `binapi:"lb_encap_type,name=encap" json:"encap,omitempty"` + Dscp uint8 `binapi:"u8,name=dscp" json:"dscp,omitempty"` + Type lb_types.LbSrvType `binapi:"lb_srv_type,name=type" json:"type,omitempty"` + TargetPort uint16 `binapi:"u16,name=target_port" json:"target_port,omitempty"` + NodePort uint16 `binapi:"u16,name=node_port" json:"node_port,omitempty"` + NewFlowsTableLength uint32 `binapi:"u32,name=new_flows_table_length,default=%!s(float64=1024)" json:"new_flows_table_length,omitempty"` + IsDel bool `binapi:"bool,name=is_del" json:"is_del,omitempty"` +} + +func (m *LbAddDelVip) Reset() { *m = LbAddDelVip{} } +func (*LbAddDelVip) GetMessageName() string { return "lb_add_del_vip" } +func (*LbAddDelVip) GetCrcString() string { return "d15b7ddc" } +func (*LbAddDelVip) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LbAddDelVip) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Pfx.Address.Af + size += 1 * 16 // m.Pfx.Address.Un + size += 1 // m.Pfx.Len + size += 1 // m.Protocol + size += 2 // m.Port + size += 4 // m.Encap + size += 1 // m.Dscp + size += 4 // m.Type + size += 2 // m.TargetPort + size += 2 // m.NodePort + size += 4 // m.NewFlowsTableLength + size += 1 // m.IsDel + return size +} +func (m *LbAddDelVip) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Pfx.Address.Af)) + buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Pfx.Len)) + buf.EncodeUint8(uint8(m.Protocol)) + buf.EncodeUint16(uint16(m.Port)) + buf.EncodeUint32(uint32(m.Encap)) + buf.EncodeUint8(uint8(m.Dscp)) + buf.EncodeUint32(uint32(m.Type)) + buf.EncodeUint16(uint16(m.TargetPort)) + buf.EncodeUint16(uint16(m.NodePort)) + buf.EncodeUint32(uint32(m.NewFlowsTableLength)) + buf.EncodeBool(m.IsDel) + return buf.Bytes(), nil +} +func (m *LbAddDelVip) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Pfx.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Pfx.Len = buf.DecodeUint8() + m.Protocol = buf.DecodeUint8() + m.Port = buf.DecodeUint16() + m.Encap = lb_types.LbEncapType(buf.DecodeUint32()) + m.Dscp = buf.DecodeUint8() + m.Type = lb_types.LbSrvType(buf.DecodeUint32()) + m.TargetPort = buf.DecodeUint16() + m.NodePort = buf.DecodeUint16() + m.NewFlowsTableLength = buf.DecodeUint32() + m.IsDel = buf.DecodeBool() + return nil +} + +// LbAddDelVipReply defines message 'lb_add_del_vip_reply'. +type LbAddDelVipReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LbAddDelVipReply) Reset() { *m = LbAddDelVipReply{} } +func (*LbAddDelVipReply) GetMessageName() string { return "lb_add_del_vip_reply" } +func (*LbAddDelVipReply) GetCrcString() string { return "e8d4e804" } +func (*LbAddDelVipReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LbAddDelVipReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *LbAddDelVipReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *LbAddDelVipReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// LbAsDetails defines message 'lb_as_details'. +type LbAsDetails struct { + Vip lb_types.LbVip `binapi:"lb_vip,name=vip" json:"vip,omitempty"` + AppSrv ip_types.Address `binapi:"address,name=app_srv" json:"app_srv,omitempty"` + Flags uint8 `binapi:"u8,name=flags" json:"flags,omitempty"` + InUseSince uint32 `binapi:"u32,name=in_use_since" json:"in_use_since,omitempty"` +} + +func (m *LbAsDetails) Reset() { *m = LbAsDetails{} } +func (*LbAsDetails) GetMessageName() string { return "lb_as_details" } +func (*LbAsDetails) GetCrcString() string { return "9c39f60e" } +func (*LbAsDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LbAsDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Vip.Pfx.Address.Af + size += 1 * 16 // m.Vip.Pfx.Address.Un + size += 1 // m.Vip.Pfx.Len + size += 1 // m.Vip.Protocol + size += 2 // m.Vip.Port + size += 1 // m.AppSrv.Af + size += 1 * 16 // m.AppSrv.Un + size += 1 // m.Flags + size += 4 // m.InUseSince + return size +} +func (m *LbAsDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Vip.Pfx.Address.Af)) + buf.EncodeBytes(m.Vip.Pfx.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Vip.Pfx.Len)) + buf.EncodeUint8(uint8(m.Vip.Protocol)) + buf.EncodeUint16(uint16(m.Vip.Port)) + buf.EncodeUint8(uint8(m.AppSrv.Af)) + buf.EncodeBytes(m.AppSrv.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint32(uint32(m.InUseSince)) + return buf.Bytes(), nil +} +func (m *LbAsDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Vip.Pfx.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Vip.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Vip.Pfx.Len = buf.DecodeUint8() + m.Vip.Protocol = ip_types.IPProto(buf.DecodeUint8()) + m.Vip.Port = buf.DecodeUint16() + m.AppSrv.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.AppSrv.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Flags = buf.DecodeUint8() + m.InUseSince = buf.DecodeUint32() + return nil +} + +// LbAsDump defines message 'lb_as_dump'. +type LbAsDump struct { + Pfx ip_types.AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` +} + +func (m *LbAsDump) Reset() { *m = LbAsDump{} } +func (*LbAsDump) GetMessageName() string { return "lb_as_dump" } +func (*LbAsDump) GetCrcString() string { return "1063f819" } +func (*LbAsDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LbAsDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Pfx.Address.Af + size += 1 * 16 // m.Pfx.Address.Un + size += 1 // m.Pfx.Len + size += 1 // m.Protocol + size += 2 // m.Port + return size +} +func (m *LbAsDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Pfx.Address.Af)) + buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Pfx.Len)) + buf.EncodeUint8(uint8(m.Protocol)) + buf.EncodeUint16(uint16(m.Port)) + return buf.Bytes(), nil +} +func (m *LbAsDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Pfx.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Pfx.Len = buf.DecodeUint8() + m.Protocol = buf.DecodeUint8() + m.Port = buf.DecodeUint16() + return nil +} + +// LbConf defines message 'lb_conf'. +type LbConf struct { + IP4SrcAddress ip_types.IP4Address `binapi:"ip4_address,name=ip4_src_address" json:"ip4_src_address,omitempty"` + IP6SrcAddress ip_types.IP6Address `binapi:"ip6_address,name=ip6_src_address" json:"ip6_src_address,omitempty"` + StickyBucketsPerCore uint32 `binapi:"u32,name=sticky_buckets_per_core,default=%!s(float64=4.294967295e+09)" json:"sticky_buckets_per_core,omitempty"` + FlowTimeout uint32 `binapi:"u32,name=flow_timeout,default=%!s(float64=4.294967295e+09)" json:"flow_timeout,omitempty"` +} + +func (m *LbConf) Reset() { *m = LbConf{} } +func (*LbConf) GetMessageName() string { return "lb_conf" } +func (*LbConf) GetCrcString() string { return "22ddb739" } +func (*LbConf) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LbConf) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.IP4SrcAddress + size += 1 * 16 // m.IP6SrcAddress + size += 4 // m.StickyBucketsPerCore + size += 4 // m.FlowTimeout + return size +} +func (m *LbConf) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.IP4SrcAddress[:], 4) + buf.EncodeBytes(m.IP6SrcAddress[:], 16) + buf.EncodeUint32(uint32(m.StickyBucketsPerCore)) + buf.EncodeUint32(uint32(m.FlowTimeout)) + return buf.Bytes(), nil +} +func (m *LbConf) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IP4SrcAddress[:], buf.DecodeBytes(4)) + copy(m.IP6SrcAddress[:], buf.DecodeBytes(16)) + m.StickyBucketsPerCore = buf.DecodeUint32() + m.FlowTimeout = buf.DecodeUint32() + return nil +} + +// LbConfReply defines message 'lb_conf_reply'. +type LbConfReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LbConfReply) Reset() { *m = LbConfReply{} } +func (*LbConfReply) GetMessageName() string { return "lb_conf_reply" } +func (*LbConfReply) GetCrcString() string { return "e8d4e804" } +func (*LbConfReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LbConfReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *LbConfReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *LbConfReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// LbFlushVip defines message 'lb_flush_vip'. +type LbFlushVip struct { + Pfx ip_types.AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` +} + +func (m *LbFlushVip) Reset() { *m = LbFlushVip{} } +func (*LbFlushVip) GetMessageName() string { return "lb_flush_vip" } +func (*LbFlushVip) GetCrcString() string { return "1063f819" } +func (*LbFlushVip) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LbFlushVip) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Pfx.Address.Af + size += 1 * 16 // m.Pfx.Address.Un + size += 1 // m.Pfx.Len + size += 1 // m.Protocol + size += 2 // m.Port + return size +} +func (m *LbFlushVip) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Pfx.Address.Af)) + buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Pfx.Len)) + buf.EncodeUint8(uint8(m.Protocol)) + buf.EncodeUint16(uint16(m.Port)) + return buf.Bytes(), nil +} +func (m *LbFlushVip) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Pfx.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Pfx.Len = buf.DecodeUint8() + m.Protocol = buf.DecodeUint8() + m.Port = buf.DecodeUint16() + return nil +} + +// LbFlushVipReply defines message 'lb_flush_vip_reply'. +type LbFlushVipReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LbFlushVipReply) Reset() { *m = LbFlushVipReply{} } +func (*LbFlushVipReply) GetMessageName() string { return "lb_flush_vip_reply" } +func (*LbFlushVipReply) GetCrcString() string { return "e8d4e804" } +func (*LbFlushVipReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LbFlushVipReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *LbFlushVipReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *LbFlushVipReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// LbVipDetails defines message 'lb_vip_details'. +type LbVipDetails struct { + Vip lb_types.LbVip `binapi:"lb_vip,name=vip" json:"vip,omitempty"` + Encap lb_types.LbEncapType `binapi:"lb_encap_type,name=encap" json:"encap,omitempty"` + Dscp ip_types.IPDscp `binapi:"ip_dscp,name=dscp" json:"dscp,omitempty"` + SrvType lb_types.LbSrvType `binapi:"lb_srv_type,name=srv_type" json:"srv_type,omitempty"` + TargetPort uint16 `binapi:"u16,name=target_port" json:"target_port,omitempty"` + FlowTableLength uint16 `binapi:"u16,name=flow_table_length" json:"flow_table_length,omitempty"` +} + +func (m *LbVipDetails) Reset() { *m = LbVipDetails{} } +func (*LbVipDetails) GetMessageName() string { return "lb_vip_details" } +func (*LbVipDetails) GetCrcString() string { return "08f39bed" } +func (*LbVipDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LbVipDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Vip.Pfx.Address.Af + size += 1 * 16 // m.Vip.Pfx.Address.Un + size += 1 // m.Vip.Pfx.Len + size += 1 // m.Vip.Protocol + size += 2 // m.Vip.Port + size += 4 // m.Encap + size += 1 // m.Dscp + size += 4 // m.SrvType + size += 2 // m.TargetPort + size += 2 // m.FlowTableLength + return size +} +func (m *LbVipDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Vip.Pfx.Address.Af)) + buf.EncodeBytes(m.Vip.Pfx.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Vip.Pfx.Len)) + buf.EncodeUint8(uint8(m.Vip.Protocol)) + buf.EncodeUint16(uint16(m.Vip.Port)) + buf.EncodeUint32(uint32(m.Encap)) + buf.EncodeUint8(uint8(m.Dscp)) + buf.EncodeUint32(uint32(m.SrvType)) + buf.EncodeUint16(uint16(m.TargetPort)) + buf.EncodeUint16(uint16(m.FlowTableLength)) + return buf.Bytes(), nil +} +func (m *LbVipDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Vip.Pfx.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Vip.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Vip.Pfx.Len = buf.DecodeUint8() + m.Vip.Protocol = ip_types.IPProto(buf.DecodeUint8()) + m.Vip.Port = buf.DecodeUint16() + m.Encap = lb_types.LbEncapType(buf.DecodeUint32()) + m.Dscp = ip_types.IPDscp(buf.DecodeUint8()) + m.SrvType = lb_types.LbSrvType(buf.DecodeUint32()) + m.TargetPort = buf.DecodeUint16() + m.FlowTableLength = buf.DecodeUint16() + return nil +} + +// LbVipDump defines message 'lb_vip_dump'. +type LbVipDump struct { + Pfx ip_types.AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"` + PfxMatcher ip_types.PrefixMatcher `binapi:"prefix_matcher,name=pfx_matcher" json:"pfx_matcher,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol,default=%!s(float64=255)" json:"protocol,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` +} + +func (m *LbVipDump) Reset() { *m = LbVipDump{} } +func (*LbVipDump) GetMessageName() string { return "lb_vip_dump" } +func (*LbVipDump) GetCrcString() string { return "c7bcb124" } +func (*LbVipDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LbVipDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Pfx.Address.Af + size += 1 * 16 // m.Pfx.Address.Un + size += 1 // m.Pfx.Len + size += 1 // m.PfxMatcher.Le + size += 1 // m.PfxMatcher.Ge + size += 1 // m.Protocol + size += 2 // m.Port + return size +} +func (m *LbVipDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Pfx.Address.Af)) + buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Pfx.Len)) + buf.EncodeUint8(uint8(m.PfxMatcher.Le)) + buf.EncodeUint8(uint8(m.PfxMatcher.Ge)) + buf.EncodeUint8(uint8(m.Protocol)) + buf.EncodeUint16(uint16(m.Port)) + return buf.Bytes(), nil +} +func (m *LbVipDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Pfx.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Pfx.Len = buf.DecodeUint8() + m.PfxMatcher.Le = buf.DecodeUint8() + m.PfxMatcher.Ge = buf.DecodeUint8() + m.Protocol = buf.DecodeUint8() + m.Port = buf.DecodeUint16() + return nil +} + +func init() { file_lb_binapi_init() } +func file_lb_binapi_init() { + api.RegisterMessage((*LbAddDelAs)(nil), "lb_add_del_as_78628987") + api.RegisterMessage((*LbAddDelAsReply)(nil), "lb_add_del_as_reply_e8d4e804") + api.RegisterMessage((*LbAddDelIntfNat4)(nil), "lb_add_del_intf_nat4_47d6e753") + api.RegisterMessage((*LbAddDelIntfNat4Reply)(nil), "lb_add_del_intf_nat4_reply_e8d4e804") + api.RegisterMessage((*LbAddDelIntfNat6)(nil), "lb_add_del_intf_nat6_47d6e753") + api.RegisterMessage((*LbAddDelIntfNat6Reply)(nil), "lb_add_del_intf_nat6_reply_e8d4e804") + api.RegisterMessage((*LbAddDelVip)(nil), "lb_add_del_vip_d15b7ddc") + api.RegisterMessage((*LbAddDelVipReply)(nil), "lb_add_del_vip_reply_e8d4e804") + api.RegisterMessage((*LbAsDetails)(nil), "lb_as_details_9c39f60e") + api.RegisterMessage((*LbAsDump)(nil), "lb_as_dump_1063f819") + api.RegisterMessage((*LbConf)(nil), "lb_conf_22ddb739") + api.RegisterMessage((*LbConfReply)(nil), "lb_conf_reply_e8d4e804") + api.RegisterMessage((*LbFlushVip)(nil), "lb_flush_vip_1063f819") + api.RegisterMessage((*LbFlushVipReply)(nil), "lb_flush_vip_reply_e8d4e804") + api.RegisterMessage((*LbVipDetails)(nil), "lb_vip_details_08f39bed") + api.RegisterMessage((*LbVipDump)(nil), "lb_vip_dump_c7bcb124") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*LbAddDelAs)(nil), + (*LbAddDelAsReply)(nil), + (*LbAddDelIntfNat4)(nil), + (*LbAddDelIntfNat4Reply)(nil), + (*LbAddDelIntfNat6)(nil), + (*LbAddDelIntfNat6Reply)(nil), + (*LbAddDelVip)(nil), + (*LbAddDelVipReply)(nil), + (*LbAsDetails)(nil), + (*LbAsDump)(nil), + (*LbConf)(nil), + (*LbConfReply)(nil), + (*LbFlushVip)(nil), + (*LbFlushVipReply)(nil), + (*LbVipDetails)(nil), + (*LbVipDump)(nil), + } +} diff --git a/binapi/lb/lb_rest.ba.go b/binapi/lb/lb_rest.ba.go new file mode 100644 index 0000000..ea7fad8 --- /dev/null +++ b/binapi/lb/lb_rest.ba.go @@ -0,0 +1,152 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package lb + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/lb_add_del_as", func(w http.ResponseWriter, req *http.Request) { + var request = new(LbAddDelAs) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.LbAddDelAs(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/lb_add_del_intf_nat4", func(w http.ResponseWriter, req *http.Request) { + var request = new(LbAddDelIntfNat4) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.LbAddDelIntfNat4(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/lb_add_del_intf_nat6", func(w http.ResponseWriter, req *http.Request) { + var request = new(LbAddDelIntfNat6) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.LbAddDelIntfNat6(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/lb_add_del_vip", func(w http.ResponseWriter, req *http.Request) { + var request = new(LbAddDelVip) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.LbAddDelVip(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/lb_conf", func(w http.ResponseWriter, req *http.Request) { + var request = new(LbConf) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.LbConf(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/lb_flush_vip", func(w http.ResponseWriter, req *http.Request) { + var request = new(LbFlushVip) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.LbFlushVip(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/lb/lb_rpc.ba.go b/binapi/lb/lb_rpc.ba.go new file mode 100644 index 0000000..c28bb47 --- /dev/null +++ b/binapi/lb/lb_rpc.ba.go @@ -0,0 +1,163 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package lb + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service lb. +type RPCService interface { + LbAddDelAs(ctx context.Context, in *LbAddDelAs) (*LbAddDelAsReply, error) + LbAddDelIntfNat4(ctx context.Context, in *LbAddDelIntfNat4) (*LbAddDelIntfNat4Reply, error) + LbAddDelIntfNat6(ctx context.Context, in *LbAddDelIntfNat6) (*LbAddDelIntfNat6Reply, error) + LbAddDelVip(ctx context.Context, in *LbAddDelVip) (*LbAddDelVipReply, error) + LbAsDump(ctx context.Context, in *LbAsDump) (RPCService_LbAsDumpClient, error) + LbConf(ctx context.Context, in *LbConf) (*LbConfReply, error) + LbFlushVip(ctx context.Context, in *LbFlushVip) (*LbFlushVipReply, error) + LbVipDump(ctx context.Context, in *LbVipDump) (RPCService_LbVipDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) LbAddDelAs(ctx context.Context, in *LbAddDelAs) (*LbAddDelAsReply, error) { + out := new(LbAddDelAsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LbAddDelIntfNat4(ctx context.Context, in *LbAddDelIntfNat4) (*LbAddDelIntfNat4Reply, error) { + out := new(LbAddDelIntfNat4Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LbAddDelIntfNat6(ctx context.Context, in *LbAddDelIntfNat6) (*LbAddDelIntfNat6Reply, error) { + out := new(LbAddDelIntfNat6Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LbAddDelVip(ctx context.Context, in *LbAddDelVip) (*LbAddDelVipReply, error) { + out := new(LbAddDelVipReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LbAsDump(ctx context.Context, in *LbAsDump) (RPCService_LbAsDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_LbAsDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_LbAsDumpClient interface { + Recv() (*LbAsDetails, error) + api.Stream +} + +type serviceClient_LbAsDumpClient struct { + api.Stream +} + +func (c *serviceClient_LbAsDumpClient) Recv() (*LbAsDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *LbAsDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) LbConf(ctx context.Context, in *LbConf) (*LbConfReply, error) { + out := new(LbConfReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LbFlushVip(ctx context.Context, in *LbFlushVip) (*LbFlushVipReply, error) { + out := new(LbFlushVipReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LbVipDump(ctx context.Context, in *LbVipDump) (RPCService_LbVipDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_LbVipDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_LbVipDumpClient interface { + Recv() (*LbVipDetails, error) + api.Stream +} + +type serviceClient_LbVipDumpClient struct { + api.Stream +} + +func (c *serviceClient_LbVipDumpClient) Recv() (*LbVipDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *LbVipDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/lb_types/lb_types.ba.go b/binapi/lb_types/lb_types.ba.go new file mode 100644 index 0000000..209b07e --- /dev/null +++ b/binapi/lb_types/lb_types.ba.go @@ -0,0 +1,209 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/lb_types.api.json + +// Package lb_types contains generated bindings for API file lb_types.api. +// +// Contents: +// 5 enums +// 1 struct +// +package lb_types + +import ( + api "git.fd.io/govpp.git/api" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +// LbEncapType defines enum 'lb_encap_type'. +type LbEncapType uint32 + +const ( + LB_API_ENCAP_TYPE_GRE4 LbEncapType = 0 + LB_API_ENCAP_TYPE_GRE6 LbEncapType = 1 + LB_API_ENCAP_TYPE_L3DSR LbEncapType = 2 + LB_API_ENCAP_TYPE_NAT4 LbEncapType = 3 + LB_API_ENCAP_TYPE_NAT6 LbEncapType = 4 + LB_API_ENCAP_N_TYPES LbEncapType = 5 +) + +var ( + LbEncapType_name = map[uint32]string{ + 0: "LB_API_ENCAP_TYPE_GRE4", + 1: "LB_API_ENCAP_TYPE_GRE6", + 2: "LB_API_ENCAP_TYPE_L3DSR", + 3: "LB_API_ENCAP_TYPE_NAT4", + 4: "LB_API_ENCAP_TYPE_NAT6", + 5: "LB_API_ENCAP_N_TYPES", + } + LbEncapType_value = map[string]uint32{ + "LB_API_ENCAP_TYPE_GRE4": 0, + "LB_API_ENCAP_TYPE_GRE6": 1, + "LB_API_ENCAP_TYPE_L3DSR": 2, + "LB_API_ENCAP_TYPE_NAT4": 3, + "LB_API_ENCAP_TYPE_NAT6": 4, + "LB_API_ENCAP_N_TYPES": 5, + } +) + +func (x LbEncapType) String() string { + s, ok := LbEncapType_name[uint32(x)] + if ok { + return s + } + return "LbEncapType(" + strconv.Itoa(int(x)) + ")" +} + +// LbLkpTypeT defines enum 'lb_lkp_type_t'. +type LbLkpTypeT uint32 + +const ( + LB_API_LKP_SAME_IP_PORT LbLkpTypeT = 0 + LB_API_LKP_DIFF_IP_PORT LbLkpTypeT = 1 + LB_API_LKP_ALL_PORT_IP LbLkpTypeT = 2 + LB_API_LKP_N_TYPES LbLkpTypeT = 3 +) + +var ( + LbLkpTypeT_name = map[uint32]string{ + 0: "LB_API_LKP_SAME_IP_PORT", + 1: "LB_API_LKP_DIFF_IP_PORT", + 2: "LB_API_LKP_ALL_PORT_IP", + 3: "LB_API_LKP_N_TYPES", + } + LbLkpTypeT_value = map[string]uint32{ + "LB_API_LKP_SAME_IP_PORT": 0, + "LB_API_LKP_DIFF_IP_PORT": 1, + "LB_API_LKP_ALL_PORT_IP": 2, + "LB_API_LKP_N_TYPES": 3, + } +) + +func (x LbLkpTypeT) String() string { + s, ok := LbLkpTypeT_name[uint32(x)] + if ok { + return s + } + return "LbLkpTypeT(" + strconv.Itoa(int(x)) + ")" +} + +// LbNatProtocol defines enum 'lb_nat_protocol'. +type LbNatProtocol uint32 + +const ( + LB_API_NAT_PROTOCOL_UDP LbNatProtocol = 6 + LB_API_NAT_PROTOCOL_TCP LbNatProtocol = 23 + LB_API_NAT_PROTOCOL_ANY LbNatProtocol = 4294967295 +) + +var ( + LbNatProtocol_name = map[uint32]string{ + 6: "LB_API_NAT_PROTOCOL_UDP", + 23: "LB_API_NAT_PROTOCOL_TCP", + 4294967295: "LB_API_NAT_PROTOCOL_ANY", + } + LbNatProtocol_value = map[string]uint32{ + "LB_API_NAT_PROTOCOL_UDP": 6, + "LB_API_NAT_PROTOCOL_TCP": 23, + "LB_API_NAT_PROTOCOL_ANY": 4294967295, + } +) + +func (x LbNatProtocol) String() string { + s, ok := LbNatProtocol_name[uint32(x)] + if ok { + return s + } + return "LbNatProtocol(" + strconv.Itoa(int(x)) + ")" +} + +// LbSrvType defines enum 'lb_srv_type'. +type LbSrvType uint32 + +const ( + LB_API_SRV_TYPE_CLUSTERIP LbSrvType = 0 + LB_API_SRV_TYPE_NODEPORT LbSrvType = 1 + LB_API_SRV_N_TYPES LbSrvType = 2 +) + +var ( + LbSrvType_name = map[uint32]string{ + 0: "LB_API_SRV_TYPE_CLUSTERIP", + 1: "LB_API_SRV_TYPE_NODEPORT", + 2: "LB_API_SRV_N_TYPES", + } + LbSrvType_value = map[string]uint32{ + "LB_API_SRV_TYPE_CLUSTERIP": 0, + "LB_API_SRV_TYPE_NODEPORT": 1, + "LB_API_SRV_N_TYPES": 2, + } +) + +func (x LbSrvType) String() string { + s, ok := LbSrvType_name[uint32(x)] + if ok { + return s + } + return "LbSrvType(" + strconv.Itoa(int(x)) + ")" +} + +// LbVipType defines enum 'lb_vip_type'. +type LbVipType uint32 + +const ( + LB_API_VIP_TYPE_IP6_GRE6 LbVipType = 0 + LB_API_VIP_TYPE_IP6_GRE4 LbVipType = 1 + LB_API_VIP_TYPE_IP4_GRE6 LbVipType = 2 + LB_API_VIP_TYPE_IP4_GRE4 LbVipType = 3 + LB_API_VIP_TYPE_IP4_L3DSR LbVipType = 4 + LB_API_VIP_TYPE_IP4_NAT4 LbVipType = 5 + LB_API_VIP_TYPE_IP6_NAT6 LbVipType = 6 + LB_API_VIP_N_TYPES LbVipType = 7 +) + +var ( + LbVipType_name = map[uint32]string{ + 0: "LB_API_VIP_TYPE_IP6_GRE6", + 1: "LB_API_VIP_TYPE_IP6_GRE4", + 2: "LB_API_VIP_TYPE_IP4_GRE6", + 3: "LB_API_VIP_TYPE_IP4_GRE4", + 4: "LB_API_VIP_TYPE_IP4_L3DSR", + 5: "LB_API_VIP_TYPE_IP4_NAT4", + 6: "LB_API_VIP_TYPE_IP6_NAT6", + 7: "LB_API_VIP_N_TYPES", + } + LbVipType_value = map[string]uint32{ + "LB_API_VIP_TYPE_IP6_GRE6": 0, + "LB_API_VIP_TYPE_IP6_GRE4": 1, + "LB_API_VIP_TYPE_IP4_GRE6": 2, + "LB_API_VIP_TYPE_IP4_GRE4": 3, + "LB_API_VIP_TYPE_IP4_L3DSR": 4, + "LB_API_VIP_TYPE_IP4_NAT4": 5, + "LB_API_VIP_TYPE_IP6_NAT6": 6, + "LB_API_VIP_N_TYPES": 7, + } +) + +func (x LbVipType) String() string { + s, ok := LbVipType_name[uint32(x)] + if ok { + return s + } + return "LbVipType(" + strconv.Itoa(int(x)) + ")" +} + +// LbVip defines type 'lb_vip'. +type LbVip struct { + Pfx ip_types.AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"` + Protocol ip_types.IPProto `binapi:"ip_proto,name=protocol" json:"protocol,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` +} diff --git a/binapi/lisp/lisp.ba.go b/binapi/lisp/lisp.ba.go new file mode 100644 index 0000000..a152648 --- /dev/null +++ b/binapi/lisp/lisp.ba.go @@ -0,0 +1,2701 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/lisp.api.json + +// Package lisp contains generated bindings for API file lisp.api. +// +// Contents: +// 1 enum +// 1 struct +// 60 messages +// +package lisp + +import ( + api "git.fd.io/govpp.git/api" + _ "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + lisp_types "git.fd.io/govpp.git/binapi/lisp_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "lisp" + APIVersion = "2.0.0" + VersionCrc = 0xf2d169ad +) + +// LispLocatorSetFilter defines enum 'lisp_locator_set_filter'. +type LispLocatorSetFilter uint8 + +const ( + LISP_LOCATOR_SET_FILTER_API_ALL LispLocatorSetFilter = 0 + LISP_LOCATOR_SET_FILTER_API_LOCAL LispLocatorSetFilter = 1 + LISP_LOCATOR_SET_FILTER_API_REMOTE LispLocatorSetFilter = 2 +) + +var ( + LispLocatorSetFilter_name = map[uint8]string{ + 0: "LISP_LOCATOR_SET_FILTER_API_ALL", + 1: "LISP_LOCATOR_SET_FILTER_API_LOCAL", + 2: "LISP_LOCATOR_SET_FILTER_API_REMOTE", + } + LispLocatorSetFilter_value = map[string]uint8{ + "LISP_LOCATOR_SET_FILTER_API_ALL": 0, + "LISP_LOCATOR_SET_FILTER_API_LOCAL": 1, + "LISP_LOCATOR_SET_FILTER_API_REMOTE": 2, + } +) + +func (x LispLocatorSetFilter) String() string { + s, ok := LispLocatorSetFilter_name[uint8(x)] + if ok { + return s + } + return "LispLocatorSetFilter(" + strconv.Itoa(int(x)) + ")" +} + +// LispAdjacency defines type 'lisp_adjacency'. +type LispAdjacency struct { + Reid lisp_types.Eid `binapi:"eid,name=reid" json:"reid,omitempty"` + Leid lisp_types.Eid `binapi:"eid,name=leid" json:"leid,omitempty"` +} + +// LispAddDelAdjacency defines message 'lisp_add_del_adjacency'. +type LispAddDelAdjacency struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + Reid lisp_types.Eid `binapi:"eid,name=reid" json:"reid,omitempty"` + Leid lisp_types.Eid `binapi:"eid,name=leid" json:"leid,omitempty"` +} + +func (m *LispAddDelAdjacency) Reset() { *m = LispAddDelAdjacency{} } +func (*LispAddDelAdjacency) GetMessageName() string { return "lisp_add_del_adjacency" } +func (*LispAddDelAdjacency) GetCrcString() string { return "cf5edb61" } +func (*LispAddDelAdjacency) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispAddDelAdjacency) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Vni + size += 1 // m.Reid.Type + size += 1 * 6 // m.Reid.Address + size += 1 // m.Leid.Type + size += 1 * 6 // m.Leid.Address + return size +} +func (m *LispAddDelAdjacency) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Vni)) + buf.EncodeUint8(uint8(m.Reid.Type)) + buf.EncodeBytes(m.Reid.Address.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Leid.Type)) + buf.EncodeBytes(m.Leid.Address.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *LispAddDelAdjacency) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Vni = buf.DecodeUint32() + m.Reid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Reid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + m.Leid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Leid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + return nil +} + +// LispAddDelAdjacencyReply defines message 'lisp_add_del_adjacency_reply'. +type LispAddDelAdjacencyReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LispAddDelAdjacencyReply) Reset() { *m = LispAddDelAdjacencyReply{} } +func (*LispAddDelAdjacencyReply) GetMessageName() string { return "lisp_add_del_adjacency_reply" } +func (*LispAddDelAdjacencyReply) GetCrcString() string { return "e8d4e804" } +func (*LispAddDelAdjacencyReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispAddDelAdjacencyReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *LispAddDelAdjacencyReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *LispAddDelAdjacencyReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// LispAddDelLocalEid defines message 'lisp_add_del_local_eid'. +type LispAddDelLocalEid struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Eid lisp_types.Eid `binapi:"eid,name=eid" json:"eid,omitempty"` + LocatorSetName string `binapi:"string[64],name=locator_set_name" json:"locator_set_name,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + Key lisp_types.HmacKey `binapi:"hmac_key,name=key" json:"key,omitempty"` +} + +func (m *LispAddDelLocalEid) Reset() { *m = LispAddDelLocalEid{} } +func (*LispAddDelLocalEid) GetMessageName() string { return "lisp_add_del_local_eid" } +func (*LispAddDelLocalEid) GetCrcString() string { return "21f573bd" } +func (*LispAddDelLocalEid) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispAddDelLocalEid) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.Eid.Type + size += 1 * 6 // m.Eid.Address + size += 64 // m.LocatorSetName + size += 4 // m.Vni + size += 1 // m.Key.ID + size += 1 * 64 // m.Key.Key + return size +} +func (m *LispAddDelLocalEid) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.Eid.Type)) + buf.EncodeBytes(m.Eid.Address.XXX_UnionData[:], 0) + buf.EncodeString(m.LocatorSetName, 64) + buf.EncodeUint32(uint32(m.Vni)) + buf.EncodeUint8(uint8(m.Key.ID)) + buf.EncodeBytes(m.Key.Key[:], 64) + return buf.Bytes(), nil +} +func (m *LispAddDelLocalEid) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Eid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Eid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + m.LocatorSetName = buf.DecodeString(64) + m.Vni = buf.DecodeUint32() + m.Key.ID = lisp_types.HmacKeyID(buf.DecodeUint8()) + copy(m.Key.Key[:], buf.DecodeBytes(64)) + return nil +} + +// LispAddDelLocalEidReply defines message 'lisp_add_del_local_eid_reply'. +type LispAddDelLocalEidReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LispAddDelLocalEidReply) Reset() { *m = LispAddDelLocalEidReply{} } +func (*LispAddDelLocalEidReply) GetMessageName() string { return "lisp_add_del_local_eid_reply" } +func (*LispAddDelLocalEidReply) GetCrcString() string { return "e8d4e804" } +func (*LispAddDelLocalEidReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispAddDelLocalEidReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *LispAddDelLocalEidReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *LispAddDelLocalEidReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// LispAddDelLocator defines message 'lisp_add_del_locator'. +type LispAddDelLocator struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + LocatorSetName string `binapi:"string[64],name=locator_set_name" json:"locator_set_name,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Priority uint8 `binapi:"u8,name=priority" json:"priority,omitempty"` + Weight uint8 `binapi:"u8,name=weight" json:"weight,omitempty"` +} + +func (m *LispAddDelLocator) Reset() { *m = LispAddDelLocator{} } +func (*LispAddDelLocator) GetMessageName() string { return "lisp_add_del_locator" } +func (*LispAddDelLocator) GetCrcString() string { return "af4d8f13" } +func (*LispAddDelLocator) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispAddDelLocator) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 64 // m.LocatorSetName + size += 4 // m.SwIfIndex + size += 1 // m.Priority + size += 1 // m.Weight + return size +} +func (m *LispAddDelLocator) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeString(m.LocatorSetName, 64) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.Priority)) + buf.EncodeUint8(uint8(m.Weight)) + return buf.Bytes(), nil +} +func (m *LispAddDelLocator) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.LocatorSetName = buf.DecodeString(64) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Priority = buf.DecodeUint8() + m.Weight = buf.DecodeUint8() + return nil +} + +// LispAddDelLocatorReply defines message 'lisp_add_del_locator_reply'. +type LispAddDelLocatorReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LispAddDelLocatorReply) Reset() { *m = LispAddDelLocatorReply{} } +func (*LispAddDelLocatorReply) GetMessageName() string { return "lisp_add_del_locator_reply" } +func (*LispAddDelLocatorReply) GetCrcString() string { return "e8d4e804" } +func (*LispAddDelLocatorReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispAddDelLocatorReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *LispAddDelLocatorReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *LispAddDelLocatorReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// LispAddDelLocatorSet defines message 'lisp_add_del_locator_set'. +type LispAddDelLocatorSet struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + LocatorSetName string `binapi:"string[64],name=locator_set_name" json:"locator_set_name,omitempty"` + LocatorNum uint32 `binapi:"u32,name=locator_num" json:"-"` + Locators []lisp_types.LocalLocator `binapi:"local_locator[locator_num],name=locators" json:"locators,omitempty"` +} + +func (m *LispAddDelLocatorSet) Reset() { *m = LispAddDelLocatorSet{} } +func (*LispAddDelLocatorSet) GetMessageName() string { return "lisp_add_del_locator_set" } +func (*LispAddDelLocatorSet) GetCrcString() string { return "6fcd6471" } +func (*LispAddDelLocatorSet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispAddDelLocatorSet) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 64 // m.LocatorSetName + size += 4 // m.LocatorNum + for j1 := 0; j1 < len(m.Locators); j1++ { + var s1 lisp_types.LocalLocator + _ = s1 + if j1 < len(m.Locators) { + s1 = m.Locators[j1] + } + size += 4 // s1.SwIfIndex + size += 1 // s1.Priority + size += 1 // s1.Weight + } + return size +} +func (m *LispAddDelLocatorSet) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeString(m.LocatorSetName, 64) + buf.EncodeUint32(uint32(len(m.Locators))) + for j0 := 0; j0 < len(m.Locators); j0++ { + var v0 lisp_types.LocalLocator + if j0 < len(m.Locators) { + v0 = m.Locators[j0] + } + buf.EncodeUint32(uint32(v0.SwIfIndex)) + buf.EncodeUint8(uint8(v0.Priority)) + buf.EncodeUint8(uint8(v0.Weight)) + } + return buf.Bytes(), nil +} +func (m *LispAddDelLocatorSet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.LocatorSetName = buf.DecodeString(64) + m.LocatorNum = buf.DecodeUint32() + m.Locators = make([]lisp_types.LocalLocator, int(m.LocatorNum)) + for j0 := 0; j0 < len(m.Locators); j0++ { + m.Locators[j0].SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Locators[j0].Priority = buf.DecodeUint8() + m.Locators[j0].Weight = buf.DecodeUint8() + } + return nil +} + +// LispAddDelLocatorSetReply defines message 'lisp_add_del_locator_set_reply'. +type LispAddDelLocatorSetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + LsIndex uint32 `binapi:"u32,name=ls_index" json:"ls_index,omitempty"` +} + +func (m *LispAddDelLocatorSetReply) Reset() { *m = LispAddDelLocatorSetReply{} } +func (*LispAddDelLocatorSetReply) GetMessageName() string { return "lisp_add_del_locator_set_reply" } +func (*LispAddDelLocatorSetReply) GetCrcString() string { return "b6666db4" } +func (*LispAddDelLocatorSetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispAddDelLocatorSetReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.LsIndex + return size +} +func (m *LispAddDelLocatorSetReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.LsIndex)) + return buf.Bytes(), nil +} +func (m *LispAddDelLocatorSetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.LsIndex = buf.DecodeUint32() + return nil +} + +// LispAddDelMapRequestItrRlocs defines message 'lisp_add_del_map_request_itr_rlocs'. +type LispAddDelMapRequestItrRlocs struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + LocatorSetName string `binapi:"string[64],name=locator_set_name" json:"locator_set_name,omitempty"` +} + +func (m *LispAddDelMapRequestItrRlocs) Reset() { *m = LispAddDelMapRequestItrRlocs{} } +func (*LispAddDelMapRequestItrRlocs) GetMessageName() string { + return "lisp_add_del_map_request_itr_rlocs" +} +func (*LispAddDelMapRequestItrRlocs) GetCrcString() string { return "6be88e45" } +func (*LispAddDelMapRequestItrRlocs) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispAddDelMapRequestItrRlocs) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 64 // m.LocatorSetName + return size +} +func (m *LispAddDelMapRequestItrRlocs) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeString(m.LocatorSetName, 64) + return buf.Bytes(), nil +} +func (m *LispAddDelMapRequestItrRlocs) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.LocatorSetName = buf.DecodeString(64) + return nil +} + +// LispAddDelMapRequestItrRlocsReply defines message 'lisp_add_del_map_request_itr_rlocs_reply'. +type LispAddDelMapRequestItrRlocsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LispAddDelMapRequestItrRlocsReply) Reset() { *m = LispAddDelMapRequestItrRlocsReply{} } +func (*LispAddDelMapRequestItrRlocsReply) GetMessageName() string { + return "lisp_add_del_map_request_itr_rlocs_reply" +} +func (*LispAddDelMapRequestItrRlocsReply) GetCrcString() string { return "e8d4e804" } +func (*LispAddDelMapRequestItrRlocsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispAddDelMapRequestItrRlocsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *LispAddDelMapRequestItrRlocsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *LispAddDelMapRequestItrRlocsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// LispAddDelMapResolver defines message 'lisp_add_del_map_resolver'. +type LispAddDelMapResolver struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"` +} + +func (m *LispAddDelMapResolver) Reset() { *m = LispAddDelMapResolver{} } +func (*LispAddDelMapResolver) GetMessageName() string { return "lisp_add_del_map_resolver" } +func (*LispAddDelMapResolver) GetCrcString() string { return "6598ea7c" } +func (*LispAddDelMapResolver) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispAddDelMapResolver) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.IPAddress.Af + size += 1 * 16 // m.IPAddress.Un + return size +} +func (m *LispAddDelMapResolver) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.IPAddress.Af)) + buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *LispAddDelMapResolver) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// LispAddDelMapResolverReply defines message 'lisp_add_del_map_resolver_reply'. +type LispAddDelMapResolverReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LispAddDelMapResolverReply) Reset() { *m = LispAddDelMapResolverReply{} } +func (*LispAddDelMapResolverReply) GetMessageName() string { return "lisp_add_del_map_resolver_reply" } +func (*LispAddDelMapResolverReply) GetCrcString() string { return "e8d4e804" } +func (*LispAddDelMapResolverReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispAddDelMapResolverReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *LispAddDelMapResolverReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *LispAddDelMapResolverReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// LispAddDelMapServer defines message 'lisp_add_del_map_server'. +type LispAddDelMapServer struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"` +} + +func (m *LispAddDelMapServer) Reset() { *m = LispAddDelMapServer{} } +func (*LispAddDelMapServer) GetMessageName() string { return "lisp_add_del_map_server" } +func (*LispAddDelMapServer) GetCrcString() string { return "6598ea7c" } +func (*LispAddDelMapServer) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispAddDelMapServer) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.IPAddress.Af + size += 1 * 16 // m.IPAddress.Un + return size +} +func (m *LispAddDelMapServer) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.IPAddress.Af)) + buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *LispAddDelMapServer) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// LispAddDelMapServerReply defines message 'lisp_add_del_map_server_reply'. +type LispAddDelMapServerReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LispAddDelMapServerReply) Reset() { *m = LispAddDelMapServerReply{} } +func (*LispAddDelMapServerReply) GetMessageName() string { return "lisp_add_del_map_server_reply" } +func (*LispAddDelMapServerReply) GetCrcString() string { return "e8d4e804" } +func (*LispAddDelMapServerReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispAddDelMapServerReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *LispAddDelMapServerReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *LispAddDelMapServerReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// LispAddDelRemoteMapping defines message 'lisp_add_del_remote_mapping'. +type LispAddDelRemoteMapping struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IsSrcDst bool `binapi:"bool,name=is_src_dst" json:"is_src_dst,omitempty"` + DelAll bool `binapi:"bool,name=del_all" json:"del_all,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + Action uint8 `binapi:"u8,name=action" json:"action,omitempty"` + Deid lisp_types.Eid `binapi:"eid,name=deid" json:"deid,omitempty"` + Seid lisp_types.Eid `binapi:"eid,name=seid" json:"seid,omitempty"` + RlocNum uint32 `binapi:"u32,name=rloc_num" json:"-"` + Rlocs []lisp_types.RemoteLocator `binapi:"remote_locator[rloc_num],name=rlocs" json:"rlocs,omitempty"` +} + +func (m *LispAddDelRemoteMapping) Reset() { *m = LispAddDelRemoteMapping{} } +func (*LispAddDelRemoteMapping) GetMessageName() string { return "lisp_add_del_remote_mapping" } +func (*LispAddDelRemoteMapping) GetCrcString() string { return "fae8ed77" } +func (*LispAddDelRemoteMapping) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispAddDelRemoteMapping) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.IsSrcDst + size += 1 // m.DelAll + size += 4 // m.Vni + size += 1 // m.Action + size += 1 // m.Deid.Type + size += 1 * 6 // m.Deid.Address + size += 1 // m.Seid.Type + size += 1 * 6 // m.Seid.Address + size += 4 // m.RlocNum + for j1 := 0; j1 < len(m.Rlocs); j1++ { + var s1 lisp_types.RemoteLocator + _ = s1 + if j1 < len(m.Rlocs) { + s1 = m.Rlocs[j1] + } + size += 1 // s1.Priority + size += 1 // s1.Weight + size += 1 // s1.IPAddress.Af + size += 1 * 16 // s1.IPAddress.Un + } + return size +} +func (m *LispAddDelRemoteMapping) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeBool(m.IsSrcDst) + buf.EncodeBool(m.DelAll) + buf.EncodeUint32(uint32(m.Vni)) + buf.EncodeUint8(uint8(m.Action)) + buf.EncodeUint8(uint8(m.Deid.Type)) + buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Seid.Type)) + buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(len(m.Rlocs))) + for j0 := 0; j0 < len(m.Rlocs); j0++ { + var v0 lisp_types.RemoteLocator + if j0 < len(m.Rlocs) { + v0 = m.Rlocs[j0] + } + buf.EncodeUint8(uint8(v0.Priority)) + buf.EncodeUint8(uint8(v0.Weight)) + buf.EncodeUint8(uint8(v0.IPAddress.Af)) + buf.EncodeBytes(v0.IPAddress.Un.XXX_UnionData[:], 0) + } + return buf.Bytes(), nil +} +func (m *LispAddDelRemoteMapping) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.IsSrcDst = buf.DecodeBool() + m.DelAll = buf.DecodeBool() + m.Vni = buf.DecodeUint32() + m.Action = buf.DecodeUint8() + m.Deid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Deid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + m.Seid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Seid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + m.RlocNum = buf.DecodeUint32() + m.Rlocs = make([]lisp_types.RemoteLocator, int(m.RlocNum)) + for j0 := 0; j0 < len(m.Rlocs); j0++ { + m.Rlocs[j0].Priority = buf.DecodeUint8() + m.Rlocs[j0].Weight = buf.DecodeUint8() + m.Rlocs[j0].IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Rlocs[j0].IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + } + return nil +} + +// LispAddDelRemoteMappingReply defines message 'lisp_add_del_remote_mapping_reply'. +type LispAddDelRemoteMappingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LispAddDelRemoteMappingReply) Reset() { *m = LispAddDelRemoteMappingReply{} } +func (*LispAddDelRemoteMappingReply) GetMessageName() string { + return "lisp_add_del_remote_mapping_reply" +} +func (*LispAddDelRemoteMappingReply) GetCrcString() string { return "e8d4e804" } +func (*LispAddDelRemoteMappingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispAddDelRemoteMappingReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *LispAddDelRemoteMappingReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *LispAddDelRemoteMappingReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// LispAdjacenciesGet defines message 'lisp_adjacencies_get'. +type LispAdjacenciesGet struct { + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` +} + +func (m *LispAdjacenciesGet) Reset() { *m = LispAdjacenciesGet{} } +func (*LispAdjacenciesGet) GetMessageName() string { return "lisp_adjacencies_get" } +func (*LispAdjacenciesGet) GetCrcString() string { return "8d1f2fe9" } +func (*LispAdjacenciesGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispAdjacenciesGet) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Vni + return size +} +func (m *LispAdjacenciesGet) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Vni)) + return buf.Bytes(), nil +} +func (m *LispAdjacenciesGet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Vni = buf.DecodeUint32() + return nil +} + +// LispAdjacenciesGetReply defines message 'lisp_adjacencies_get_reply'. +type LispAdjacenciesGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + Adjacencies []LispAdjacency `binapi:"lisp_adjacency[count],name=adjacencies" json:"adjacencies,omitempty"` +} + +func (m *LispAdjacenciesGetReply) Reset() { *m = LispAdjacenciesGetReply{} } +func (*LispAdjacenciesGetReply) GetMessageName() string { return "lisp_adjacencies_get_reply" } +func (*LispAdjacenciesGetReply) GetCrcString() string { return "3f97bcdd" } +func (*LispAdjacenciesGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispAdjacenciesGetReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.Count + for j1 := 0; j1 < len(m.Adjacencies); j1++ { + var s1 LispAdjacency + _ = s1 + if j1 < len(m.Adjacencies) { + s1 = m.Adjacencies[j1] + } + size += 1 // s1.Reid.Type + size += 1 * 6 // s1.Reid.Address + size += 1 // s1.Leid.Type + size += 1 * 6 // s1.Leid.Address + } + return size +} +func (m *LispAdjacenciesGetReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(len(m.Adjacencies))) + for j0 := 0; j0 < len(m.Adjacencies); j0++ { + var v0 LispAdjacency + if j0 < len(m.Adjacencies) { + v0 = m.Adjacencies[j0] + } + buf.EncodeUint8(uint8(v0.Reid.Type)) + buf.EncodeBytes(v0.Reid.Address.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(v0.Leid.Type)) + buf.EncodeBytes(v0.Leid.Address.XXX_UnionData[:], 0) + } + return buf.Bytes(), nil +} +func (m *LispAdjacenciesGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Count = buf.DecodeUint32() + m.Adjacencies = make([]LispAdjacency, int(m.Count)) + for j0 := 0; j0 < len(m.Adjacencies); j0++ { + m.Adjacencies[j0].Reid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Adjacencies[j0].Reid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + m.Adjacencies[j0].Leid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Adjacencies[j0].Leid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + } + return nil +} + +// LispEidTableAddDelMap defines message 'lisp_eid_table_add_del_map'. +type LispEidTableAddDelMap struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + DpTable uint32 `binapi:"u32,name=dp_table" json:"dp_table,omitempty"` + IsL2 bool `binapi:"bool,name=is_l2" json:"is_l2,omitempty"` +} + +func (m *LispEidTableAddDelMap) Reset() { *m = LispEidTableAddDelMap{} } +func (*LispEidTableAddDelMap) GetMessageName() string { return "lisp_eid_table_add_del_map" } +func (*LispEidTableAddDelMap) GetCrcString() string { return "9481416b" } +func (*LispEidTableAddDelMap) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispEidTableAddDelMap) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Vni + size += 4 // m.DpTable + size += 1 // m.IsL2 + return size +} +func (m *LispEidTableAddDelMap) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Vni)) + buf.EncodeUint32(uint32(m.DpTable)) + buf.EncodeBool(m.IsL2) + return buf.Bytes(), nil +} +func (m *LispEidTableAddDelMap) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Vni = buf.DecodeUint32() + m.DpTable = buf.DecodeUint32() + m.IsL2 = buf.DecodeBool() + return nil +} + +// LispEidTableAddDelMapReply defines message 'lisp_eid_table_add_del_map_reply'. +type LispEidTableAddDelMapReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LispEidTableAddDelMapReply) Reset() { *m = LispEidTableAddDelMapReply{} } +func (*LispEidTableAddDelMapReply) GetMessageName() string { return "lisp_eid_table_add_del_map_reply" } +func (*LispEidTableAddDelMapReply) GetCrcString() string { return "e8d4e804" } +func (*LispEidTableAddDelMapReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispEidTableAddDelMapReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *LispEidTableAddDelMapReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *LispEidTableAddDelMapReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// LispEidTableDetails defines message 'lisp_eid_table_details'. +type LispEidTableDetails struct { + LocatorSetIndex uint32 `binapi:"u32,name=locator_set_index" json:"locator_set_index,omitempty"` + Action uint8 `binapi:"u8,name=action" json:"action,omitempty"` + IsLocal bool `binapi:"bool,name=is_local" json:"is_local,omitempty"` + IsSrcDst bool `binapi:"bool,name=is_src_dst" json:"is_src_dst,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + Deid lisp_types.Eid `binapi:"eid,name=deid" json:"deid,omitempty"` + Seid lisp_types.Eid `binapi:"eid,name=seid" json:"seid,omitempty"` + TTL uint32 `binapi:"u32,name=ttl" json:"ttl,omitempty"` + Authoritative uint8 `binapi:"u8,name=authoritative" json:"authoritative,omitempty"` + Key lisp_types.HmacKey `binapi:"hmac_key,name=key" json:"key,omitempty"` +} + +func (m *LispEidTableDetails) Reset() { *m = LispEidTableDetails{} } +func (*LispEidTableDetails) GetMessageName() string { return "lisp_eid_table_details" } +func (*LispEidTableDetails) GetCrcString() string { return "4bc32e3a" } +func (*LispEidTableDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispEidTableDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.LocatorSetIndex + size += 1 // m.Action + size += 1 // m.IsLocal + size += 1 // m.IsSrcDst + size += 4 // m.Vni + size += 1 // m.Deid.Type + size += 1 * 6 // m.Deid.Address + size += 1 // m.Seid.Type + size += 1 * 6 // m.Seid.Address + size += 4 // m.TTL + size += 1 // m.Authoritative + size += 1 // m.Key.ID + size += 1 * 64 // m.Key.Key + return size +} +func (m *LispEidTableDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.LocatorSetIndex)) + buf.EncodeUint8(uint8(m.Action)) + buf.EncodeBool(m.IsLocal) + buf.EncodeBool(m.IsSrcDst) + buf.EncodeUint32(uint32(m.Vni)) + buf.EncodeUint8(uint8(m.Deid.Type)) + buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Seid.Type)) + buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.TTL)) + buf.EncodeUint8(uint8(m.Authoritative)) + buf.EncodeUint8(uint8(m.Key.ID)) + buf.EncodeBytes(m.Key.Key[:], 64) + return buf.Bytes(), nil +} +func (m *LispEidTableDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.LocatorSetIndex = buf.DecodeUint32() + m.Action = buf.DecodeUint8() + m.IsLocal = buf.DecodeBool() + m.IsSrcDst = buf.DecodeBool() + m.Vni = buf.DecodeUint32() + m.Deid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Deid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + m.Seid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Seid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + m.TTL = buf.DecodeUint32() + m.Authoritative = buf.DecodeUint8() + m.Key.ID = lisp_types.HmacKeyID(buf.DecodeUint8()) + copy(m.Key.Key[:], buf.DecodeBytes(64)) + return nil +} + +// LispEidTableDump defines message 'lisp_eid_table_dump'. +type LispEidTableDump struct { + EidSet uint8 `binapi:"u8,name=eid_set" json:"eid_set,omitempty"` + PrefixLength uint8 `binapi:"u8,name=prefix_length" json:"prefix_length,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + Eid lisp_types.Eid `binapi:"eid,name=eid" json:"eid,omitempty"` + Filter LispLocatorSetFilter `binapi:"lisp_locator_set_filter,name=filter" json:"filter,omitempty"` +} + +func (m *LispEidTableDump) Reset() { *m = LispEidTableDump{} } +func (*LispEidTableDump) GetMessageName() string { return "lisp_eid_table_dump" } +func (*LispEidTableDump) GetCrcString() string { return "b959b73b" } +func (*LispEidTableDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispEidTableDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.EidSet + size += 1 // m.PrefixLength + size += 4 // m.Vni + size += 1 // m.Eid.Type + size += 1 * 6 // m.Eid.Address + size += 1 // m.Filter + return size +} +func (m *LispEidTableDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.EidSet)) + buf.EncodeUint8(uint8(m.PrefixLength)) + buf.EncodeUint32(uint32(m.Vni)) + buf.EncodeUint8(uint8(m.Eid.Type)) + buf.EncodeBytes(m.Eid.Address.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Filter)) + return buf.Bytes(), nil +} +func (m *LispEidTableDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EidSet = buf.DecodeUint8() + m.PrefixLength = buf.DecodeUint8() + m.Vni = buf.DecodeUint32() + m.Eid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Eid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + m.Filter = LispLocatorSetFilter(buf.DecodeUint8()) + return nil +} + +// LispEidTableMapDetails defines message 'lisp_eid_table_map_details'. +type LispEidTableMapDetails struct { + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + DpTable uint32 `binapi:"u32,name=dp_table" json:"dp_table,omitempty"` +} + +func (m *LispEidTableMapDetails) Reset() { *m = LispEidTableMapDetails{} } +func (*LispEidTableMapDetails) GetMessageName() string { return "lisp_eid_table_map_details" } +func (*LispEidTableMapDetails) GetCrcString() string { return "0b6859e2" } +func (*LispEidTableMapDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispEidTableMapDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Vni + size += 4 // m.DpTable + return size +} +func (m *LispEidTableMapDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Vni)) + buf.EncodeUint32(uint32(m.DpTable)) + return buf.Bytes(), nil +} +func (m *LispEidTableMapDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Vni = buf.DecodeUint32() + m.DpTable = buf.DecodeUint32() + return nil +} + +// LispEidTableMapDump defines message 'lisp_eid_table_map_dump'. +type LispEidTableMapDump struct { + IsL2 bool `binapi:"bool,name=is_l2" json:"is_l2,omitempty"` +} + +func (m *LispEidTableMapDump) Reset() { *m = LispEidTableMapDump{} } +func (*LispEidTableMapDump) GetMessageName() string { return "lisp_eid_table_map_dump" } +func (*LispEidTableMapDump) GetCrcString() string { return "d6cf0c3d" } +func (*LispEidTableMapDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispEidTableMapDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsL2 + return size +} +func (m *LispEidTableMapDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsL2) + return buf.Bytes(), nil +} +func (m *LispEidTableMapDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsL2 = buf.DecodeBool() + return nil +} + +// LispEidTableVniDetails defines message 'lisp_eid_table_vni_details'. +type LispEidTableVniDetails struct { + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` +} + +func (m *LispEidTableVniDetails) Reset() { *m = LispEidTableVniDetails{} } +func (*LispEidTableVniDetails) GetMessageName() string { return "lisp_eid_table_vni_details" } +func (*LispEidTableVniDetails) GetCrcString() string { return "64abc01e" } +func (*LispEidTableVniDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispEidTableVniDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Vni + return size +} +func (m *LispEidTableVniDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Vni)) + return buf.Bytes(), nil +} +func (m *LispEidTableVniDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Vni = buf.DecodeUint32() + return nil +} + +// LispEidTableVniDump defines message 'lisp_eid_table_vni_dump'. +type LispEidTableVniDump struct{} + +func (m *LispEidTableVniDump) Reset() { *m = LispEidTableVniDump{} } +func (*LispEidTableVniDump) GetMessageName() string { return "lisp_eid_table_vni_dump" } +func (*LispEidTableVniDump) GetCrcString() string { return "51077d14" } +func (*LispEidTableVniDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispEidTableVniDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *LispEidTableVniDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *LispEidTableVniDump) Unmarshal(b []byte) error { + return nil +} + +// LispEnableDisable defines message 'lisp_enable_disable'. +type LispEnableDisable struct { + IsEnable bool `binapi:"bool,name=is_enable,default=true" json:"is_enable,omitempty"` +} + +func (m *LispEnableDisable) Reset() { *m = LispEnableDisable{} } +func (*LispEnableDisable) GetMessageName() string { return "lisp_enable_disable" } +func (*LispEnableDisable) GetCrcString() string { return "c264d7bf" } +func (*LispEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsEnable + return size +} +func (m *LispEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsEnable) + return buf.Bytes(), nil +} +func (m *LispEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsEnable = buf.DecodeBool() + return nil +} + +// LispEnableDisableReply defines message 'lisp_enable_disable_reply'. +type LispEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LispEnableDisableReply) Reset() { *m = LispEnableDisableReply{} } +func (*LispEnableDisableReply) GetMessageName() string { return "lisp_enable_disable_reply" } +func (*LispEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*LispEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *LispEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *LispEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// LispGetMapRequestItrRlocs defines message 'lisp_get_map_request_itr_rlocs'. +type LispGetMapRequestItrRlocs struct{} + +func (m *LispGetMapRequestItrRlocs) Reset() { *m = LispGetMapRequestItrRlocs{} } +func (*LispGetMapRequestItrRlocs) GetMessageName() string { return "lisp_get_map_request_itr_rlocs" } +func (*LispGetMapRequestItrRlocs) GetCrcString() string { return "51077d14" } +func (*LispGetMapRequestItrRlocs) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispGetMapRequestItrRlocs) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *LispGetMapRequestItrRlocs) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *LispGetMapRequestItrRlocs) Unmarshal(b []byte) error { + return nil +} + +// LispGetMapRequestItrRlocsReply defines message 'lisp_get_map_request_itr_rlocs_reply'. +type LispGetMapRequestItrRlocsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + LocatorSetName string `binapi:"string[64],name=locator_set_name" json:"locator_set_name,omitempty"` +} + +func (m *LispGetMapRequestItrRlocsReply) Reset() { *m = LispGetMapRequestItrRlocsReply{} } +func (*LispGetMapRequestItrRlocsReply) GetMessageName() string { + return "lisp_get_map_request_itr_rlocs_reply" +} +func (*LispGetMapRequestItrRlocsReply) GetCrcString() string { return "76580f3a" } +func (*LispGetMapRequestItrRlocsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispGetMapRequestItrRlocsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 64 // m.LocatorSetName + return size +} +func (m *LispGetMapRequestItrRlocsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeString(m.LocatorSetName, 64) + return buf.Bytes(), nil +} +func (m *LispGetMapRequestItrRlocsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.LocatorSetName = buf.DecodeString(64) + return nil +} + +// LispLocatorDetails defines message 'lisp_locator_details'. +type LispLocatorDetails struct { + Local uint8 `binapi:"u8,name=local" json:"local,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"` + Priority uint8 `binapi:"u8,name=priority" json:"priority,omitempty"` + Weight uint8 `binapi:"u8,name=weight" json:"weight,omitempty"` +} + +func (m *LispLocatorDetails) Reset() { *m = LispLocatorDetails{} } +func (*LispLocatorDetails) GetMessageName() string { return "lisp_locator_details" } +func (*LispLocatorDetails) GetCrcString() string { return "c0c4c2a7" } +func (*LispLocatorDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispLocatorDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Local + size += 4 // m.SwIfIndex + size += 1 // m.IPAddress.Af + size += 1 * 16 // m.IPAddress.Un + size += 1 // m.Priority + size += 1 // m.Weight + return size +} +func (m *LispLocatorDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Local)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.IPAddress.Af)) + buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Priority)) + buf.EncodeUint8(uint8(m.Weight)) + return buf.Bytes(), nil +} +func (m *LispLocatorDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Local = buf.DecodeUint8() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Priority = buf.DecodeUint8() + m.Weight = buf.DecodeUint8() + return nil +} + +// LispLocatorDump defines message 'lisp_locator_dump'. +type LispLocatorDump struct { + LsIndex uint32 `binapi:"u32,name=ls_index" json:"ls_index,omitempty"` + LsName string `binapi:"string[64],name=ls_name" json:"ls_name,omitempty"` + IsIndexSet uint8 `binapi:"u8,name=is_index_set" json:"is_index_set,omitempty"` +} + +func (m *LispLocatorDump) Reset() { *m = LispLocatorDump{} } +func (*LispLocatorDump) GetMessageName() string { return "lisp_locator_dump" } +func (*LispLocatorDump) GetCrcString() string { return "b954fad7" } +func (*LispLocatorDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispLocatorDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.LsIndex + size += 64 // m.LsName + size += 1 // m.IsIndexSet + return size +} +func (m *LispLocatorDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.LsIndex)) + buf.EncodeString(m.LsName, 64) + buf.EncodeUint8(uint8(m.IsIndexSet)) + return buf.Bytes(), nil +} +func (m *LispLocatorDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.LsIndex = buf.DecodeUint32() + m.LsName = buf.DecodeString(64) + m.IsIndexSet = buf.DecodeUint8() + return nil +} + +// LispLocatorSetDetails defines message 'lisp_locator_set_details'. +type LispLocatorSetDetails struct { + LsIndex uint32 `binapi:"u32,name=ls_index" json:"ls_index,omitempty"` + LsName string `binapi:"string[64],name=ls_name" json:"ls_name,omitempty"` +} + +func (m *LispLocatorSetDetails) Reset() { *m = LispLocatorSetDetails{} } +func (*LispLocatorSetDetails) GetMessageName() string { return "lisp_locator_set_details" } +func (*LispLocatorSetDetails) GetCrcString() string { return "5b33a105" } +func (*LispLocatorSetDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispLocatorSetDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.LsIndex + size += 64 // m.LsName + return size +} +func (m *LispLocatorSetDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.LsIndex)) + buf.EncodeString(m.LsName, 64) + return buf.Bytes(), nil +} +func (m *LispLocatorSetDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.LsIndex = buf.DecodeUint32() + m.LsName = buf.DecodeString(64) + return nil +} + +// LispLocatorSetDump defines message 'lisp_locator_set_dump'. +type LispLocatorSetDump struct { + Filter LispLocatorSetFilter `binapi:"lisp_locator_set_filter,name=filter" json:"filter,omitempty"` +} + +func (m *LispLocatorSetDump) Reset() { *m = LispLocatorSetDump{} } +func (*LispLocatorSetDump) GetMessageName() string { return "lisp_locator_set_dump" } +func (*LispLocatorSetDump) GetCrcString() string { return "c2cb5922" } +func (*LispLocatorSetDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispLocatorSetDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Filter + return size +} +func (m *LispLocatorSetDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Filter)) + return buf.Bytes(), nil +} +func (m *LispLocatorSetDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Filter = LispLocatorSetFilter(buf.DecodeUint8()) + return nil +} + +// LispMapRegisterEnableDisable defines message 'lisp_map_register_enable_disable'. +type LispMapRegisterEnableDisable struct { + IsEnable bool `binapi:"bool,name=is_enable,default=true" json:"is_enable,omitempty"` +} + +func (m *LispMapRegisterEnableDisable) Reset() { *m = LispMapRegisterEnableDisable{} } +func (*LispMapRegisterEnableDisable) GetMessageName() string { + return "lisp_map_register_enable_disable" +} +func (*LispMapRegisterEnableDisable) GetCrcString() string { return "c264d7bf" } +func (*LispMapRegisterEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispMapRegisterEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsEnable + return size +} +func (m *LispMapRegisterEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsEnable) + return buf.Bytes(), nil +} +func (m *LispMapRegisterEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsEnable = buf.DecodeBool() + return nil +} + +// LispMapRegisterEnableDisableReply defines message 'lisp_map_register_enable_disable_reply'. +type LispMapRegisterEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LispMapRegisterEnableDisableReply) Reset() { *m = LispMapRegisterEnableDisableReply{} } +func (*LispMapRegisterEnableDisableReply) GetMessageName() string { + return "lisp_map_register_enable_disable_reply" +} +func (*LispMapRegisterEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*LispMapRegisterEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispMapRegisterEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *LispMapRegisterEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *LispMapRegisterEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// LispMapRequestMode defines message 'lisp_map_request_mode'. +type LispMapRequestMode struct { + IsSrcDst bool `binapi:"bool,name=is_src_dst" json:"is_src_dst,omitempty"` +} + +func (m *LispMapRequestMode) Reset() { *m = LispMapRequestMode{} } +func (*LispMapRequestMode) GetMessageName() string { return "lisp_map_request_mode" } +func (*LispMapRequestMode) GetCrcString() string { return "f43c26ae" } +func (*LispMapRequestMode) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispMapRequestMode) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsSrcDst + return size +} +func (m *LispMapRequestMode) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsSrcDst) + return buf.Bytes(), nil +} +func (m *LispMapRequestMode) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsSrcDst = buf.DecodeBool() + return nil +} + +// LispMapRequestModeReply defines message 'lisp_map_request_mode_reply'. +type LispMapRequestModeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LispMapRequestModeReply) Reset() { *m = LispMapRequestModeReply{} } +func (*LispMapRequestModeReply) GetMessageName() string { return "lisp_map_request_mode_reply" } +func (*LispMapRequestModeReply) GetCrcString() string { return "e8d4e804" } +func (*LispMapRequestModeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispMapRequestModeReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *LispMapRequestModeReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *LispMapRequestModeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// LispMapResolverDetails defines message 'lisp_map_resolver_details'. +type LispMapResolverDetails struct { + IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"` +} + +func (m *LispMapResolverDetails) Reset() { *m = LispMapResolverDetails{} } +func (*LispMapResolverDetails) GetMessageName() string { return "lisp_map_resolver_details" } +func (*LispMapResolverDetails) GetCrcString() string { return "82a09deb" } +func (*LispMapResolverDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispMapResolverDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IPAddress.Af + size += 1 * 16 // m.IPAddress.Un + return size +} +func (m *LispMapResolverDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.IPAddress.Af)) + buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *LispMapResolverDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// LispMapResolverDump defines message 'lisp_map_resolver_dump'. +type LispMapResolverDump struct{} + +func (m *LispMapResolverDump) Reset() { *m = LispMapResolverDump{} } +func (*LispMapResolverDump) GetMessageName() string { return "lisp_map_resolver_dump" } +func (*LispMapResolverDump) GetCrcString() string { return "51077d14" } +func (*LispMapResolverDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispMapResolverDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *LispMapResolverDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *LispMapResolverDump) Unmarshal(b []byte) error { + return nil +} + +// LispMapServerDetails defines message 'lisp_map_server_details'. +type LispMapServerDetails struct { + IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"` +} + +func (m *LispMapServerDetails) Reset() { *m = LispMapServerDetails{} } +func (*LispMapServerDetails) GetMessageName() string { return "lisp_map_server_details" } +func (*LispMapServerDetails) GetCrcString() string { return "82a09deb" } +func (*LispMapServerDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispMapServerDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IPAddress.Af + size += 1 * 16 // m.IPAddress.Un + return size +} +func (m *LispMapServerDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.IPAddress.Af)) + buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *LispMapServerDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// LispMapServerDump defines message 'lisp_map_server_dump'. +type LispMapServerDump struct{} + +func (m *LispMapServerDump) Reset() { *m = LispMapServerDump{} } +func (*LispMapServerDump) GetMessageName() string { return "lisp_map_server_dump" } +func (*LispMapServerDump) GetCrcString() string { return "51077d14" } +func (*LispMapServerDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispMapServerDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *LispMapServerDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *LispMapServerDump) Unmarshal(b []byte) error { + return nil +} + +// LispPitrSetLocatorSet defines message 'lisp_pitr_set_locator_set'. +type LispPitrSetLocatorSet struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + LsName string `binapi:"string[64],name=ls_name" json:"ls_name,omitempty"` +} + +func (m *LispPitrSetLocatorSet) Reset() { *m = LispPitrSetLocatorSet{} } +func (*LispPitrSetLocatorSet) GetMessageName() string { return "lisp_pitr_set_locator_set" } +func (*LispPitrSetLocatorSet) GetCrcString() string { return "486e2b76" } +func (*LispPitrSetLocatorSet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispPitrSetLocatorSet) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 64 // m.LsName + return size +} +func (m *LispPitrSetLocatorSet) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeString(m.LsName, 64) + return buf.Bytes(), nil +} +func (m *LispPitrSetLocatorSet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.LsName = buf.DecodeString(64) + return nil +} + +// LispPitrSetLocatorSetReply defines message 'lisp_pitr_set_locator_set_reply'. +type LispPitrSetLocatorSetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LispPitrSetLocatorSetReply) Reset() { *m = LispPitrSetLocatorSetReply{} } +func (*LispPitrSetLocatorSetReply) GetMessageName() string { return "lisp_pitr_set_locator_set_reply" } +func (*LispPitrSetLocatorSetReply) GetCrcString() string { return "e8d4e804" } +func (*LispPitrSetLocatorSetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispPitrSetLocatorSetReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *LispPitrSetLocatorSetReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *LispPitrSetLocatorSetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// LispRlocProbeEnableDisable defines message 'lisp_rloc_probe_enable_disable'. +type LispRlocProbeEnableDisable struct { + IsEnable bool `binapi:"bool,name=is_enable,default=true" json:"is_enable,omitempty"` +} + +func (m *LispRlocProbeEnableDisable) Reset() { *m = LispRlocProbeEnableDisable{} } +func (*LispRlocProbeEnableDisable) GetMessageName() string { return "lisp_rloc_probe_enable_disable" } +func (*LispRlocProbeEnableDisable) GetCrcString() string { return "c264d7bf" } +func (*LispRlocProbeEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispRlocProbeEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsEnable + return size +} +func (m *LispRlocProbeEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsEnable) + return buf.Bytes(), nil +} +func (m *LispRlocProbeEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsEnable = buf.DecodeBool() + return nil +} + +// LispRlocProbeEnableDisableReply defines message 'lisp_rloc_probe_enable_disable_reply'. +type LispRlocProbeEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LispRlocProbeEnableDisableReply) Reset() { *m = LispRlocProbeEnableDisableReply{} } +func (*LispRlocProbeEnableDisableReply) GetMessageName() string { + return "lisp_rloc_probe_enable_disable_reply" +} +func (*LispRlocProbeEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*LispRlocProbeEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispRlocProbeEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *LispRlocProbeEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *LispRlocProbeEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// LispUsePetr defines message 'lisp_use_petr'. +type LispUsePetr struct { + IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` +} + +func (m *LispUsePetr) Reset() { *m = LispUsePetr{} } +func (*LispUsePetr) GetMessageName() string { return "lisp_use_petr" } +func (*LispUsePetr) GetCrcString() string { return "9e141831" } +func (*LispUsePetr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LispUsePetr) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IPAddress.Af + size += 1 * 16 // m.IPAddress.Un + size += 1 // m.IsAdd + return size +} +func (m *LispUsePetr) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.IPAddress.Af)) + buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *LispUsePetr) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.IsAdd = buf.DecodeBool() + return nil +} + +// LispUsePetrReply defines message 'lisp_use_petr_reply'. +type LispUsePetrReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LispUsePetrReply) Reset() { *m = LispUsePetrReply{} } +func (*LispUsePetrReply) GetMessageName() string { return "lisp_use_petr_reply" } +func (*LispUsePetrReply) GetCrcString() string { return "e8d4e804" } +func (*LispUsePetrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LispUsePetrReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *LispUsePetrReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *LispUsePetrReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// ShowLispMapRegisterState defines message 'show_lisp_map_register_state'. +type ShowLispMapRegisterState struct{} + +func (m *ShowLispMapRegisterState) Reset() { *m = ShowLispMapRegisterState{} } +func (*ShowLispMapRegisterState) GetMessageName() string { return "show_lisp_map_register_state" } +func (*ShowLispMapRegisterState) GetCrcString() string { return "51077d14" } +func (*ShowLispMapRegisterState) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ShowLispMapRegisterState) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowLispMapRegisterState) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ShowLispMapRegisterState) Unmarshal(b []byte) error { + return nil +} + +// ShowLispMapRegisterStateReply defines message 'show_lisp_map_register_state_reply'. +type ShowLispMapRegisterStateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IsEnabled bool `binapi:"bool,name=is_enabled,default=true" json:"is_enabled,omitempty"` +} + +func (m *ShowLispMapRegisterStateReply) Reset() { *m = ShowLispMapRegisterStateReply{} } +func (*ShowLispMapRegisterStateReply) GetMessageName() string { + return "show_lisp_map_register_state_reply" +} +func (*ShowLispMapRegisterStateReply) GetCrcString() string { return "e33a377b" } +func (*ShowLispMapRegisterStateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ShowLispMapRegisterStateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.IsEnabled + return size +} +func (m *ShowLispMapRegisterStateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBool(m.IsEnabled) + return buf.Bytes(), nil +} +func (m *ShowLispMapRegisterStateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.IsEnabled = buf.DecodeBool() + return nil +} + +// ShowLispMapRequestMode defines message 'show_lisp_map_request_mode'. +type ShowLispMapRequestMode struct{} + +func (m *ShowLispMapRequestMode) Reset() { *m = ShowLispMapRequestMode{} } +func (*ShowLispMapRequestMode) GetMessageName() string { return "show_lisp_map_request_mode" } +func (*ShowLispMapRequestMode) GetCrcString() string { return "51077d14" } +func (*ShowLispMapRequestMode) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ShowLispMapRequestMode) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowLispMapRequestMode) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ShowLispMapRequestMode) Unmarshal(b []byte) error { + return nil +} + +// ShowLispMapRequestModeReply defines message 'show_lisp_map_request_mode_reply'. +type ShowLispMapRequestModeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IsSrcDst bool `binapi:"bool,name=is_src_dst" json:"is_src_dst,omitempty"` +} + +func (m *ShowLispMapRequestModeReply) Reset() { *m = ShowLispMapRequestModeReply{} } +func (*ShowLispMapRequestModeReply) GetMessageName() string { + return "show_lisp_map_request_mode_reply" +} +func (*ShowLispMapRequestModeReply) GetCrcString() string { return "5b05038e" } +func (*ShowLispMapRequestModeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ShowLispMapRequestModeReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.IsSrcDst + return size +} +func (m *ShowLispMapRequestModeReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBool(m.IsSrcDst) + return buf.Bytes(), nil +} +func (m *ShowLispMapRequestModeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.IsSrcDst = buf.DecodeBool() + return nil +} + +// ShowLispPitr defines message 'show_lisp_pitr'. +type ShowLispPitr struct{} + +func (m *ShowLispPitr) Reset() { *m = ShowLispPitr{} } +func (*ShowLispPitr) GetMessageName() string { return "show_lisp_pitr" } +func (*ShowLispPitr) GetCrcString() string { return "51077d14" } +func (*ShowLispPitr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ShowLispPitr) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowLispPitr) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ShowLispPitr) Unmarshal(b []byte) error { + return nil +} + +// ShowLispPitrReply defines message 'show_lisp_pitr_reply'. +type ShowLispPitrReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IsEnabled bool `binapi:"bool,name=is_enabled" json:"is_enabled,omitempty"` + LocatorSetName string `binapi:"string[64],name=locator_set_name" json:"locator_set_name,omitempty"` +} + +func (m *ShowLispPitrReply) Reset() { *m = ShowLispPitrReply{} } +func (*ShowLispPitrReply) GetMessageName() string { return "show_lisp_pitr_reply" } +func (*ShowLispPitrReply) GetCrcString() string { return "27aa69b1" } +func (*ShowLispPitrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ShowLispPitrReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.IsEnabled + size += 64 // m.LocatorSetName + return size +} +func (m *ShowLispPitrReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBool(m.IsEnabled) + buf.EncodeString(m.LocatorSetName, 64) + return buf.Bytes(), nil +} +func (m *ShowLispPitrReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.IsEnabled = buf.DecodeBool() + m.LocatorSetName = buf.DecodeString(64) + return nil +} + +// ShowLispRlocProbeState defines message 'show_lisp_rloc_probe_state'. +type ShowLispRlocProbeState struct{} + +func (m *ShowLispRlocProbeState) Reset() { *m = ShowLispRlocProbeState{} } +func (*ShowLispRlocProbeState) GetMessageName() string { return "show_lisp_rloc_probe_state" } +func (*ShowLispRlocProbeState) GetCrcString() string { return "51077d14" } +func (*ShowLispRlocProbeState) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ShowLispRlocProbeState) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowLispRlocProbeState) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ShowLispRlocProbeState) Unmarshal(b []byte) error { + return nil +} + +// ShowLispRlocProbeStateReply defines message 'show_lisp_rloc_probe_state_reply'. +type ShowLispRlocProbeStateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IsEnabled bool `binapi:"bool,name=is_enabled,default=true" json:"is_enabled,omitempty"` +} + +func (m *ShowLispRlocProbeStateReply) Reset() { *m = ShowLispRlocProbeStateReply{} } +func (*ShowLispRlocProbeStateReply) GetMessageName() string { + return "show_lisp_rloc_probe_state_reply" +} +func (*ShowLispRlocProbeStateReply) GetCrcString() string { return "e33a377b" } +func (*ShowLispRlocProbeStateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ShowLispRlocProbeStateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.IsEnabled + return size +} +func (m *ShowLispRlocProbeStateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBool(m.IsEnabled) + return buf.Bytes(), nil +} +func (m *ShowLispRlocProbeStateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.IsEnabled = buf.DecodeBool() + return nil +} + +// ShowLispStatus defines message 'show_lisp_status'. +type ShowLispStatus struct{} + +func (m *ShowLispStatus) Reset() { *m = ShowLispStatus{} } +func (*ShowLispStatus) GetMessageName() string { return "show_lisp_status" } +func (*ShowLispStatus) GetCrcString() string { return "51077d14" } +func (*ShowLispStatus) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ShowLispStatus) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowLispStatus) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ShowLispStatus) Unmarshal(b []byte) error { + return nil +} + +// ShowLispStatusReply defines message 'show_lisp_status_reply'. +type ShowLispStatusReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IsLispEnabled bool `binapi:"bool,name=is_lisp_enabled" json:"is_lisp_enabled,omitempty"` + IsGpeEnabled bool `binapi:"bool,name=is_gpe_enabled" json:"is_gpe_enabled,omitempty"` +} + +func (m *ShowLispStatusReply) Reset() { *m = ShowLispStatusReply{} } +func (*ShowLispStatusReply) GetMessageName() string { return "show_lisp_status_reply" } +func (*ShowLispStatusReply) GetCrcString() string { return "9e8f10c0" } +func (*ShowLispStatusReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ShowLispStatusReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.IsLispEnabled + size += 1 // m.IsGpeEnabled + return size +} +func (m *ShowLispStatusReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBool(m.IsLispEnabled) + buf.EncodeBool(m.IsGpeEnabled) + return buf.Bytes(), nil +} +func (m *ShowLispStatusReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.IsLispEnabled = buf.DecodeBool() + m.IsGpeEnabled = buf.DecodeBool() + return nil +} + +// ShowLispUsePetr defines message 'show_lisp_use_petr'. +type ShowLispUsePetr struct{} + +func (m *ShowLispUsePetr) Reset() { *m = ShowLispUsePetr{} } +func (*ShowLispUsePetr) GetMessageName() string { return "show_lisp_use_petr" } +func (*ShowLispUsePetr) GetCrcString() string { return "51077d14" } +func (*ShowLispUsePetr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ShowLispUsePetr) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowLispUsePetr) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ShowLispUsePetr) Unmarshal(b []byte) error { + return nil +} + +// ShowLispUsePetrReply defines message 'show_lisp_use_petr_reply'. +type ShowLispUsePetrReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IsPetrEnable bool `binapi:"bool,name=is_petr_enable,default=true" json:"is_petr_enable,omitempty"` + IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"` +} + +func (m *ShowLispUsePetrReply) Reset() { *m = ShowLispUsePetrReply{} } +func (*ShowLispUsePetrReply) GetMessageName() string { return "show_lisp_use_petr_reply" } +func (*ShowLispUsePetrReply) GetCrcString() string { return "dcad8a81" } +func (*ShowLispUsePetrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ShowLispUsePetrReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.IsPetrEnable + size += 1 // m.IPAddress.Af + size += 1 * 16 // m.IPAddress.Un + return size +} +func (m *ShowLispUsePetrReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBool(m.IsPetrEnable) + buf.EncodeUint8(uint8(m.IPAddress.Af)) + buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *ShowLispUsePetrReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.IsPetrEnable = buf.DecodeBool() + m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +func init() { file_lisp_binapi_init() } +func file_lisp_binapi_init() { + api.RegisterMessage((*LispAddDelAdjacency)(nil), "lisp_add_del_adjacency_cf5edb61") + api.RegisterMessage((*LispAddDelAdjacencyReply)(nil), "lisp_add_del_adjacency_reply_e8d4e804") + api.RegisterMessage((*LispAddDelLocalEid)(nil), "lisp_add_del_local_eid_21f573bd") + api.RegisterMessage((*LispAddDelLocalEidReply)(nil), "lisp_add_del_local_eid_reply_e8d4e804") + api.RegisterMessage((*LispAddDelLocator)(nil), "lisp_add_del_locator_af4d8f13") + api.RegisterMessage((*LispAddDelLocatorReply)(nil), "lisp_add_del_locator_reply_e8d4e804") + api.RegisterMessage((*LispAddDelLocatorSet)(nil), "lisp_add_del_locator_set_6fcd6471") + api.RegisterMessage((*LispAddDelLocatorSetReply)(nil), "lisp_add_del_locator_set_reply_b6666db4") + api.RegisterMessage((*LispAddDelMapRequestItrRlocs)(nil), "lisp_add_del_map_request_itr_rlocs_6be88e45") + api.RegisterMessage((*LispAddDelMapRequestItrRlocsReply)(nil), "lisp_add_del_map_request_itr_rlocs_reply_e8d4e804") + api.RegisterMessage((*LispAddDelMapResolver)(nil), "lisp_add_del_map_resolver_6598ea7c") + api.RegisterMessage((*LispAddDelMapResolverReply)(nil), "lisp_add_del_map_resolver_reply_e8d4e804") + api.RegisterMessage((*LispAddDelMapServer)(nil), "lisp_add_del_map_server_6598ea7c") + api.RegisterMessage((*LispAddDelMapServerReply)(nil), "lisp_add_del_map_server_reply_e8d4e804") + api.RegisterMessage((*LispAddDelRemoteMapping)(nil), "lisp_add_del_remote_mapping_fae8ed77") + api.RegisterMessage((*LispAddDelRemoteMappingReply)(nil), "lisp_add_del_remote_mapping_reply_e8d4e804") + api.RegisterMessage((*LispAdjacenciesGet)(nil), "lisp_adjacencies_get_8d1f2fe9") + api.RegisterMessage((*LispAdjacenciesGetReply)(nil), "lisp_adjacencies_get_reply_3f97bcdd") + api.RegisterMessage((*LispEidTableAddDelMap)(nil), "lisp_eid_table_add_del_map_9481416b") + api.RegisterMessage((*LispEidTableAddDelMapReply)(nil), "lisp_eid_table_add_del_map_reply_e8d4e804") + api.RegisterMessage((*LispEidTableDetails)(nil), "lisp_eid_table_details_4bc32e3a") + api.RegisterMessage((*LispEidTableDump)(nil), "lisp_eid_table_dump_b959b73b") + api.RegisterMessage((*LispEidTableMapDetails)(nil), "lisp_eid_table_map_details_0b6859e2") + api.RegisterMessage((*LispEidTableMapDump)(nil), "lisp_eid_table_map_dump_d6cf0c3d") + api.RegisterMessage((*LispEidTableVniDetails)(nil), "lisp_eid_table_vni_details_64abc01e") + api.RegisterMessage((*LispEidTableVniDump)(nil), "lisp_eid_table_vni_dump_51077d14") + api.RegisterMessage((*LispEnableDisable)(nil), "lisp_enable_disable_c264d7bf") + api.RegisterMessage((*LispEnableDisableReply)(nil), "lisp_enable_disable_reply_e8d4e804") + api.RegisterMessage((*LispGetMapRequestItrRlocs)(nil), "lisp_get_map_request_itr_rlocs_51077d14") + api.RegisterMessage((*LispGetMapRequestItrRlocsReply)(nil), "lisp_get_map_request_itr_rlocs_reply_76580f3a") + api.RegisterMessage((*LispLocatorDetails)(nil), "lisp_locator_details_c0c4c2a7") + api.RegisterMessage((*LispLocatorDump)(nil), "lisp_locator_dump_b954fad7") + api.RegisterMessage((*LispLocatorSetDetails)(nil), "lisp_locator_set_details_5b33a105") + api.RegisterMessage((*LispLocatorSetDump)(nil), "lisp_locator_set_dump_c2cb5922") + api.RegisterMessage((*LispMapRegisterEnableDisable)(nil), "lisp_map_register_enable_disable_c264d7bf") + api.RegisterMessage((*LispMapRegisterEnableDisableReply)(nil), "lisp_map_register_enable_disable_reply_e8d4e804") + api.RegisterMessage((*LispMapRequestMode)(nil), "lisp_map_request_mode_f43c26ae") + api.RegisterMessage((*LispMapRequestModeReply)(nil), "lisp_map_request_mode_reply_e8d4e804") + api.RegisterMessage((*LispMapResolverDetails)(nil), "lisp_map_resolver_details_82a09deb") + api.RegisterMessage((*LispMapResolverDump)(nil), "lisp_map_resolver_dump_51077d14") + api.RegisterMessage((*LispMapServerDetails)(nil), "lisp_map_server_details_82a09deb") + api.RegisterMessage((*LispMapServerDump)(nil), "lisp_map_server_dump_51077d14") + api.RegisterMessage((*LispPitrSetLocatorSet)(nil), "lisp_pitr_set_locator_set_486e2b76") + api.RegisterMessage((*LispPitrSetLocatorSetReply)(nil), "lisp_pitr_set_locator_set_reply_e8d4e804") + api.RegisterMessage((*LispRlocProbeEnableDisable)(nil), "lisp_rloc_probe_enable_disable_c264d7bf") + api.RegisterMessage((*LispRlocProbeEnableDisableReply)(nil), "lisp_rloc_probe_enable_disable_reply_e8d4e804") + api.RegisterMessage((*LispUsePetr)(nil), "lisp_use_petr_9e141831") + api.RegisterMessage((*LispUsePetrReply)(nil), "lisp_use_petr_reply_e8d4e804") + api.RegisterMessage((*ShowLispMapRegisterState)(nil), "show_lisp_map_register_state_51077d14") + api.RegisterMessage((*ShowLispMapRegisterStateReply)(nil), "show_lisp_map_register_state_reply_e33a377b") + api.RegisterMessage((*ShowLispMapRequestMode)(nil), "show_lisp_map_request_mode_51077d14") + api.RegisterMessage((*ShowLispMapRequestModeReply)(nil), "show_lisp_map_request_mode_reply_5b05038e") + api.RegisterMessage((*ShowLispPitr)(nil), "show_lisp_pitr_51077d14") + api.RegisterMessage((*ShowLispPitrReply)(nil), "show_lisp_pitr_reply_27aa69b1") + api.RegisterMessage((*ShowLispRlocProbeState)(nil), "show_lisp_rloc_probe_state_51077d14") + api.RegisterMessage((*ShowLispRlocProbeStateReply)(nil), "show_lisp_rloc_probe_state_reply_e33a377b") + api.RegisterMessage((*ShowLispStatus)(nil), "show_lisp_status_51077d14") + api.RegisterMessage((*ShowLispStatusReply)(nil), "show_lisp_status_reply_9e8f10c0") + api.RegisterMessage((*ShowLispUsePetr)(nil), "show_lisp_use_petr_51077d14") + api.RegisterMessage((*ShowLispUsePetrReply)(nil), "show_lisp_use_petr_reply_dcad8a81") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*LispAddDelAdjacency)(nil), + (*LispAddDelAdjacencyReply)(nil), + (*LispAddDelLocalEid)(nil), + (*LispAddDelLocalEidReply)(nil), + (*LispAddDelLocator)(nil), + (*LispAddDelLocatorReply)(nil), + (*LispAddDelLocatorSet)(nil), + (*LispAddDelLocatorSetReply)(nil), + (*LispAddDelMapRequestItrRlocs)(nil), + (*LispAddDelMapRequestItrRlocsReply)(nil), + (*LispAddDelMapResolver)(nil), + (*LispAddDelMapResolverReply)(nil), + (*LispAddDelMapServer)(nil), + (*LispAddDelMapServerReply)(nil), + (*LispAddDelRemoteMapping)(nil), + (*LispAddDelRemoteMappingReply)(nil), + (*LispAdjacenciesGet)(nil), + (*LispAdjacenciesGetReply)(nil), + (*LispEidTableAddDelMap)(nil), + (*LispEidTableAddDelMapReply)(nil), + (*LispEidTableDetails)(nil), + (*LispEidTableDump)(nil), + (*LispEidTableMapDetails)(nil), + (*LispEidTableMapDump)(nil), + (*LispEidTableVniDetails)(nil), + (*LispEidTableVniDump)(nil), + (*LispEnableDisable)(nil), + (*LispEnableDisableReply)(nil), + (*LispGetMapRequestItrRlocs)(nil), + (*LispGetMapRequestItrRlocsReply)(nil), + (*LispLocatorDetails)(nil), + (*LispLocatorDump)(nil), + (*LispLocatorSetDetails)(nil), + (*LispLocatorSetDump)(nil), + (*LispMapRegisterEnableDisable)(nil), + (*LispMapRegisterEnableDisableReply)(nil), + (*LispMapRequestMode)(nil), + (*LispMapRequestModeReply)(nil), + (*LispMapResolverDetails)(nil), + (*LispMapResolverDump)(nil), + (*LispMapServerDetails)(nil), + (*LispMapServerDump)(nil), + (*LispPitrSetLocatorSet)(nil), + (*LispPitrSetLocatorSetReply)(nil), + (*LispRlocProbeEnableDisable)(nil), + (*LispRlocProbeEnableDisableReply)(nil), + (*LispUsePetr)(nil), + (*LispUsePetrReply)(nil), + (*ShowLispMapRegisterState)(nil), + (*ShowLispMapRegisterStateReply)(nil), + (*ShowLispMapRequestMode)(nil), + (*ShowLispMapRequestModeReply)(nil), + (*ShowLispPitr)(nil), + (*ShowLispPitrReply)(nil), + (*ShowLispRlocProbeState)(nil), + (*ShowLispRlocProbeStateReply)(nil), + (*ShowLispStatus)(nil), + (*ShowLispStatusReply)(nil), + (*ShowLispUsePetr)(nil), + (*ShowLispUsePetrReply)(nil), + } +} diff --git a/binapi/lisp/lisp_rest.ba.go b/binapi/lisp/lisp_rest.ba.go new file mode 100644 index 0000000..024d6f5 --- /dev/null +++ b/binapi/lisp/lisp_rest.ba.go @@ -0,0 +1,480 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package lisp + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/lisp_add_del_adjacency", func(w http.ResponseWriter, req *http.Request) { + var request = new(LispAddDelAdjacency) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.LispAddDelAdjacency(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/lisp_add_del_local_eid", func(w http.ResponseWriter, req *http.Request) { + var request = new(LispAddDelLocalEid) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.LispAddDelLocalEid(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/lisp_add_del_locator", func(w http.ResponseWriter, req *http.Request) { + var request = new(LispAddDelLocator) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.LispAddDelLocator(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/lisp_add_del_locator_set", func(w http.ResponseWriter, req *http.Request) { + var request = new(LispAddDelLocatorSet) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.LispAddDelLocatorSet(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/lisp_add_del_map_request_itr_rlocs", func(w http.ResponseWriter, req *http.Request) { + var request = new(LispAddDelMapRequestItrRlocs) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.LispAddDelMapRequestItrRlocs(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/lisp_add_del_map_resolver", func(w http.ResponseWriter, req *http.Request) { + var request = new(LispAddDelMapResolver) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.LispAddDelMapResolver(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/lisp_add_del_map_server", func(w http.ResponseWriter, req *http.Request) { + var request = new(LispAddDelMapServer) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.LispAddDelMapServer(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/lisp_add_del_remote_mapping", func(w http.ResponseWriter, req *http.Request) { + var request = new(LispAddDelRemoteMapping) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.LispAddDelRemoteMapping(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/lisp_adjacencies_get", func(w http.ResponseWriter, req *http.Request) { + var request = new(LispAdjacenciesGet) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.LispAdjacenciesGet(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/lisp_eid_table_add_del_map", func(w http.ResponseWriter, req *http.Request) { + var request = new(LispEidTableAddDelMap) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.LispEidTableAddDelMap(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/lisp_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(LispEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.LispEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/lisp_get_map_request_itr_rlocs", func(w http.ResponseWriter, req *http.Request) { + var request = new(LispGetMapRequestItrRlocs) + reply, err := rpc.LispGetMapRequestItrRlocs(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/lisp_map_register_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(LispMapRegisterEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.LispMapRegisterEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/lisp_map_request_mode", func(w http.ResponseWriter, req *http.Request) { + var request = new(LispMapRequestMode) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.LispMapRequestMode(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/lisp_pitr_set_locator_set", func(w http.ResponseWriter, req *http.Request) { + var request = new(LispPitrSetLocatorSet) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.LispPitrSetLocatorSet(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/lisp_rloc_probe_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(LispRlocProbeEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.LispRlocProbeEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/lisp_use_petr", func(w http.ResponseWriter, req *http.Request) { + var request = new(LispUsePetr) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.LispUsePetr(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/show_lisp_map_register_state", func(w http.ResponseWriter, req *http.Request) { + var request = new(ShowLispMapRegisterState) + reply, err := rpc.ShowLispMapRegisterState(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/show_lisp_map_request_mode", func(w http.ResponseWriter, req *http.Request) { + var request = new(ShowLispMapRequestMode) + reply, err := rpc.ShowLispMapRequestMode(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/show_lisp_pitr", func(w http.ResponseWriter, req *http.Request) { + var request = new(ShowLispPitr) + reply, err := rpc.ShowLispPitr(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/show_lisp_rloc_probe_state", func(w http.ResponseWriter, req *http.Request) { + var request = new(ShowLispRlocProbeState) + reply, err := rpc.ShowLispRlocProbeState(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/show_lisp_status", func(w http.ResponseWriter, req *http.Request) { + var request = new(ShowLispStatus) + reply, err := rpc.ShowLispStatus(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/show_lisp_use_petr", func(w http.ResponseWriter, req *http.Request) { + var request = new(ShowLispUsePetr) + reply, err := rpc.ShowLispUsePetr(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/lisp/lisp_rpc.ba.go b/binapi/lisp/lisp_rpc.ba.go new file mode 100644 index 0000000..1c82bdf --- /dev/null +++ b/binapi/lisp/lisp_rpc.ba.go @@ -0,0 +1,533 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package lisp + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service lisp. +type RPCService interface { + LispAddDelAdjacency(ctx context.Context, in *LispAddDelAdjacency) (*LispAddDelAdjacencyReply, error) + LispAddDelLocalEid(ctx context.Context, in *LispAddDelLocalEid) (*LispAddDelLocalEidReply, error) + LispAddDelLocator(ctx context.Context, in *LispAddDelLocator) (*LispAddDelLocatorReply, error) + LispAddDelLocatorSet(ctx context.Context, in *LispAddDelLocatorSet) (*LispAddDelLocatorSetReply, error) + LispAddDelMapRequestItrRlocs(ctx context.Context, in *LispAddDelMapRequestItrRlocs) (*LispAddDelMapRequestItrRlocsReply, error) + LispAddDelMapResolver(ctx context.Context, in *LispAddDelMapResolver) (*LispAddDelMapResolverReply, error) + LispAddDelMapServer(ctx context.Context, in *LispAddDelMapServer) (*LispAddDelMapServerReply, error) + LispAddDelRemoteMapping(ctx context.Context, in *LispAddDelRemoteMapping) (*LispAddDelRemoteMappingReply, error) + LispAdjacenciesGet(ctx context.Context, in *LispAdjacenciesGet) (*LispAdjacenciesGetReply, error) + LispEidTableAddDelMap(ctx context.Context, in *LispEidTableAddDelMap) (*LispEidTableAddDelMapReply, error) + LispEidTableDump(ctx context.Context, in *LispEidTableDump) (RPCService_LispEidTableDumpClient, error) + LispEidTableMapDump(ctx context.Context, in *LispEidTableMapDump) (RPCService_LispEidTableMapDumpClient, error) + LispEidTableVniDump(ctx context.Context, in *LispEidTableVniDump) (RPCService_LispEidTableVniDumpClient, error) + LispEnableDisable(ctx context.Context, in *LispEnableDisable) (*LispEnableDisableReply, error) + LispGetMapRequestItrRlocs(ctx context.Context, in *LispGetMapRequestItrRlocs) (*LispGetMapRequestItrRlocsReply, error) + LispLocatorDump(ctx context.Context, in *LispLocatorDump) (RPCService_LispLocatorDumpClient, error) + LispLocatorSetDump(ctx context.Context, in *LispLocatorSetDump) (RPCService_LispLocatorSetDumpClient, error) + LispMapRegisterEnableDisable(ctx context.Context, in *LispMapRegisterEnableDisable) (*LispMapRegisterEnableDisableReply, error) + LispMapRequestMode(ctx context.Context, in *LispMapRequestMode) (*LispMapRequestModeReply, error) + LispMapResolverDump(ctx context.Context, in *LispMapResolverDump) (RPCService_LispMapResolverDumpClient, error) + LispMapServerDump(ctx context.Context, in *LispMapServerDump) (RPCService_LispMapServerDumpClient, error) + LispPitrSetLocatorSet(ctx context.Context, in *LispPitrSetLocatorSet) (*LispPitrSetLocatorSetReply, error) + LispRlocProbeEnableDisable(ctx context.Context, in *LispRlocProbeEnableDisable) (*LispRlocProbeEnableDisableReply, error) + LispUsePetr(ctx context.Context, in *LispUsePetr) (*LispUsePetrReply, error) + ShowLispMapRegisterState(ctx context.Context, in *ShowLispMapRegisterState) (*ShowLispMapRegisterStateReply, error) + ShowLispMapRequestMode(ctx context.Context, in *ShowLispMapRequestMode) (*ShowLispMapRequestModeReply, error) + ShowLispPitr(ctx context.Context, in *ShowLispPitr) (*ShowLispPitrReply, error) + ShowLispRlocProbeState(ctx context.Context, in *ShowLispRlocProbeState) (*ShowLispRlocProbeStateReply, error) + ShowLispStatus(ctx context.Context, in *ShowLispStatus) (*ShowLispStatusReply, error) + ShowLispUsePetr(ctx context.Context, in *ShowLispUsePetr) (*ShowLispUsePetrReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) LispAddDelAdjacency(ctx context.Context, in *LispAddDelAdjacency) (*LispAddDelAdjacencyReply, error) { + out := new(LispAddDelAdjacencyReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LispAddDelLocalEid(ctx context.Context, in *LispAddDelLocalEid) (*LispAddDelLocalEidReply, error) { + out := new(LispAddDelLocalEidReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LispAddDelLocator(ctx context.Context, in *LispAddDelLocator) (*LispAddDelLocatorReply, error) { + out := new(LispAddDelLocatorReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LispAddDelLocatorSet(ctx context.Context, in *LispAddDelLocatorSet) (*LispAddDelLocatorSetReply, error) { + out := new(LispAddDelLocatorSetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LispAddDelMapRequestItrRlocs(ctx context.Context, in *LispAddDelMapRequestItrRlocs) (*LispAddDelMapRequestItrRlocsReply, error) { + out := new(LispAddDelMapRequestItrRlocsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LispAddDelMapResolver(ctx context.Context, in *LispAddDelMapResolver) (*LispAddDelMapResolverReply, error) { + out := new(LispAddDelMapResolverReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LispAddDelMapServer(ctx context.Context, in *LispAddDelMapServer) (*LispAddDelMapServerReply, error) { + out := new(LispAddDelMapServerReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LispAddDelRemoteMapping(ctx context.Context, in *LispAddDelRemoteMapping) (*LispAddDelRemoteMappingReply, error) { + out := new(LispAddDelRemoteMappingReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LispAdjacenciesGet(ctx context.Context, in *LispAdjacenciesGet) (*LispAdjacenciesGetReply, error) { + out := new(LispAdjacenciesGetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LispEidTableAddDelMap(ctx context.Context, in *LispEidTableAddDelMap) (*LispEidTableAddDelMapReply, error) { + out := new(LispEidTableAddDelMapReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LispEidTableDump(ctx context.Context, in *LispEidTableDump) (RPCService_LispEidTableDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_LispEidTableDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_LispEidTableDumpClient interface { + Recv() (*LispEidTableDetails, error) + api.Stream +} + +type serviceClient_LispEidTableDumpClient struct { + api.Stream +} + +func (c *serviceClient_LispEidTableDumpClient) Recv() (*LispEidTableDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *LispEidTableDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) LispEidTableMapDump(ctx context.Context, in *LispEidTableMapDump) (RPCService_LispEidTableMapDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_LispEidTableMapDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_LispEidTableMapDumpClient interface { + Recv() (*LispEidTableMapDetails, error) + api.Stream +} + +type serviceClient_LispEidTableMapDumpClient struct { + api.Stream +} + +func (c *serviceClient_LispEidTableMapDumpClient) Recv() (*LispEidTableMapDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *LispEidTableMapDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) LispEidTableVniDump(ctx context.Context, in *LispEidTableVniDump) (RPCService_LispEidTableVniDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_LispEidTableVniDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_LispEidTableVniDumpClient interface { + Recv() (*LispEidTableVniDetails, error) + api.Stream +} + +type serviceClient_LispEidTableVniDumpClient struct { + api.Stream +} + +func (c *serviceClient_LispEidTableVniDumpClient) Recv() (*LispEidTableVniDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *LispEidTableVniDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) LispEnableDisable(ctx context.Context, in *LispEnableDisable) (*LispEnableDisableReply, error) { + out := new(LispEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LispGetMapRequestItrRlocs(ctx context.Context, in *LispGetMapRequestItrRlocs) (*LispGetMapRequestItrRlocsReply, error) { + out := new(LispGetMapRequestItrRlocsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LispLocatorDump(ctx context.Context, in *LispLocatorDump) (RPCService_LispLocatorDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_LispLocatorDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_LispLocatorDumpClient interface { + Recv() (*LispLocatorDetails, error) + api.Stream +} + +type serviceClient_LispLocatorDumpClient struct { + api.Stream +} + +func (c *serviceClient_LispLocatorDumpClient) Recv() (*LispLocatorDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *LispLocatorDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) LispLocatorSetDump(ctx context.Context, in *LispLocatorSetDump) (RPCService_LispLocatorSetDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_LispLocatorSetDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_LispLocatorSetDumpClient interface { + Recv() (*LispLocatorSetDetails, error) + api.Stream +} + +type serviceClient_LispLocatorSetDumpClient struct { + api.Stream +} + +func (c *serviceClient_LispLocatorSetDumpClient) Recv() (*LispLocatorSetDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *LispLocatorSetDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) LispMapRegisterEnableDisable(ctx context.Context, in *LispMapRegisterEnableDisable) (*LispMapRegisterEnableDisableReply, error) { + out := new(LispMapRegisterEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LispMapRequestMode(ctx context.Context, in *LispMapRequestMode) (*LispMapRequestModeReply, error) { + out := new(LispMapRequestModeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LispMapResolverDump(ctx context.Context, in *LispMapResolverDump) (RPCService_LispMapResolverDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_LispMapResolverDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_LispMapResolverDumpClient interface { + Recv() (*LispMapResolverDetails, error) + api.Stream +} + +type serviceClient_LispMapResolverDumpClient struct { + api.Stream +} + +func (c *serviceClient_LispMapResolverDumpClient) Recv() (*LispMapResolverDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *LispMapResolverDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) LispMapServerDump(ctx context.Context, in *LispMapServerDump) (RPCService_LispMapServerDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_LispMapServerDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_LispMapServerDumpClient interface { + Recv() (*LispMapServerDetails, error) + api.Stream +} + +type serviceClient_LispMapServerDumpClient struct { + api.Stream +} + +func (c *serviceClient_LispMapServerDumpClient) Recv() (*LispMapServerDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *LispMapServerDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) LispPitrSetLocatorSet(ctx context.Context, in *LispPitrSetLocatorSet) (*LispPitrSetLocatorSetReply, error) { + out := new(LispPitrSetLocatorSetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LispRlocProbeEnableDisable(ctx context.Context, in *LispRlocProbeEnableDisable) (*LispRlocProbeEnableDisableReply, error) { + out := new(LispRlocProbeEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LispUsePetr(ctx context.Context, in *LispUsePetr) (*LispUsePetrReply, error) { + out := new(LispUsePetrReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowLispMapRegisterState(ctx context.Context, in *ShowLispMapRegisterState) (*ShowLispMapRegisterStateReply, error) { + out := new(ShowLispMapRegisterStateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowLispMapRequestMode(ctx context.Context, in *ShowLispMapRequestMode) (*ShowLispMapRequestModeReply, error) { + out := new(ShowLispMapRequestModeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowLispPitr(ctx context.Context, in *ShowLispPitr) (*ShowLispPitrReply, error) { + out := new(ShowLispPitrReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowLispRlocProbeState(ctx context.Context, in *ShowLispRlocProbeState) (*ShowLispRlocProbeStateReply, error) { + out := new(ShowLispRlocProbeStateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowLispStatus(ctx context.Context, in *ShowLispStatus) (*ShowLispStatusReply, error) { + out := new(ShowLispStatusReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowLispUsePetr(ctx context.Context, in *ShowLispUsePetr) (*ShowLispUsePetrReply, error) { + out := new(ShowLispUsePetrReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/lisp_gpe/lisp_gpe.ba.go b/binapi/lisp_gpe/lisp_gpe.ba.go new file mode 100644 index 0000000..bd817a3 --- /dev/null +++ b/binapi/lisp_gpe/lisp_gpe.ba.go @@ -0,0 +1,1019 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/lisp_gpe.api.json + +// Package lisp_gpe contains generated bindings for API file lisp_gpe.api. +// +// Contents: +// 3 structs +// 20 messages +// +package lisp_gpe + +import ( + api "git.fd.io/govpp.git/api" + _ "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + lisp_types "git.fd.io/govpp.git/binapi/lisp_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "lisp_gpe" + APIVersion = "2.0.0" + VersionCrc = 0x4947ac96 +) + +// GpeFwdEntry defines type 'gpe_fwd_entry'. +type GpeFwdEntry struct { + FwdEntryIndex uint32 `binapi:"u32,name=fwd_entry_index" json:"fwd_entry_index,omitempty"` + DpTable uint32 `binapi:"u32,name=dp_table" json:"dp_table,omitempty"` + Leid lisp_types.Eid `binapi:"eid,name=leid" json:"leid,omitempty"` + Reid lisp_types.Eid `binapi:"eid,name=reid" json:"reid,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + Action uint8 `binapi:"u8,name=action" json:"action,omitempty"` +} + +// GpeLocator defines type 'gpe_locator'. +type GpeLocator struct { + Weight uint8 `binapi:"u8,name=weight" json:"weight,omitempty"` + Addr ip_types.Address `binapi:"address,name=addr" json:"addr,omitempty"` +} + +// GpeNativeFwdRpath defines type 'gpe_native_fwd_rpath'. +type GpeNativeFwdRpath struct { + FibIndex uint32 `binapi:"u32,name=fib_index" json:"fib_index,omitempty"` + NhSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=nh_sw_if_index" json:"nh_sw_if_index,omitempty"` + NhAddr ip_types.Address `binapi:"address,name=nh_addr" json:"nh_addr,omitempty"` +} + +// GpeAddDelFwdEntry defines message 'gpe_add_del_fwd_entry'. +type GpeAddDelFwdEntry struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + RmtEid lisp_types.Eid `binapi:"eid,name=rmt_eid" json:"rmt_eid,omitempty"` + LclEid lisp_types.Eid `binapi:"eid,name=lcl_eid" json:"lcl_eid,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + DpTable uint32 `binapi:"u32,name=dp_table" json:"dp_table,omitempty"` + Action uint8 `binapi:"u8,name=action" json:"action,omitempty"` + LocNum uint32 `binapi:"u32,name=loc_num" json:"-"` + Locs []GpeLocator `binapi:"gpe_locator[loc_num],name=locs" json:"locs,omitempty"` +} + +func (m *GpeAddDelFwdEntry) Reset() { *m = GpeAddDelFwdEntry{} } +func (*GpeAddDelFwdEntry) GetMessageName() string { return "gpe_add_del_fwd_entry" } +func (*GpeAddDelFwdEntry) GetCrcString() string { return "de6df50f" } +func (*GpeAddDelFwdEntry) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GpeAddDelFwdEntry) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.RmtEid.Type + size += 1 * 6 // m.RmtEid.Address + size += 1 // m.LclEid.Type + size += 1 * 6 // m.LclEid.Address + size += 4 // m.Vni + size += 4 // m.DpTable + size += 1 // m.Action + size += 4 // m.LocNum + for j1 := 0; j1 < len(m.Locs); j1++ { + var s1 GpeLocator + _ = s1 + if j1 < len(m.Locs) { + s1 = m.Locs[j1] + } + size += 1 // s1.Weight + size += 1 // s1.Addr.Af + size += 1 * 16 // s1.Addr.Un + } + return size +} +func (m *GpeAddDelFwdEntry) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.RmtEid.Type)) + buf.EncodeBytes(m.RmtEid.Address.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.LclEid.Type)) + buf.EncodeBytes(m.LclEid.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.Vni)) + buf.EncodeUint32(uint32(m.DpTable)) + buf.EncodeUint8(uint8(m.Action)) + buf.EncodeUint32(uint32(len(m.Locs))) + for j0 := 0; j0 < len(m.Locs); j0++ { + var v0 GpeLocator + if j0 < len(m.Locs) { + v0 = m.Locs[j0] + } + buf.EncodeUint8(uint8(v0.Weight)) + buf.EncodeUint8(uint8(v0.Addr.Af)) + buf.EncodeBytes(v0.Addr.Un.XXX_UnionData[:], 0) + } + return buf.Bytes(), nil +} +func (m *GpeAddDelFwdEntry) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.RmtEid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.RmtEid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + m.LclEid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.LclEid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + m.Vni = buf.DecodeUint32() + m.DpTable = buf.DecodeUint32() + m.Action = buf.DecodeUint8() + m.LocNum = buf.DecodeUint32() + m.Locs = make([]GpeLocator, int(m.LocNum)) + for j0 := 0; j0 < len(m.Locs); j0++ { + m.Locs[j0].Weight = buf.DecodeUint8() + m.Locs[j0].Addr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Locs[j0].Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + } + return nil +} + +// GpeAddDelFwdEntryReply defines message 'gpe_add_del_fwd_entry_reply'. +type GpeAddDelFwdEntryReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + FwdEntryIndex uint32 `binapi:"u32,name=fwd_entry_index" json:"fwd_entry_index,omitempty"` +} + +func (m *GpeAddDelFwdEntryReply) Reset() { *m = GpeAddDelFwdEntryReply{} } +func (*GpeAddDelFwdEntryReply) GetMessageName() string { return "gpe_add_del_fwd_entry_reply" } +func (*GpeAddDelFwdEntryReply) GetCrcString() string { return "efe5f176" } +func (*GpeAddDelFwdEntryReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GpeAddDelFwdEntryReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.FwdEntryIndex + return size +} +func (m *GpeAddDelFwdEntryReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.FwdEntryIndex)) + return buf.Bytes(), nil +} +func (m *GpeAddDelFwdEntryReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.FwdEntryIndex = buf.DecodeUint32() + return nil +} + +// GpeAddDelIface defines message 'gpe_add_del_iface'. +type GpeAddDelIface struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IsL2 bool `binapi:"bool,name=is_l2" json:"is_l2,omitempty"` + DpTable uint32 `binapi:"u32,name=dp_table" json:"dp_table,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` +} + +func (m *GpeAddDelIface) Reset() { *m = GpeAddDelIface{} } +func (*GpeAddDelIface) GetMessageName() string { return "gpe_add_del_iface" } +func (*GpeAddDelIface) GetCrcString() string { return "3ccff273" } +func (*GpeAddDelIface) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GpeAddDelIface) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.IsL2 + size += 4 // m.DpTable + size += 4 // m.Vni + return size +} +func (m *GpeAddDelIface) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeBool(m.IsL2) + buf.EncodeUint32(uint32(m.DpTable)) + buf.EncodeUint32(uint32(m.Vni)) + return buf.Bytes(), nil +} +func (m *GpeAddDelIface) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.IsL2 = buf.DecodeBool() + m.DpTable = buf.DecodeUint32() + m.Vni = buf.DecodeUint32() + return nil +} + +// GpeAddDelIfaceReply defines message 'gpe_add_del_iface_reply'. +type GpeAddDelIfaceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *GpeAddDelIfaceReply) Reset() { *m = GpeAddDelIfaceReply{} } +func (*GpeAddDelIfaceReply) GetMessageName() string { return "gpe_add_del_iface_reply" } +func (*GpeAddDelIfaceReply) GetCrcString() string { return "e8d4e804" } +func (*GpeAddDelIfaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GpeAddDelIfaceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *GpeAddDelIfaceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *GpeAddDelIfaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// GpeAddDelNativeFwdRpath defines message 'gpe_add_del_native_fwd_rpath'. +type GpeAddDelNativeFwdRpath struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + NhSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=nh_sw_if_index" json:"nh_sw_if_index,omitempty"` + NhAddr ip_types.Address `binapi:"address,name=nh_addr" json:"nh_addr,omitempty"` +} + +func (m *GpeAddDelNativeFwdRpath) Reset() { *m = GpeAddDelNativeFwdRpath{} } +func (*GpeAddDelNativeFwdRpath) GetMessageName() string { return "gpe_add_del_native_fwd_rpath" } +func (*GpeAddDelNativeFwdRpath) GetCrcString() string { return "812da2f2" } +func (*GpeAddDelNativeFwdRpath) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GpeAddDelNativeFwdRpath) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.TableID + size += 4 // m.NhSwIfIndex + size += 1 // m.NhAddr.Af + size += 1 * 16 // m.NhAddr.Un + return size +} +func (m *GpeAddDelNativeFwdRpath) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.TableID)) + buf.EncodeUint32(uint32(m.NhSwIfIndex)) + buf.EncodeUint8(uint8(m.NhAddr.Af)) + buf.EncodeBytes(m.NhAddr.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *GpeAddDelNativeFwdRpath) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.TableID = buf.DecodeUint32() + m.NhSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.NhAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.NhAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// GpeAddDelNativeFwdRpathReply defines message 'gpe_add_del_native_fwd_rpath_reply'. +type GpeAddDelNativeFwdRpathReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *GpeAddDelNativeFwdRpathReply) Reset() { *m = GpeAddDelNativeFwdRpathReply{} } +func (*GpeAddDelNativeFwdRpathReply) GetMessageName() string { + return "gpe_add_del_native_fwd_rpath_reply" +} +func (*GpeAddDelNativeFwdRpathReply) GetCrcString() string { return "e8d4e804" } +func (*GpeAddDelNativeFwdRpathReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GpeAddDelNativeFwdRpathReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *GpeAddDelNativeFwdRpathReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *GpeAddDelNativeFwdRpathReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// GpeEnableDisable defines message 'gpe_enable_disable'. +type GpeEnableDisable struct { + IsEnable bool `binapi:"bool,name=is_enable,default=true" json:"is_enable,omitempty"` +} + +func (m *GpeEnableDisable) Reset() { *m = GpeEnableDisable{} } +func (*GpeEnableDisable) GetMessageName() string { return "gpe_enable_disable" } +func (*GpeEnableDisable) GetCrcString() string { return "c264d7bf" } +func (*GpeEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GpeEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsEnable + return size +} +func (m *GpeEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsEnable) + return buf.Bytes(), nil +} +func (m *GpeEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsEnable = buf.DecodeBool() + return nil +} + +// GpeEnableDisableReply defines message 'gpe_enable_disable_reply'. +type GpeEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *GpeEnableDisableReply) Reset() { *m = GpeEnableDisableReply{} } +func (*GpeEnableDisableReply) GetMessageName() string { return "gpe_enable_disable_reply" } +func (*GpeEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*GpeEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GpeEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *GpeEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *GpeEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// GpeFwdEntriesGet defines message 'gpe_fwd_entries_get'. +type GpeFwdEntriesGet struct { + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` +} + +func (m *GpeFwdEntriesGet) Reset() { *m = GpeFwdEntriesGet{} } +func (*GpeFwdEntriesGet) GetMessageName() string { return "gpe_fwd_entries_get" } +func (*GpeFwdEntriesGet) GetCrcString() string { return "8d1f2fe9" } +func (*GpeFwdEntriesGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GpeFwdEntriesGet) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Vni + return size +} +func (m *GpeFwdEntriesGet) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Vni)) + return buf.Bytes(), nil +} +func (m *GpeFwdEntriesGet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Vni = buf.DecodeUint32() + return nil +} + +// GpeFwdEntriesGetReply defines message 'gpe_fwd_entries_get_reply'. +type GpeFwdEntriesGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + Entries []GpeFwdEntry `binapi:"gpe_fwd_entry[count],name=entries" json:"entries,omitempty"` +} + +func (m *GpeFwdEntriesGetReply) Reset() { *m = GpeFwdEntriesGetReply{} } +func (*GpeFwdEntriesGetReply) GetMessageName() string { return "gpe_fwd_entries_get_reply" } +func (*GpeFwdEntriesGetReply) GetCrcString() string { return "f9f53f1b" } +func (*GpeFwdEntriesGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GpeFwdEntriesGetReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.Count + for j1 := 0; j1 < len(m.Entries); j1++ { + var s1 GpeFwdEntry + _ = s1 + if j1 < len(m.Entries) { + s1 = m.Entries[j1] + } + size += 4 // s1.FwdEntryIndex + size += 4 // s1.DpTable + size += 1 // s1.Leid.Type + size += 1 * 6 // s1.Leid.Address + size += 1 // s1.Reid.Type + size += 1 * 6 // s1.Reid.Address + size += 4 // s1.Vni + size += 1 // s1.Action + } + return size +} +func (m *GpeFwdEntriesGetReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(len(m.Entries))) + for j0 := 0; j0 < len(m.Entries); j0++ { + var v0 GpeFwdEntry + if j0 < len(m.Entries) { + v0 = m.Entries[j0] + } + buf.EncodeUint32(uint32(v0.FwdEntryIndex)) + buf.EncodeUint32(uint32(v0.DpTable)) + buf.EncodeUint8(uint8(v0.Leid.Type)) + buf.EncodeBytes(v0.Leid.Address.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(v0.Reid.Type)) + buf.EncodeBytes(v0.Reid.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v0.Vni)) + buf.EncodeUint8(uint8(v0.Action)) + } + return buf.Bytes(), nil +} +func (m *GpeFwdEntriesGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Count = buf.DecodeUint32() + m.Entries = make([]GpeFwdEntry, int(m.Count)) + for j0 := 0; j0 < len(m.Entries); j0++ { + m.Entries[j0].FwdEntryIndex = buf.DecodeUint32() + m.Entries[j0].DpTable = buf.DecodeUint32() + m.Entries[j0].Leid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Entries[j0].Leid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + m.Entries[j0].Reid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Entries[j0].Reid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + m.Entries[j0].Vni = buf.DecodeUint32() + m.Entries[j0].Action = buf.DecodeUint8() + } + return nil +} + +// GpeFwdEntryPathDetails defines message 'gpe_fwd_entry_path_details'. +type GpeFwdEntryPathDetails struct { + LclLoc GpeLocator `binapi:"gpe_locator,name=lcl_loc" json:"lcl_loc,omitempty"` + RmtLoc GpeLocator `binapi:"gpe_locator,name=rmt_loc" json:"rmt_loc,omitempty"` +} + +func (m *GpeFwdEntryPathDetails) Reset() { *m = GpeFwdEntryPathDetails{} } +func (*GpeFwdEntryPathDetails) GetMessageName() string { return "gpe_fwd_entry_path_details" } +func (*GpeFwdEntryPathDetails) GetCrcString() string { return "ee80b19a" } +func (*GpeFwdEntryPathDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GpeFwdEntryPathDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.LclLoc.Weight + size += 1 // m.LclLoc.Addr.Af + size += 1 * 16 // m.LclLoc.Addr.Un + size += 1 // m.RmtLoc.Weight + size += 1 // m.RmtLoc.Addr.Af + size += 1 * 16 // m.RmtLoc.Addr.Un + return size +} +func (m *GpeFwdEntryPathDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.LclLoc.Weight)) + buf.EncodeUint8(uint8(m.LclLoc.Addr.Af)) + buf.EncodeBytes(m.LclLoc.Addr.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.RmtLoc.Weight)) + buf.EncodeUint8(uint8(m.RmtLoc.Addr.Af)) + buf.EncodeBytes(m.RmtLoc.Addr.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *GpeFwdEntryPathDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.LclLoc.Weight = buf.DecodeUint8() + m.LclLoc.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.LclLoc.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.RmtLoc.Weight = buf.DecodeUint8() + m.RmtLoc.Addr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.RmtLoc.Addr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// GpeFwdEntryPathDump defines message 'gpe_fwd_entry_path_dump'. +type GpeFwdEntryPathDump struct { + FwdEntryIndex uint32 `binapi:"u32,name=fwd_entry_index" json:"fwd_entry_index,omitempty"` +} + +func (m *GpeFwdEntryPathDump) Reset() { *m = GpeFwdEntryPathDump{} } +func (*GpeFwdEntryPathDump) GetMessageName() string { return "gpe_fwd_entry_path_dump" } +func (*GpeFwdEntryPathDump) GetCrcString() string { return "39bce980" } +func (*GpeFwdEntryPathDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GpeFwdEntryPathDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.FwdEntryIndex + return size +} +func (m *GpeFwdEntryPathDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.FwdEntryIndex)) + return buf.Bytes(), nil +} +func (m *GpeFwdEntryPathDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.FwdEntryIndex = buf.DecodeUint32() + return nil +} + +// GpeFwdEntryVnisGet defines message 'gpe_fwd_entry_vnis_get'. +type GpeFwdEntryVnisGet struct{} + +func (m *GpeFwdEntryVnisGet) Reset() { *m = GpeFwdEntryVnisGet{} } +func (*GpeFwdEntryVnisGet) GetMessageName() string { return "gpe_fwd_entry_vnis_get" } +func (*GpeFwdEntryVnisGet) GetCrcString() string { return "51077d14" } +func (*GpeFwdEntryVnisGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GpeFwdEntryVnisGet) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *GpeFwdEntryVnisGet) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *GpeFwdEntryVnisGet) Unmarshal(b []byte) error { + return nil +} + +// GpeFwdEntryVnisGetReply defines message 'gpe_fwd_entry_vnis_get_reply'. +type GpeFwdEntryVnisGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + Vnis []uint32 `binapi:"u32[count],name=vnis" json:"vnis,omitempty"` +} + +func (m *GpeFwdEntryVnisGetReply) Reset() { *m = GpeFwdEntryVnisGetReply{} } +func (*GpeFwdEntryVnisGetReply) GetMessageName() string { return "gpe_fwd_entry_vnis_get_reply" } +func (*GpeFwdEntryVnisGetReply) GetCrcString() string { return "aa70da20" } +func (*GpeFwdEntryVnisGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GpeFwdEntryVnisGetReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.Count + size += 4 * len(m.Vnis) // m.Vnis + return size +} +func (m *GpeFwdEntryVnisGetReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(len(m.Vnis))) + for i := 0; i < len(m.Vnis); i++ { + var x uint32 + if i < len(m.Vnis) { + x = uint32(m.Vnis[i]) + } + buf.EncodeUint32(uint32(x)) + } + return buf.Bytes(), nil +} +func (m *GpeFwdEntryVnisGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Count = buf.DecodeUint32() + m.Vnis = make([]uint32, m.Count) + for i := 0; i < len(m.Vnis); i++ { + m.Vnis[i] = buf.DecodeUint32() + } + return nil +} + +// GpeGetEncapMode defines message 'gpe_get_encap_mode'. +type GpeGetEncapMode struct{} + +func (m *GpeGetEncapMode) Reset() { *m = GpeGetEncapMode{} } +func (*GpeGetEncapMode) GetMessageName() string { return "gpe_get_encap_mode" } +func (*GpeGetEncapMode) GetCrcString() string { return "51077d14" } +func (*GpeGetEncapMode) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GpeGetEncapMode) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *GpeGetEncapMode) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *GpeGetEncapMode) Unmarshal(b []byte) error { + return nil +} + +// GpeGetEncapModeReply defines message 'gpe_get_encap_mode_reply'. +type GpeGetEncapModeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + EncapMode uint8 `binapi:"u8,name=encap_mode" json:"encap_mode,omitempty"` +} + +func (m *GpeGetEncapModeReply) Reset() { *m = GpeGetEncapModeReply{} } +func (*GpeGetEncapModeReply) GetMessageName() string { return "gpe_get_encap_mode_reply" } +func (*GpeGetEncapModeReply) GetCrcString() string { return "36e3f7ca" } +func (*GpeGetEncapModeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GpeGetEncapModeReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.EncapMode + return size +} +func (m *GpeGetEncapModeReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint8(uint8(m.EncapMode)) + return buf.Bytes(), nil +} +func (m *GpeGetEncapModeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.EncapMode = buf.DecodeUint8() + return nil +} + +// GpeNativeFwdRpathsGet defines message 'gpe_native_fwd_rpaths_get'. +type GpeNativeFwdRpathsGet struct { + IsIP4 bool `binapi:"bool,name=is_ip4" json:"is_ip4,omitempty"` +} + +func (m *GpeNativeFwdRpathsGet) Reset() { *m = GpeNativeFwdRpathsGet{} } +func (*GpeNativeFwdRpathsGet) GetMessageName() string { return "gpe_native_fwd_rpaths_get" } +func (*GpeNativeFwdRpathsGet) GetCrcString() string { return "f652ceb4" } +func (*GpeNativeFwdRpathsGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GpeNativeFwdRpathsGet) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsIP4 + return size +} +func (m *GpeNativeFwdRpathsGet) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsIP4) + return buf.Bytes(), nil +} +func (m *GpeNativeFwdRpathsGet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsIP4 = buf.DecodeBool() + return nil +} + +// GpeNativeFwdRpathsGetReply defines message 'gpe_native_fwd_rpaths_get_reply'. +type GpeNativeFwdRpathsGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + Entries []GpeNativeFwdRpath `binapi:"gpe_native_fwd_rpath[count],name=entries" json:"entries,omitempty"` +} + +func (m *GpeNativeFwdRpathsGetReply) Reset() { *m = GpeNativeFwdRpathsGetReply{} } +func (*GpeNativeFwdRpathsGetReply) GetMessageName() string { return "gpe_native_fwd_rpaths_get_reply" } +func (*GpeNativeFwdRpathsGetReply) GetCrcString() string { return "79d54eb9" } +func (*GpeNativeFwdRpathsGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GpeNativeFwdRpathsGetReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.Count + for j1 := 0; j1 < len(m.Entries); j1++ { + var s1 GpeNativeFwdRpath + _ = s1 + if j1 < len(m.Entries) { + s1 = m.Entries[j1] + } + size += 4 // s1.FibIndex + size += 4 // s1.NhSwIfIndex + size += 1 // s1.NhAddr.Af + size += 1 * 16 // s1.NhAddr.Un + } + return size +} +func (m *GpeNativeFwdRpathsGetReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(len(m.Entries))) + for j0 := 0; j0 < len(m.Entries); j0++ { + var v0 GpeNativeFwdRpath + if j0 < len(m.Entries) { + v0 = m.Entries[j0] + } + buf.EncodeUint32(uint32(v0.FibIndex)) + buf.EncodeUint32(uint32(v0.NhSwIfIndex)) + buf.EncodeUint8(uint8(v0.NhAddr.Af)) + buf.EncodeBytes(v0.NhAddr.Un.XXX_UnionData[:], 0) + } + return buf.Bytes(), nil +} +func (m *GpeNativeFwdRpathsGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Count = buf.DecodeUint32() + m.Entries = make([]GpeNativeFwdRpath, int(m.Count)) + for j0 := 0; j0 < len(m.Entries); j0++ { + m.Entries[j0].FibIndex = buf.DecodeUint32() + m.Entries[j0].NhSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Entries[j0].NhAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entries[j0].NhAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + } + return nil +} + +// GpeSetEncapMode defines message 'gpe_set_encap_mode'. +type GpeSetEncapMode struct { + IsVxlan bool `binapi:"bool,name=is_vxlan" json:"is_vxlan,omitempty"` +} + +func (m *GpeSetEncapMode) Reset() { *m = GpeSetEncapMode{} } +func (*GpeSetEncapMode) GetMessageName() string { return "gpe_set_encap_mode" } +func (*GpeSetEncapMode) GetCrcString() string { return "bd819eac" } +func (*GpeSetEncapMode) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GpeSetEncapMode) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsVxlan + return size +} +func (m *GpeSetEncapMode) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsVxlan) + return buf.Bytes(), nil +} +func (m *GpeSetEncapMode) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsVxlan = buf.DecodeBool() + return nil +} + +// GpeSetEncapModeReply defines message 'gpe_set_encap_mode_reply'. +type GpeSetEncapModeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *GpeSetEncapModeReply) Reset() { *m = GpeSetEncapModeReply{} } +func (*GpeSetEncapModeReply) GetMessageName() string { return "gpe_set_encap_mode_reply" } +func (*GpeSetEncapModeReply) GetCrcString() string { return "e8d4e804" } +func (*GpeSetEncapModeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GpeSetEncapModeReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *GpeSetEncapModeReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *GpeSetEncapModeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_lisp_gpe_binapi_init() } +func file_lisp_gpe_binapi_init() { + api.RegisterMessage((*GpeAddDelFwdEntry)(nil), "gpe_add_del_fwd_entry_de6df50f") + api.RegisterMessage((*GpeAddDelFwdEntryReply)(nil), "gpe_add_del_fwd_entry_reply_efe5f176") + api.RegisterMessage((*GpeAddDelIface)(nil), "gpe_add_del_iface_3ccff273") + api.RegisterMessage((*GpeAddDelIfaceReply)(nil), "gpe_add_del_iface_reply_e8d4e804") + api.RegisterMessage((*GpeAddDelNativeFwdRpath)(nil), "gpe_add_del_native_fwd_rpath_812da2f2") + api.RegisterMessage((*GpeAddDelNativeFwdRpathReply)(nil), "gpe_add_del_native_fwd_rpath_reply_e8d4e804") + api.RegisterMessage((*GpeEnableDisable)(nil), "gpe_enable_disable_c264d7bf") + api.RegisterMessage((*GpeEnableDisableReply)(nil), "gpe_enable_disable_reply_e8d4e804") + api.RegisterMessage((*GpeFwdEntriesGet)(nil), "gpe_fwd_entries_get_8d1f2fe9") + api.RegisterMessage((*GpeFwdEntriesGetReply)(nil), "gpe_fwd_entries_get_reply_f9f53f1b") + api.RegisterMessage((*GpeFwdEntryPathDetails)(nil), "gpe_fwd_entry_path_details_ee80b19a") + api.RegisterMessage((*GpeFwdEntryPathDump)(nil), "gpe_fwd_entry_path_dump_39bce980") + api.RegisterMessage((*GpeFwdEntryVnisGet)(nil), "gpe_fwd_entry_vnis_get_51077d14") + api.RegisterMessage((*GpeFwdEntryVnisGetReply)(nil), "gpe_fwd_entry_vnis_get_reply_aa70da20") + api.RegisterMessage((*GpeGetEncapMode)(nil), "gpe_get_encap_mode_51077d14") + api.RegisterMessage((*GpeGetEncapModeReply)(nil), "gpe_get_encap_mode_reply_36e3f7ca") + api.RegisterMessage((*GpeNativeFwdRpathsGet)(nil), "gpe_native_fwd_rpaths_get_f652ceb4") + api.RegisterMessage((*GpeNativeFwdRpathsGetReply)(nil), "gpe_native_fwd_rpaths_get_reply_79d54eb9") + api.RegisterMessage((*GpeSetEncapMode)(nil), "gpe_set_encap_mode_bd819eac") + api.RegisterMessage((*GpeSetEncapModeReply)(nil), "gpe_set_encap_mode_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*GpeAddDelFwdEntry)(nil), + (*GpeAddDelFwdEntryReply)(nil), + (*GpeAddDelIface)(nil), + (*GpeAddDelIfaceReply)(nil), + (*GpeAddDelNativeFwdRpath)(nil), + (*GpeAddDelNativeFwdRpathReply)(nil), + (*GpeEnableDisable)(nil), + (*GpeEnableDisableReply)(nil), + (*GpeFwdEntriesGet)(nil), + (*GpeFwdEntriesGetReply)(nil), + (*GpeFwdEntryPathDetails)(nil), + (*GpeFwdEntryPathDump)(nil), + (*GpeFwdEntryVnisGet)(nil), + (*GpeFwdEntryVnisGetReply)(nil), + (*GpeGetEncapMode)(nil), + (*GpeGetEncapModeReply)(nil), + (*GpeNativeFwdRpathsGet)(nil), + (*GpeNativeFwdRpathsGetReply)(nil), + (*GpeSetEncapMode)(nil), + (*GpeSetEncapModeReply)(nil), + } +} diff --git a/binapi/lisp_gpe/lisp_gpe_rest.ba.go b/binapi/lisp_gpe/lisp_gpe_rest.ba.go new file mode 100644 index 0000000..498b211 --- /dev/null +++ b/binapi/lisp_gpe/lisp_gpe_rest.ba.go @@ -0,0 +1,203 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package lisp_gpe + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/gpe_add_del_fwd_entry", func(w http.ResponseWriter, req *http.Request) { + var request = new(GpeAddDelFwdEntry) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GpeAddDelFwdEntry(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/gpe_add_del_iface", func(w http.ResponseWriter, req *http.Request) { + var request = new(GpeAddDelIface) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GpeAddDelIface(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/gpe_add_del_native_fwd_rpath", func(w http.ResponseWriter, req *http.Request) { + var request = new(GpeAddDelNativeFwdRpath) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GpeAddDelNativeFwdRpath(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/gpe_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(GpeEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GpeEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/gpe_fwd_entries_get", func(w http.ResponseWriter, req *http.Request) { + var request = new(GpeFwdEntriesGet) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GpeFwdEntriesGet(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/gpe_fwd_entry_vnis_get", func(w http.ResponseWriter, req *http.Request) { + var request = new(GpeFwdEntryVnisGet) + reply, err := rpc.GpeFwdEntryVnisGet(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/gpe_get_encap_mode", func(w http.ResponseWriter, req *http.Request) { + var request = new(GpeGetEncapMode) + reply, err := rpc.GpeGetEncapMode(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/gpe_native_fwd_rpaths_get", func(w http.ResponseWriter, req *http.Request) { + var request = new(GpeNativeFwdRpathsGet) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GpeNativeFwdRpathsGet(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/gpe_set_encap_mode", func(w http.ResponseWriter, req *http.Request) { + var request = new(GpeSetEncapMode) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GpeSetEncapMode(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/lisp_gpe/lisp_gpe_rpc.ba.go b/binapi/lisp_gpe/lisp_gpe_rpc.ba.go new file mode 100644 index 0000000..42dcb31 --- /dev/null +++ b/binapi/lisp_gpe/lisp_gpe_rpc.ba.go @@ -0,0 +1,153 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package lisp_gpe + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service lisp_gpe. +type RPCService interface { + GpeAddDelFwdEntry(ctx context.Context, in *GpeAddDelFwdEntry) (*GpeAddDelFwdEntryReply, error) + GpeAddDelIface(ctx context.Context, in *GpeAddDelIface) (*GpeAddDelIfaceReply, error) + GpeAddDelNativeFwdRpath(ctx context.Context, in *GpeAddDelNativeFwdRpath) (*GpeAddDelNativeFwdRpathReply, error) + GpeEnableDisable(ctx context.Context, in *GpeEnableDisable) (*GpeEnableDisableReply, error) + GpeFwdEntriesGet(ctx context.Context, in *GpeFwdEntriesGet) (*GpeFwdEntriesGetReply, error) + GpeFwdEntryPathDump(ctx context.Context, in *GpeFwdEntryPathDump) (RPCService_GpeFwdEntryPathDumpClient, error) + GpeFwdEntryVnisGet(ctx context.Context, in *GpeFwdEntryVnisGet) (*GpeFwdEntryVnisGetReply, error) + GpeGetEncapMode(ctx context.Context, in *GpeGetEncapMode) (*GpeGetEncapModeReply, error) + GpeNativeFwdRpathsGet(ctx context.Context, in *GpeNativeFwdRpathsGet) (*GpeNativeFwdRpathsGetReply, error) + GpeSetEncapMode(ctx context.Context, in *GpeSetEncapMode) (*GpeSetEncapModeReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) GpeAddDelFwdEntry(ctx context.Context, in *GpeAddDelFwdEntry) (*GpeAddDelFwdEntryReply, error) { + out := new(GpeAddDelFwdEntryReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GpeAddDelIface(ctx context.Context, in *GpeAddDelIface) (*GpeAddDelIfaceReply, error) { + out := new(GpeAddDelIfaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GpeAddDelNativeFwdRpath(ctx context.Context, in *GpeAddDelNativeFwdRpath) (*GpeAddDelNativeFwdRpathReply, error) { + out := new(GpeAddDelNativeFwdRpathReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GpeEnableDisable(ctx context.Context, in *GpeEnableDisable) (*GpeEnableDisableReply, error) { + out := new(GpeEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GpeFwdEntriesGet(ctx context.Context, in *GpeFwdEntriesGet) (*GpeFwdEntriesGetReply, error) { + out := new(GpeFwdEntriesGetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GpeFwdEntryPathDump(ctx context.Context, in *GpeFwdEntryPathDump) (RPCService_GpeFwdEntryPathDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_GpeFwdEntryPathDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_GpeFwdEntryPathDumpClient interface { + Recv() (*GpeFwdEntryPathDetails, error) + api.Stream +} + +type serviceClient_GpeFwdEntryPathDumpClient struct { + api.Stream +} + +func (c *serviceClient_GpeFwdEntryPathDumpClient) Recv() (*GpeFwdEntryPathDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *GpeFwdEntryPathDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) GpeFwdEntryVnisGet(ctx context.Context, in *GpeFwdEntryVnisGet) (*GpeFwdEntryVnisGetReply, error) { + out := new(GpeFwdEntryVnisGetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GpeGetEncapMode(ctx context.Context, in *GpeGetEncapMode) (*GpeGetEncapModeReply, error) { + out := new(GpeGetEncapModeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GpeNativeFwdRpathsGet(ctx context.Context, in *GpeNativeFwdRpathsGet) (*GpeNativeFwdRpathsGetReply, error) { + out := new(GpeNativeFwdRpathsGetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GpeSetEncapMode(ctx context.Context, in *GpeSetEncapMode) (*GpeSetEncapModeReply, error) { + out := new(GpeSetEncapModeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/lisp_types/lisp_types.ba.go b/binapi/lisp_types/lisp_types.ba.go new file mode 100644 index 0000000..6bae4b7 --- /dev/null +++ b/binapi/lisp_types/lisp_types.ba.go @@ -0,0 +1,177 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/lisp_types.api.json + +// Package lisp_types contains generated bindings for API file lisp_types.api. +// +// Contents: +// 2 enums +// 5 structs +// 1 union +// +package lisp_types + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +// EidType defines enum 'eid_type'. +type EidType uint8 + +const ( + EID_TYPE_API_PREFIX EidType = 0 + EID_TYPE_API_MAC EidType = 1 + EID_TYPE_API_NSH EidType = 2 +) + +var ( + EidType_name = map[uint8]string{ + 0: "EID_TYPE_API_PREFIX", + 1: "EID_TYPE_API_MAC", + 2: "EID_TYPE_API_NSH", + } + EidType_value = map[string]uint8{ + "EID_TYPE_API_PREFIX": 0, + "EID_TYPE_API_MAC": 1, + "EID_TYPE_API_NSH": 2, + } +) + +func (x EidType) String() string { + s, ok := EidType_name[uint8(x)] + if ok { + return s + } + return "EidType(" + strconv.Itoa(int(x)) + ")" +} + +// HmacKeyID defines enum 'hmac_key_id'. +type HmacKeyID uint8 + +const ( + KEY_ID_API_HMAC_NO_KEY HmacKeyID = 0 + KEY_ID_API_HMAC_SHA_1_96 HmacKeyID = 1 + KEY_ID_API_HMAC_SHA_256_128 HmacKeyID = 2 +) + +var ( + HmacKeyID_name = map[uint8]string{ + 0: "KEY_ID_API_HMAC_NO_KEY", + 1: "KEY_ID_API_HMAC_SHA_1_96", + 2: "KEY_ID_API_HMAC_SHA_256_128", + } + HmacKeyID_value = map[string]uint8{ + "KEY_ID_API_HMAC_NO_KEY": 0, + "KEY_ID_API_HMAC_SHA_1_96": 1, + "KEY_ID_API_HMAC_SHA_256_128": 2, + } +) + +func (x HmacKeyID) String() string { + s, ok := HmacKeyID_name[uint8(x)] + if ok { + return s + } + return "HmacKeyID(" + strconv.Itoa(int(x)) + ")" +} + +// Eid defines type 'eid'. +type Eid struct { + Type EidType `binapi:"eid_type,name=type" json:"type,omitempty"` + Address EidAddress `binapi:"eid_address,name=address" json:"address,omitempty"` +} + +// HmacKey defines type 'hmac_key'. +type HmacKey struct { + ID HmacKeyID `binapi:"hmac_key_id,name=id" json:"id,omitempty"` + Key []byte `binapi:"u8[64],name=key" json:"key,omitempty"` +} + +// LocalLocator defines type 'local_locator'. +type LocalLocator struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Priority uint8 `binapi:"u8,name=priority" json:"priority,omitempty"` + Weight uint8 `binapi:"u8,name=weight" json:"weight,omitempty"` +} + +// Nsh defines type 'nsh'. +type Nsh struct { + Spi uint32 `binapi:"u32,name=spi" json:"spi,omitempty"` + Si uint8 `binapi:"u8,name=si" json:"si,omitempty"` +} + +// RemoteLocator defines type 'remote_locator'. +type RemoteLocator struct { + Priority uint8 `binapi:"u8,name=priority" json:"priority,omitempty"` + Weight uint8 `binapi:"u8,name=weight" json:"weight,omitempty"` + IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"` +} + +// EidAddress defines union 'eid_address'. +type EidAddress struct { + // Prefix *ip_types.Prefix + // Mac *ethernet_types.MacAddress + // Nsh *Nsh + XXX_UnionData [6]byte +} + +func EidAddressPrefix(a ip_types.Prefix) (u EidAddress) { + u.SetPrefix(a) + return +} +func (u *EidAddress) SetPrefix(a ip_types.Prefix) { + var buf = codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeUint8(uint8(a.Address.Af)) + buf.EncodeBytes(a.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(a.Len)) +} +func (u *EidAddress) GetPrefix() (a ip_types.Prefix) { + var buf = codec.NewBuffer(u.XXX_UnionData[:]) + a.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(a.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + a.Len = buf.DecodeUint8() + return +} + +func EidAddressMac(a ethernet_types.MacAddress) (u EidAddress) { + u.SetMac(a) + return +} +func (u *EidAddress) SetMac(a ethernet_types.MacAddress) { + var buf = codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeBytes(a[:], 6) +} +func (u *EidAddress) GetMac() (a ethernet_types.MacAddress) { + var buf = codec.NewBuffer(u.XXX_UnionData[:]) + copy(a[:], buf.DecodeBytes(6)) + return +} + +func EidAddressNsh(a Nsh) (u EidAddress) { + u.SetNsh(a) + return +} +func (u *EidAddress) SetNsh(a Nsh) { + var buf = codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeUint32(uint32(a.Spi)) + buf.EncodeUint8(uint8(a.Si)) +} +func (u *EidAddress) GetNsh() (a Nsh) { + var buf = codec.NewBuffer(u.XXX_UnionData[:]) + a.Spi = buf.DecodeUint32() + a.Si = buf.DecodeUint8() + return +} diff --git a/binapi/lldp/lldp.ba.go b/binapi/lldp/lldp.ba.go new file mode 100644 index 0000000..a9bae7f --- /dev/null +++ b/binapi/lldp/lldp.ba.go @@ -0,0 +1,221 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/lldp.api.json + +// Package lldp contains generated bindings for API file lldp.api. +// +// Contents: +// 4 messages +// +package lldp + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "lldp" + APIVersion = "2.0.0" + VersionCrc = 0x44347d6 +) + +// LldpConfig defines message 'lldp_config'. +type LldpConfig struct { + TxHold uint32 `binapi:"u32,name=tx_hold" json:"tx_hold,omitempty"` + TxInterval uint32 `binapi:"u32,name=tx_interval" json:"tx_interval,omitempty"` + SystemName string `binapi:"string[],name=system_name" json:"system_name,omitempty"` +} + +func (m *LldpConfig) Reset() { *m = LldpConfig{} } +func (*LldpConfig) GetMessageName() string { return "lldp_config" } +func (*LldpConfig) GetCrcString() string { return "c14445df" } +func (*LldpConfig) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LldpConfig) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.TxHold + size += 4 // m.TxInterval + size += 4 + len(m.SystemName) // m.SystemName + return size +} +func (m *LldpConfig) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.TxHold)) + buf.EncodeUint32(uint32(m.TxInterval)) + buf.EncodeString(m.SystemName, 0) + return buf.Bytes(), nil +} +func (m *LldpConfig) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.TxHold = buf.DecodeUint32() + m.TxInterval = buf.DecodeUint32() + m.SystemName = buf.DecodeString(0) + return nil +} + +// LldpConfigReply defines message 'lldp_config_reply'. +type LldpConfigReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *LldpConfigReply) Reset() { *m = LldpConfigReply{} } +func (*LldpConfigReply) GetMessageName() string { return "lldp_config_reply" } +func (*LldpConfigReply) GetCrcString() string { return "e8d4e804" } +func (*LldpConfigReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LldpConfigReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *LldpConfigReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *LldpConfigReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceSetLldp defines message 'sw_interface_set_lldp'. +type SwInterfaceSetLldp struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + MgmtIP4 ip_types.IP4Address `binapi:"ip4_address,name=mgmt_ip4" json:"mgmt_ip4,omitempty"` + MgmtIP6 ip_types.IP6Address `binapi:"ip6_address,name=mgmt_ip6" json:"mgmt_ip6,omitempty"` + MgmtOid []byte `binapi:"u8[128],name=mgmt_oid" json:"mgmt_oid,omitempty"` + Enable bool `binapi:"bool,name=enable,default=true" json:"enable,omitempty"` + PortDesc string `binapi:"string[],name=port_desc" json:"port_desc,omitempty"` +} + +func (m *SwInterfaceSetLldp) Reset() { *m = SwInterfaceSetLldp{} } +func (*SwInterfaceSetLldp) GetMessageName() string { return "sw_interface_set_lldp" } +func (*SwInterfaceSetLldp) GetCrcString() string { return "d646ae0f" } +func (*SwInterfaceSetLldp) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetLldp) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 * 4 // m.MgmtIP4 + size += 1 * 16 // m.MgmtIP6 + size += 1 * 128 // m.MgmtOid + size += 1 // m.Enable + size += 4 + len(m.PortDesc) // m.PortDesc + return size +} +func (m *SwInterfaceSetLldp) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBytes(m.MgmtIP4[:], 4) + buf.EncodeBytes(m.MgmtIP6[:], 16) + buf.EncodeBytes(m.MgmtOid[:], 128) + buf.EncodeBool(m.Enable) + buf.EncodeString(m.PortDesc, 0) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetLldp) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + copy(m.MgmtIP4[:], buf.DecodeBytes(4)) + copy(m.MgmtIP6[:], buf.DecodeBytes(16)) + copy(m.MgmtOid[:], buf.DecodeBytes(128)) + m.Enable = buf.DecodeBool() + m.PortDesc = buf.DecodeString(0) + return nil +} + +// SwInterfaceSetLldpReply defines message 'sw_interface_set_lldp_reply'. +type SwInterfaceSetLldpReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetLldpReply) Reset() { *m = SwInterfaceSetLldpReply{} } +func (*SwInterfaceSetLldpReply) GetMessageName() string { return "sw_interface_set_lldp_reply" } +func (*SwInterfaceSetLldpReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetLldpReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetLldpReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetLldpReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetLldpReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_lldp_binapi_init() } +func file_lldp_binapi_init() { + api.RegisterMessage((*LldpConfig)(nil), "lldp_config_c14445df") + api.RegisterMessage((*LldpConfigReply)(nil), "lldp_config_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSetLldp)(nil), "sw_interface_set_lldp_d646ae0f") + api.RegisterMessage((*SwInterfaceSetLldpReply)(nil), "sw_interface_set_lldp_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*LldpConfig)(nil), + (*LldpConfigReply)(nil), + (*SwInterfaceSetLldp)(nil), + (*SwInterfaceSetLldpReply)(nil), + } +} diff --git a/binapi/lldp/lldp_rest.ba.go b/binapi/lldp/lldp_rest.ba.go new file mode 100644 index 0000000..807ef94 --- /dev/null +++ b/binapi/lldp/lldp_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package lldp + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/lldp_config", func(w http.ResponseWriter, req *http.Request) { + var request = new(LldpConfig) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.LldpConfig(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_set_lldp", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceSetLldp) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceSetLldp(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/lldp/lldp_rpc.ba.go b/binapi/lldp/lldp_rpc.ba.go new file mode 100644 index 0000000..9d5eb85 --- /dev/null +++ b/binapi/lldp/lldp_rpc.ba.go @@ -0,0 +1,40 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package lldp + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service lldp. +type RPCService interface { + LldpConfig(ctx context.Context, in *LldpConfig) (*LldpConfigReply, error) + SwInterfaceSetLldp(ctx context.Context, in *SwInterfaceSetLldp) (*SwInterfaceSetLldpReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) LldpConfig(ctx context.Context, in *LldpConfig) (*LldpConfigReply, error) { + out := new(LldpConfigReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetLldp(ctx context.Context, in *SwInterfaceSetLldp) (*SwInterfaceSetLldpReply, error) { + out := new(SwInterfaceSetLldpReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/mactime/mactime.ba.go b/binapi/mactime/mactime.ba.go new file mode 100644 index 0000000..4019d70 --- /dev/null +++ b/binapi/mactime/mactime.ba.go @@ -0,0 +1,430 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/mactime.api.json + +// Package mactime contains generated bindings for API file mactime.api. +// +// Contents: +// 2 structs +// 7 messages +// +package mactime + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "mactime" + APIVersion = "2.0.0" + VersionCrc = 0x9283d3e +) + +// MactimeTimeRange defines type 'mactime_time_range'. +type MactimeTimeRange struct { + Start float64 `binapi:"f64,name=start" json:"start,omitempty"` + End float64 `binapi:"f64,name=end" json:"end,omitempty"` +} + +// TimeRange defines type 'time_range'. +type TimeRange struct { + Start float64 `binapi:"f64,name=start" json:"start,omitempty"` + End float64 `binapi:"f64,name=end" json:"end,omitempty"` +} + +// MactimeAddDelRange defines message 'mactime_add_del_range'. +type MactimeAddDelRange struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Drop bool `binapi:"bool,name=drop" json:"drop,omitempty"` + Allow bool `binapi:"bool,name=allow" json:"allow,omitempty"` + AllowQuota uint8 `binapi:"u8,name=allow_quota" json:"allow_quota,omitempty"` + NoUDP10001 bool `binapi:"bool,name=no_udp_10001" json:"no_udp_10001,omitempty"` + DataQuota uint64 `binapi:"u64,name=data_quota" json:"data_quota,omitempty"` + MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` + DeviceName string `binapi:"string[64],name=device_name" json:"device_name,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + Ranges []TimeRange `binapi:"time_range[count],name=ranges" json:"ranges,omitempty"` +} + +func (m *MactimeAddDelRange) Reset() { *m = MactimeAddDelRange{} } +func (*MactimeAddDelRange) GetMessageName() string { return "mactime_add_del_range" } +func (*MactimeAddDelRange) GetCrcString() string { return "101858ef" } +func (*MactimeAddDelRange) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MactimeAddDelRange) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.Drop + size += 1 // m.Allow + size += 1 // m.AllowQuota + size += 1 // m.NoUDP10001 + size += 8 // m.DataQuota + size += 1 * 6 // m.MacAddress + size += 64 // m.DeviceName + size += 4 // m.Count + for j1 := 0; j1 < len(m.Ranges); j1++ { + var s1 TimeRange + _ = s1 + if j1 < len(m.Ranges) { + s1 = m.Ranges[j1] + } + size += 8 // s1.Start + size += 8 // s1.End + } + return size +} +func (m *MactimeAddDelRange) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeBool(m.Drop) + buf.EncodeBool(m.Allow) + buf.EncodeUint8(uint8(m.AllowQuota)) + buf.EncodeBool(m.NoUDP10001) + buf.EncodeUint64(uint64(m.DataQuota)) + buf.EncodeBytes(m.MacAddress[:], 6) + buf.EncodeString(m.DeviceName, 64) + buf.EncodeUint32(uint32(len(m.Ranges))) + for j0 := 0; j0 < len(m.Ranges); j0++ { + var v0 TimeRange + if j0 < len(m.Ranges) { + v0 = m.Ranges[j0] + } + buf.EncodeFloat64(float64(v0.Start)) + buf.EncodeFloat64(float64(v0.End)) + } + return buf.Bytes(), nil +} +func (m *MactimeAddDelRange) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Drop = buf.DecodeBool() + m.Allow = buf.DecodeBool() + m.AllowQuota = buf.DecodeUint8() + m.NoUDP10001 = buf.DecodeBool() + m.DataQuota = buf.DecodeUint64() + copy(m.MacAddress[:], buf.DecodeBytes(6)) + m.DeviceName = buf.DecodeString(64) + m.Count = buf.DecodeUint32() + m.Ranges = make([]TimeRange, int(m.Count)) + for j0 := 0; j0 < len(m.Ranges); j0++ { + m.Ranges[j0].Start = float64(buf.DecodeFloat64()) + m.Ranges[j0].End = float64(buf.DecodeFloat64()) + } + return nil +} + +// MactimeAddDelRangeReply defines message 'mactime_add_del_range_reply'. +type MactimeAddDelRangeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MactimeAddDelRangeReply) Reset() { *m = MactimeAddDelRangeReply{} } +func (*MactimeAddDelRangeReply) GetMessageName() string { return "mactime_add_del_range_reply" } +func (*MactimeAddDelRangeReply) GetCrcString() string { return "e8d4e804" } +func (*MactimeAddDelRangeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MactimeAddDelRangeReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *MactimeAddDelRangeReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MactimeAddDelRangeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MactimeDetails defines message 'mactime_details'. +type MactimeDetails struct { + PoolIndex uint32 `binapi:"u32,name=pool_index" json:"pool_index,omitempty"` + MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` + DataQuota uint64 `binapi:"u64,name=data_quota" json:"data_quota,omitempty"` + DataUsedInRange uint64 `binapi:"u64,name=data_used_in_range" json:"data_used_in_range,omitempty"` + Flags uint32 `binapi:"u32,name=flags" json:"flags,omitempty"` + DeviceName string `binapi:"string[64],name=device_name" json:"device_name,omitempty"` + Nranges uint32 `binapi:"u32,name=nranges" json:"-"` + Ranges []MactimeTimeRange `binapi:"mactime_time_range[nranges],name=ranges" json:"ranges,omitempty"` +} + +func (m *MactimeDetails) Reset() { *m = MactimeDetails{} } +func (*MactimeDetails) GetMessageName() string { return "mactime_details" } +func (*MactimeDetails) GetCrcString() string { return "44921c06" } +func (*MactimeDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MactimeDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.PoolIndex + size += 1 * 6 // m.MacAddress + size += 8 // m.DataQuota + size += 8 // m.DataUsedInRange + size += 4 // m.Flags + size += 64 // m.DeviceName + size += 4 // m.Nranges + for j1 := 0; j1 < len(m.Ranges); j1++ { + var s1 MactimeTimeRange + _ = s1 + if j1 < len(m.Ranges) { + s1 = m.Ranges[j1] + } + size += 8 // s1.Start + size += 8 // s1.End + } + return size +} +func (m *MactimeDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.PoolIndex)) + buf.EncodeBytes(m.MacAddress[:], 6) + buf.EncodeUint64(uint64(m.DataQuota)) + buf.EncodeUint64(uint64(m.DataUsedInRange)) + buf.EncodeUint32(uint32(m.Flags)) + buf.EncodeString(m.DeviceName, 64) + buf.EncodeUint32(uint32(len(m.Ranges))) + for j0 := 0; j0 < len(m.Ranges); j0++ { + var v0 MactimeTimeRange + if j0 < len(m.Ranges) { + v0 = m.Ranges[j0] + } + buf.EncodeFloat64(float64(v0.Start)) + buf.EncodeFloat64(float64(v0.End)) + } + return buf.Bytes(), nil +} +func (m *MactimeDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PoolIndex = buf.DecodeUint32() + copy(m.MacAddress[:], buf.DecodeBytes(6)) + m.DataQuota = buf.DecodeUint64() + m.DataUsedInRange = buf.DecodeUint64() + m.Flags = buf.DecodeUint32() + m.DeviceName = buf.DecodeString(64) + m.Nranges = buf.DecodeUint32() + m.Ranges = make([]MactimeTimeRange, int(m.Nranges)) + for j0 := 0; j0 < len(m.Ranges); j0++ { + m.Ranges[j0].Start = float64(buf.DecodeFloat64()) + m.Ranges[j0].End = float64(buf.DecodeFloat64()) + } + return nil +} + +// MactimeDump defines message 'mactime_dump'. +type MactimeDump struct { + MyTableEpoch uint32 `binapi:"u32,name=my_table_epoch" json:"my_table_epoch,omitempty"` +} + +func (m *MactimeDump) Reset() { *m = MactimeDump{} } +func (*MactimeDump) GetMessageName() string { return "mactime_dump" } +func (*MactimeDump) GetCrcString() string { return "8f454e23" } +func (*MactimeDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MactimeDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.MyTableEpoch + return size +} +func (m *MactimeDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.MyTableEpoch)) + return buf.Bytes(), nil +} +func (m *MactimeDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.MyTableEpoch = buf.DecodeUint32() + return nil +} + +// MactimeDumpReply defines message 'mactime_dump_reply'. +type MactimeDumpReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + TableEpoch uint32 `binapi:"u32,name=table_epoch" json:"table_epoch,omitempty"` +} + +func (m *MactimeDumpReply) Reset() { *m = MactimeDumpReply{} } +func (*MactimeDumpReply) GetMessageName() string { return "mactime_dump_reply" } +func (*MactimeDumpReply) GetCrcString() string { return "49bcc753" } +func (*MactimeDumpReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MactimeDumpReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.TableEpoch + return size +} +func (m *MactimeDumpReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.TableEpoch)) + return buf.Bytes(), nil +} +func (m *MactimeDumpReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.TableEpoch = buf.DecodeUint32() + return nil +} + +// MactimeEnableDisable defines message 'mactime_enable_disable'. +type MactimeEnableDisable struct { + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *MactimeEnableDisable) Reset() { *m = MactimeEnableDisable{} } +func (*MactimeEnableDisable) GetMessageName() string { return "mactime_enable_disable" } +func (*MactimeEnableDisable) GetCrcString() string { return "3865946c" } +func (*MactimeEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MactimeEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.EnableDisable + size += 4 // m.SwIfIndex + return size +} +func (m *MactimeEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.EnableDisable) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *MactimeEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EnableDisable = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// MactimeEnableDisableReply defines message 'mactime_enable_disable_reply'. +type MactimeEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MactimeEnableDisableReply) Reset() { *m = MactimeEnableDisableReply{} } +func (*MactimeEnableDisableReply) GetMessageName() string { return "mactime_enable_disable_reply" } +func (*MactimeEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*MactimeEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MactimeEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *MactimeEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MactimeEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_mactime_binapi_init() } +func file_mactime_binapi_init() { + api.RegisterMessage((*MactimeAddDelRange)(nil), "mactime_add_del_range_101858ef") + api.RegisterMessage((*MactimeAddDelRangeReply)(nil), "mactime_add_del_range_reply_e8d4e804") + api.RegisterMessage((*MactimeDetails)(nil), "mactime_details_44921c06") + api.RegisterMessage((*MactimeDump)(nil), "mactime_dump_8f454e23") + api.RegisterMessage((*MactimeDumpReply)(nil), "mactime_dump_reply_49bcc753") + api.RegisterMessage((*MactimeEnableDisable)(nil), "mactime_enable_disable_3865946c") + api.RegisterMessage((*MactimeEnableDisableReply)(nil), "mactime_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*MactimeAddDelRange)(nil), + (*MactimeAddDelRangeReply)(nil), + (*MactimeDetails)(nil), + (*MactimeDump)(nil), + (*MactimeDumpReply)(nil), + (*MactimeEnableDisable)(nil), + (*MactimeEnableDisableReply)(nil), + } +} diff --git a/binapi/mactime/mactime_rest.ba.go b/binapi/mactime/mactime_rest.ba.go new file mode 100644 index 0000000..4318dbc --- /dev/null +++ b/binapi/mactime/mactime_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package mactime + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/mactime_add_del_range", func(w http.ResponseWriter, req *http.Request) { + var request = new(MactimeAddDelRange) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MactimeAddDelRange(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/mactime_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(MactimeEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MactimeEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/mactime/mactime_rpc.ba.go b/binapi/mactime/mactime_rpc.ba.go new file mode 100644 index 0000000..a92a14c --- /dev/null +++ b/binapi/mactime/mactime_rpc.ba.go @@ -0,0 +1,83 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package mactime + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service mactime. +type RPCService interface { + MactimeAddDelRange(ctx context.Context, in *MactimeAddDelRange) (*MactimeAddDelRangeReply, error) + MactimeDump(ctx context.Context, in *MactimeDump) (RPCService_MactimeDumpClient, error) + MactimeEnableDisable(ctx context.Context, in *MactimeEnableDisable) (*MactimeEnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) MactimeAddDelRange(ctx context.Context, in *MactimeAddDelRange) (*MactimeAddDelRangeReply, error) { + out := new(MactimeAddDelRangeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MactimeDump(ctx context.Context, in *MactimeDump) (RPCService_MactimeDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_MactimeDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_MactimeDumpClient interface { + Recv() (*MactimeDetails, error) + api.Stream +} + +type serviceClient_MactimeDumpClient struct { + api.Stream +} + +func (c *serviceClient_MactimeDumpClient) Recv() (*MactimeDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *MactimeDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) MactimeEnableDisable(ctx context.Context, in *MactimeEnableDisable) (*MactimeEnableDisableReply, error) { + out := new(MactimeEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/map/map.ba.go b/binapi/map/map.ba.go new file mode 100644 index 0000000..fc3c733 --- /dev/null +++ b/binapi/map/map.ba.go @@ -0,0 +1,1404 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/map.api.json + +// Package maps contains generated bindings for API file map.api. +// +// Contents: +// 30 messages +// +package maps + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "map" + APIVersion = "4.1.1" + VersionCrc = 0x82b79829 +) + +// MapAddDelRule defines message 'map_add_del_rule'. +type MapAddDelRule struct { + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + IP6Dst ip_types.IP6Address `binapi:"ip6_address,name=ip6_dst" json:"ip6_dst,omitempty"` + Psid uint16 `binapi:"u16,name=psid" json:"psid,omitempty"` +} + +func (m *MapAddDelRule) Reset() { *m = MapAddDelRule{} } +func (*MapAddDelRule) GetMessageName() string { return "map_add_del_rule" } +func (*MapAddDelRule) GetCrcString() string { return "c65b32f7" } +func (*MapAddDelRule) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MapAddDelRule) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Index + size += 1 // m.IsAdd + size += 1 * 16 // m.IP6Dst + size += 2 // m.Psid + return size +} +func (m *MapAddDelRule) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Index)) + buf.EncodeBool(m.IsAdd) + buf.EncodeBytes(m.IP6Dst[:], 16) + buf.EncodeUint16(uint16(m.Psid)) + return buf.Bytes(), nil +} +func (m *MapAddDelRule) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Index = buf.DecodeUint32() + m.IsAdd = buf.DecodeBool() + copy(m.IP6Dst[:], buf.DecodeBytes(16)) + m.Psid = buf.DecodeUint16() + return nil +} + +// MapAddDelRuleReply defines message 'map_add_del_rule_reply'. +type MapAddDelRuleReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MapAddDelRuleReply) Reset() { *m = MapAddDelRuleReply{} } +func (*MapAddDelRuleReply) GetMessageName() string { return "map_add_del_rule_reply" } +func (*MapAddDelRuleReply) GetCrcString() string { return "e8d4e804" } +func (*MapAddDelRuleReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MapAddDelRuleReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *MapAddDelRuleReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MapAddDelRuleReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MapAddDomain defines message 'map_add_domain'. +type MapAddDomain struct { + IP6Prefix ip_types.IP6Prefix `binapi:"ip6_prefix,name=ip6_prefix" json:"ip6_prefix,omitempty"` + IP4Prefix ip_types.IP4Prefix `binapi:"ip4_prefix,name=ip4_prefix" json:"ip4_prefix,omitempty"` + IP6Src ip_types.IP6Prefix `binapi:"ip6_prefix,name=ip6_src" json:"ip6_src,omitempty"` + EaBitsLen uint8 `binapi:"u8,name=ea_bits_len" json:"ea_bits_len,omitempty"` + PsidOffset uint8 `binapi:"u8,name=psid_offset" json:"psid_offset,omitempty"` + PsidLength uint8 `binapi:"u8,name=psid_length" json:"psid_length,omitempty"` + Mtu uint16 `binapi:"u16,name=mtu,default=%!s(float64=1280)" json:"mtu,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` +} + +func (m *MapAddDomain) Reset() { *m = MapAddDomain{} } +func (*MapAddDomain) GetMessageName() string { return "map_add_domain" } +func (*MapAddDomain) GetCrcString() string { return "7a5a18c9" } +func (*MapAddDomain) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MapAddDomain) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 16 // m.IP6Prefix.Address + size += 1 // m.IP6Prefix.Len + size += 1 * 4 // m.IP4Prefix.Address + size += 1 // m.IP4Prefix.Len + size += 1 * 16 // m.IP6Src.Address + size += 1 // m.IP6Src.Len + size += 1 // m.EaBitsLen + size += 1 // m.PsidOffset + size += 1 // m.PsidLength + size += 2 // m.Mtu + size += 64 // m.Tag + return size +} +func (m *MapAddDomain) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.IP6Prefix.Address[:], 16) + buf.EncodeUint8(uint8(m.IP6Prefix.Len)) + buf.EncodeBytes(m.IP4Prefix.Address[:], 4) + buf.EncodeUint8(uint8(m.IP4Prefix.Len)) + buf.EncodeBytes(m.IP6Src.Address[:], 16) + buf.EncodeUint8(uint8(m.IP6Src.Len)) + buf.EncodeUint8(uint8(m.EaBitsLen)) + buf.EncodeUint8(uint8(m.PsidOffset)) + buf.EncodeUint8(uint8(m.PsidLength)) + buf.EncodeUint16(uint16(m.Mtu)) + buf.EncodeString(m.Tag, 64) + return buf.Bytes(), nil +} +func (m *MapAddDomain) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IP6Prefix.Address[:], buf.DecodeBytes(16)) + m.IP6Prefix.Len = buf.DecodeUint8() + copy(m.IP4Prefix.Address[:], buf.DecodeBytes(4)) + m.IP4Prefix.Len = buf.DecodeUint8() + copy(m.IP6Src.Address[:], buf.DecodeBytes(16)) + m.IP6Src.Len = buf.DecodeUint8() + m.EaBitsLen = buf.DecodeUint8() + m.PsidOffset = buf.DecodeUint8() + m.PsidLength = buf.DecodeUint8() + m.Mtu = buf.DecodeUint16() + m.Tag = buf.DecodeString(64) + return nil +} + +// MapAddDomainReply defines message 'map_add_domain_reply'. +type MapAddDomainReply struct { + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MapAddDomainReply) Reset() { *m = MapAddDomainReply{} } +func (*MapAddDomainReply) GetMessageName() string { return "map_add_domain_reply" } +func (*MapAddDomainReply) GetCrcString() string { return "3e6d4e2c" } +func (*MapAddDomainReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MapAddDomainReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Index + size += 4 // m.Retval + return size +} +func (m *MapAddDomainReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Index)) + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MapAddDomainReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Index = buf.DecodeUint32() + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MapDelDomain defines message 'map_del_domain'. +type MapDelDomain struct { + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` +} + +func (m *MapDelDomain) Reset() { *m = MapDelDomain{} } +func (*MapDelDomain) GetMessageName() string { return "map_del_domain" } +func (*MapDelDomain) GetCrcString() string { return "8ac76db6" } +func (*MapDelDomain) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MapDelDomain) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Index + return size +} +func (m *MapDelDomain) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Index)) + return buf.Bytes(), nil +} +func (m *MapDelDomain) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Index = buf.DecodeUint32() + return nil +} + +// MapDelDomainReply defines message 'map_del_domain_reply'. +type MapDelDomainReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MapDelDomainReply) Reset() { *m = MapDelDomainReply{} } +func (*MapDelDomainReply) GetMessageName() string { return "map_del_domain_reply" } +func (*MapDelDomainReply) GetCrcString() string { return "e8d4e804" } +func (*MapDelDomainReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MapDelDomainReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *MapDelDomainReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MapDelDomainReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MapDomainDetails defines message 'map_domain_details'. +type MapDomainDetails struct { + DomainIndex uint32 `binapi:"u32,name=domain_index" json:"domain_index,omitempty"` + IP6Prefix ip_types.IP6Prefix `binapi:"ip6_prefix,name=ip6_prefix" json:"ip6_prefix,omitempty"` + IP4Prefix ip_types.IP4Prefix `binapi:"ip4_prefix,name=ip4_prefix" json:"ip4_prefix,omitempty"` + IP6Src ip_types.IP6Prefix `binapi:"ip6_prefix,name=ip6_src" json:"ip6_src,omitempty"` + EaBitsLen uint8 `binapi:"u8,name=ea_bits_len" json:"ea_bits_len,omitempty"` + PsidOffset uint8 `binapi:"u8,name=psid_offset" json:"psid_offset,omitempty"` + PsidLength uint8 `binapi:"u8,name=psid_length" json:"psid_length,omitempty"` + Flags uint8 `binapi:"u8,name=flags" json:"flags,omitempty"` + Mtu uint16 `binapi:"u16,name=mtu" json:"mtu,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` +} + +func (m *MapDomainDetails) Reset() { *m = MapDomainDetails{} } +func (*MapDomainDetails) GetMessageName() string { return "map_domain_details" } +func (*MapDomainDetails) GetCrcString() string { return "fc1859dd" } +func (*MapDomainDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MapDomainDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.DomainIndex + size += 1 * 16 // m.IP6Prefix.Address + size += 1 // m.IP6Prefix.Len + size += 1 * 4 // m.IP4Prefix.Address + size += 1 // m.IP4Prefix.Len + size += 1 * 16 // m.IP6Src.Address + size += 1 // m.IP6Src.Len + size += 1 // m.EaBitsLen + size += 1 // m.PsidOffset + size += 1 // m.PsidLength + size += 1 // m.Flags + size += 2 // m.Mtu + size += 64 // m.Tag + return size +} +func (m *MapDomainDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.DomainIndex)) + buf.EncodeBytes(m.IP6Prefix.Address[:], 16) + buf.EncodeUint8(uint8(m.IP6Prefix.Len)) + buf.EncodeBytes(m.IP4Prefix.Address[:], 4) + buf.EncodeUint8(uint8(m.IP4Prefix.Len)) + buf.EncodeBytes(m.IP6Src.Address[:], 16) + buf.EncodeUint8(uint8(m.IP6Src.Len)) + buf.EncodeUint8(uint8(m.EaBitsLen)) + buf.EncodeUint8(uint8(m.PsidOffset)) + buf.EncodeUint8(uint8(m.PsidLength)) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint16(uint16(m.Mtu)) + buf.EncodeString(m.Tag, 64) + return buf.Bytes(), nil +} +func (m *MapDomainDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.DomainIndex = buf.DecodeUint32() + copy(m.IP6Prefix.Address[:], buf.DecodeBytes(16)) + m.IP6Prefix.Len = buf.DecodeUint8() + copy(m.IP4Prefix.Address[:], buf.DecodeBytes(4)) + m.IP4Prefix.Len = buf.DecodeUint8() + copy(m.IP6Src.Address[:], buf.DecodeBytes(16)) + m.IP6Src.Len = buf.DecodeUint8() + m.EaBitsLen = buf.DecodeUint8() + m.PsidOffset = buf.DecodeUint8() + m.PsidLength = buf.DecodeUint8() + m.Flags = buf.DecodeUint8() + m.Mtu = buf.DecodeUint16() + m.Tag = buf.DecodeString(64) + return nil +} + +// MapDomainDump defines message 'map_domain_dump'. +type MapDomainDump struct{} + +func (m *MapDomainDump) Reset() { *m = MapDomainDump{} } +func (*MapDomainDump) GetMessageName() string { return "map_domain_dump" } +func (*MapDomainDump) GetCrcString() string { return "51077d14" } +func (*MapDomainDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MapDomainDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MapDomainDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *MapDomainDump) Unmarshal(b []byte) error { + return nil +} + +// MapIfEnableDisable defines message 'map_if_enable_disable'. +type MapIfEnableDisable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsEnable bool `binapi:"bool,name=is_enable" json:"is_enable,omitempty"` + IsTranslation bool `binapi:"bool,name=is_translation" json:"is_translation,omitempty"` +} + +func (m *MapIfEnableDisable) Reset() { *m = MapIfEnableDisable{} } +func (*MapIfEnableDisable) GetMessageName() string { return "map_if_enable_disable" } +func (*MapIfEnableDisable) GetCrcString() string { return "59bb32f4" } +func (*MapIfEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MapIfEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.IsEnable + size += 1 // m.IsTranslation + return size +} +func (m *MapIfEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsEnable) + buf.EncodeBool(m.IsTranslation) + return buf.Bytes(), nil +} +func (m *MapIfEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsEnable = buf.DecodeBool() + m.IsTranslation = buf.DecodeBool() + return nil +} + +// MapIfEnableDisableReply defines message 'map_if_enable_disable_reply'. +type MapIfEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MapIfEnableDisableReply) Reset() { *m = MapIfEnableDisableReply{} } +func (*MapIfEnableDisableReply) GetMessageName() string { return "map_if_enable_disable_reply" } +func (*MapIfEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*MapIfEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MapIfEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *MapIfEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MapIfEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MapParamAddDelPreResolve defines message 'map_param_add_del_pre_resolve'. +type MapParamAddDelPreResolve struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + IP4NhAddress ip_types.IP4Address `binapi:"ip4_address,name=ip4_nh_address" json:"ip4_nh_address,omitempty"` + IP6NhAddress ip_types.IP6Address `binapi:"ip6_address,name=ip6_nh_address" json:"ip6_nh_address,omitempty"` +} + +func (m *MapParamAddDelPreResolve) Reset() { *m = MapParamAddDelPreResolve{} } +func (*MapParamAddDelPreResolve) GetMessageName() string { return "map_param_add_del_pre_resolve" } +func (*MapParamAddDelPreResolve) GetCrcString() string { return "17008c66" } +func (*MapParamAddDelPreResolve) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MapParamAddDelPreResolve) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 * 4 // m.IP4NhAddress + size += 1 * 16 // m.IP6NhAddress + return size +} +func (m *MapParamAddDelPreResolve) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeBytes(m.IP4NhAddress[:], 4) + buf.EncodeBytes(m.IP6NhAddress[:], 16) + return buf.Bytes(), nil +} +func (m *MapParamAddDelPreResolve) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + copy(m.IP4NhAddress[:], buf.DecodeBytes(4)) + copy(m.IP6NhAddress[:], buf.DecodeBytes(16)) + return nil +} + +// MapParamAddDelPreResolveReply defines message 'map_param_add_del_pre_resolve_reply'. +type MapParamAddDelPreResolveReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MapParamAddDelPreResolveReply) Reset() { *m = MapParamAddDelPreResolveReply{} } +func (*MapParamAddDelPreResolveReply) GetMessageName() string { + return "map_param_add_del_pre_resolve_reply" +} +func (*MapParamAddDelPreResolveReply) GetCrcString() string { return "e8d4e804" } +func (*MapParamAddDelPreResolveReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MapParamAddDelPreResolveReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *MapParamAddDelPreResolveReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MapParamAddDelPreResolveReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MapParamGet defines message 'map_param_get'. +type MapParamGet struct{} + +func (m *MapParamGet) Reset() { *m = MapParamGet{} } +func (*MapParamGet) GetMessageName() string { return "map_param_get" } +func (*MapParamGet) GetCrcString() string { return "51077d14" } +func (*MapParamGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MapParamGet) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MapParamGet) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *MapParamGet) Unmarshal(b []byte) error { + return nil +} + +// MapParamGetReply defines message 'map_param_get_reply'. +type MapParamGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + FragInner uint8 `binapi:"u8,name=frag_inner" json:"frag_inner,omitempty"` + FragIgnoreDf uint8 `binapi:"u8,name=frag_ignore_df" json:"frag_ignore_df,omitempty"` + ICMPIP4ErrRelaySrc ip_types.IP4Address `binapi:"ip4_address,name=icmp_ip4_err_relay_src" json:"icmp_ip4_err_relay_src,omitempty"` + ICMP6EnableUnreachable bool `binapi:"bool,name=icmp6_enable_unreachable" json:"icmp6_enable_unreachable,omitempty"` + IP4NhAddress ip_types.IP4Address `binapi:"ip4_address,name=ip4_nh_address" json:"ip4_nh_address,omitempty"` + IP6NhAddress ip_types.IP6Address `binapi:"ip6_address,name=ip6_nh_address" json:"ip6_nh_address,omitempty"` + IP4LifetimeMs uint16 `binapi:"u16,name=ip4_lifetime_ms" json:"ip4_lifetime_ms,omitempty"` + IP4PoolSize uint16 `binapi:"u16,name=ip4_pool_size" json:"ip4_pool_size,omitempty"` + IP4Buffers uint32 `binapi:"u32,name=ip4_buffers" json:"ip4_buffers,omitempty"` + IP4HtRatio float64 `binapi:"f64,name=ip4_ht_ratio" json:"ip4_ht_ratio,omitempty"` + SecCheckEnable bool `binapi:"bool,name=sec_check_enable" json:"sec_check_enable,omitempty"` + SecCheckFragments bool `binapi:"bool,name=sec_check_fragments" json:"sec_check_fragments,omitempty"` + TcCopy bool `binapi:"bool,name=tc_copy" json:"tc_copy,omitempty"` + TcClass uint8 `binapi:"u8,name=tc_class" json:"tc_class,omitempty"` +} + +func (m *MapParamGetReply) Reset() { *m = MapParamGetReply{} } +func (*MapParamGetReply) GetMessageName() string { return "map_param_get_reply" } +func (*MapParamGetReply) GetCrcString() string { return "28092156" } +func (*MapParamGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MapParamGetReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.FragInner + size += 1 // m.FragIgnoreDf + size += 1 * 4 // m.ICMPIP4ErrRelaySrc + size += 1 // m.ICMP6EnableUnreachable + size += 1 * 4 // m.IP4NhAddress + size += 1 * 16 // m.IP6NhAddress + size += 2 // m.IP4LifetimeMs + size += 2 // m.IP4PoolSize + size += 4 // m.IP4Buffers + size += 8 // m.IP4HtRatio + size += 1 // m.SecCheckEnable + size += 1 // m.SecCheckFragments + size += 1 // m.TcCopy + size += 1 // m.TcClass + return size +} +func (m *MapParamGetReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint8(uint8(m.FragInner)) + buf.EncodeUint8(uint8(m.FragIgnoreDf)) + buf.EncodeBytes(m.ICMPIP4ErrRelaySrc[:], 4) + buf.EncodeBool(m.ICMP6EnableUnreachable) + buf.EncodeBytes(m.IP4NhAddress[:], 4) + buf.EncodeBytes(m.IP6NhAddress[:], 16) + buf.EncodeUint16(uint16(m.IP4LifetimeMs)) + buf.EncodeUint16(uint16(m.IP4PoolSize)) + buf.EncodeUint32(uint32(m.IP4Buffers)) + buf.EncodeFloat64(float64(m.IP4HtRatio)) + buf.EncodeBool(m.SecCheckEnable) + buf.EncodeBool(m.SecCheckFragments) + buf.EncodeBool(m.TcCopy) + buf.EncodeUint8(uint8(m.TcClass)) + return buf.Bytes(), nil +} +func (m *MapParamGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.FragInner = buf.DecodeUint8() + m.FragIgnoreDf = buf.DecodeUint8() + copy(m.ICMPIP4ErrRelaySrc[:], buf.DecodeBytes(4)) + m.ICMP6EnableUnreachable = buf.DecodeBool() + copy(m.IP4NhAddress[:], buf.DecodeBytes(4)) + copy(m.IP6NhAddress[:], buf.DecodeBytes(16)) + m.IP4LifetimeMs = buf.DecodeUint16() + m.IP4PoolSize = buf.DecodeUint16() + m.IP4Buffers = buf.DecodeUint32() + m.IP4HtRatio = float64(buf.DecodeFloat64()) + m.SecCheckEnable = buf.DecodeBool() + m.SecCheckFragments = buf.DecodeBool() + m.TcCopy = buf.DecodeBool() + m.TcClass = buf.DecodeUint8() + return nil +} + +// MapParamSetFragmentation defines message 'map_param_set_fragmentation'. +type MapParamSetFragmentation struct { + Inner bool `binapi:"bool,name=inner" json:"inner,omitempty"` + IgnoreDf bool `binapi:"bool,name=ignore_df" json:"ignore_df,omitempty"` +} + +func (m *MapParamSetFragmentation) Reset() { *m = MapParamSetFragmentation{} } +func (*MapParamSetFragmentation) GetMessageName() string { return "map_param_set_fragmentation" } +func (*MapParamSetFragmentation) GetCrcString() string { return "9ff54d90" } +func (*MapParamSetFragmentation) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MapParamSetFragmentation) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Inner + size += 1 // m.IgnoreDf + return size +} +func (m *MapParamSetFragmentation) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.Inner) + buf.EncodeBool(m.IgnoreDf) + return buf.Bytes(), nil +} +func (m *MapParamSetFragmentation) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Inner = buf.DecodeBool() + m.IgnoreDf = buf.DecodeBool() + return nil +} + +// MapParamSetFragmentationReply defines message 'map_param_set_fragmentation_reply'. +type MapParamSetFragmentationReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MapParamSetFragmentationReply) Reset() { *m = MapParamSetFragmentationReply{} } +func (*MapParamSetFragmentationReply) GetMessageName() string { + return "map_param_set_fragmentation_reply" +} +func (*MapParamSetFragmentationReply) GetCrcString() string { return "e8d4e804" } +func (*MapParamSetFragmentationReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MapParamSetFragmentationReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *MapParamSetFragmentationReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MapParamSetFragmentationReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MapParamSetICMP defines message 'map_param_set_icmp'. +type MapParamSetICMP struct { + IP4ErrRelaySrc ip_types.IP4Address `binapi:"ip4_address,name=ip4_err_relay_src" json:"ip4_err_relay_src,omitempty"` +} + +func (m *MapParamSetICMP) Reset() { *m = MapParamSetICMP{} } +func (*MapParamSetICMP) GetMessageName() string { return "map_param_set_icmp" } +func (*MapParamSetICMP) GetCrcString() string { return "58210cbf" } +func (*MapParamSetICMP) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MapParamSetICMP) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.IP4ErrRelaySrc + return size +} +func (m *MapParamSetICMP) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.IP4ErrRelaySrc[:], 4) + return buf.Bytes(), nil +} +func (m *MapParamSetICMP) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IP4ErrRelaySrc[:], buf.DecodeBytes(4)) + return nil +} + +// MapParamSetICMP6 defines message 'map_param_set_icmp6'. +type MapParamSetICMP6 struct { + EnableUnreachable bool `binapi:"bool,name=enable_unreachable" json:"enable_unreachable,omitempty"` +} + +func (m *MapParamSetICMP6) Reset() { *m = MapParamSetICMP6{} } +func (*MapParamSetICMP6) GetMessageName() string { return "map_param_set_icmp6" } +func (*MapParamSetICMP6) GetCrcString() string { return "5d01f8c1" } +func (*MapParamSetICMP6) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MapParamSetICMP6) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.EnableUnreachable + return size +} +func (m *MapParamSetICMP6) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.EnableUnreachable) + return buf.Bytes(), nil +} +func (m *MapParamSetICMP6) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EnableUnreachable = buf.DecodeBool() + return nil +} + +// MapParamSetICMP6Reply defines message 'map_param_set_icmp6_reply'. +type MapParamSetICMP6Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MapParamSetICMP6Reply) Reset() { *m = MapParamSetICMP6Reply{} } +func (*MapParamSetICMP6Reply) GetMessageName() string { return "map_param_set_icmp6_reply" } +func (*MapParamSetICMP6Reply) GetCrcString() string { return "e8d4e804" } +func (*MapParamSetICMP6Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MapParamSetICMP6Reply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *MapParamSetICMP6Reply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MapParamSetICMP6Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MapParamSetICMPReply defines message 'map_param_set_icmp_reply'. +type MapParamSetICMPReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MapParamSetICMPReply) Reset() { *m = MapParamSetICMPReply{} } +func (*MapParamSetICMPReply) GetMessageName() string { return "map_param_set_icmp_reply" } +func (*MapParamSetICMPReply) GetCrcString() string { return "e8d4e804" } +func (*MapParamSetICMPReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MapParamSetICMPReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *MapParamSetICMPReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MapParamSetICMPReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MapParamSetSecurityCheck defines message 'map_param_set_security_check'. +type MapParamSetSecurityCheck struct { + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` + Fragments bool `binapi:"bool,name=fragments" json:"fragments,omitempty"` +} + +func (m *MapParamSetSecurityCheck) Reset() { *m = MapParamSetSecurityCheck{} } +func (*MapParamSetSecurityCheck) GetMessageName() string { return "map_param_set_security_check" } +func (*MapParamSetSecurityCheck) GetCrcString() string { return "6abe9836" } +func (*MapParamSetSecurityCheck) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MapParamSetSecurityCheck) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Enable + size += 1 // m.Fragments + return size +} +func (m *MapParamSetSecurityCheck) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.Enable) + buf.EncodeBool(m.Fragments) + return buf.Bytes(), nil +} +func (m *MapParamSetSecurityCheck) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Enable = buf.DecodeBool() + m.Fragments = buf.DecodeBool() + return nil +} + +// MapParamSetSecurityCheckReply defines message 'map_param_set_security_check_reply'. +type MapParamSetSecurityCheckReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MapParamSetSecurityCheckReply) Reset() { *m = MapParamSetSecurityCheckReply{} } +func (*MapParamSetSecurityCheckReply) GetMessageName() string { + return "map_param_set_security_check_reply" +} +func (*MapParamSetSecurityCheckReply) GetCrcString() string { return "e8d4e804" } +func (*MapParamSetSecurityCheckReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MapParamSetSecurityCheckReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *MapParamSetSecurityCheckReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MapParamSetSecurityCheckReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MapParamSetTCP defines message 'map_param_set_tcp'. +type MapParamSetTCP struct { + TCPMss uint16 `binapi:"u16,name=tcp_mss" json:"tcp_mss,omitempty"` +} + +func (m *MapParamSetTCP) Reset() { *m = MapParamSetTCP{} } +func (*MapParamSetTCP) GetMessageName() string { return "map_param_set_tcp" } +func (*MapParamSetTCP) GetCrcString() string { return "87a825d9" } +func (*MapParamSetTCP) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MapParamSetTCP) Size() int { + if m == nil { + return 0 + } + var size int + size += 2 // m.TCPMss + return size +} +func (m *MapParamSetTCP) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint16(uint16(m.TCPMss)) + return buf.Bytes(), nil +} +func (m *MapParamSetTCP) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.TCPMss = buf.DecodeUint16() + return nil +} + +// MapParamSetTCPReply defines message 'map_param_set_tcp_reply'. +type MapParamSetTCPReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MapParamSetTCPReply) Reset() { *m = MapParamSetTCPReply{} } +func (*MapParamSetTCPReply) GetMessageName() string { return "map_param_set_tcp_reply" } +func (*MapParamSetTCPReply) GetCrcString() string { return "e8d4e804" } +func (*MapParamSetTCPReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MapParamSetTCPReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *MapParamSetTCPReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MapParamSetTCPReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MapParamSetTrafficClass defines message 'map_param_set_traffic_class'. +type MapParamSetTrafficClass struct { + Copy bool `binapi:"bool,name=copy" json:"copy,omitempty"` + TcClass uint8 `binapi:"u8,name=tc_class" json:"tc_class,omitempty"` +} + +func (m *MapParamSetTrafficClass) Reset() { *m = MapParamSetTrafficClass{} } +func (*MapParamSetTrafficClass) GetMessageName() string { return "map_param_set_traffic_class" } +func (*MapParamSetTrafficClass) GetCrcString() string { return "9cac455c" } +func (*MapParamSetTrafficClass) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MapParamSetTrafficClass) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Copy + size += 1 // m.TcClass + return size +} +func (m *MapParamSetTrafficClass) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.Copy) + buf.EncodeUint8(uint8(m.TcClass)) + return buf.Bytes(), nil +} +func (m *MapParamSetTrafficClass) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Copy = buf.DecodeBool() + m.TcClass = buf.DecodeUint8() + return nil +} + +// MapParamSetTrafficClassReply defines message 'map_param_set_traffic_class_reply'. +type MapParamSetTrafficClassReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MapParamSetTrafficClassReply) Reset() { *m = MapParamSetTrafficClassReply{} } +func (*MapParamSetTrafficClassReply) GetMessageName() string { + return "map_param_set_traffic_class_reply" +} +func (*MapParamSetTrafficClassReply) GetCrcString() string { return "e8d4e804" } +func (*MapParamSetTrafficClassReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MapParamSetTrafficClassReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *MapParamSetTrafficClassReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MapParamSetTrafficClassReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MapRuleDetails defines message 'map_rule_details'. +type MapRuleDetails struct { + IP6Dst ip_types.IP6Address `binapi:"ip6_address,name=ip6_dst" json:"ip6_dst,omitempty"` + Psid uint16 `binapi:"u16,name=psid" json:"psid,omitempty"` +} + +func (m *MapRuleDetails) Reset() { *m = MapRuleDetails{} } +func (*MapRuleDetails) GetMessageName() string { return "map_rule_details" } +func (*MapRuleDetails) GetCrcString() string { return "c7cbeea5" } +func (*MapRuleDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MapRuleDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 16 // m.IP6Dst + size += 2 // m.Psid + return size +} +func (m *MapRuleDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.IP6Dst[:], 16) + buf.EncodeUint16(uint16(m.Psid)) + return buf.Bytes(), nil +} +func (m *MapRuleDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IP6Dst[:], buf.DecodeBytes(16)) + m.Psid = buf.DecodeUint16() + return nil +} + +// MapRuleDump defines message 'map_rule_dump'. +type MapRuleDump struct { + DomainIndex uint32 `binapi:"u32,name=domain_index" json:"domain_index,omitempty"` +} + +func (m *MapRuleDump) Reset() { *m = MapRuleDump{} } +func (*MapRuleDump) GetMessageName() string { return "map_rule_dump" } +func (*MapRuleDump) GetCrcString() string { return "e43e6ff6" } +func (*MapRuleDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MapRuleDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.DomainIndex + return size +} +func (m *MapRuleDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.DomainIndex)) + return buf.Bytes(), nil +} +func (m *MapRuleDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.DomainIndex = buf.DecodeUint32() + return nil +} + +// MapSummaryStats defines message 'map_summary_stats'. +type MapSummaryStats struct{} + +func (m *MapSummaryStats) Reset() { *m = MapSummaryStats{} } +func (*MapSummaryStats) GetMessageName() string { return "map_summary_stats" } +func (*MapSummaryStats) GetCrcString() string { return "51077d14" } +func (*MapSummaryStats) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MapSummaryStats) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MapSummaryStats) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *MapSummaryStats) Unmarshal(b []byte) error { + return nil +} + +// MapSummaryStatsReply defines message 'map_summary_stats_reply'. +type MapSummaryStatsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + TotalBindings uint64 `binapi:"u64,name=total_bindings" json:"total_bindings,omitempty"` + TotalPkts []uint64 `binapi:"u64[2],name=total_pkts" json:"total_pkts,omitempty"` + TotalBytes []uint64 `binapi:"u64[2],name=total_bytes" json:"total_bytes,omitempty"` + TotalIP4Fragments uint64 `binapi:"u64,name=total_ip4_fragments" json:"total_ip4_fragments,omitempty"` + TotalSecurityCheck []uint64 `binapi:"u64[2],name=total_security_check" json:"total_security_check,omitempty"` +} + +func (m *MapSummaryStatsReply) Reset() { *m = MapSummaryStatsReply{} } +func (*MapSummaryStatsReply) GetMessageName() string { return "map_summary_stats_reply" } +func (*MapSummaryStatsReply) GetCrcString() string { return "0e4ace0e" } +func (*MapSummaryStatsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MapSummaryStatsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 8 // m.TotalBindings + size += 8 * 2 // m.TotalPkts + size += 8 * 2 // m.TotalBytes + size += 8 // m.TotalIP4Fragments + size += 8 * 2 // m.TotalSecurityCheck + return size +} +func (m *MapSummaryStatsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint64(uint64(m.TotalBindings)) + for i := 0; i < 2; i++ { + var x uint64 + if i < len(m.TotalPkts) { + x = uint64(m.TotalPkts[i]) + } + buf.EncodeUint64(uint64(x)) + } + for i := 0; i < 2; i++ { + var x uint64 + if i < len(m.TotalBytes) { + x = uint64(m.TotalBytes[i]) + } + buf.EncodeUint64(uint64(x)) + } + buf.EncodeUint64(uint64(m.TotalIP4Fragments)) + for i := 0; i < 2; i++ { + var x uint64 + if i < len(m.TotalSecurityCheck) { + x = uint64(m.TotalSecurityCheck[i]) + } + buf.EncodeUint64(uint64(x)) + } + return buf.Bytes(), nil +} +func (m *MapSummaryStatsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.TotalBindings = buf.DecodeUint64() + m.TotalPkts = make([]uint64, 2) + for i := 0; i < len(m.TotalPkts); i++ { + m.TotalPkts[i] = buf.DecodeUint64() + } + m.TotalBytes = make([]uint64, 2) + for i := 0; i < len(m.TotalBytes); i++ { + m.TotalBytes[i] = buf.DecodeUint64() + } + m.TotalIP4Fragments = buf.DecodeUint64() + m.TotalSecurityCheck = make([]uint64, 2) + for i := 0; i < len(m.TotalSecurityCheck); i++ { + m.TotalSecurityCheck[i] = buf.DecodeUint64() + } + return nil +} + +func init() { file_maps_binapi_init() } +func file_maps_binapi_init() { + api.RegisterMessage((*MapAddDelRule)(nil), "map_add_del_rule_c65b32f7") + api.RegisterMessage((*MapAddDelRuleReply)(nil), "map_add_del_rule_reply_e8d4e804") + api.RegisterMessage((*MapAddDomain)(nil), "map_add_domain_7a5a18c9") + api.RegisterMessage((*MapAddDomainReply)(nil), "map_add_domain_reply_3e6d4e2c") + api.RegisterMessage((*MapDelDomain)(nil), "map_del_domain_8ac76db6") + api.RegisterMessage((*MapDelDomainReply)(nil), "map_del_domain_reply_e8d4e804") + api.RegisterMessage((*MapDomainDetails)(nil), "map_domain_details_fc1859dd") + api.RegisterMessage((*MapDomainDump)(nil), "map_domain_dump_51077d14") + api.RegisterMessage((*MapIfEnableDisable)(nil), "map_if_enable_disable_59bb32f4") + api.RegisterMessage((*MapIfEnableDisableReply)(nil), "map_if_enable_disable_reply_e8d4e804") + api.RegisterMessage((*MapParamAddDelPreResolve)(nil), "map_param_add_del_pre_resolve_17008c66") + api.RegisterMessage((*MapParamAddDelPreResolveReply)(nil), "map_param_add_del_pre_resolve_reply_e8d4e804") + api.RegisterMessage((*MapParamGet)(nil), "map_param_get_51077d14") + api.RegisterMessage((*MapParamGetReply)(nil), "map_param_get_reply_28092156") + api.RegisterMessage((*MapParamSetFragmentation)(nil), "map_param_set_fragmentation_9ff54d90") + api.RegisterMessage((*MapParamSetFragmentationReply)(nil), "map_param_set_fragmentation_reply_e8d4e804") + api.RegisterMessage((*MapParamSetICMP)(nil), "map_param_set_icmp_58210cbf") + api.RegisterMessage((*MapParamSetICMP6)(nil), "map_param_set_icmp6_5d01f8c1") + api.RegisterMessage((*MapParamSetICMP6Reply)(nil), "map_param_set_icmp6_reply_e8d4e804") + api.RegisterMessage((*MapParamSetICMPReply)(nil), "map_param_set_icmp_reply_e8d4e804") + api.RegisterMessage((*MapParamSetSecurityCheck)(nil), "map_param_set_security_check_6abe9836") + api.RegisterMessage((*MapParamSetSecurityCheckReply)(nil), "map_param_set_security_check_reply_e8d4e804") + api.RegisterMessage((*MapParamSetTCP)(nil), "map_param_set_tcp_87a825d9") + api.RegisterMessage((*MapParamSetTCPReply)(nil), "map_param_set_tcp_reply_e8d4e804") + api.RegisterMessage((*MapParamSetTrafficClass)(nil), "map_param_set_traffic_class_9cac455c") + api.RegisterMessage((*MapParamSetTrafficClassReply)(nil), "map_param_set_traffic_class_reply_e8d4e804") + api.RegisterMessage((*MapRuleDetails)(nil), "map_rule_details_c7cbeea5") + api.RegisterMessage((*MapRuleDump)(nil), "map_rule_dump_e43e6ff6") + api.RegisterMessage((*MapSummaryStats)(nil), "map_summary_stats_51077d14") + api.RegisterMessage((*MapSummaryStatsReply)(nil), "map_summary_stats_reply_0e4ace0e") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*MapAddDelRule)(nil), + (*MapAddDelRuleReply)(nil), + (*MapAddDomain)(nil), + (*MapAddDomainReply)(nil), + (*MapDelDomain)(nil), + (*MapDelDomainReply)(nil), + (*MapDomainDetails)(nil), + (*MapDomainDump)(nil), + (*MapIfEnableDisable)(nil), + (*MapIfEnableDisableReply)(nil), + (*MapParamAddDelPreResolve)(nil), + (*MapParamAddDelPreResolveReply)(nil), + (*MapParamGet)(nil), + (*MapParamGetReply)(nil), + (*MapParamSetFragmentation)(nil), + (*MapParamSetFragmentationReply)(nil), + (*MapParamSetICMP)(nil), + (*MapParamSetICMP6)(nil), + (*MapParamSetICMP6Reply)(nil), + (*MapParamSetICMPReply)(nil), + (*MapParamSetSecurityCheck)(nil), + (*MapParamSetSecurityCheckReply)(nil), + (*MapParamSetTCP)(nil), + (*MapParamSetTCPReply)(nil), + (*MapParamSetTrafficClass)(nil), + (*MapParamSetTrafficClassReply)(nil), + (*MapRuleDetails)(nil), + (*MapRuleDump)(nil), + (*MapSummaryStats)(nil), + (*MapSummaryStatsReply)(nil), + } +} diff --git a/binapi/map/map_rest.ba.go b/binapi/map/map_rest.ba.go new file mode 100644 index 0000000..922acb5 --- /dev/null +++ b/binapi/map/map_rest.ba.go @@ -0,0 +1,295 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package maps + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/map_add_del_rule", func(w http.ResponseWriter, req *http.Request) { + var request = new(MapAddDelRule) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MapAddDelRule(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/map_add_domain", func(w http.ResponseWriter, req *http.Request) { + var request = new(MapAddDomain) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MapAddDomain(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/map_del_domain", func(w http.ResponseWriter, req *http.Request) { + var request = new(MapDelDomain) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MapDelDomain(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/map_if_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(MapIfEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MapIfEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/map_param_add_del_pre_resolve", func(w http.ResponseWriter, req *http.Request) { + var request = new(MapParamAddDelPreResolve) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MapParamAddDelPreResolve(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/map_param_get", func(w http.ResponseWriter, req *http.Request) { + var request = new(MapParamGet) + reply, err := rpc.MapParamGet(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/map_param_set_fragmentation", func(w http.ResponseWriter, req *http.Request) { + var request = new(MapParamSetFragmentation) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MapParamSetFragmentation(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/map_param_set_icmp", func(w http.ResponseWriter, req *http.Request) { + var request = new(MapParamSetICMP) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MapParamSetICMP(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/map_param_set_icmp6", func(w http.ResponseWriter, req *http.Request) { + var request = new(MapParamSetICMP6) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MapParamSetICMP6(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/map_param_set_security_check", func(w http.ResponseWriter, req *http.Request) { + var request = new(MapParamSetSecurityCheck) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MapParamSetSecurityCheck(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/map_param_set_tcp", func(w http.ResponseWriter, req *http.Request) { + var request = new(MapParamSetTCP) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MapParamSetTCP(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/map_param_set_traffic_class", func(w http.ResponseWriter, req *http.Request) { + var request = new(MapParamSetTrafficClass) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MapParamSetTrafficClass(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/map_summary_stats", func(w http.ResponseWriter, req *http.Request) { + var request = new(MapSummaryStats) + reply, err := rpc.MapSummaryStats(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/map/map_rpc.ba.go b/binapi/map/map_rpc.ba.go new file mode 100644 index 0000000..6f7c3c7 --- /dev/null +++ b/binapi/map/map_rpc.ba.go @@ -0,0 +1,233 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package maps + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service map. +type RPCService interface { + MapAddDelRule(ctx context.Context, in *MapAddDelRule) (*MapAddDelRuleReply, error) + MapAddDomain(ctx context.Context, in *MapAddDomain) (*MapAddDomainReply, error) + MapDelDomain(ctx context.Context, in *MapDelDomain) (*MapDelDomainReply, error) + MapDomainDump(ctx context.Context, in *MapDomainDump) (RPCService_MapDomainDumpClient, error) + MapIfEnableDisable(ctx context.Context, in *MapIfEnableDisable) (*MapIfEnableDisableReply, error) + MapParamAddDelPreResolve(ctx context.Context, in *MapParamAddDelPreResolve) (*MapParamAddDelPreResolveReply, error) + MapParamGet(ctx context.Context, in *MapParamGet) (*MapParamGetReply, error) + MapParamSetFragmentation(ctx context.Context, in *MapParamSetFragmentation) (*MapParamSetFragmentationReply, error) + MapParamSetICMP(ctx context.Context, in *MapParamSetICMP) (*MapParamSetICMPReply, error) + MapParamSetICMP6(ctx context.Context, in *MapParamSetICMP6) (*MapParamSetICMP6Reply, error) + MapParamSetSecurityCheck(ctx context.Context, in *MapParamSetSecurityCheck) (*MapParamSetSecurityCheckReply, error) + MapParamSetTCP(ctx context.Context, in *MapParamSetTCP) (*MapParamSetTCPReply, error) + MapParamSetTrafficClass(ctx context.Context, in *MapParamSetTrafficClass) (*MapParamSetTrafficClassReply, error) + MapRuleDump(ctx context.Context, in *MapRuleDump) (RPCService_MapRuleDumpClient, error) + MapSummaryStats(ctx context.Context, in *MapSummaryStats) (*MapSummaryStatsReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) MapAddDelRule(ctx context.Context, in *MapAddDelRule) (*MapAddDelRuleReply, error) { + out := new(MapAddDelRuleReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MapAddDomain(ctx context.Context, in *MapAddDomain) (*MapAddDomainReply, error) { + out := new(MapAddDomainReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MapDelDomain(ctx context.Context, in *MapDelDomain) (*MapDelDomainReply, error) { + out := new(MapDelDomainReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MapDomainDump(ctx context.Context, in *MapDomainDump) (RPCService_MapDomainDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_MapDomainDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_MapDomainDumpClient interface { + Recv() (*MapDomainDetails, error) + api.Stream +} + +type serviceClient_MapDomainDumpClient struct { + api.Stream +} + +func (c *serviceClient_MapDomainDumpClient) Recv() (*MapDomainDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *MapDomainDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) MapIfEnableDisable(ctx context.Context, in *MapIfEnableDisable) (*MapIfEnableDisableReply, error) { + out := new(MapIfEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MapParamAddDelPreResolve(ctx context.Context, in *MapParamAddDelPreResolve) (*MapParamAddDelPreResolveReply, error) { + out := new(MapParamAddDelPreResolveReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MapParamGet(ctx context.Context, in *MapParamGet) (*MapParamGetReply, error) { + out := new(MapParamGetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MapParamSetFragmentation(ctx context.Context, in *MapParamSetFragmentation) (*MapParamSetFragmentationReply, error) { + out := new(MapParamSetFragmentationReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MapParamSetICMP(ctx context.Context, in *MapParamSetICMP) (*MapParamSetICMPReply, error) { + out := new(MapParamSetICMPReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MapParamSetICMP6(ctx context.Context, in *MapParamSetICMP6) (*MapParamSetICMP6Reply, error) { + out := new(MapParamSetICMP6Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MapParamSetSecurityCheck(ctx context.Context, in *MapParamSetSecurityCheck) (*MapParamSetSecurityCheckReply, error) { + out := new(MapParamSetSecurityCheckReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MapParamSetTCP(ctx context.Context, in *MapParamSetTCP) (*MapParamSetTCPReply, error) { + out := new(MapParamSetTCPReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MapParamSetTrafficClass(ctx context.Context, in *MapParamSetTrafficClass) (*MapParamSetTrafficClassReply, error) { + out := new(MapParamSetTrafficClassReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MapRuleDump(ctx context.Context, in *MapRuleDump) (RPCService_MapRuleDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_MapRuleDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_MapRuleDumpClient interface { + Recv() (*MapRuleDetails, error) + api.Stream +} + +type serviceClient_MapRuleDumpClient struct { + api.Stream +} + +func (c *serviceClient_MapRuleDumpClient) Recv() (*MapRuleDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *MapRuleDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) MapSummaryStats(ctx context.Context, in *MapSummaryStats) (*MapSummaryStatsReply, error) { + out := new(MapSummaryStatsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/mdata/mdata.ba.go b/binapi/mdata/mdata.ba.go new file mode 100644 index 0000000..aba1dee --- /dev/null +++ b/binapi/mdata/mdata.ba.go @@ -0,0 +1,116 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/mdata.api.json + +// Package mdata contains generated bindings for API file mdata.api. +// +// Contents: +// 2 messages +// +package mdata + +import ( + api "git.fd.io/govpp.git/api" + _ "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "mdata" + APIVersion = "0.1.0" + VersionCrc = 0x3a1911dd +) + +// MdataEnableDisable defines message 'mdata_enable_disable'. +type MdataEnableDisable struct { + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` +} + +func (m *MdataEnableDisable) Reset() { *m = MdataEnableDisable{} } +func (*MdataEnableDisable) GetMessageName() string { return "mdata_enable_disable" } +func (*MdataEnableDisable) GetCrcString() string { return "2e7b47df" } +func (*MdataEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MdataEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.EnableDisable + return size +} +func (m *MdataEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.EnableDisable) + return buf.Bytes(), nil +} +func (m *MdataEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EnableDisable = buf.DecodeBool() + return nil +} + +// MdataEnableDisableReply defines message 'mdata_enable_disable_reply'. +type MdataEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MdataEnableDisableReply) Reset() { *m = MdataEnableDisableReply{} } +func (*MdataEnableDisableReply) GetMessageName() string { return "mdata_enable_disable_reply" } +func (*MdataEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*MdataEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MdataEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *MdataEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MdataEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_mdata_binapi_init() } +func file_mdata_binapi_init() { + api.RegisterMessage((*MdataEnableDisable)(nil), "mdata_enable_disable_2e7b47df") + api.RegisterMessage((*MdataEnableDisableReply)(nil), "mdata_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*MdataEnableDisable)(nil), + (*MdataEnableDisableReply)(nil), + } +} diff --git a/binapi/mdata/mdata_rest.ba.go b/binapi/mdata/mdata_rest.ba.go new file mode 100644 index 0000000..12b22e7 --- /dev/null +++ b/binapi/mdata/mdata_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package mdata + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/mdata_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(MdataEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MdataEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/mdata/mdata_rpc.ba.go b/binapi/mdata/mdata_rpc.ba.go new file mode 100644 index 0000000..08e05d5 --- /dev/null +++ b/binapi/mdata/mdata_rpc.ba.go @@ -0,0 +1,30 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package mdata + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service mdata. +type RPCService interface { + MdataEnableDisable(ctx context.Context, in *MdataEnableDisable) (*MdataEnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) MdataEnableDisable(ctx context.Context, in *MdataEnableDisable) (*MdataEnableDisableReply, error) { + out := new(MdataEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/memclnt/memclnt.ba.go b/binapi/memclnt/memclnt.ba.go new file mode 100644 index 0000000..915379c --- /dev/null +++ b/binapi/memclnt/memclnt.ba.go @@ -0,0 +1,1036 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/memclnt.api.json + +// Package memclnt contains generated bindings for API file memclnt.api. +// +// Contents: +// 2 structs +// 22 messages +// +package memclnt + +import ( + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "memclnt" + APIVersion = "2.1.0" + VersionCrc = 0x8d3dd881 +) + +// MessageTableEntry defines type 'message_table_entry'. +type MessageTableEntry struct { + Index uint16 `binapi:"u16,name=index" json:"index,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty"` +} + +// ModuleVersion defines type 'module_version'. +type ModuleVersion struct { + Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` + Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` + Patch uint32 `binapi:"u32,name=patch" json:"patch,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty"` +} + +// APIVersions defines message 'api_versions'. +type APIVersions struct{} + +func (m *APIVersions) Reset() { *m = APIVersions{} } +func (*APIVersions) GetMessageName() string { return "api_versions" } +func (*APIVersions) GetCrcString() string { return "51077d14" } +func (*APIVersions) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *APIVersions) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *APIVersions) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *APIVersions) Unmarshal(b []byte) error { + return nil +} + +// APIVersionsReply defines message 'api_versions_reply'. +type APIVersionsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + APIVersions []ModuleVersion `binapi:"module_version[count],name=api_versions" json:"api_versions,omitempty"` +} + +func (m *APIVersionsReply) Reset() { *m = APIVersionsReply{} } +func (*APIVersionsReply) GetMessageName() string { return "api_versions_reply" } +func (*APIVersionsReply) GetCrcString() string { return "5f0d99d6" } +func (*APIVersionsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *APIVersionsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.Count + for j1 := 0; j1 < len(m.APIVersions); j1++ { + var s1 ModuleVersion + _ = s1 + if j1 < len(m.APIVersions) { + s1 = m.APIVersions[j1] + } + size += 4 // s1.Major + size += 4 // s1.Minor + size += 4 // s1.Patch + size += 64 // s1.Name + } + return size +} +func (m *APIVersionsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(len(m.APIVersions))) + for j0 := 0; j0 < len(m.APIVersions); j0++ { + var v0 ModuleVersion + if j0 < len(m.APIVersions) { + v0 = m.APIVersions[j0] + } + buf.EncodeUint32(uint32(v0.Major)) + buf.EncodeUint32(uint32(v0.Minor)) + buf.EncodeUint32(uint32(v0.Patch)) + buf.EncodeString(v0.Name, 64) + } + return buf.Bytes(), nil +} +func (m *APIVersionsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Count = buf.DecodeUint32() + m.APIVersions = make([]ModuleVersion, int(m.Count)) + for j0 := 0; j0 < len(m.APIVersions); j0++ { + m.APIVersions[j0].Major = buf.DecodeUint32() + m.APIVersions[j0].Minor = buf.DecodeUint32() + m.APIVersions[j0].Patch = buf.DecodeUint32() + m.APIVersions[j0].Name = buf.DecodeString(64) + } + return nil +} + +// GetFirstMsgID defines message 'get_first_msg_id'. +type GetFirstMsgID struct { + Name string `binapi:"string[64],name=name" json:"name,omitempty"` +} + +func (m *GetFirstMsgID) Reset() { *m = GetFirstMsgID{} } +func (*GetFirstMsgID) GetMessageName() string { return "get_first_msg_id" } +func (*GetFirstMsgID) GetCrcString() string { return "ebf79a66" } +func (*GetFirstMsgID) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GetFirstMsgID) Size() int { + if m == nil { + return 0 + } + var size int + size += 64 // m.Name + return size +} +func (m *GetFirstMsgID) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.Name, 64) + return buf.Bytes(), nil +} +func (m *GetFirstMsgID) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Name = buf.DecodeString(64) + return nil +} + +// GetFirstMsgIDReply defines message 'get_first_msg_id_reply'. +type GetFirstMsgIDReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + FirstMsgID uint16 `binapi:"u16,name=first_msg_id" json:"first_msg_id,omitempty"` +} + +func (m *GetFirstMsgIDReply) Reset() { *m = GetFirstMsgIDReply{} } +func (*GetFirstMsgIDReply) GetMessageName() string { return "get_first_msg_id_reply" } +func (*GetFirstMsgIDReply) GetCrcString() string { return "7d337472" } +func (*GetFirstMsgIDReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GetFirstMsgIDReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 2 // m.FirstMsgID + return size +} +func (m *GetFirstMsgIDReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint16(uint16(m.FirstMsgID)) + return buf.Bytes(), nil +} +func (m *GetFirstMsgIDReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.FirstMsgID = buf.DecodeUint16() + return nil +} + +// MemclntCreate defines message 'memclnt_create'. +type MemclntCreate struct { + CtxQuota int32 `binapi:"i32,name=ctx_quota" json:"ctx_quota,omitempty"` + InputQueue uint64 `binapi:"u64,name=input_queue" json:"input_queue,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + APIVersions []uint32 `binapi:"u32[8],name=api_versions" json:"api_versions,omitempty"` +} + +func (m *MemclntCreate) Reset() { *m = MemclntCreate{} } +func (*MemclntCreate) GetMessageName() string { return "memclnt_create" } +func (*MemclntCreate) GetCrcString() string { return "9c5e1c2f" } +func (*MemclntCreate) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MemclntCreate) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.CtxQuota + size += 8 // m.InputQueue + size += 64 // m.Name + size += 4 * 8 // m.APIVersions + return size +} +func (m *MemclntCreate) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.CtxQuota)) + buf.EncodeUint64(uint64(m.InputQueue)) + buf.EncodeString(m.Name, 64) + for i := 0; i < 8; i++ { + var x uint32 + if i < len(m.APIVersions) { + x = uint32(m.APIVersions[i]) + } + buf.EncodeUint32(uint32(x)) + } + return buf.Bytes(), nil +} +func (m *MemclntCreate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.CtxQuota = int32(buf.DecodeUint32()) + m.InputQueue = buf.DecodeUint64() + m.Name = buf.DecodeString(64) + m.APIVersions = make([]uint32, 8) + for i := 0; i < len(m.APIVersions); i++ { + m.APIVersions[i] = buf.DecodeUint32() + } + return nil +} + +// MemclntCreateReply defines message 'memclnt_create_reply'. +type MemclntCreateReply struct { + Response int32 `binapi:"i32,name=response" json:"response,omitempty"` + Handle uint64 `binapi:"u64,name=handle" json:"handle,omitempty"` + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` + MessageTable uint64 `binapi:"u64,name=message_table" json:"message_table,omitempty"` +} + +func (m *MemclntCreateReply) Reset() { *m = MemclntCreateReply{} } +func (*MemclntCreateReply) GetMessageName() string { return "memclnt_create_reply" } +func (*MemclntCreateReply) GetCrcString() string { return "42ec4560" } +func (*MemclntCreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MemclntCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Response + size += 8 // m.Handle + size += 4 // m.Index + size += 8 // m.MessageTable + return size +} +func (m *MemclntCreateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Response)) + buf.EncodeUint64(uint64(m.Handle)) + buf.EncodeUint32(uint32(m.Index)) + buf.EncodeUint64(uint64(m.MessageTable)) + return buf.Bytes(), nil +} +func (m *MemclntCreateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Response = int32(buf.DecodeUint32()) + m.Handle = buf.DecodeUint64() + m.Index = buf.DecodeUint32() + m.MessageTable = buf.DecodeUint64() + return nil +} + +// MemclntDelete defines message 'memclnt_delete'. +type MemclntDelete struct { + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` + Handle uint64 `binapi:"u64,name=handle" json:"handle,omitempty"` + DoCleanup bool `binapi:"bool,name=do_cleanup" json:"do_cleanup,omitempty"` +} + +func (m *MemclntDelete) Reset() { *m = MemclntDelete{} } +func (*MemclntDelete) GetMessageName() string { return "memclnt_delete" } +func (*MemclntDelete) GetCrcString() string { return "7e1c04e3" } +func (*MemclntDelete) GetMessageType() api.MessageType { + return api.OtherMessage +} + +func (m *MemclntDelete) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Index + size += 8 // m.Handle + size += 1 // m.DoCleanup + return size +} +func (m *MemclntDelete) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Index)) + buf.EncodeUint64(uint64(m.Handle)) + buf.EncodeBool(m.DoCleanup) + return buf.Bytes(), nil +} +func (m *MemclntDelete) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Index = buf.DecodeUint32() + m.Handle = buf.DecodeUint64() + m.DoCleanup = buf.DecodeBool() + return nil +} + +// MemclntDeleteReply defines message 'memclnt_delete_reply'. +type MemclntDeleteReply struct { + Response int32 `binapi:"i32,name=response" json:"response,omitempty"` + Handle uint64 `binapi:"u64,name=handle" json:"handle,omitempty"` +} + +func (m *MemclntDeleteReply) Reset() { *m = MemclntDeleteReply{} } +func (*MemclntDeleteReply) GetMessageName() string { return "memclnt_delete_reply" } +func (*MemclntDeleteReply) GetCrcString() string { return "3d3b6312" } +func (*MemclntDeleteReply) GetMessageType() api.MessageType { + return api.OtherMessage +} + +func (m *MemclntDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Response + size += 8 // m.Handle + return size +} +func (m *MemclntDeleteReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Response)) + buf.EncodeUint64(uint64(m.Handle)) + return buf.Bytes(), nil +} +func (m *MemclntDeleteReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Response = int32(buf.DecodeUint32()) + m.Handle = buf.DecodeUint64() + return nil +} + +// MemclntKeepalive defines message 'memclnt_keepalive'. +type MemclntKeepalive struct{} + +func (m *MemclntKeepalive) Reset() { *m = MemclntKeepalive{} } +func (*MemclntKeepalive) GetMessageName() string { return "memclnt_keepalive" } +func (*MemclntKeepalive) GetCrcString() string { return "51077d14" } +func (*MemclntKeepalive) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MemclntKeepalive) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MemclntKeepalive) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *MemclntKeepalive) Unmarshal(b []byte) error { + return nil +} + +// MemclntKeepaliveReply defines message 'memclnt_keepalive_reply'. +type MemclntKeepaliveReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MemclntKeepaliveReply) Reset() { *m = MemclntKeepaliveReply{} } +func (*MemclntKeepaliveReply) GetMessageName() string { return "memclnt_keepalive_reply" } +func (*MemclntKeepaliveReply) GetCrcString() string { return "e8d4e804" } +func (*MemclntKeepaliveReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MemclntKeepaliveReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *MemclntKeepaliveReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MemclntKeepaliveReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MemclntReadTimeout defines message 'memclnt_read_timeout'. +type MemclntReadTimeout struct { + Dummy uint8 `binapi:"u8,name=dummy" json:"dummy,omitempty"` +} + +func (m *MemclntReadTimeout) Reset() { *m = MemclntReadTimeout{} } +func (*MemclntReadTimeout) GetMessageName() string { return "memclnt_read_timeout" } +func (*MemclntReadTimeout) GetCrcString() string { return "c3a3a452" } +func (*MemclntReadTimeout) GetMessageType() api.MessageType { + return api.OtherMessage +} + +func (m *MemclntReadTimeout) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Dummy + return size +} +func (m *MemclntReadTimeout) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Dummy)) + return buf.Bytes(), nil +} +func (m *MemclntReadTimeout) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Dummy = buf.DecodeUint8() + return nil +} + +// MemclntRxThreadSuspend defines message 'memclnt_rx_thread_suspend'. +type MemclntRxThreadSuspend struct { + Dummy uint8 `binapi:"u8,name=dummy" json:"dummy,omitempty"` +} + +func (m *MemclntRxThreadSuspend) Reset() { *m = MemclntRxThreadSuspend{} } +func (*MemclntRxThreadSuspend) GetMessageName() string { return "memclnt_rx_thread_suspend" } +func (*MemclntRxThreadSuspend) GetCrcString() string { return "c3a3a452" } +func (*MemclntRxThreadSuspend) GetMessageType() api.MessageType { + return api.OtherMessage +} + +func (m *MemclntRxThreadSuspend) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Dummy + return size +} +func (m *MemclntRxThreadSuspend) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Dummy)) + return buf.Bytes(), nil +} +func (m *MemclntRxThreadSuspend) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Dummy = buf.DecodeUint8() + return nil +} + +// RPCCall defines message 'rpc_call'. +type RPCCall struct { + Function uint64 `binapi:"u64,name=function" json:"function,omitempty"` + Multicast uint8 `binapi:"u8,name=multicast" json:"multicast,omitempty"` + NeedBarrierSync uint8 `binapi:"u8,name=need_barrier_sync" json:"need_barrier_sync,omitempty"` + SendReply uint8 `binapi:"u8,name=send_reply" json:"send_reply,omitempty"` + DataLen uint32 `binapi:"u32,name=data_len" json:"-"` + Data []byte `binapi:"u8[data_len],name=data" json:"data,omitempty"` +} + +func (m *RPCCall) Reset() { *m = RPCCall{} } +func (*RPCCall) GetMessageName() string { return "rpc_call" } +func (*RPCCall) GetCrcString() string { return "7e8a2c95" } +func (*RPCCall) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *RPCCall) Size() int { + if m == nil { + return 0 + } + var size int + size += 8 // m.Function + size += 1 // m.Multicast + size += 1 // m.NeedBarrierSync + size += 1 // m.SendReply + size += 4 // m.DataLen + size += 1 * len(m.Data) // m.Data + return size +} +func (m *RPCCall) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint64(uint64(m.Function)) + buf.EncodeUint8(uint8(m.Multicast)) + buf.EncodeUint8(uint8(m.NeedBarrierSync)) + buf.EncodeUint8(uint8(m.SendReply)) + buf.EncodeUint32(uint32(len(m.Data))) + buf.EncodeBytes(m.Data[:], 0) + return buf.Bytes(), nil +} +func (m *RPCCall) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Function = buf.DecodeUint64() + m.Multicast = buf.DecodeUint8() + m.NeedBarrierSync = buf.DecodeUint8() + m.SendReply = buf.DecodeUint8() + m.DataLen = buf.DecodeUint32() + copy(m.Data[:], buf.DecodeBytes(0)) + return nil +} + +// RPCCallReply defines message 'rpc_call_reply'. +type RPCCallReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *RPCCallReply) Reset() { *m = RPCCallReply{} } +func (*RPCCallReply) GetMessageName() string { return "rpc_call_reply" } +func (*RPCCallReply) GetCrcString() string { return "e8d4e804" } +func (*RPCCallReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *RPCCallReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *RPCCallReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *RPCCallReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// RxThreadExit defines message 'rx_thread_exit'. +type RxThreadExit struct { + Dummy uint8 `binapi:"u8,name=dummy" json:"dummy,omitempty"` +} + +func (m *RxThreadExit) Reset() { *m = RxThreadExit{} } +func (*RxThreadExit) GetMessageName() string { return "rx_thread_exit" } +func (*RxThreadExit) GetCrcString() string { return "c3a3a452" } +func (*RxThreadExit) GetMessageType() api.MessageType { + return api.OtherMessage +} + +func (m *RxThreadExit) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Dummy + return size +} +func (m *RxThreadExit) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Dummy)) + return buf.Bytes(), nil +} +func (m *RxThreadExit) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Dummy = buf.DecodeUint8() + return nil +} + +// SockInitShm defines message 'sock_init_shm'. +type SockInitShm struct { + RequestedSize uint32 `binapi:"u32,name=requested_size" json:"requested_size,omitempty"` + Nitems uint8 `binapi:"u8,name=nitems" json:"-"` + Configs []uint64 `binapi:"u64[nitems],name=configs" json:"configs,omitempty"` +} + +func (m *SockInitShm) Reset() { *m = SockInitShm{} } +func (*SockInitShm) GetMessageName() string { return "sock_init_shm" } +func (*SockInitShm) GetCrcString() string { return "51646d92" } +func (*SockInitShm) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SockInitShm) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.RequestedSize + size += 1 // m.Nitems + size += 8 * len(m.Configs) // m.Configs + return size +} +func (m *SockInitShm) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.RequestedSize)) + buf.EncodeUint8(uint8(len(m.Configs))) + for i := 0; i < len(m.Configs); i++ { + var x uint64 + if i < len(m.Configs) { + x = uint64(m.Configs[i]) + } + buf.EncodeUint64(uint64(x)) + } + return buf.Bytes(), nil +} +func (m *SockInitShm) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.RequestedSize = buf.DecodeUint32() + m.Nitems = buf.DecodeUint8() + m.Configs = make([]uint64, m.Nitems) + for i := 0; i < len(m.Configs); i++ { + m.Configs[i] = buf.DecodeUint64() + } + return nil +} + +// SockInitShmReply defines message 'sock_init_shm_reply'. +type SockInitShmReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SockInitShmReply) Reset() { *m = SockInitShmReply{} } +func (*SockInitShmReply) GetMessageName() string { return "sock_init_shm_reply" } +func (*SockInitShmReply) GetCrcString() string { return "e8d4e804" } +func (*SockInitShmReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SockInitShmReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SockInitShmReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SockInitShmReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SockclntCreate defines message 'sockclnt_create'. +type SockclntCreate struct { + Name string `binapi:"string[64],name=name" json:"name,omitempty"` +} + +func (m *SockclntCreate) Reset() { *m = SockclntCreate{} } +func (*SockclntCreate) GetMessageName() string { return "sockclnt_create" } +func (*SockclntCreate) GetCrcString() string { return "455fb9c4" } +func (*SockclntCreate) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SockclntCreate) Size() int { + if m == nil { + return 0 + } + var size int + size += 64 // m.Name + return size +} +func (m *SockclntCreate) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.Name, 64) + return buf.Bytes(), nil +} +func (m *SockclntCreate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Name = buf.DecodeString(64) + return nil +} + +// SockclntCreateReply defines message 'sockclnt_create_reply'. +type SockclntCreateReply struct { + Response int32 `binapi:"i32,name=response" json:"response,omitempty"` + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` + Count uint16 `binapi:"u16,name=count" json:"-"` + MessageTable []MessageTableEntry `binapi:"message_table_entry[count],name=message_table" json:"message_table,omitempty"` +} + +func (m *SockclntCreateReply) Reset() { *m = SockclntCreateReply{} } +func (*SockclntCreateReply) GetMessageName() string { return "sockclnt_create_reply" } +func (*SockclntCreateReply) GetCrcString() string { return "35166268" } +func (*SockclntCreateReply) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SockclntCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Response + size += 4 // m.Index + size += 2 // m.Count + for j1 := 0; j1 < len(m.MessageTable); j1++ { + var s1 MessageTableEntry + _ = s1 + if j1 < len(m.MessageTable) { + s1 = m.MessageTable[j1] + } + size += 2 // s1.Index + size += 64 // s1.Name + } + return size +} +func (m *SockclntCreateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Response)) + buf.EncodeUint32(uint32(m.Index)) + buf.EncodeUint16(uint16(len(m.MessageTable))) + for j0 := 0; j0 < len(m.MessageTable); j0++ { + var v0 MessageTableEntry + if j0 < len(m.MessageTable) { + v0 = m.MessageTable[j0] + } + buf.EncodeUint16(uint16(v0.Index)) + buf.EncodeString(v0.Name, 64) + } + return buf.Bytes(), nil +} +func (m *SockclntCreateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Response = int32(buf.DecodeUint32()) + m.Index = buf.DecodeUint32() + m.Count = buf.DecodeUint16() + m.MessageTable = make([]MessageTableEntry, int(m.Count)) + for j0 := 0; j0 < len(m.MessageTable); j0++ { + m.MessageTable[j0].Index = buf.DecodeUint16() + m.MessageTable[j0].Name = buf.DecodeString(64) + } + return nil +} + +// SockclntDelete defines message 'sockclnt_delete'. +type SockclntDelete struct { + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` +} + +func (m *SockclntDelete) Reset() { *m = SockclntDelete{} } +func (*SockclntDelete) GetMessageName() string { return "sockclnt_delete" } +func (*SockclntDelete) GetCrcString() string { return "8ac76db6" } +func (*SockclntDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SockclntDelete) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Index + return size +} +func (m *SockclntDelete) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Index)) + return buf.Bytes(), nil +} +func (m *SockclntDelete) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Index = buf.DecodeUint32() + return nil +} + +// SockclntDeleteReply defines message 'sockclnt_delete_reply'. +type SockclntDeleteReply struct { + Response int32 `binapi:"i32,name=response" json:"response,omitempty"` +} + +func (m *SockclntDeleteReply) Reset() { *m = SockclntDeleteReply{} } +func (*SockclntDeleteReply) GetMessageName() string { return "sockclnt_delete_reply" } +func (*SockclntDeleteReply) GetCrcString() string { return "8f38b1ee" } +func (*SockclntDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SockclntDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Response + return size +} +func (m *SockclntDeleteReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Response)) + return buf.Bytes(), nil +} +func (m *SockclntDeleteReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Response = int32(buf.DecodeUint32()) + return nil +} + +// TracePluginMsgIds defines message 'trace_plugin_msg_ids'. +type TracePluginMsgIds struct { + PluginName string `binapi:"string[128],name=plugin_name" json:"plugin_name,omitempty"` + FirstMsgID uint16 `binapi:"u16,name=first_msg_id" json:"first_msg_id,omitempty"` + LastMsgID uint16 `binapi:"u16,name=last_msg_id" json:"last_msg_id,omitempty"` +} + +func (m *TracePluginMsgIds) Reset() { *m = TracePluginMsgIds{} } +func (*TracePluginMsgIds) GetMessageName() string { return "trace_plugin_msg_ids" } +func (*TracePluginMsgIds) GetCrcString() string { return "f476d3ce" } +func (*TracePluginMsgIds) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *TracePluginMsgIds) Size() int { + if m == nil { + return 0 + } + var size int + size += 128 // m.PluginName + size += 2 // m.FirstMsgID + size += 2 // m.LastMsgID + return size +} +func (m *TracePluginMsgIds) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.PluginName, 128) + buf.EncodeUint16(uint16(m.FirstMsgID)) + buf.EncodeUint16(uint16(m.LastMsgID)) + return buf.Bytes(), nil +} +func (m *TracePluginMsgIds) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PluginName = buf.DecodeString(128) + m.FirstMsgID = buf.DecodeUint16() + m.LastMsgID = buf.DecodeUint16() + return nil +} + +func init() { file_memclnt_binapi_init() } +func file_memclnt_binapi_init() { + api.RegisterMessage((*APIVersions)(nil), "api_versions_51077d14") + api.RegisterMessage((*APIVersionsReply)(nil), "api_versions_reply_5f0d99d6") + api.RegisterMessage((*GetFirstMsgID)(nil), "get_first_msg_id_ebf79a66") + api.RegisterMessage((*GetFirstMsgIDReply)(nil), "get_first_msg_id_reply_7d337472") + api.RegisterMessage((*MemclntCreate)(nil), "memclnt_create_9c5e1c2f") + api.RegisterMessage((*MemclntCreateReply)(nil), "memclnt_create_reply_42ec4560") + api.RegisterMessage((*MemclntDelete)(nil), "memclnt_delete_7e1c04e3") + api.RegisterMessage((*MemclntDeleteReply)(nil), "memclnt_delete_reply_3d3b6312") + api.RegisterMessage((*MemclntKeepalive)(nil), "memclnt_keepalive_51077d14") + api.RegisterMessage((*MemclntKeepaliveReply)(nil), "memclnt_keepalive_reply_e8d4e804") + api.RegisterMessage((*MemclntReadTimeout)(nil), "memclnt_read_timeout_c3a3a452") + api.RegisterMessage((*MemclntRxThreadSuspend)(nil), "memclnt_rx_thread_suspend_c3a3a452") + api.RegisterMessage((*RPCCall)(nil), "rpc_call_7e8a2c95") + api.RegisterMessage((*RPCCallReply)(nil), "rpc_call_reply_e8d4e804") + api.RegisterMessage((*RxThreadExit)(nil), "rx_thread_exit_c3a3a452") + api.RegisterMessage((*SockInitShm)(nil), "sock_init_shm_51646d92") + api.RegisterMessage((*SockInitShmReply)(nil), "sock_init_shm_reply_e8d4e804") + api.RegisterMessage((*SockclntCreate)(nil), "sockclnt_create_455fb9c4") + api.RegisterMessage((*SockclntCreateReply)(nil), "sockclnt_create_reply_35166268") + api.RegisterMessage((*SockclntDelete)(nil), "sockclnt_delete_8ac76db6") + api.RegisterMessage((*SockclntDeleteReply)(nil), "sockclnt_delete_reply_8f38b1ee") + api.RegisterMessage((*TracePluginMsgIds)(nil), "trace_plugin_msg_ids_f476d3ce") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*APIVersions)(nil), + (*APIVersionsReply)(nil), + (*GetFirstMsgID)(nil), + (*GetFirstMsgIDReply)(nil), + (*MemclntCreate)(nil), + (*MemclntCreateReply)(nil), + (*MemclntDelete)(nil), + (*MemclntDeleteReply)(nil), + (*MemclntKeepalive)(nil), + (*MemclntKeepaliveReply)(nil), + (*MemclntReadTimeout)(nil), + (*MemclntRxThreadSuspend)(nil), + (*RPCCall)(nil), + (*RPCCallReply)(nil), + (*RxThreadExit)(nil), + (*SockInitShm)(nil), + (*SockInitShmReply)(nil), + (*SockclntCreate)(nil), + (*SockclntCreateReply)(nil), + (*SockclntDelete)(nil), + (*SockclntDeleteReply)(nil), + (*TracePluginMsgIds)(nil), + } +} diff --git a/binapi/memclnt/memclnt_rest.ba.go b/binapi/memclnt/memclnt_rest.ba.go new file mode 100644 index 0000000..bb409da --- /dev/null +++ b/binapi/memclnt/memclnt_rest.ba.go @@ -0,0 +1,203 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package memclnt + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/api_versions", func(w http.ResponseWriter, req *http.Request) { + var request = new(APIVersions) + reply, err := rpc.APIVersions(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/get_first_msg_id", func(w http.ResponseWriter, req *http.Request) { + var request = new(GetFirstMsgID) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GetFirstMsgID(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/memclnt_create", func(w http.ResponseWriter, req *http.Request) { + var request = new(MemclntCreate) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MemclntCreate(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/memclnt_delete", func(w http.ResponseWriter, req *http.Request) { + var request = new(MemclntDelete) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MemclntDelete(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/memclnt_keepalive", func(w http.ResponseWriter, req *http.Request) { + var request = new(MemclntKeepalive) + reply, err := rpc.MemclntKeepalive(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/rpc_call", func(w http.ResponseWriter, req *http.Request) { + var request = new(RPCCall) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.RPCCall(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sock_init_shm", func(w http.ResponseWriter, req *http.Request) { + var request = new(SockInitShm) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SockInitShm(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sockclnt_create", func(w http.ResponseWriter, req *http.Request) { + var request = new(SockclntCreate) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SockclntCreate(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sockclnt_delete", func(w http.ResponseWriter, req *http.Request) { + var request = new(SockclntDelete) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SockclntDelete(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/memclnt/memclnt_rpc.ba.go b/binapi/memclnt/memclnt_rpc.ba.go new file mode 100644 index 0000000..ec60156 --- /dev/null +++ b/binapi/memclnt/memclnt_rpc.ba.go @@ -0,0 +1,162 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package memclnt + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service memclnt. +type RPCService interface { + APIVersions(ctx context.Context, in *APIVersions) (*APIVersionsReply, error) + GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) + MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) + MemclntDelete(ctx context.Context, in *MemclntDelete) (*MemclntDeleteReply, error) + MemclntKeepalive(ctx context.Context, in *MemclntKeepalive) (*MemclntKeepaliveReply, error) + MemclntReadTimeout(ctx context.Context, in *MemclntReadTimeout) error + MemclntRxThreadSuspend(ctx context.Context, in *MemclntRxThreadSuspend) error + RPCCall(ctx context.Context, in *RPCCall) (*RPCCallReply, error) + RxThreadExit(ctx context.Context, in *RxThreadExit) error + SockInitShm(ctx context.Context, in *SockInitShm) (*SockInitShmReply, error) + SockclntCreate(ctx context.Context, in *SockclntCreate) (*SockclntCreateReply, error) + SockclntDelete(ctx context.Context, in *SockclntDelete) (*SockclntDeleteReply, error) + TracePluginMsgIds(ctx context.Context, in *TracePluginMsgIds) error +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) APIVersions(ctx context.Context, in *APIVersions) (*APIVersionsReply, error) { + out := new(APIVersionsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) { + out := new(GetFirstMsgIDReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) { + out := new(MemclntCreateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntDelete(ctx context.Context, in *MemclntDelete) (*MemclntDeleteReply, error) { + out := new(MemclntDeleteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntKeepalive(ctx context.Context, in *MemclntKeepalive) (*MemclntKeepaliveReply, error) { + out := new(MemclntKeepaliveReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntReadTimeout(ctx context.Context, in *MemclntReadTimeout) error { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return err + } + err = stream.SendMsg(in) + if err != nil { + return err + } + return nil +} + +func (c *serviceClient) MemclntRxThreadSuspend(ctx context.Context, in *MemclntRxThreadSuspend) error { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return err + } + err = stream.SendMsg(in) + if err != nil { + return err + } + return nil +} + +func (c *serviceClient) RPCCall(ctx context.Context, in *RPCCall) (*RPCCallReply, error) { + out := new(RPCCallReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) RxThreadExit(ctx context.Context, in *RxThreadExit) error { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return err + } + err = stream.SendMsg(in) + if err != nil { + return err + } + return nil +} + +func (c *serviceClient) SockInitShm(ctx context.Context, in *SockInitShm) (*SockInitShmReply, error) { + out := new(SockInitShmReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SockclntCreate(ctx context.Context, in *SockclntCreate) (*SockclntCreateReply, error) { + out := new(SockclntCreateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SockclntDelete(ctx context.Context, in *SockclntDelete) (*SockclntDeleteReply, error) { + out := new(SockclntDeleteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) TracePluginMsgIds(ctx context.Context, in *TracePluginMsgIds) error { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return err + } + err = stream.SendMsg(in) + if err != nil { + return err + } + return nil +} diff --git a/binapi/memif/memif.ba.go b/binapi/memif/memif.ba.go new file mode 100644 index 0000000..be5d392 --- /dev/null +++ b/binapi/memif/memif.ba.go @@ -0,0 +1,566 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/memif.api.json + +// Package memif contains generated bindings for API file memif.api. +// +// Contents: +// 2 enums +// 10 messages +// +package memif + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "memif" + APIVersion = "3.0.0" + VersionCrc = 0x1a1c95b8 +) + +// MemifMode defines enum 'memif_mode'. +type MemifMode uint32 + +const ( + MEMIF_MODE_API_ETHERNET MemifMode = 0 + MEMIF_MODE_API_IP MemifMode = 1 + MEMIF_MODE_API_PUNT_INJECT MemifMode = 2 +) + +var ( + MemifMode_name = map[uint32]string{ + 0: "MEMIF_MODE_API_ETHERNET", + 1: "MEMIF_MODE_API_IP", + 2: "MEMIF_MODE_API_PUNT_INJECT", + } + MemifMode_value = map[string]uint32{ + "MEMIF_MODE_API_ETHERNET": 0, + "MEMIF_MODE_API_IP": 1, + "MEMIF_MODE_API_PUNT_INJECT": 2, + } +) + +func (x MemifMode) String() string { + s, ok := MemifMode_name[uint32(x)] + if ok { + return s + } + return "MemifMode(" + strconv.Itoa(int(x)) + ")" +} + +// MemifRole defines enum 'memif_role'. +type MemifRole uint32 + +const ( + MEMIF_ROLE_API_MASTER MemifRole = 0 + MEMIF_ROLE_API_SLAVE MemifRole = 1 +) + +var ( + MemifRole_name = map[uint32]string{ + 0: "MEMIF_ROLE_API_MASTER", + 1: "MEMIF_ROLE_API_SLAVE", + } + MemifRole_value = map[string]uint32{ + "MEMIF_ROLE_API_MASTER": 0, + "MEMIF_ROLE_API_SLAVE": 1, + } +) + +func (x MemifRole) String() string { + s, ok := MemifRole_name[uint32(x)] + if ok { + return s + } + return "MemifRole(" + strconv.Itoa(int(x)) + ")" +} + +// MemifCreate defines message 'memif_create'. +type MemifCreate struct { + Role MemifRole `binapi:"memif_role,name=role" json:"role,omitempty"` + Mode MemifMode `binapi:"memif_mode,name=mode" json:"mode,omitempty"` + RxQueues uint8 `binapi:"u8,name=rx_queues" json:"rx_queues,omitempty"` + TxQueues uint8 `binapi:"u8,name=tx_queues" json:"tx_queues,omitempty"` + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` + SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` + RingSize uint32 `binapi:"u32,name=ring_size" json:"ring_size,omitempty"` + BufferSize uint16 `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"` + NoZeroCopy bool `binapi:"bool,name=no_zero_copy" json:"no_zero_copy,omitempty"` + HwAddr ethernet_types.MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` + Secret string `binapi:"string[24],name=secret" json:"secret,omitempty"` +} + +func (m *MemifCreate) Reset() { *m = MemifCreate{} } +func (*MemifCreate) GetMessageName() string { return "memif_create" } +func (*MemifCreate) GetCrcString() string { return "b1b25061" } +func (*MemifCreate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MemifCreate) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Role + size += 4 // m.Mode + size += 1 // m.RxQueues + size += 1 // m.TxQueues + size += 4 // m.ID + size += 4 // m.SocketID + size += 4 // m.RingSize + size += 2 // m.BufferSize + size += 1 // m.NoZeroCopy + size += 1 * 6 // m.HwAddr + size += 24 // m.Secret + return size +} +func (m *MemifCreate) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Role)) + buf.EncodeUint32(uint32(m.Mode)) + buf.EncodeUint8(uint8(m.RxQueues)) + buf.EncodeUint8(uint8(m.TxQueues)) + buf.EncodeUint32(uint32(m.ID)) + buf.EncodeUint32(uint32(m.SocketID)) + buf.EncodeUint32(uint32(m.RingSize)) + buf.EncodeUint16(uint16(m.BufferSize)) + buf.EncodeBool(m.NoZeroCopy) + buf.EncodeBytes(m.HwAddr[:], 6) + buf.EncodeString(m.Secret, 24) + return buf.Bytes(), nil +} +func (m *MemifCreate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Role = MemifRole(buf.DecodeUint32()) + m.Mode = MemifMode(buf.DecodeUint32()) + m.RxQueues = buf.DecodeUint8() + m.TxQueues = buf.DecodeUint8() + m.ID = buf.DecodeUint32() + m.SocketID = buf.DecodeUint32() + m.RingSize = buf.DecodeUint32() + m.BufferSize = buf.DecodeUint16() + m.NoZeroCopy = buf.DecodeBool() + copy(m.HwAddr[:], buf.DecodeBytes(6)) + m.Secret = buf.DecodeString(24) + return nil +} + +// MemifCreateReply defines message 'memif_create_reply'. +type MemifCreateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *MemifCreateReply) Reset() { *m = MemifCreateReply{} } +func (*MemifCreateReply) GetMessageName() string { return "memif_create_reply" } +func (*MemifCreateReply) GetCrcString() string { return "5383d31f" } +func (*MemifCreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MemifCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *MemifCreateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *MemifCreateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// MemifDelete defines message 'memif_delete'. +type MemifDelete struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *MemifDelete) Reset() { *m = MemifDelete{} } +func (*MemifDelete) GetMessageName() string { return "memif_delete" } +func (*MemifDelete) GetCrcString() string { return "f9e6675e" } +func (*MemifDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MemifDelete) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *MemifDelete) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *MemifDelete) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// MemifDeleteReply defines message 'memif_delete_reply'. +type MemifDeleteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MemifDeleteReply) Reset() { *m = MemifDeleteReply{} } +func (*MemifDeleteReply) GetMessageName() string { return "memif_delete_reply" } +func (*MemifDeleteReply) GetCrcString() string { return "e8d4e804" } +func (*MemifDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MemifDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *MemifDeleteReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MemifDeleteReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MemifDetails defines message 'memif_details'. +type MemifDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + HwAddr ethernet_types.MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` + Role MemifRole `binapi:"memif_role,name=role" json:"role,omitempty"` + Mode MemifMode `binapi:"memif_mode,name=mode" json:"mode,omitempty"` + ZeroCopy bool `binapi:"bool,name=zero_copy" json:"zero_copy,omitempty"` + SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` + RingSize uint32 `binapi:"u32,name=ring_size" json:"ring_size,omitempty"` + BufferSize uint16 `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"` + Flags interface_types.IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` + IfName string `binapi:"string[64],name=if_name" json:"if_name,omitempty"` +} + +func (m *MemifDetails) Reset() { *m = MemifDetails{} } +func (*MemifDetails) GetMessageName() string { return "memif_details" } +func (*MemifDetails) GetCrcString() string { return "d0382c4c" } +func (*MemifDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MemifDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 * 6 // m.HwAddr + size += 4 // m.ID + size += 4 // m.Role + size += 4 // m.Mode + size += 1 // m.ZeroCopy + size += 4 // m.SocketID + size += 4 // m.RingSize + size += 2 // m.BufferSize + size += 4 // m.Flags + size += 64 // m.IfName + return size +} +func (m *MemifDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBytes(m.HwAddr[:], 6) + buf.EncodeUint32(uint32(m.ID)) + buf.EncodeUint32(uint32(m.Role)) + buf.EncodeUint32(uint32(m.Mode)) + buf.EncodeBool(m.ZeroCopy) + buf.EncodeUint32(uint32(m.SocketID)) + buf.EncodeUint32(uint32(m.RingSize)) + buf.EncodeUint16(uint16(m.BufferSize)) + buf.EncodeUint32(uint32(m.Flags)) + buf.EncodeString(m.IfName, 64) + return buf.Bytes(), nil +} +func (m *MemifDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + copy(m.HwAddr[:], buf.DecodeBytes(6)) + m.ID = buf.DecodeUint32() + m.Role = MemifRole(buf.DecodeUint32()) + m.Mode = MemifMode(buf.DecodeUint32()) + m.ZeroCopy = buf.DecodeBool() + m.SocketID = buf.DecodeUint32() + m.RingSize = buf.DecodeUint32() + m.BufferSize = buf.DecodeUint16() + m.Flags = interface_types.IfStatusFlags(buf.DecodeUint32()) + m.IfName = buf.DecodeString(64) + return nil +} + +// MemifDump defines message 'memif_dump'. +type MemifDump struct{} + +func (m *MemifDump) Reset() { *m = MemifDump{} } +func (*MemifDump) GetMessageName() string { return "memif_dump" } +func (*MemifDump) GetCrcString() string { return "51077d14" } +func (*MemifDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MemifDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MemifDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *MemifDump) Unmarshal(b []byte) error { + return nil +} + +// MemifSocketFilenameAddDel defines message 'memif_socket_filename_add_del'. +type MemifSocketFilenameAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` + SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty"` +} + +func (m *MemifSocketFilenameAddDel) Reset() { *m = MemifSocketFilenameAddDel{} } +func (*MemifSocketFilenameAddDel) GetMessageName() string { return "memif_socket_filename_add_del" } +func (*MemifSocketFilenameAddDel) GetCrcString() string { return "a2ce1a10" } +func (*MemifSocketFilenameAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MemifSocketFilenameAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.SocketID + size += 108 // m.SocketFilename + return size +} +func (m *MemifSocketFilenameAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.SocketID)) + buf.EncodeString(m.SocketFilename, 108) + return buf.Bytes(), nil +} +func (m *MemifSocketFilenameAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.SocketID = buf.DecodeUint32() + m.SocketFilename = buf.DecodeString(108) + return nil +} + +// MemifSocketFilenameAddDelReply defines message 'memif_socket_filename_add_del_reply'. +type MemifSocketFilenameAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MemifSocketFilenameAddDelReply) Reset() { *m = MemifSocketFilenameAddDelReply{} } +func (*MemifSocketFilenameAddDelReply) GetMessageName() string { + return "memif_socket_filename_add_del_reply" +} +func (*MemifSocketFilenameAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*MemifSocketFilenameAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MemifSocketFilenameAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *MemifSocketFilenameAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MemifSocketFilenameAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MemifSocketFilenameDetails defines message 'memif_socket_filename_details'. +type MemifSocketFilenameDetails struct { + SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` + SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty"` +} + +func (m *MemifSocketFilenameDetails) Reset() { *m = MemifSocketFilenameDetails{} } +func (*MemifSocketFilenameDetails) GetMessageName() string { return "memif_socket_filename_details" } +func (*MemifSocketFilenameDetails) GetCrcString() string { return "7ff326f7" } +func (*MemifSocketFilenameDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MemifSocketFilenameDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SocketID + size += 108 // m.SocketFilename + return size +} +func (m *MemifSocketFilenameDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SocketID)) + buf.EncodeString(m.SocketFilename, 108) + return buf.Bytes(), nil +} +func (m *MemifSocketFilenameDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SocketID = buf.DecodeUint32() + m.SocketFilename = buf.DecodeString(108) + return nil +} + +// MemifSocketFilenameDump defines message 'memif_socket_filename_dump'. +type MemifSocketFilenameDump struct{} + +func (m *MemifSocketFilenameDump) Reset() { *m = MemifSocketFilenameDump{} } +func (*MemifSocketFilenameDump) GetMessageName() string { return "memif_socket_filename_dump" } +func (*MemifSocketFilenameDump) GetCrcString() string { return "51077d14" } +func (*MemifSocketFilenameDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MemifSocketFilenameDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MemifSocketFilenameDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *MemifSocketFilenameDump) Unmarshal(b []byte) error { + return nil +} + +func init() { file_memif_binapi_init() } +func file_memif_binapi_init() { + api.RegisterMessage((*MemifCreate)(nil), "memif_create_b1b25061") + api.RegisterMessage((*MemifCreateReply)(nil), "memif_create_reply_5383d31f") + api.RegisterMessage((*MemifDelete)(nil), "memif_delete_f9e6675e") + api.RegisterMessage((*MemifDeleteReply)(nil), "memif_delete_reply_e8d4e804") + api.RegisterMessage((*MemifDetails)(nil), "memif_details_d0382c4c") + api.RegisterMessage((*MemifDump)(nil), "memif_dump_51077d14") + api.RegisterMessage((*MemifSocketFilenameAddDel)(nil), "memif_socket_filename_add_del_a2ce1a10") + api.RegisterMessage((*MemifSocketFilenameAddDelReply)(nil), "memif_socket_filename_add_del_reply_e8d4e804") + api.RegisterMessage((*MemifSocketFilenameDetails)(nil), "memif_socket_filename_details_7ff326f7") + api.RegisterMessage((*MemifSocketFilenameDump)(nil), "memif_socket_filename_dump_51077d14") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*MemifCreate)(nil), + (*MemifCreateReply)(nil), + (*MemifDelete)(nil), + (*MemifDeleteReply)(nil), + (*MemifDetails)(nil), + (*MemifDump)(nil), + (*MemifSocketFilenameAddDel)(nil), + (*MemifSocketFilenameAddDelReply)(nil), + (*MemifSocketFilenameDetails)(nil), + (*MemifSocketFilenameDump)(nil), + } +} diff --git a/binapi/memif/memif_rest.ba.go b/binapi/memif/memif_rest.ba.go new file mode 100644 index 0000000..726824f --- /dev/null +++ b/binapi/memif/memif_rest.ba.go @@ -0,0 +1,83 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package memif + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/memif_create", func(w http.ResponseWriter, req *http.Request) { + var request = new(MemifCreate) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MemifCreate(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/memif_delete", func(w http.ResponseWriter, req *http.Request) { + var request = new(MemifDelete) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MemifDelete(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/memif_socket_filename_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(MemifSocketFilenameAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MemifSocketFilenameAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/memif/memif_rpc.ba.go b/binapi/memif/memif_rpc.ba.go new file mode 100644 index 0000000..4cd1fa1 --- /dev/null +++ b/binapi/memif/memif_rpc.ba.go @@ -0,0 +1,133 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package memif + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service memif. +type RPCService interface { + MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) + MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) + MemifDump(ctx context.Context, in *MemifDump) (RPCService_MemifDumpClient, error) + MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) + MemifSocketFilenameDump(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_MemifSocketFilenameDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) { + out := new(MemifCreateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) { + out := new(MemifDeleteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemifDump(ctx context.Context, in *MemifDump) (RPCService_MemifDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_MemifDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_MemifDumpClient interface { + Recv() (*MemifDetails, error) + api.Stream +} + +type serviceClient_MemifDumpClient struct { + api.Stream +} + +func (c *serviceClient_MemifDumpClient) Recv() (*MemifDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *MemifDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) { + out := new(MemifSocketFilenameAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemifSocketFilenameDump(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_MemifSocketFilenameDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_MemifSocketFilenameDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_MemifSocketFilenameDumpClient interface { + Recv() (*MemifSocketFilenameDetails, error) + api.Stream +} + +type serviceClient_MemifSocketFilenameDumpClient struct { + api.Stream +} + +func (c *serviceClient_MemifSocketFilenameDumpClient) Recv() (*MemifSocketFilenameDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *MemifSocketFilenameDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/mfib_types/mfib_types.ba.go b/binapi/mfib_types/mfib_types.ba.go new file mode 100644 index 0000000..645d64c --- /dev/null +++ b/binapi/mfib_types/mfib_types.ba.go @@ -0,0 +1,90 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/mfib_types.api.json + +// Package mfib_types contains generated bindings for API file mfib_types.api. +// +// Contents: +// 1 enum +// 1 struct +// +package mfib_types + +import ( + api "git.fd.io/govpp.git/api" + fib_types "git.fd.io/govpp.git/binapi/fib_types" + _ "git.fd.io/govpp.git/binapi/ip_types" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +// MfibItfFlags defines enum 'mfib_itf_flags'. +type MfibItfFlags uint32 + +const ( + MFIB_API_ITF_FLAG_NONE MfibItfFlags = 0 + MFIB_API_ITF_FLAG_NEGATE_SIGNAL MfibItfFlags = 1 + MFIB_API_ITF_FLAG_ACCEPT MfibItfFlags = 2 + MFIB_API_ITF_FLAG_FORWARD MfibItfFlags = 4 + MFIB_API_ITF_FLAG_SIGNAL_PRESENT MfibItfFlags = 8 + MFIB_API_ITF_FLAG_DONT_PRESERVE MfibItfFlags = 16 +) + +var ( + MfibItfFlags_name = map[uint32]string{ + 0: "MFIB_API_ITF_FLAG_NONE", + 1: "MFIB_API_ITF_FLAG_NEGATE_SIGNAL", + 2: "MFIB_API_ITF_FLAG_ACCEPT", + 4: "MFIB_API_ITF_FLAG_FORWARD", + 8: "MFIB_API_ITF_FLAG_SIGNAL_PRESENT", + 16: "MFIB_API_ITF_FLAG_DONT_PRESERVE", + } + MfibItfFlags_value = map[string]uint32{ + "MFIB_API_ITF_FLAG_NONE": 0, + "MFIB_API_ITF_FLAG_NEGATE_SIGNAL": 1, + "MFIB_API_ITF_FLAG_ACCEPT": 2, + "MFIB_API_ITF_FLAG_FORWARD": 4, + "MFIB_API_ITF_FLAG_SIGNAL_PRESENT": 8, + "MFIB_API_ITF_FLAG_DONT_PRESERVE": 16, + } +) + +func (x MfibItfFlags) String() string { + s, ok := MfibItfFlags_name[uint32(x)] + if ok { + return s + } + str := func(n uint32) string { + s, ok := MfibItfFlags_name[uint32(n)] + if ok { + return s + } + return "MfibItfFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint32(0); i <= 32; i++ { + val := uint32(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint32(x)) + } + return s +} + +// MfibPath defines type 'mfib_path'. +type MfibPath struct { + ItfFlags MfibItfFlags `binapi:"mfib_itf_flags,name=itf_flags" json:"itf_flags,omitempty"` + Path fib_types.FibPath `binapi:"fib_path,name=path" json:"path,omitempty"` +} diff --git a/binapi/mpls/mpls.ba.go b/binapi/mpls/mpls.ba.go new file mode 100644 index 0000000..4656a9a --- /dev/null +++ b/binapi/mpls/mpls.ba.go @@ -0,0 +1,1126 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/mpls.api.json + +// Package mpls contains generated bindings for API file mpls.api. +// +// Contents: +// 3 structs +// 16 messages +// +package mpls + +import ( + api "git.fd.io/govpp.git/api" + fib_types "git.fd.io/govpp.git/binapi/fib_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "mpls" + APIVersion = "1.1.1" + VersionCrc = 0xd83a030f +) + +// MplsRoute defines type 'mpls_route'. +type MplsRoute struct { + MrTableID uint32 `binapi:"u32,name=mr_table_id" json:"mr_table_id,omitempty"` + MrLabel uint32 `binapi:"u32,name=mr_label" json:"mr_label,omitempty"` + MrEos uint8 `binapi:"u8,name=mr_eos" json:"mr_eos,omitempty"` + MrEosProto uint8 `binapi:"u8,name=mr_eos_proto" json:"mr_eos_proto,omitempty"` + MrIsMulticast bool `binapi:"bool,name=mr_is_multicast" json:"mr_is_multicast,omitempty"` + MrNPaths uint8 `binapi:"u8,name=mr_n_paths" json:"-"` + MrPaths []fib_types.FibPath `binapi:"fib_path[mr_n_paths],name=mr_paths" json:"mr_paths,omitempty"` +} + +// MplsTable defines type 'mpls_table'. +type MplsTable struct { + MtTableID uint32 `binapi:"u32,name=mt_table_id" json:"mt_table_id,omitempty"` + MtName string `binapi:"string[64],name=mt_name" json:"mt_name,omitempty"` +} + +// MplsTunnel defines type 'mpls_tunnel'. +type MplsTunnel struct { + MtSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mt_sw_if_index" json:"mt_sw_if_index,omitempty"` + MtTunnelIndex uint32 `binapi:"u32,name=mt_tunnel_index" json:"mt_tunnel_index,omitempty"` + MtL2Only bool `binapi:"bool,name=mt_l2_only" json:"mt_l2_only,omitempty"` + MtIsMulticast bool `binapi:"bool,name=mt_is_multicast" json:"mt_is_multicast,omitempty"` + MtTag string `binapi:"string[64],name=mt_tag" json:"mt_tag,omitempty"` + MtNPaths uint8 `binapi:"u8,name=mt_n_paths" json:"-"` + MtPaths []fib_types.FibPath `binapi:"fib_path[mt_n_paths],name=mt_paths" json:"mt_paths,omitempty"` +} + +// MplsIPBindUnbind defines message 'mpls_ip_bind_unbind'. +type MplsIPBindUnbind struct { + MbMplsTableID uint32 `binapi:"u32,name=mb_mpls_table_id" json:"mb_mpls_table_id,omitempty"` + MbLabel uint32 `binapi:"u32,name=mb_label" json:"mb_label,omitempty"` + MbIPTableID uint32 `binapi:"u32,name=mb_ip_table_id" json:"mb_ip_table_id,omitempty"` + MbIsBind bool `binapi:"bool,name=mb_is_bind" json:"mb_is_bind,omitempty"` + MbPrefix ip_types.Prefix `binapi:"prefix,name=mb_prefix" json:"mb_prefix,omitempty"` +} + +func (m *MplsIPBindUnbind) Reset() { *m = MplsIPBindUnbind{} } +func (*MplsIPBindUnbind) GetMessageName() string { return "mpls_ip_bind_unbind" } +func (*MplsIPBindUnbind) GetCrcString() string { return "48249a27" } +func (*MplsIPBindUnbind) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MplsIPBindUnbind) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.MbMplsTableID + size += 4 // m.MbLabel + size += 4 // m.MbIPTableID + size += 1 // m.MbIsBind + size += 1 // m.MbPrefix.Address.Af + size += 1 * 16 // m.MbPrefix.Address.Un + size += 1 // m.MbPrefix.Len + return size +} +func (m *MplsIPBindUnbind) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.MbMplsTableID)) + buf.EncodeUint32(uint32(m.MbLabel)) + buf.EncodeUint32(uint32(m.MbIPTableID)) + buf.EncodeBool(m.MbIsBind) + buf.EncodeUint8(uint8(m.MbPrefix.Address.Af)) + buf.EncodeBytes(m.MbPrefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.MbPrefix.Len)) + return buf.Bytes(), nil +} +func (m *MplsIPBindUnbind) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.MbMplsTableID = buf.DecodeUint32() + m.MbLabel = buf.DecodeUint32() + m.MbIPTableID = buf.DecodeUint32() + m.MbIsBind = buf.DecodeBool() + m.MbPrefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.MbPrefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.MbPrefix.Len = buf.DecodeUint8() + return nil +} + +// MplsIPBindUnbindReply defines message 'mpls_ip_bind_unbind_reply'. +type MplsIPBindUnbindReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MplsIPBindUnbindReply) Reset() { *m = MplsIPBindUnbindReply{} } +func (*MplsIPBindUnbindReply) GetMessageName() string { return "mpls_ip_bind_unbind_reply" } +func (*MplsIPBindUnbindReply) GetCrcString() string { return "e8d4e804" } +func (*MplsIPBindUnbindReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MplsIPBindUnbindReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *MplsIPBindUnbindReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MplsIPBindUnbindReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MplsRouteAddDel defines message 'mpls_route_add_del'. +type MplsRouteAddDel struct { + MrIsAdd bool `binapi:"bool,name=mr_is_add" json:"mr_is_add,omitempty"` + MrIsMultipath bool `binapi:"bool,name=mr_is_multipath" json:"mr_is_multipath,omitempty"` + MrRoute MplsRoute `binapi:"mpls_route,name=mr_route" json:"mr_route,omitempty"` +} + +func (m *MplsRouteAddDel) Reset() { *m = MplsRouteAddDel{} } +func (*MplsRouteAddDel) GetMessageName() string { return "mpls_route_add_del" } +func (*MplsRouteAddDel) GetCrcString() string { return "343cff54" } +func (*MplsRouteAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MplsRouteAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.MrIsAdd + size += 1 // m.MrIsMultipath + size += 4 // m.MrRoute.MrTableID + size += 4 // m.MrRoute.MrLabel + size += 1 // m.MrRoute.MrEos + size += 1 // m.MrRoute.MrEosProto + size += 1 // m.MrRoute.MrIsMulticast + size += 1 // m.MrRoute.MrNPaths + for j2 := 0; j2 < len(m.MrRoute.MrPaths); j2++ { + var s2 fib_types.FibPath + _ = s2 + if j2 < len(m.MrRoute.MrPaths) { + s2 = m.MrRoute.MrPaths[j2] + } + size += 4 // s2.SwIfIndex + size += 4 // s2.TableID + size += 4 // s2.RpfID + size += 1 // s2.Weight + size += 1 // s2.Preference + size += 4 // s2.Type + size += 4 // s2.Flags + size += 4 // s2.Proto + size += 1 * 16 // s2.Nh.Address + size += 4 // s2.Nh.ViaLabel + size += 4 // s2.Nh.ObjID + size += 4 // s2.Nh.ClassifyTableIndex + size += 1 // s2.NLabels + for j3 := 0; j3 < 16; j3++ { + var s3 fib_types.FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + size += 1 // s3.IsUniform + size += 4 // s3.Label + size += 1 // s3.TTL + size += 1 // s3.Exp + } + } + return size +} +func (m *MplsRouteAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.MrIsAdd) + buf.EncodeBool(m.MrIsMultipath) + buf.EncodeUint32(uint32(m.MrRoute.MrTableID)) + buf.EncodeUint32(uint32(m.MrRoute.MrLabel)) + buf.EncodeUint8(uint8(m.MrRoute.MrEos)) + buf.EncodeUint8(uint8(m.MrRoute.MrEosProto)) + buf.EncodeBool(m.MrRoute.MrIsMulticast) + buf.EncodeUint8(uint8(len(m.MrRoute.MrPaths))) + for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ { + var v1 fib_types.FibPath + if j1 < len(m.MrRoute.MrPaths) { + v1 = m.MrRoute.MrPaths[j1] + } + buf.EncodeUint32(uint32(v1.SwIfIndex)) + buf.EncodeUint32(uint32(v1.TableID)) + buf.EncodeUint32(uint32(v1.RpfID)) + buf.EncodeUint8(uint8(v1.Weight)) + buf.EncodeUint8(uint8(v1.Preference)) + buf.EncodeUint32(uint32(v1.Type)) + buf.EncodeUint32(uint32(v1.Flags)) + buf.EncodeUint32(uint32(v1.Proto)) + buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v1.Nh.ViaLabel)) + buf.EncodeUint32(uint32(v1.Nh.ObjID)) + buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex)) + buf.EncodeUint8(uint8(v1.NLabels)) + for j2 := 0; j2 < 16; j2++ { + var v2 fib_types.FibMplsLabel + if j2 < len(v1.LabelStack) { + v2 = v1.LabelStack[j2] + } + buf.EncodeUint8(uint8(v2.IsUniform)) + buf.EncodeUint32(uint32(v2.Label)) + buf.EncodeUint8(uint8(v2.TTL)) + buf.EncodeUint8(uint8(v2.Exp)) + } + } + return buf.Bytes(), nil +} +func (m *MplsRouteAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.MrIsAdd = buf.DecodeBool() + m.MrIsMultipath = buf.DecodeBool() + m.MrRoute.MrTableID = buf.DecodeUint32() + m.MrRoute.MrLabel = buf.DecodeUint32() + m.MrRoute.MrEos = buf.DecodeUint8() + m.MrRoute.MrEosProto = buf.DecodeUint8() + m.MrRoute.MrIsMulticast = buf.DecodeBool() + m.MrRoute.MrNPaths = buf.DecodeUint8() + m.MrRoute.MrPaths = make([]fib_types.FibPath, int(m.MrRoute.MrNPaths)) + for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ { + m.MrRoute.MrPaths[j1].SwIfIndex = buf.DecodeUint32() + m.MrRoute.MrPaths[j1].TableID = buf.DecodeUint32() + m.MrRoute.MrPaths[j1].RpfID = buf.DecodeUint32() + m.MrRoute.MrPaths[j1].Weight = buf.DecodeUint8() + m.MrRoute.MrPaths[j1].Preference = buf.DecodeUint8() + m.MrRoute.MrPaths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.MrRoute.MrPaths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.MrRoute.MrPaths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.MrRoute.MrPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.MrRoute.MrPaths[j1].Nh.ViaLabel = buf.DecodeUint32() + m.MrRoute.MrPaths[j1].Nh.ObjID = buf.DecodeUint32() + m.MrRoute.MrPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.MrRoute.MrPaths[j1].NLabels = buf.DecodeUint8() + for j2 := 0; j2 < 16; j2++ { + m.MrRoute.MrPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() + m.MrRoute.MrPaths[j1].LabelStack[j2].Label = buf.DecodeUint32() + m.MrRoute.MrPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8() + m.MrRoute.MrPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8() + } + } + return nil +} + +// MplsRouteAddDelReply defines message 'mpls_route_add_del_reply'. +type MplsRouteAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` +} + +func (m *MplsRouteAddDelReply) Reset() { *m = MplsRouteAddDelReply{} } +func (*MplsRouteAddDelReply) GetMessageName() string { return "mpls_route_add_del_reply" } +func (*MplsRouteAddDelReply) GetCrcString() string { return "1992deab" } +func (*MplsRouteAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MplsRouteAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.StatsIndex + return size +} +func (m *MplsRouteAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.StatsIndex)) + return buf.Bytes(), nil +} +func (m *MplsRouteAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.StatsIndex = buf.DecodeUint32() + return nil +} + +// MplsRouteDetails defines message 'mpls_route_details'. +type MplsRouteDetails struct { + MrRoute MplsRoute `binapi:"mpls_route,name=mr_route" json:"mr_route,omitempty"` +} + +func (m *MplsRouteDetails) Reset() { *m = MplsRouteDetails{} } +func (*MplsRouteDetails) GetMessageName() string { return "mpls_route_details" } +func (*MplsRouteDetails) GetCrcString() string { return "d0ac384c" } +func (*MplsRouteDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MplsRouteDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.MrRoute.MrTableID + size += 4 // m.MrRoute.MrLabel + size += 1 // m.MrRoute.MrEos + size += 1 // m.MrRoute.MrEosProto + size += 1 // m.MrRoute.MrIsMulticast + size += 1 // m.MrRoute.MrNPaths + for j2 := 0; j2 < len(m.MrRoute.MrPaths); j2++ { + var s2 fib_types.FibPath + _ = s2 + if j2 < len(m.MrRoute.MrPaths) { + s2 = m.MrRoute.MrPaths[j2] + } + size += 4 // s2.SwIfIndex + size += 4 // s2.TableID + size += 4 // s2.RpfID + size += 1 // s2.Weight + size += 1 // s2.Preference + size += 4 // s2.Type + size += 4 // s2.Flags + size += 4 // s2.Proto + size += 1 * 16 // s2.Nh.Address + size += 4 // s2.Nh.ViaLabel + size += 4 // s2.Nh.ObjID + size += 4 // s2.Nh.ClassifyTableIndex + size += 1 // s2.NLabels + for j3 := 0; j3 < 16; j3++ { + var s3 fib_types.FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + size += 1 // s3.IsUniform + size += 4 // s3.Label + size += 1 // s3.TTL + size += 1 // s3.Exp + } + } + return size +} +func (m *MplsRouteDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.MrRoute.MrTableID)) + buf.EncodeUint32(uint32(m.MrRoute.MrLabel)) + buf.EncodeUint8(uint8(m.MrRoute.MrEos)) + buf.EncodeUint8(uint8(m.MrRoute.MrEosProto)) + buf.EncodeBool(m.MrRoute.MrIsMulticast) + buf.EncodeUint8(uint8(len(m.MrRoute.MrPaths))) + for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ { + var v1 fib_types.FibPath + if j1 < len(m.MrRoute.MrPaths) { + v1 = m.MrRoute.MrPaths[j1] + } + buf.EncodeUint32(uint32(v1.SwIfIndex)) + buf.EncodeUint32(uint32(v1.TableID)) + buf.EncodeUint32(uint32(v1.RpfID)) + buf.EncodeUint8(uint8(v1.Weight)) + buf.EncodeUint8(uint8(v1.Preference)) + buf.EncodeUint32(uint32(v1.Type)) + buf.EncodeUint32(uint32(v1.Flags)) + buf.EncodeUint32(uint32(v1.Proto)) + buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v1.Nh.ViaLabel)) + buf.EncodeUint32(uint32(v1.Nh.ObjID)) + buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex)) + buf.EncodeUint8(uint8(v1.NLabels)) + for j2 := 0; j2 < 16; j2++ { + var v2 fib_types.FibMplsLabel + if j2 < len(v1.LabelStack) { + v2 = v1.LabelStack[j2] + } + buf.EncodeUint8(uint8(v2.IsUniform)) + buf.EncodeUint32(uint32(v2.Label)) + buf.EncodeUint8(uint8(v2.TTL)) + buf.EncodeUint8(uint8(v2.Exp)) + } + } + return buf.Bytes(), nil +} +func (m *MplsRouteDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.MrRoute.MrTableID = buf.DecodeUint32() + m.MrRoute.MrLabel = buf.DecodeUint32() + m.MrRoute.MrEos = buf.DecodeUint8() + m.MrRoute.MrEosProto = buf.DecodeUint8() + m.MrRoute.MrIsMulticast = buf.DecodeBool() + m.MrRoute.MrNPaths = buf.DecodeUint8() + m.MrRoute.MrPaths = make([]fib_types.FibPath, int(m.MrRoute.MrNPaths)) + for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ { + m.MrRoute.MrPaths[j1].SwIfIndex = buf.DecodeUint32() + m.MrRoute.MrPaths[j1].TableID = buf.DecodeUint32() + m.MrRoute.MrPaths[j1].RpfID = buf.DecodeUint32() + m.MrRoute.MrPaths[j1].Weight = buf.DecodeUint8() + m.MrRoute.MrPaths[j1].Preference = buf.DecodeUint8() + m.MrRoute.MrPaths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.MrRoute.MrPaths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.MrRoute.MrPaths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.MrRoute.MrPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.MrRoute.MrPaths[j1].Nh.ViaLabel = buf.DecodeUint32() + m.MrRoute.MrPaths[j1].Nh.ObjID = buf.DecodeUint32() + m.MrRoute.MrPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.MrRoute.MrPaths[j1].NLabels = buf.DecodeUint8() + for j2 := 0; j2 < 16; j2++ { + m.MrRoute.MrPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() + m.MrRoute.MrPaths[j1].LabelStack[j2].Label = buf.DecodeUint32() + m.MrRoute.MrPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8() + m.MrRoute.MrPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8() + } + } + return nil +} + +// MplsRouteDump defines message 'mpls_route_dump'. +type MplsRouteDump struct { + Table MplsTable `binapi:"mpls_table,name=table" json:"table,omitempty"` +} + +func (m *MplsRouteDump) Reset() { *m = MplsRouteDump{} } +func (*MplsRouteDump) GetMessageName() string { return "mpls_route_dump" } +func (*MplsRouteDump) GetCrcString() string { return "935fdefa" } +func (*MplsRouteDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MplsRouteDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Table.MtTableID + size += 64 // m.Table.MtName + return size +} +func (m *MplsRouteDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Table.MtTableID)) + buf.EncodeString(m.Table.MtName, 64) + return buf.Bytes(), nil +} +func (m *MplsRouteDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Table.MtTableID = buf.DecodeUint32() + m.Table.MtName = buf.DecodeString(64) + return nil +} + +// MplsTableAddDel defines message 'mpls_table_add_del'. +type MplsTableAddDel struct { + MtIsAdd bool `binapi:"bool,name=mt_is_add,default=true" json:"mt_is_add,omitempty"` + MtTable MplsTable `binapi:"mpls_table,name=mt_table" json:"mt_table,omitempty"` +} + +func (m *MplsTableAddDel) Reset() { *m = MplsTableAddDel{} } +func (*MplsTableAddDel) GetMessageName() string { return "mpls_table_add_del" } +func (*MplsTableAddDel) GetCrcString() string { return "57817512" } +func (*MplsTableAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MplsTableAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.MtIsAdd + size += 4 // m.MtTable.MtTableID + size += 64 // m.MtTable.MtName + return size +} +func (m *MplsTableAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.MtIsAdd) + buf.EncodeUint32(uint32(m.MtTable.MtTableID)) + buf.EncodeString(m.MtTable.MtName, 64) + return buf.Bytes(), nil +} +func (m *MplsTableAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.MtIsAdd = buf.DecodeBool() + m.MtTable.MtTableID = buf.DecodeUint32() + m.MtTable.MtName = buf.DecodeString(64) + return nil +} + +// MplsTableAddDelReply defines message 'mpls_table_add_del_reply'. +type MplsTableAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MplsTableAddDelReply) Reset() { *m = MplsTableAddDelReply{} } +func (*MplsTableAddDelReply) GetMessageName() string { return "mpls_table_add_del_reply" } +func (*MplsTableAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*MplsTableAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MplsTableAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *MplsTableAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MplsTableAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MplsTableDetails defines message 'mpls_table_details'. +type MplsTableDetails struct { + MtTable MplsTable `binapi:"mpls_table,name=mt_table" json:"mt_table,omitempty"` +} + +func (m *MplsTableDetails) Reset() { *m = MplsTableDetails{} } +func (*MplsTableDetails) GetMessageName() string { return "mpls_table_details" } +func (*MplsTableDetails) GetCrcString() string { return "f03ecdc8" } +func (*MplsTableDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MplsTableDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.MtTable.MtTableID + size += 64 // m.MtTable.MtName + return size +} +func (m *MplsTableDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.MtTable.MtTableID)) + buf.EncodeString(m.MtTable.MtName, 64) + return buf.Bytes(), nil +} +func (m *MplsTableDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.MtTable.MtTableID = buf.DecodeUint32() + m.MtTable.MtName = buf.DecodeString(64) + return nil +} + +// MplsTableDump defines message 'mpls_table_dump'. +type MplsTableDump struct{} + +func (m *MplsTableDump) Reset() { *m = MplsTableDump{} } +func (*MplsTableDump) GetMessageName() string { return "mpls_table_dump" } +func (*MplsTableDump) GetCrcString() string { return "51077d14" } +func (*MplsTableDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MplsTableDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MplsTableDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *MplsTableDump) Unmarshal(b []byte) error { + return nil +} + +// MplsTunnelAddDel defines message 'mpls_tunnel_add_del'. +type MplsTunnelAddDel struct { + MtIsAdd bool `binapi:"bool,name=mt_is_add,default=true" json:"mt_is_add,omitempty"` + MtTunnel MplsTunnel `binapi:"mpls_tunnel,name=mt_tunnel" json:"mt_tunnel,omitempty"` +} + +func (m *MplsTunnelAddDel) Reset() { *m = MplsTunnelAddDel{} } +func (*MplsTunnelAddDel) GetMessageName() string { return "mpls_tunnel_add_del" } +func (*MplsTunnelAddDel) GetCrcString() string { return "e57ce61d" } +func (*MplsTunnelAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MplsTunnelAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.MtIsAdd + size += 4 // m.MtTunnel.MtSwIfIndex + size += 4 // m.MtTunnel.MtTunnelIndex + size += 1 // m.MtTunnel.MtL2Only + size += 1 // m.MtTunnel.MtIsMulticast + size += 64 // m.MtTunnel.MtTag + size += 1 // m.MtTunnel.MtNPaths + for j2 := 0; j2 < len(m.MtTunnel.MtPaths); j2++ { + var s2 fib_types.FibPath + _ = s2 + if j2 < len(m.MtTunnel.MtPaths) { + s2 = m.MtTunnel.MtPaths[j2] + } + size += 4 // s2.SwIfIndex + size += 4 // s2.TableID + size += 4 // s2.RpfID + size += 1 // s2.Weight + size += 1 // s2.Preference + size += 4 // s2.Type + size += 4 // s2.Flags + size += 4 // s2.Proto + size += 1 * 16 // s2.Nh.Address + size += 4 // s2.Nh.ViaLabel + size += 4 // s2.Nh.ObjID + size += 4 // s2.Nh.ClassifyTableIndex + size += 1 // s2.NLabels + for j3 := 0; j3 < 16; j3++ { + var s3 fib_types.FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + size += 1 // s3.IsUniform + size += 4 // s3.Label + size += 1 // s3.TTL + size += 1 // s3.Exp + } + } + return size +} +func (m *MplsTunnelAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.MtIsAdd) + buf.EncodeUint32(uint32(m.MtTunnel.MtSwIfIndex)) + buf.EncodeUint32(uint32(m.MtTunnel.MtTunnelIndex)) + buf.EncodeBool(m.MtTunnel.MtL2Only) + buf.EncodeBool(m.MtTunnel.MtIsMulticast) + buf.EncodeString(m.MtTunnel.MtTag, 64) + buf.EncodeUint8(uint8(len(m.MtTunnel.MtPaths))) + for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ { + var v1 fib_types.FibPath + if j1 < len(m.MtTunnel.MtPaths) { + v1 = m.MtTunnel.MtPaths[j1] + } + buf.EncodeUint32(uint32(v1.SwIfIndex)) + buf.EncodeUint32(uint32(v1.TableID)) + buf.EncodeUint32(uint32(v1.RpfID)) + buf.EncodeUint8(uint8(v1.Weight)) + buf.EncodeUint8(uint8(v1.Preference)) + buf.EncodeUint32(uint32(v1.Type)) + buf.EncodeUint32(uint32(v1.Flags)) + buf.EncodeUint32(uint32(v1.Proto)) + buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v1.Nh.ViaLabel)) + buf.EncodeUint32(uint32(v1.Nh.ObjID)) + buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex)) + buf.EncodeUint8(uint8(v1.NLabels)) + for j2 := 0; j2 < 16; j2++ { + var v2 fib_types.FibMplsLabel + if j2 < len(v1.LabelStack) { + v2 = v1.LabelStack[j2] + } + buf.EncodeUint8(uint8(v2.IsUniform)) + buf.EncodeUint32(uint32(v2.Label)) + buf.EncodeUint8(uint8(v2.TTL)) + buf.EncodeUint8(uint8(v2.Exp)) + } + } + return buf.Bytes(), nil +} +func (m *MplsTunnelAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.MtIsAdd = buf.DecodeBool() + m.MtTunnel.MtSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.MtTunnel.MtTunnelIndex = buf.DecodeUint32() + m.MtTunnel.MtL2Only = buf.DecodeBool() + m.MtTunnel.MtIsMulticast = buf.DecodeBool() + m.MtTunnel.MtTag = buf.DecodeString(64) + m.MtTunnel.MtNPaths = buf.DecodeUint8() + m.MtTunnel.MtPaths = make([]fib_types.FibPath, int(m.MtTunnel.MtNPaths)) + for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ { + m.MtTunnel.MtPaths[j1].SwIfIndex = buf.DecodeUint32() + m.MtTunnel.MtPaths[j1].TableID = buf.DecodeUint32() + m.MtTunnel.MtPaths[j1].RpfID = buf.DecodeUint32() + m.MtTunnel.MtPaths[j1].Weight = buf.DecodeUint8() + m.MtTunnel.MtPaths[j1].Preference = buf.DecodeUint8() + m.MtTunnel.MtPaths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.MtTunnel.MtPaths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.MtTunnel.MtPaths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.MtTunnel.MtPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.MtTunnel.MtPaths[j1].Nh.ViaLabel = buf.DecodeUint32() + m.MtTunnel.MtPaths[j1].Nh.ObjID = buf.DecodeUint32() + m.MtTunnel.MtPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.MtTunnel.MtPaths[j1].NLabels = buf.DecodeUint8() + for j2 := 0; j2 < 16; j2++ { + m.MtTunnel.MtPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() + m.MtTunnel.MtPaths[j1].LabelStack[j2].Label = buf.DecodeUint32() + m.MtTunnel.MtPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8() + m.MtTunnel.MtPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8() + } + } + return nil +} + +// MplsTunnelAddDelReply defines message 'mpls_tunnel_add_del_reply'. +type MplsTunnelAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + TunnelIndex uint32 `binapi:"u32,name=tunnel_index" json:"tunnel_index,omitempty"` +} + +func (m *MplsTunnelAddDelReply) Reset() { *m = MplsTunnelAddDelReply{} } +func (*MplsTunnelAddDelReply) GetMessageName() string { return "mpls_tunnel_add_del_reply" } +func (*MplsTunnelAddDelReply) GetCrcString() string { return "afb01472" } +func (*MplsTunnelAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MplsTunnelAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + size += 4 // m.TunnelIndex + return size +} +func (m *MplsTunnelAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.TunnelIndex)) + return buf.Bytes(), nil +} +func (m *MplsTunnelAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.TunnelIndex = buf.DecodeUint32() + return nil +} + +// MplsTunnelDetails defines message 'mpls_tunnel_details'. +type MplsTunnelDetails struct { + MtTunnel MplsTunnel `binapi:"mpls_tunnel,name=mt_tunnel" json:"mt_tunnel,omitempty"` +} + +func (m *MplsTunnelDetails) Reset() { *m = MplsTunnelDetails{} } +func (*MplsTunnelDetails) GetMessageName() string { return "mpls_tunnel_details" } +func (*MplsTunnelDetails) GetCrcString() string { return "f3c0928e" } +func (*MplsTunnelDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MplsTunnelDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.MtTunnel.MtSwIfIndex + size += 4 // m.MtTunnel.MtTunnelIndex + size += 1 // m.MtTunnel.MtL2Only + size += 1 // m.MtTunnel.MtIsMulticast + size += 64 // m.MtTunnel.MtTag + size += 1 // m.MtTunnel.MtNPaths + for j2 := 0; j2 < len(m.MtTunnel.MtPaths); j2++ { + var s2 fib_types.FibPath + _ = s2 + if j2 < len(m.MtTunnel.MtPaths) { + s2 = m.MtTunnel.MtPaths[j2] + } + size += 4 // s2.SwIfIndex + size += 4 // s2.TableID + size += 4 // s2.RpfID + size += 1 // s2.Weight + size += 1 // s2.Preference + size += 4 // s2.Type + size += 4 // s2.Flags + size += 4 // s2.Proto + size += 1 * 16 // s2.Nh.Address + size += 4 // s2.Nh.ViaLabel + size += 4 // s2.Nh.ObjID + size += 4 // s2.Nh.ClassifyTableIndex + size += 1 // s2.NLabels + for j3 := 0; j3 < 16; j3++ { + var s3 fib_types.FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + size += 1 // s3.IsUniform + size += 4 // s3.Label + size += 1 // s3.TTL + size += 1 // s3.Exp + } + } + return size +} +func (m *MplsTunnelDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.MtTunnel.MtSwIfIndex)) + buf.EncodeUint32(uint32(m.MtTunnel.MtTunnelIndex)) + buf.EncodeBool(m.MtTunnel.MtL2Only) + buf.EncodeBool(m.MtTunnel.MtIsMulticast) + buf.EncodeString(m.MtTunnel.MtTag, 64) + buf.EncodeUint8(uint8(len(m.MtTunnel.MtPaths))) + for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ { + var v1 fib_types.FibPath + if j1 < len(m.MtTunnel.MtPaths) { + v1 = m.MtTunnel.MtPaths[j1] + } + buf.EncodeUint32(uint32(v1.SwIfIndex)) + buf.EncodeUint32(uint32(v1.TableID)) + buf.EncodeUint32(uint32(v1.RpfID)) + buf.EncodeUint8(uint8(v1.Weight)) + buf.EncodeUint8(uint8(v1.Preference)) + buf.EncodeUint32(uint32(v1.Type)) + buf.EncodeUint32(uint32(v1.Flags)) + buf.EncodeUint32(uint32(v1.Proto)) + buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v1.Nh.ViaLabel)) + buf.EncodeUint32(uint32(v1.Nh.ObjID)) + buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex)) + buf.EncodeUint8(uint8(v1.NLabels)) + for j2 := 0; j2 < 16; j2++ { + var v2 fib_types.FibMplsLabel + if j2 < len(v1.LabelStack) { + v2 = v1.LabelStack[j2] + } + buf.EncodeUint8(uint8(v2.IsUniform)) + buf.EncodeUint32(uint32(v2.Label)) + buf.EncodeUint8(uint8(v2.TTL)) + buf.EncodeUint8(uint8(v2.Exp)) + } + } + return buf.Bytes(), nil +} +func (m *MplsTunnelDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.MtTunnel.MtSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.MtTunnel.MtTunnelIndex = buf.DecodeUint32() + m.MtTunnel.MtL2Only = buf.DecodeBool() + m.MtTunnel.MtIsMulticast = buf.DecodeBool() + m.MtTunnel.MtTag = buf.DecodeString(64) + m.MtTunnel.MtNPaths = buf.DecodeUint8() + m.MtTunnel.MtPaths = make([]fib_types.FibPath, int(m.MtTunnel.MtNPaths)) + for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ { + m.MtTunnel.MtPaths[j1].SwIfIndex = buf.DecodeUint32() + m.MtTunnel.MtPaths[j1].TableID = buf.DecodeUint32() + m.MtTunnel.MtPaths[j1].RpfID = buf.DecodeUint32() + m.MtTunnel.MtPaths[j1].Weight = buf.DecodeUint8() + m.MtTunnel.MtPaths[j1].Preference = buf.DecodeUint8() + m.MtTunnel.MtPaths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.MtTunnel.MtPaths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.MtTunnel.MtPaths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.MtTunnel.MtPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.MtTunnel.MtPaths[j1].Nh.ViaLabel = buf.DecodeUint32() + m.MtTunnel.MtPaths[j1].Nh.ObjID = buf.DecodeUint32() + m.MtTunnel.MtPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.MtTunnel.MtPaths[j1].NLabels = buf.DecodeUint8() + for j2 := 0; j2 < 16; j2++ { + m.MtTunnel.MtPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() + m.MtTunnel.MtPaths[j1].LabelStack[j2].Label = buf.DecodeUint32() + m.MtTunnel.MtPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8() + m.MtTunnel.MtPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8() + } + } + return nil +} + +// MplsTunnelDump defines message 'mpls_tunnel_dump'. +type MplsTunnelDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"` +} + +func (m *MplsTunnelDump) Reset() { *m = MplsTunnelDump{} } +func (*MplsTunnelDump) GetMessageName() string { return "mpls_tunnel_dump" } +func (*MplsTunnelDump) GetCrcString() string { return "f9e6675e" } +func (*MplsTunnelDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MplsTunnelDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *MplsTunnelDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *MplsTunnelDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// SwInterfaceSetMplsEnable defines message 'sw_interface_set_mpls_enable'. +type SwInterfaceSetMplsEnable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Enable bool `binapi:"bool,name=enable,default=true" json:"enable,omitempty"` +} + +func (m *SwInterfaceSetMplsEnable) Reset() { *m = SwInterfaceSetMplsEnable{} } +func (*SwInterfaceSetMplsEnable) GetMessageName() string { return "sw_interface_set_mpls_enable" } +func (*SwInterfaceSetMplsEnable) GetCrcString() string { return "ae6cfcfb" } +func (*SwInterfaceSetMplsEnable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetMplsEnable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Enable + return size +} +func (m *SwInterfaceSetMplsEnable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetMplsEnable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Enable = buf.DecodeBool() + return nil +} + +// SwInterfaceSetMplsEnableReply defines message 'sw_interface_set_mpls_enable_reply'. +type SwInterfaceSetMplsEnableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetMplsEnableReply) Reset() { *m = SwInterfaceSetMplsEnableReply{} } +func (*SwInterfaceSetMplsEnableReply) GetMessageName() string { + return "sw_interface_set_mpls_enable_reply" +} +func (*SwInterfaceSetMplsEnableReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetMplsEnableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetMplsEnableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetMplsEnableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetMplsEnableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_mpls_binapi_init() } +func file_mpls_binapi_init() { + api.RegisterMessage((*MplsIPBindUnbind)(nil), "mpls_ip_bind_unbind_48249a27") + api.RegisterMessage((*MplsIPBindUnbindReply)(nil), "mpls_ip_bind_unbind_reply_e8d4e804") + api.RegisterMessage((*MplsRouteAddDel)(nil), "mpls_route_add_del_343cff54") + api.RegisterMessage((*MplsRouteAddDelReply)(nil), "mpls_route_add_del_reply_1992deab") + api.RegisterMessage((*MplsRouteDetails)(nil), "mpls_route_details_d0ac384c") + api.RegisterMessage((*MplsRouteDump)(nil), "mpls_route_dump_935fdefa") + api.RegisterMessage((*MplsTableAddDel)(nil), "mpls_table_add_del_57817512") + api.RegisterMessage((*MplsTableAddDelReply)(nil), "mpls_table_add_del_reply_e8d4e804") + api.RegisterMessage((*MplsTableDetails)(nil), "mpls_table_details_f03ecdc8") + api.RegisterMessage((*MplsTableDump)(nil), "mpls_table_dump_51077d14") + api.RegisterMessage((*MplsTunnelAddDel)(nil), "mpls_tunnel_add_del_e57ce61d") + api.RegisterMessage((*MplsTunnelAddDelReply)(nil), "mpls_tunnel_add_del_reply_afb01472") + api.RegisterMessage((*MplsTunnelDetails)(nil), "mpls_tunnel_details_f3c0928e") + api.RegisterMessage((*MplsTunnelDump)(nil), "mpls_tunnel_dump_f9e6675e") + api.RegisterMessage((*SwInterfaceSetMplsEnable)(nil), "sw_interface_set_mpls_enable_ae6cfcfb") + api.RegisterMessage((*SwInterfaceSetMplsEnableReply)(nil), "sw_interface_set_mpls_enable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*MplsIPBindUnbind)(nil), + (*MplsIPBindUnbindReply)(nil), + (*MplsRouteAddDel)(nil), + (*MplsRouteAddDelReply)(nil), + (*MplsRouteDetails)(nil), + (*MplsRouteDump)(nil), + (*MplsTableAddDel)(nil), + (*MplsTableAddDelReply)(nil), + (*MplsTableDetails)(nil), + (*MplsTableDump)(nil), + (*MplsTunnelAddDel)(nil), + (*MplsTunnelAddDelReply)(nil), + (*MplsTunnelDetails)(nil), + (*MplsTunnelDump)(nil), + (*SwInterfaceSetMplsEnable)(nil), + (*SwInterfaceSetMplsEnableReply)(nil), + } +} diff --git a/binapi/mpls/mpls_rest.ba.go b/binapi/mpls/mpls_rest.ba.go new file mode 100644 index 0000000..9cac11b --- /dev/null +++ b/binapi/mpls/mpls_rest.ba.go @@ -0,0 +1,129 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package mpls + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/mpls_ip_bind_unbind", func(w http.ResponseWriter, req *http.Request) { + var request = new(MplsIPBindUnbind) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MplsIPBindUnbind(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/mpls_route_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(MplsRouteAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MplsRouteAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/mpls_table_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(MplsTableAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MplsTableAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/mpls_tunnel_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(MplsTunnelAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MplsTunnelAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_set_mpls_enable", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceSetMplsEnable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceSetMplsEnable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/mpls/mpls_rpc.ba.go b/binapi/mpls/mpls_rpc.ba.go new file mode 100644 index 0000000..4a1d06e --- /dev/null +++ b/binapi/mpls/mpls_rpc.ba.go @@ -0,0 +1,193 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package mpls + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service mpls. +type RPCService interface { + MplsIPBindUnbind(ctx context.Context, in *MplsIPBindUnbind) (*MplsIPBindUnbindReply, error) + MplsRouteAddDel(ctx context.Context, in *MplsRouteAddDel) (*MplsRouteAddDelReply, error) + MplsRouteDump(ctx context.Context, in *MplsRouteDump) (RPCService_MplsRouteDumpClient, error) + MplsTableAddDel(ctx context.Context, in *MplsTableAddDel) (*MplsTableAddDelReply, error) + MplsTableDump(ctx context.Context, in *MplsTableDump) (RPCService_MplsTableDumpClient, error) + MplsTunnelAddDel(ctx context.Context, in *MplsTunnelAddDel) (*MplsTunnelAddDelReply, error) + MplsTunnelDump(ctx context.Context, in *MplsTunnelDump) (RPCService_MplsTunnelDumpClient, error) + SwInterfaceSetMplsEnable(ctx context.Context, in *SwInterfaceSetMplsEnable) (*SwInterfaceSetMplsEnableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) MplsIPBindUnbind(ctx context.Context, in *MplsIPBindUnbind) (*MplsIPBindUnbindReply, error) { + out := new(MplsIPBindUnbindReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MplsRouteAddDel(ctx context.Context, in *MplsRouteAddDel) (*MplsRouteAddDelReply, error) { + out := new(MplsRouteAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MplsRouteDump(ctx context.Context, in *MplsRouteDump) (RPCService_MplsRouteDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_MplsRouteDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_MplsRouteDumpClient interface { + Recv() (*MplsRouteDetails, error) + api.Stream +} + +type serviceClient_MplsRouteDumpClient struct { + api.Stream +} + +func (c *serviceClient_MplsRouteDumpClient) Recv() (*MplsRouteDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *MplsRouteDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) MplsTableAddDel(ctx context.Context, in *MplsTableAddDel) (*MplsTableAddDelReply, error) { + out := new(MplsTableAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MplsTableDump(ctx context.Context, in *MplsTableDump) (RPCService_MplsTableDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_MplsTableDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_MplsTableDumpClient interface { + Recv() (*MplsTableDetails, error) + api.Stream +} + +type serviceClient_MplsTableDumpClient struct { + api.Stream +} + +func (c *serviceClient_MplsTableDumpClient) Recv() (*MplsTableDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *MplsTableDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) MplsTunnelAddDel(ctx context.Context, in *MplsTunnelAddDel) (*MplsTunnelAddDelReply, error) { + out := new(MplsTunnelAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MplsTunnelDump(ctx context.Context, in *MplsTunnelDump) (RPCService_MplsTunnelDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_MplsTunnelDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_MplsTunnelDumpClient interface { + Recv() (*MplsTunnelDetails, error) + api.Stream +} + +type serviceClient_MplsTunnelDumpClient struct { + api.Stream +} + +func (c *serviceClient_MplsTunnelDumpClient) Recv() (*MplsTunnelDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *MplsTunnelDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) SwInterfaceSetMplsEnable(ctx context.Context, in *SwInterfaceSetMplsEnable) (*SwInterfaceSetMplsEnableReply, error) { + out := new(SwInterfaceSetMplsEnableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/nat/nat.ba.go b/binapi/nat/nat.ba.go new file mode 100644 index 0000000..75a9f98 --- /dev/null +++ b/binapi/nat/nat.ba.go @@ -0,0 +1,5713 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/nat.api.json + +// Package nat contains generated bindings for API file nat.api. +// +// Contents: +// 2 enums +// 1 struct +// 125 messages +// +package nat + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "nat" + APIVersion = "5.2.0" + VersionCrc = 0xabdcbb0d +) + +// NatConfigFlags defines enum 'nat_config_flags'. +type NatConfigFlags uint8 + +const ( + NAT_IS_NONE NatConfigFlags = 0 + NAT_IS_TWICE_NAT NatConfigFlags = 1 + NAT_IS_SELF_TWICE_NAT NatConfigFlags = 2 + NAT_IS_OUT2IN_ONLY NatConfigFlags = 4 + NAT_IS_ADDR_ONLY NatConfigFlags = 8 + NAT_IS_OUTSIDE NatConfigFlags = 16 + NAT_IS_INSIDE NatConfigFlags = 32 + NAT_IS_STATIC NatConfigFlags = 64 + NAT_IS_EXT_HOST_VALID NatConfigFlags = 128 +) + +var ( + NatConfigFlags_name = map[uint8]string{ + 0: "NAT_IS_NONE", + 1: "NAT_IS_TWICE_NAT", + 2: "NAT_IS_SELF_TWICE_NAT", + 4: "NAT_IS_OUT2IN_ONLY", + 8: "NAT_IS_ADDR_ONLY", + 16: "NAT_IS_OUTSIDE", + 32: "NAT_IS_INSIDE", + 64: "NAT_IS_STATIC", + 128: "NAT_IS_EXT_HOST_VALID", + } + NatConfigFlags_value = map[string]uint8{ + "NAT_IS_NONE": 0, + "NAT_IS_TWICE_NAT": 1, + "NAT_IS_SELF_TWICE_NAT": 2, + "NAT_IS_OUT2IN_ONLY": 4, + "NAT_IS_ADDR_ONLY": 8, + "NAT_IS_OUTSIDE": 16, + "NAT_IS_INSIDE": 32, + "NAT_IS_STATIC": 64, + "NAT_IS_EXT_HOST_VALID": 128, + } +) + +func (x NatConfigFlags) String() string { + s, ok := NatConfigFlags_name[uint8(x)] + if ok { + return s + } + str := func(n uint8) string { + s, ok := NatConfigFlags_name[uint8(n)] + if ok { + return s + } + return "NatConfigFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint8(0); i <= 8; i++ { + val := uint8(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint8(x)) + } + return s +} + +// NatLogLevel defines enum 'nat_log_level'. +type NatLogLevel uint8 + +const ( + NAT_LOG_NONE NatLogLevel = 0 + NAT_LOG_ERROR NatLogLevel = 1 + NAT_LOG_WARNING NatLogLevel = 2 + NAT_LOG_NOTICE NatLogLevel = 3 + NAT_LOG_INFO NatLogLevel = 4 + NAT_LOG_DEBUG NatLogLevel = 5 +) + +var ( + NatLogLevel_name = map[uint8]string{ + 0: "NAT_LOG_NONE", + 1: "NAT_LOG_ERROR", + 2: "NAT_LOG_WARNING", + 3: "NAT_LOG_NOTICE", + 4: "NAT_LOG_INFO", + 5: "NAT_LOG_DEBUG", + } + NatLogLevel_value = map[string]uint8{ + "NAT_LOG_NONE": 0, + "NAT_LOG_ERROR": 1, + "NAT_LOG_WARNING": 2, + "NAT_LOG_NOTICE": 3, + "NAT_LOG_INFO": 4, + "NAT_LOG_DEBUG": 5, + } +) + +func (x NatLogLevel) String() string { + s, ok := NatLogLevel_name[uint8(x)] + if ok { + return s + } + return "NatLogLevel(" + strconv.Itoa(int(x)) + ")" +} + +// Nat44LbAddrPort defines type 'nat44_lb_addr_port'. +type Nat44LbAddrPort struct { + Addr ip_types.IP4Address `binapi:"ip4_address,name=addr" json:"addr,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + Probability uint8 `binapi:"u8,name=probability" json:"probability,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +// Nat44AddDelAddressRange defines message 'nat44_add_del_address_range'. +type Nat44AddDelAddressRange struct { + FirstIPAddress ip_types.IP4Address `binapi:"ip4_address,name=first_ip_address" json:"first_ip_address,omitempty"` + LastIPAddress ip_types.IP4Address `binapi:"ip4_address,name=last_ip_address" json:"last_ip_address,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` +} + +func (m *Nat44AddDelAddressRange) Reset() { *m = Nat44AddDelAddressRange{} } +func (*Nat44AddDelAddressRange) GetMessageName() string { return "nat44_add_del_address_range" } +func (*Nat44AddDelAddressRange) GetCrcString() string { return "d4c7568c" } +func (*Nat44AddDelAddressRange) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44AddDelAddressRange) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.FirstIPAddress + size += 1 * 4 // m.LastIPAddress + size += 4 // m.VrfID + size += 1 // m.IsAdd + size += 1 // m.Flags + return size +} +func (m *Nat44AddDelAddressRange) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.FirstIPAddress[:], 4) + buf.EncodeBytes(m.LastIPAddress[:], 4) + buf.EncodeUint32(uint32(m.VrfID)) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.Flags)) + return buf.Bytes(), nil +} +func (m *Nat44AddDelAddressRange) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.FirstIPAddress[:], buf.DecodeBytes(4)) + copy(m.LastIPAddress[:], buf.DecodeBytes(4)) + m.VrfID = buf.DecodeUint32() + m.IsAdd = buf.DecodeBool() + m.Flags = NatConfigFlags(buf.DecodeUint8()) + return nil +} + +// Nat44AddDelAddressRangeReply defines message 'nat44_add_del_address_range_reply'. +type Nat44AddDelAddressRangeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44AddDelAddressRangeReply) Reset() { *m = Nat44AddDelAddressRangeReply{} } +func (*Nat44AddDelAddressRangeReply) GetMessageName() string { + return "nat44_add_del_address_range_reply" +} +func (*Nat44AddDelAddressRangeReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44AddDelAddressRangeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44AddDelAddressRangeReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Nat44AddDelAddressRangeReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Nat44AddDelAddressRangeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Nat44AddDelIdentityMapping defines message 'nat44_add_del_identity_mapping'. +type Nat44AddDelIdentityMapping struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` +} + +func (m *Nat44AddDelIdentityMapping) Reset() { *m = Nat44AddDelIdentityMapping{} } +func (*Nat44AddDelIdentityMapping) GetMessageName() string { return "nat44_add_del_identity_mapping" } +func (*Nat44AddDelIdentityMapping) GetCrcString() string { return "8e12743f" } +func (*Nat44AddDelIdentityMapping) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44AddDelIdentityMapping) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.Flags + size += 1 * 4 // m.IPAddress + size += 1 // m.Protocol + size += 2 // m.Port + size += 4 // m.SwIfIndex + size += 4 // m.VrfID + size += 64 // m.Tag + return size +} +func (m *Nat44AddDelIdentityMapping) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeBytes(m.IPAddress[:], 4) + buf.EncodeUint8(uint8(m.Protocol)) + buf.EncodeUint16(uint16(m.Port)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.VrfID)) + buf.EncodeString(m.Tag, 64) + return buf.Bytes(), nil +} +func (m *Nat44AddDelIdentityMapping) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Flags = NatConfigFlags(buf.DecodeUint8()) + copy(m.IPAddress[:], buf.DecodeBytes(4)) + m.Protocol = buf.DecodeUint8() + m.Port = buf.DecodeUint16() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.VrfID = buf.DecodeUint32() + m.Tag = buf.DecodeString(64) + return nil +} + +// Nat44AddDelIdentityMappingReply defines message 'nat44_add_del_identity_mapping_reply'. +type Nat44AddDelIdentityMappingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44AddDelIdentityMappingReply) Reset() { *m = Nat44AddDelIdentityMappingReply{} } +func (*Nat44AddDelIdentityMappingReply) GetMessageName() string { + return "nat44_add_del_identity_mapping_reply" +} +func (*Nat44AddDelIdentityMappingReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44AddDelIdentityMappingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44AddDelIdentityMappingReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Nat44AddDelIdentityMappingReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Nat44AddDelIdentityMappingReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Nat44AddDelInterfaceAddr defines message 'nat44_add_del_interface_addr'. +type Nat44AddDelInterfaceAddr struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` +} + +func (m *Nat44AddDelInterfaceAddr) Reset() { *m = Nat44AddDelInterfaceAddr{} } +func (*Nat44AddDelInterfaceAddr) GetMessageName() string { return "nat44_add_del_interface_addr" } +func (*Nat44AddDelInterfaceAddr) GetCrcString() string { return "fc835325" } +func (*Nat44AddDelInterfaceAddr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44AddDelInterfaceAddr) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.SwIfIndex + size += 1 // m.Flags + return size +} +func (m *Nat44AddDelInterfaceAddr) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.Flags)) + return buf.Bytes(), nil +} +func (m *Nat44AddDelInterfaceAddr) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Flags = NatConfigFlags(buf.DecodeUint8()) + return nil +} + +// Nat44AddDelInterfaceAddrReply defines message 'nat44_add_del_interface_addr_reply'. +type Nat44AddDelInterfaceAddrReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44AddDelInterfaceAddrReply) Reset() { *m = Nat44AddDelInterfaceAddrReply{} } +func (*Nat44AddDelInterfaceAddrReply) GetMessageName() string { + return "nat44_add_del_interface_addr_reply" +} +func (*Nat44AddDelInterfaceAddrReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44AddDelInterfaceAddrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44AddDelInterfaceAddrReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Nat44AddDelInterfaceAddrReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Nat44AddDelInterfaceAddrReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Nat44AddDelLbStaticMapping defines message 'nat44_add_del_lb_static_mapping'. +type Nat44AddDelLbStaticMapping struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + ExternalAddr ip_types.IP4Address `binapi:"ip4_address,name=external_addr" json:"external_addr,omitempty"` + ExternalPort uint16 `binapi:"u16,name=external_port" json:"external_port,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` + Affinity uint32 `binapi:"u32,name=affinity" json:"affinity,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` + LocalNum uint32 `binapi:"u32,name=local_num" json:"-"` + Locals []Nat44LbAddrPort `binapi:"nat44_lb_addr_port[local_num],name=locals" json:"locals,omitempty"` +} + +func (m *Nat44AddDelLbStaticMapping) Reset() { *m = Nat44AddDelLbStaticMapping{} } +func (*Nat44AddDelLbStaticMapping) GetMessageName() string { return "nat44_add_del_lb_static_mapping" } +func (*Nat44AddDelLbStaticMapping) GetCrcString() string { return "53b24611" } +func (*Nat44AddDelLbStaticMapping) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44AddDelLbStaticMapping) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.Flags + size += 1 * 4 // m.ExternalAddr + size += 2 // m.ExternalPort + size += 1 // m.Protocol + size += 4 // m.Affinity + size += 64 // m.Tag + size += 4 // m.LocalNum + for j1 := 0; j1 < len(m.Locals); j1++ { + var s1 Nat44LbAddrPort + _ = s1 + if j1 < len(m.Locals) { + s1 = m.Locals[j1] + } + size += 1 * 4 // s1.Addr + size += 2 // s1.Port + size += 1 // s1.Probability + size += 4 // s1.VrfID + } + return size +} +func (m *Nat44AddDelLbStaticMapping) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeBytes(m.ExternalAddr[:], 4) + buf.EncodeUint16(uint16(m.ExternalPort)) + buf.EncodeUint8(uint8(m.Protocol)) + buf.EncodeUint32(uint32(m.Affinity)) + buf.EncodeString(m.Tag, 64) + buf.EncodeUint32(uint32(len(m.Locals))) + for j0 := 0; j0 < len(m.Locals); j0++ { + var v0 Nat44LbAddrPort + if j0 < len(m.Locals) { + v0 = m.Locals[j0] + } + buf.EncodeBytes(v0.Addr[:], 4) + buf.EncodeUint16(uint16(v0.Port)) + buf.EncodeUint8(uint8(v0.Probability)) + buf.EncodeUint32(uint32(v0.VrfID)) + } + return buf.Bytes(), nil +} +func (m *Nat44AddDelLbStaticMapping) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Flags = NatConfigFlags(buf.DecodeUint8()) + copy(m.ExternalAddr[:], buf.DecodeBytes(4)) + m.ExternalPort = buf.DecodeUint16() + m.Protocol = buf.DecodeUint8() + m.Affinity = buf.DecodeUint32() + m.Tag = buf.DecodeString(64) + m.LocalNum = buf.DecodeUint32() + m.Locals = make([]Nat44LbAddrPort, int(m.LocalNum)) + for j0 := 0; j0 < len(m.Locals); j0++ { + copy(m.Locals[j0].Addr[:], buf.DecodeBytes(4)) + m.Locals[j0].Port = buf.DecodeUint16() + m.Locals[j0].Probability = buf.DecodeUint8() + m.Locals[j0].VrfID = buf.DecodeUint32() + } + return nil +} + +// Nat44AddDelLbStaticMappingReply defines message 'nat44_add_del_lb_static_mapping_reply'. +type Nat44AddDelLbStaticMappingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44AddDelLbStaticMappingReply) Reset() { *m = Nat44AddDelLbStaticMappingReply{} } +func (*Nat44AddDelLbStaticMappingReply) GetMessageName() string { + return "nat44_add_del_lb_static_mapping_reply" +} +func (*Nat44AddDelLbStaticMappingReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44AddDelLbStaticMappingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44AddDelLbStaticMappingReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Nat44AddDelLbStaticMappingReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Nat44AddDelLbStaticMappingReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Nat44AddDelStaticMapping defines message 'nat44_add_del_static_mapping'. +type Nat44AddDelStaticMapping struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + LocalIPAddress ip_types.IP4Address `binapi:"ip4_address,name=local_ip_address" json:"local_ip_address,omitempty"` + ExternalIPAddress ip_types.IP4Address `binapi:"ip4_address,name=external_ip_address" json:"external_ip_address,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` + LocalPort uint16 `binapi:"u16,name=local_port" json:"local_port,omitempty"` + ExternalPort uint16 `binapi:"u16,name=external_port" json:"external_port,omitempty"` + ExternalSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=external_sw_if_index" json:"external_sw_if_index,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` +} + +func (m *Nat44AddDelStaticMapping) Reset() { *m = Nat44AddDelStaticMapping{} } +func (*Nat44AddDelStaticMapping) GetMessageName() string { return "nat44_add_del_static_mapping" } +func (*Nat44AddDelStaticMapping) GetCrcString() string { return "e165e83b" } +func (*Nat44AddDelStaticMapping) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44AddDelStaticMapping) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.Flags + size += 1 * 4 // m.LocalIPAddress + size += 1 * 4 // m.ExternalIPAddress + size += 1 // m.Protocol + size += 2 // m.LocalPort + size += 2 // m.ExternalPort + size += 4 // m.ExternalSwIfIndex + size += 4 // m.VrfID + size += 64 // m.Tag + return size +} +func (m *Nat44AddDelStaticMapping) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeBytes(m.LocalIPAddress[:], 4) + buf.EncodeBytes(m.ExternalIPAddress[:], 4) + buf.EncodeUint8(uint8(m.Protocol)) + buf.EncodeUint16(uint16(m.LocalPort)) + buf.EncodeUint16(uint16(m.ExternalPort)) + buf.EncodeUint32(uint32(m.ExternalSwIfIndex)) + buf.EncodeUint32(uint32(m.VrfID)) + buf.EncodeString(m.Tag, 64) + return buf.Bytes(), nil +} +func (m *Nat44AddDelStaticMapping) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Flags = NatConfigFlags(buf.DecodeUint8()) + copy(m.LocalIPAddress[:], buf.DecodeBytes(4)) + copy(m.ExternalIPAddress[:], buf.DecodeBytes(4)) + m.Protocol = buf.DecodeUint8() + m.LocalPort = buf.DecodeUint16() + m.ExternalPort = buf.DecodeUint16() + m.ExternalSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.VrfID = buf.DecodeUint32() + m.Tag = buf.DecodeString(64) + return nil +} + +// Nat44AddDelStaticMappingReply defines message 'nat44_add_del_static_mapping_reply'. +type Nat44AddDelStaticMappingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44AddDelStaticMappingReply) Reset() { *m = Nat44AddDelStaticMappingReply{} } +func (*Nat44AddDelStaticMappingReply) GetMessageName() string { + return "nat44_add_del_static_mapping_reply" +} +func (*Nat44AddDelStaticMappingReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44AddDelStaticMappingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44AddDelStaticMappingReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Nat44AddDelStaticMappingReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Nat44AddDelStaticMappingReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Nat44AddressDetails defines message 'nat44_address_details'. +type Nat44AddressDetails struct { + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` + Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +func (m *Nat44AddressDetails) Reset() { *m = Nat44AddressDetails{} } +func (*Nat44AddressDetails) GetMessageName() string { return "nat44_address_details" } +func (*Nat44AddressDetails) GetCrcString() string { return "45410ac4" } +func (*Nat44AddressDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44AddressDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.IPAddress + size += 1 // m.Flags + size += 4 // m.VrfID + return size +} +func (m *Nat44AddressDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.IPAddress[:], 4) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint32(uint32(m.VrfID)) + return buf.Bytes(), nil +} +func (m *Nat44AddressDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IPAddress[:], buf.DecodeBytes(4)) + m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.VrfID = buf.DecodeUint32() + return nil +} + +// Nat44AddressDump defines message 'nat44_address_dump'. +type Nat44AddressDump struct{} + +func (m *Nat44AddressDump) Reset() { *m = Nat44AddressDump{} } +func (*Nat44AddressDump) GetMessageName() string { return "nat44_address_dump" } +func (*Nat44AddressDump) GetCrcString() string { return "51077d14" } +func (*Nat44AddressDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44AddressDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *Nat44AddressDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *Nat44AddressDump) Unmarshal(b []byte) error { + return nil +} + +// Nat44DelSession defines message 'nat44_del_session'. +type Nat44DelSession struct { + Address ip_types.IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + ExtHostAddress ip_types.IP4Address `binapi:"ip4_address,name=ext_host_address" json:"ext_host_address,omitempty"` + ExtHostPort uint16 `binapi:"u16,name=ext_host_port" json:"ext_host_port,omitempty"` +} + +func (m *Nat44DelSession) Reset() { *m = Nat44DelSession{} } +func (*Nat44DelSession) GetMessageName() string { return "nat44_del_session" } +func (*Nat44DelSession) GetCrcString() string { return "4c49c387" } +func (*Nat44DelSession) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44DelSession) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.Address + size += 1 // m.Protocol + size += 2 // m.Port + size += 4 // m.VrfID + size += 1 // m.Flags + size += 1 * 4 // m.ExtHostAddress + size += 2 // m.ExtHostPort + return size +} +func (m *Nat44DelSession) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.Address[:], 4) + buf.EncodeUint8(uint8(m.Protocol)) + buf.EncodeUint16(uint16(m.Port)) + buf.EncodeUint32(uint32(m.VrfID)) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeBytes(m.ExtHostAddress[:], 4) + buf.EncodeUint16(uint16(m.ExtHostPort)) + return buf.Bytes(), nil +} +func (m *Nat44DelSession) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.Address[:], buf.DecodeBytes(4)) + m.Protocol = buf.DecodeUint8() + m.Port = buf.DecodeUint16() + m.VrfID = buf.DecodeUint32() + m.Flags = NatConfigFlags(buf.DecodeUint8()) + copy(m.ExtHostAddress[:], buf.DecodeBytes(4)) + m.ExtHostPort = buf.DecodeUint16() + return nil +} + +// Nat44DelSessionReply defines message 'nat44_del_session_reply'. +type Nat44DelSessionReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44DelSessionReply) Reset() { *m = Nat44DelSessionReply{} } +func (*Nat44DelSessionReply) GetMessageName() string { return "nat44_del_session_reply" } +func (*Nat44DelSessionReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44DelSessionReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44DelSessionReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Nat44DelSessionReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Nat44DelSessionReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Nat44DelUser defines message 'nat44_del_user'. +type Nat44DelUser struct { + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` + FibIndex uint32 `binapi:"u32,name=fib_index" json:"fib_index,omitempty"` +} + +func (m *Nat44DelUser) Reset() { *m = Nat44DelUser{} } +func (*Nat44DelUser) GetMessageName() string { return "nat44_del_user" } +func (*Nat44DelUser) GetCrcString() string { return "99a9f998" } +func (*Nat44DelUser) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44DelUser) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.IPAddress + size += 4 // m.FibIndex + return size +} +func (m *Nat44DelUser) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.IPAddress[:], 4) + buf.EncodeUint32(uint32(m.FibIndex)) + return buf.Bytes(), nil +} +func (m *Nat44DelUser) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IPAddress[:], buf.DecodeBytes(4)) + m.FibIndex = buf.DecodeUint32() + return nil +} + +// Nat44DelUserReply defines message 'nat44_del_user_reply'. +type Nat44DelUserReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44DelUserReply) Reset() { *m = Nat44DelUserReply{} } +func (*Nat44DelUserReply) GetMessageName() string { return "nat44_del_user_reply" } +func (*Nat44DelUserReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44DelUserReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44DelUserReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Nat44DelUserReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Nat44DelUserReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Nat44ForwardingEnableDisable defines message 'nat44_forwarding_enable_disable'. +type Nat44ForwardingEnableDisable struct { + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *Nat44ForwardingEnableDisable) Reset() { *m = Nat44ForwardingEnableDisable{} } +func (*Nat44ForwardingEnableDisable) GetMessageName() string { + return "nat44_forwarding_enable_disable" +} +func (*Nat44ForwardingEnableDisable) GetCrcString() string { return "b3e225d2" } +func (*Nat44ForwardingEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44ForwardingEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Enable + return size +} +func (m *Nat44ForwardingEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *Nat44ForwardingEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Enable = buf.DecodeBool() + return nil +} + +// Nat44ForwardingEnableDisableReply defines message 'nat44_forwarding_enable_disable_reply'. +type Nat44ForwardingEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44ForwardingEnableDisableReply) Reset() { *m = Nat44ForwardingEnableDisableReply{} } +func (*Nat44ForwardingEnableDisableReply) GetMessageName() string { + return "nat44_forwarding_enable_disable_reply" +} +func (*Nat44ForwardingEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44ForwardingEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44ForwardingEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Nat44ForwardingEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Nat44ForwardingEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Nat44ForwardingIsEnabled defines message 'nat44_forwarding_is_enabled'. +type Nat44ForwardingIsEnabled struct{} + +func (m *Nat44ForwardingIsEnabled) Reset() { *m = Nat44ForwardingIsEnabled{} } +func (*Nat44ForwardingIsEnabled) GetMessageName() string { return "nat44_forwarding_is_enabled" } +func (*Nat44ForwardingIsEnabled) GetCrcString() string { return "51077d14" } +func (*Nat44ForwardingIsEnabled) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44ForwardingIsEnabled) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *Nat44ForwardingIsEnabled) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *Nat44ForwardingIsEnabled) Unmarshal(b []byte) error { + return nil +} + +// Nat44ForwardingIsEnabledReply defines message 'nat44_forwarding_is_enabled_reply'. +type Nat44ForwardingIsEnabledReply struct { + Enabled bool `binapi:"bool,name=enabled" json:"enabled,omitempty"` +} + +func (m *Nat44ForwardingIsEnabledReply) Reset() { *m = Nat44ForwardingIsEnabledReply{} } +func (*Nat44ForwardingIsEnabledReply) GetMessageName() string { + return "nat44_forwarding_is_enabled_reply" +} +func (*Nat44ForwardingIsEnabledReply) GetCrcString() string { return "46924a06" } +func (*Nat44ForwardingIsEnabledReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44ForwardingIsEnabledReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Enabled + return size +} +func (m *Nat44ForwardingIsEnabledReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.Enabled) + return buf.Bytes(), nil +} +func (m *Nat44ForwardingIsEnabledReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Enabled = buf.DecodeBool() + return nil +} + +// Nat44IdentityMappingDetails defines message 'nat44_identity_mapping_details'. +type Nat44IdentityMappingDetails struct { + Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` +} + +func (m *Nat44IdentityMappingDetails) Reset() { *m = Nat44IdentityMappingDetails{} } +func (*Nat44IdentityMappingDetails) GetMessageName() string { return "nat44_identity_mapping_details" } +func (*Nat44IdentityMappingDetails) GetCrcString() string { return "36d21351" } +func (*Nat44IdentityMappingDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44IdentityMappingDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Flags + size += 1 * 4 // m.IPAddress + size += 1 // m.Protocol + size += 2 // m.Port + size += 4 // m.SwIfIndex + size += 4 // m.VrfID + size += 64 // m.Tag + return size +} +func (m *Nat44IdentityMappingDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeBytes(m.IPAddress[:], 4) + buf.EncodeUint8(uint8(m.Protocol)) + buf.EncodeUint16(uint16(m.Port)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.VrfID)) + buf.EncodeString(m.Tag, 64) + return buf.Bytes(), nil +} +func (m *Nat44IdentityMappingDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Flags = NatConfigFlags(buf.DecodeUint8()) + copy(m.IPAddress[:], buf.DecodeBytes(4)) + m.Protocol = buf.DecodeUint8() + m.Port = buf.DecodeUint16() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.VrfID = buf.DecodeUint32() + m.Tag = buf.DecodeString(64) + return nil +} + +// Nat44IdentityMappingDump defines message 'nat44_identity_mapping_dump'. +type Nat44IdentityMappingDump struct{} + +func (m *Nat44IdentityMappingDump) Reset() { *m = Nat44IdentityMappingDump{} } +func (*Nat44IdentityMappingDump) GetMessageName() string { return "nat44_identity_mapping_dump" } +func (*Nat44IdentityMappingDump) GetCrcString() string { return "51077d14" } +func (*Nat44IdentityMappingDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44IdentityMappingDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *Nat44IdentityMappingDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *Nat44IdentityMappingDump) Unmarshal(b []byte) error { + return nil +} + +// Nat44InterfaceAddDelFeature defines message 'nat44_interface_add_del_feature'. +type Nat44InterfaceAddDelFeature struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Nat44InterfaceAddDelFeature) Reset() { *m = Nat44InterfaceAddDelFeature{} } +func (*Nat44InterfaceAddDelFeature) GetMessageName() string { return "nat44_interface_add_del_feature" } +func (*Nat44InterfaceAddDelFeature) GetCrcString() string { return "f3699b83" } +func (*Nat44InterfaceAddDelFeature) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44InterfaceAddDelFeature) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.Flags + size += 4 // m.SwIfIndex + return size +} +func (m *Nat44InterfaceAddDelFeature) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Nat44InterfaceAddDelFeature) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Nat44InterfaceAddDelFeatureReply defines message 'nat44_interface_add_del_feature_reply'. +type Nat44InterfaceAddDelFeatureReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44InterfaceAddDelFeatureReply) Reset() { *m = Nat44InterfaceAddDelFeatureReply{} } +func (*Nat44InterfaceAddDelFeatureReply) GetMessageName() string { + return "nat44_interface_add_del_feature_reply" +} +func (*Nat44InterfaceAddDelFeatureReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44InterfaceAddDelFeatureReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44InterfaceAddDelFeatureReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Nat44InterfaceAddDelFeatureReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Nat44InterfaceAddDelFeatureReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Nat44InterfaceAddDelOutputFeature defines message 'nat44_interface_add_del_output_feature'. +type Nat44InterfaceAddDelOutputFeature struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Nat44InterfaceAddDelOutputFeature) Reset() { *m = Nat44InterfaceAddDelOutputFeature{} } +func (*Nat44InterfaceAddDelOutputFeature) GetMessageName() string { + return "nat44_interface_add_del_output_feature" +} +func (*Nat44InterfaceAddDelOutputFeature) GetCrcString() string { return "f3699b83" } +func (*Nat44InterfaceAddDelOutputFeature) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44InterfaceAddDelOutputFeature) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.Flags + size += 4 // m.SwIfIndex + return size +} +func (m *Nat44InterfaceAddDelOutputFeature) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Nat44InterfaceAddDelOutputFeature) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Nat44InterfaceAddDelOutputFeatureReply defines message 'nat44_interface_add_del_output_feature_reply'. +type Nat44InterfaceAddDelOutputFeatureReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44InterfaceAddDelOutputFeatureReply) Reset() { + *m = Nat44InterfaceAddDelOutputFeatureReply{} +} +func (*Nat44InterfaceAddDelOutputFeatureReply) GetMessageName() string { + return "nat44_interface_add_del_output_feature_reply" +} +func (*Nat44InterfaceAddDelOutputFeatureReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44InterfaceAddDelOutputFeatureReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44InterfaceAddDelOutputFeatureReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Nat44InterfaceAddDelOutputFeatureReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Nat44InterfaceAddDelOutputFeatureReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Nat44InterfaceAddrDetails defines message 'nat44_interface_addr_details'. +type Nat44InterfaceAddrDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` +} + +func (m *Nat44InterfaceAddrDetails) Reset() { *m = Nat44InterfaceAddrDetails{} } +func (*Nat44InterfaceAddrDetails) GetMessageName() string { return "nat44_interface_addr_details" } +func (*Nat44InterfaceAddrDetails) GetCrcString() string { return "3e687514" } +func (*Nat44InterfaceAddrDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44InterfaceAddrDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Flags + return size +} +func (m *Nat44InterfaceAddrDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.Flags)) + return buf.Bytes(), nil +} +func (m *Nat44InterfaceAddrDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Flags = NatConfigFlags(buf.DecodeUint8()) + return nil +} + +// Nat44InterfaceAddrDump defines message 'nat44_interface_addr_dump'. +type Nat44InterfaceAddrDump struct{} + +func (m *Nat44InterfaceAddrDump) Reset() { *m = Nat44InterfaceAddrDump{} } +func (*Nat44InterfaceAddrDump) GetMessageName() string { return "nat44_interface_addr_dump" } +func (*Nat44InterfaceAddrDump) GetCrcString() string { return "51077d14" } +func (*Nat44InterfaceAddrDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44InterfaceAddrDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *Nat44InterfaceAddrDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *Nat44InterfaceAddrDump) Unmarshal(b []byte) error { + return nil +} + +// Nat44InterfaceDetails defines message 'nat44_interface_details'. +type Nat44InterfaceDetails struct { + Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Nat44InterfaceDetails) Reset() { *m = Nat44InterfaceDetails{} } +func (*Nat44InterfaceDetails) GetMessageName() string { return "nat44_interface_details" } +func (*Nat44InterfaceDetails) GetCrcString() string { return "5d286289" } +func (*Nat44InterfaceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44InterfaceDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Flags + size += 4 // m.SwIfIndex + return size +} +func (m *Nat44InterfaceDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Nat44InterfaceDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Nat44InterfaceDump defines message 'nat44_interface_dump'. +type Nat44InterfaceDump struct{} + +func (m *Nat44InterfaceDump) Reset() { *m = Nat44InterfaceDump{} } +func (*Nat44InterfaceDump) GetMessageName() string { return "nat44_interface_dump" } +func (*Nat44InterfaceDump) GetCrcString() string { return "51077d14" } +func (*Nat44InterfaceDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44InterfaceDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *Nat44InterfaceDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *Nat44InterfaceDump) Unmarshal(b []byte) error { + return nil +} + +// Nat44InterfaceOutputFeatureDetails defines message 'nat44_interface_output_feature_details'. +type Nat44InterfaceOutputFeatureDetails struct { + Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Nat44InterfaceOutputFeatureDetails) Reset() { *m = Nat44InterfaceOutputFeatureDetails{} } +func (*Nat44InterfaceOutputFeatureDetails) GetMessageName() string { + return "nat44_interface_output_feature_details" +} +func (*Nat44InterfaceOutputFeatureDetails) GetCrcString() string { return "5d286289" } +func (*Nat44InterfaceOutputFeatureDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44InterfaceOutputFeatureDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Flags + size += 4 // m.SwIfIndex + return size +} +func (m *Nat44InterfaceOutputFeatureDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Nat44InterfaceOutputFeatureDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Nat44InterfaceOutputFeatureDump defines message 'nat44_interface_output_feature_dump'. +type Nat44InterfaceOutputFeatureDump struct{} + +func (m *Nat44InterfaceOutputFeatureDump) Reset() { *m = Nat44InterfaceOutputFeatureDump{} } +func (*Nat44InterfaceOutputFeatureDump) GetMessageName() string { + return "nat44_interface_output_feature_dump" +} +func (*Nat44InterfaceOutputFeatureDump) GetCrcString() string { return "51077d14" } +func (*Nat44InterfaceOutputFeatureDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44InterfaceOutputFeatureDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *Nat44InterfaceOutputFeatureDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *Nat44InterfaceOutputFeatureDump) Unmarshal(b []byte) error { + return nil +} + +// Nat44LbStaticMappingAddDelLocal defines message 'nat44_lb_static_mapping_add_del_local'. +type Nat44LbStaticMappingAddDelLocal struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + ExternalAddr ip_types.IP4Address `binapi:"ip4_address,name=external_addr" json:"external_addr,omitempty"` + ExternalPort uint16 `binapi:"u16,name=external_port" json:"external_port,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` + Local Nat44LbAddrPort `binapi:"nat44_lb_addr_port,name=local" json:"local,omitempty"` +} + +func (m *Nat44LbStaticMappingAddDelLocal) Reset() { *m = Nat44LbStaticMappingAddDelLocal{} } +func (*Nat44LbStaticMappingAddDelLocal) GetMessageName() string { + return "nat44_lb_static_mapping_add_del_local" +} +func (*Nat44LbStaticMappingAddDelLocal) GetCrcString() string { return "2910a151" } +func (*Nat44LbStaticMappingAddDelLocal) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44LbStaticMappingAddDelLocal) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 * 4 // m.ExternalAddr + size += 2 // m.ExternalPort + size += 1 // m.Protocol + size += 1 * 4 // m.Local.Addr + size += 2 // m.Local.Port + size += 1 // m.Local.Probability + size += 4 // m.Local.VrfID + return size +} +func (m *Nat44LbStaticMappingAddDelLocal) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeBytes(m.ExternalAddr[:], 4) + buf.EncodeUint16(uint16(m.ExternalPort)) + buf.EncodeUint8(uint8(m.Protocol)) + buf.EncodeBytes(m.Local.Addr[:], 4) + buf.EncodeUint16(uint16(m.Local.Port)) + buf.EncodeUint8(uint8(m.Local.Probability)) + buf.EncodeUint32(uint32(m.Local.VrfID)) + return buf.Bytes(), nil +} +func (m *Nat44LbStaticMappingAddDelLocal) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + copy(m.ExternalAddr[:], buf.DecodeBytes(4)) + m.ExternalPort = buf.DecodeUint16() + m.Protocol = buf.DecodeUint8() + copy(m.Local.Addr[:], buf.DecodeBytes(4)) + m.Local.Port = buf.DecodeUint16() + m.Local.Probability = buf.DecodeUint8() + m.Local.VrfID = buf.DecodeUint32() + return nil +} + +// Nat44LbStaticMappingAddDelLocalReply defines message 'nat44_lb_static_mapping_add_del_local_reply'. +type Nat44LbStaticMappingAddDelLocalReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44LbStaticMappingAddDelLocalReply) Reset() { *m = Nat44LbStaticMappingAddDelLocalReply{} } +func (*Nat44LbStaticMappingAddDelLocalReply) GetMessageName() string { + return "nat44_lb_static_mapping_add_del_local_reply" +} +func (*Nat44LbStaticMappingAddDelLocalReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44LbStaticMappingAddDelLocalReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44LbStaticMappingAddDelLocalReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Nat44LbStaticMappingAddDelLocalReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Nat44LbStaticMappingAddDelLocalReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Nat44LbStaticMappingDetails defines message 'nat44_lb_static_mapping_details'. +type Nat44LbStaticMappingDetails struct { + ExternalAddr ip_types.IP4Address `binapi:"ip4_address,name=external_addr" json:"external_addr,omitempty"` + ExternalPort uint16 `binapi:"u16,name=external_port" json:"external_port,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` + Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + Affinity uint32 `binapi:"u32,name=affinity" json:"affinity,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` + LocalNum uint32 `binapi:"u32,name=local_num" json:"-"` + Locals []Nat44LbAddrPort `binapi:"nat44_lb_addr_port[local_num],name=locals" json:"locals,omitempty"` +} + +func (m *Nat44LbStaticMappingDetails) Reset() { *m = Nat44LbStaticMappingDetails{} } +func (*Nat44LbStaticMappingDetails) GetMessageName() string { return "nat44_lb_static_mapping_details" } +func (*Nat44LbStaticMappingDetails) GetCrcString() string { return "2267b9e8" } +func (*Nat44LbStaticMappingDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44LbStaticMappingDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.ExternalAddr + size += 2 // m.ExternalPort + size += 1 // m.Protocol + size += 1 // m.Flags + size += 4 // m.Affinity + size += 64 // m.Tag + size += 4 // m.LocalNum + for j1 := 0; j1 < len(m.Locals); j1++ { + var s1 Nat44LbAddrPort + _ = s1 + if j1 < len(m.Locals) { + s1 = m.Locals[j1] + } + size += 1 * 4 // s1.Addr + size += 2 // s1.Port + size += 1 // s1.Probability + size += 4 // s1.VrfID + } + return size +} +func (m *Nat44LbStaticMappingDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.ExternalAddr[:], 4) + buf.EncodeUint16(uint16(m.ExternalPort)) + buf.EncodeUint8(uint8(m.Protocol)) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint32(uint32(m.Affinity)) + buf.EncodeString(m.Tag, 64) + buf.EncodeUint32(uint32(len(m.Locals))) + for j0 := 0; j0 < len(m.Locals); j0++ { + var v0 Nat44LbAddrPort + if j0 < len(m.Locals) { + v0 = m.Locals[j0] + } + buf.EncodeBytes(v0.Addr[:], 4) + buf.EncodeUint16(uint16(v0.Port)) + buf.EncodeUint8(uint8(v0.Probability)) + buf.EncodeUint32(uint32(v0.VrfID)) + } + return buf.Bytes(), nil +} +func (m *Nat44LbStaticMappingDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.ExternalAddr[:], buf.DecodeBytes(4)) + m.ExternalPort = buf.DecodeUint16() + m.Protocol = buf.DecodeUint8() + m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.Affinity = buf.DecodeUint32() + m.Tag = buf.DecodeString(64) + m.LocalNum = buf.DecodeUint32() + m.Locals = make([]Nat44LbAddrPort, int(m.LocalNum)) + for j0 := 0; j0 < len(m.Locals); j0++ { + copy(m.Locals[j0].Addr[:], buf.DecodeBytes(4)) + m.Locals[j0].Port = buf.DecodeUint16() + m.Locals[j0].Probability = buf.DecodeUint8() + m.Locals[j0].VrfID = buf.DecodeUint32() + } + return nil +} + +// Nat44LbStaticMappingDump defines message 'nat44_lb_static_mapping_dump'. +type Nat44LbStaticMappingDump struct{} + +func (m *Nat44LbStaticMappingDump) Reset() { *m = Nat44LbStaticMappingDump{} } +func (*Nat44LbStaticMappingDump) GetMessageName() string { return "nat44_lb_static_mapping_dump" } +func (*Nat44LbStaticMappingDump) GetCrcString() string { return "51077d14" } +func (*Nat44LbStaticMappingDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44LbStaticMappingDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *Nat44LbStaticMappingDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *Nat44LbStaticMappingDump) Unmarshal(b []byte) error { + return nil +} + +// Nat44SessionCleanup defines message 'nat44_session_cleanup'. +type Nat44SessionCleanup struct{} + +func (m *Nat44SessionCleanup) Reset() { *m = Nat44SessionCleanup{} } +func (*Nat44SessionCleanup) GetMessageName() string { return "nat44_session_cleanup" } +func (*Nat44SessionCleanup) GetCrcString() string { return "51077d14" } +func (*Nat44SessionCleanup) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44SessionCleanup) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *Nat44SessionCleanup) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *Nat44SessionCleanup) Unmarshal(b []byte) error { + return nil +} + +// Nat44SessionCleanupReply defines message 'nat44_session_cleanup_reply'. +type Nat44SessionCleanupReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44SessionCleanupReply) Reset() { *m = Nat44SessionCleanupReply{} } +func (*Nat44SessionCleanupReply) GetMessageName() string { return "nat44_session_cleanup_reply" } +func (*Nat44SessionCleanupReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44SessionCleanupReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44SessionCleanupReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Nat44SessionCleanupReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Nat44SessionCleanupReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Nat44SetSessionLimit defines message 'nat44_set_session_limit'. +type Nat44SetSessionLimit struct { + SessionLimit uint32 `binapi:"u32,name=session_limit" json:"session_limit,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +func (m *Nat44SetSessionLimit) Reset() { *m = Nat44SetSessionLimit{} } +func (*Nat44SetSessionLimit) GetMessageName() string { return "nat44_set_session_limit" } +func (*Nat44SetSessionLimit) GetCrcString() string { return "8899bbb1" } +func (*Nat44SetSessionLimit) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44SetSessionLimit) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SessionLimit + size += 4 // m.VrfID + return size +} +func (m *Nat44SetSessionLimit) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SessionLimit)) + buf.EncodeUint32(uint32(m.VrfID)) + return buf.Bytes(), nil +} +func (m *Nat44SetSessionLimit) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SessionLimit = buf.DecodeUint32() + m.VrfID = buf.DecodeUint32() + return nil +} + +// Nat44SetSessionLimitReply defines message 'nat44_set_session_limit_reply'. +type Nat44SetSessionLimitReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat44SetSessionLimitReply) Reset() { *m = Nat44SetSessionLimitReply{} } +func (*Nat44SetSessionLimitReply) GetMessageName() string { return "nat44_set_session_limit_reply" } +func (*Nat44SetSessionLimitReply) GetCrcString() string { return "e8d4e804" } +func (*Nat44SetSessionLimitReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44SetSessionLimitReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Nat44SetSessionLimitReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Nat44SetSessionLimitReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Nat44StaticMappingDetails defines message 'nat44_static_mapping_details'. +type Nat44StaticMappingDetails struct { + Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + LocalIPAddress ip_types.IP4Address `binapi:"ip4_address,name=local_ip_address" json:"local_ip_address,omitempty"` + ExternalIPAddress ip_types.IP4Address `binapi:"ip4_address,name=external_ip_address" json:"external_ip_address,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` + LocalPort uint16 `binapi:"u16,name=local_port" json:"local_port,omitempty"` + ExternalPort uint16 `binapi:"u16,name=external_port" json:"external_port,omitempty"` + ExternalSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=external_sw_if_index" json:"external_sw_if_index,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` +} + +func (m *Nat44StaticMappingDetails) Reset() { *m = Nat44StaticMappingDetails{} } +func (*Nat44StaticMappingDetails) GetMessageName() string { return "nat44_static_mapping_details" } +func (*Nat44StaticMappingDetails) GetCrcString() string { return "1a433ef7" } +func (*Nat44StaticMappingDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44StaticMappingDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Flags + size += 1 * 4 // m.LocalIPAddress + size += 1 * 4 // m.ExternalIPAddress + size += 1 // m.Protocol + size += 2 // m.LocalPort + size += 2 // m.ExternalPort + size += 4 // m.ExternalSwIfIndex + size += 4 // m.VrfID + size += 64 // m.Tag + return size +} +func (m *Nat44StaticMappingDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeBytes(m.LocalIPAddress[:], 4) + buf.EncodeBytes(m.ExternalIPAddress[:], 4) + buf.EncodeUint8(uint8(m.Protocol)) + buf.EncodeUint16(uint16(m.LocalPort)) + buf.EncodeUint16(uint16(m.ExternalPort)) + buf.EncodeUint32(uint32(m.ExternalSwIfIndex)) + buf.EncodeUint32(uint32(m.VrfID)) + buf.EncodeString(m.Tag, 64) + return buf.Bytes(), nil +} +func (m *Nat44StaticMappingDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Flags = NatConfigFlags(buf.DecodeUint8()) + copy(m.LocalIPAddress[:], buf.DecodeBytes(4)) + copy(m.ExternalIPAddress[:], buf.DecodeBytes(4)) + m.Protocol = buf.DecodeUint8() + m.LocalPort = buf.DecodeUint16() + m.ExternalPort = buf.DecodeUint16() + m.ExternalSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.VrfID = buf.DecodeUint32() + m.Tag = buf.DecodeString(64) + return nil +} + +// Nat44StaticMappingDump defines message 'nat44_static_mapping_dump'. +type Nat44StaticMappingDump struct{} + +func (m *Nat44StaticMappingDump) Reset() { *m = Nat44StaticMappingDump{} } +func (*Nat44StaticMappingDump) GetMessageName() string { return "nat44_static_mapping_dump" } +func (*Nat44StaticMappingDump) GetCrcString() string { return "51077d14" } +func (*Nat44StaticMappingDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44StaticMappingDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *Nat44StaticMappingDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *Nat44StaticMappingDump) Unmarshal(b []byte) error { + return nil +} + +// Nat44UserDetails defines message 'nat44_user_details'. +type Nat44UserDetails struct { + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` + Nsessions uint32 `binapi:"u32,name=nsessions" json:"nsessions,omitempty"` + Nstaticsessions uint32 `binapi:"u32,name=nstaticsessions" json:"nstaticsessions,omitempty"` +} + +func (m *Nat44UserDetails) Reset() { *m = Nat44UserDetails{} } +func (*Nat44UserDetails) GetMessageName() string { return "nat44_user_details" } +func (*Nat44UserDetails) GetCrcString() string { return "355896c2" } +func (*Nat44UserDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44UserDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.VrfID + size += 1 * 4 // m.IPAddress + size += 4 // m.Nsessions + size += 4 // m.Nstaticsessions + return size +} +func (m *Nat44UserDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.VrfID)) + buf.EncodeBytes(m.IPAddress[:], 4) + buf.EncodeUint32(uint32(m.Nsessions)) + buf.EncodeUint32(uint32(m.Nstaticsessions)) + return buf.Bytes(), nil +} +func (m *Nat44UserDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.VrfID = buf.DecodeUint32() + copy(m.IPAddress[:], buf.DecodeBytes(4)) + m.Nsessions = buf.DecodeUint32() + m.Nstaticsessions = buf.DecodeUint32() + return nil +} + +// Nat44UserDump defines message 'nat44_user_dump'. +type Nat44UserDump struct{} + +func (m *Nat44UserDump) Reset() { *m = Nat44UserDump{} } +func (*Nat44UserDump) GetMessageName() string { return "nat44_user_dump" } +func (*Nat44UserDump) GetCrcString() string { return "51077d14" } +func (*Nat44UserDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44UserDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *Nat44UserDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *Nat44UserDump) Unmarshal(b []byte) error { + return nil +} + +// Nat44UserSessionDetails defines message 'nat44_user_session_details'. +type Nat44UserSessionDetails struct { + OutsideIPAddress ip_types.IP4Address `binapi:"ip4_address,name=outside_ip_address" json:"outside_ip_address,omitempty"` + OutsidePort uint16 `binapi:"u16,name=outside_port" json:"outside_port,omitempty"` + InsideIPAddress ip_types.IP4Address `binapi:"ip4_address,name=inside_ip_address" json:"inside_ip_address,omitempty"` + InsidePort uint16 `binapi:"u16,name=inside_port" json:"inside_port,omitempty"` + Protocol uint16 `binapi:"u16,name=protocol" json:"protocol,omitempty"` + Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + LastHeard uint64 `binapi:"u64,name=last_heard" json:"last_heard,omitempty"` + TotalBytes uint64 `binapi:"u64,name=total_bytes" json:"total_bytes,omitempty"` + TotalPkts uint32 `binapi:"u32,name=total_pkts" json:"total_pkts,omitempty"` + ExtHostAddress ip_types.IP4Address `binapi:"ip4_address,name=ext_host_address" json:"ext_host_address,omitempty"` + ExtHostPort uint16 `binapi:"u16,name=ext_host_port" json:"ext_host_port,omitempty"` + ExtHostNatAddress ip_types.IP4Address `binapi:"ip4_address,name=ext_host_nat_address" json:"ext_host_nat_address,omitempty"` + ExtHostNatPort uint16 `binapi:"u16,name=ext_host_nat_port" json:"ext_host_nat_port,omitempty"` +} + +func (m *Nat44UserSessionDetails) Reset() { *m = Nat44UserSessionDetails{} } +func (*Nat44UserSessionDetails) GetMessageName() string { return "nat44_user_session_details" } +func (*Nat44UserSessionDetails) GetCrcString() string { return "1965fd69" } +func (*Nat44UserSessionDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat44UserSessionDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.OutsideIPAddress + size += 2 // m.OutsidePort + size += 1 * 4 // m.InsideIPAddress + size += 2 // m.InsidePort + size += 2 // m.Protocol + size += 1 // m.Flags + size += 8 // m.LastHeard + size += 8 // m.TotalBytes + size += 4 // m.TotalPkts + size += 1 * 4 // m.ExtHostAddress + size += 2 // m.ExtHostPort + size += 1 * 4 // m.ExtHostNatAddress + size += 2 // m.ExtHostNatPort + return size +} +func (m *Nat44UserSessionDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.OutsideIPAddress[:], 4) + buf.EncodeUint16(uint16(m.OutsidePort)) + buf.EncodeBytes(m.InsideIPAddress[:], 4) + buf.EncodeUint16(uint16(m.InsidePort)) + buf.EncodeUint16(uint16(m.Protocol)) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint64(uint64(m.LastHeard)) + buf.EncodeUint64(uint64(m.TotalBytes)) + buf.EncodeUint32(uint32(m.TotalPkts)) + buf.EncodeBytes(m.ExtHostAddress[:], 4) + buf.EncodeUint16(uint16(m.ExtHostPort)) + buf.EncodeBytes(m.ExtHostNatAddress[:], 4) + buf.EncodeUint16(uint16(m.ExtHostNatPort)) + return buf.Bytes(), nil +} +func (m *Nat44UserSessionDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.OutsideIPAddress[:], buf.DecodeBytes(4)) + m.OutsidePort = buf.DecodeUint16() + copy(m.InsideIPAddress[:], buf.DecodeBytes(4)) + m.InsidePort = buf.DecodeUint16() + m.Protocol = buf.DecodeUint16() + m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.LastHeard = buf.DecodeUint64() + m.TotalBytes = buf.DecodeUint64() + m.TotalPkts = buf.DecodeUint32() + copy(m.ExtHostAddress[:], buf.DecodeBytes(4)) + m.ExtHostPort = buf.DecodeUint16() + copy(m.ExtHostNatAddress[:], buf.DecodeBytes(4)) + m.ExtHostNatPort = buf.DecodeUint16() + return nil +} + +// Nat44UserSessionDump defines message 'nat44_user_session_dump'. +type Nat44UserSessionDump struct { + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +func (m *Nat44UserSessionDump) Reset() { *m = Nat44UserSessionDump{} } +func (*Nat44UserSessionDump) GetMessageName() string { return "nat44_user_session_dump" } +func (*Nat44UserSessionDump) GetCrcString() string { return "e1899c98" } +func (*Nat44UserSessionDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat44UserSessionDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.IPAddress + size += 4 // m.VrfID + return size +} +func (m *Nat44UserSessionDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.IPAddress[:], 4) + buf.EncodeUint32(uint32(m.VrfID)) + return buf.Bytes(), nil +} +func (m *Nat44UserSessionDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IPAddress[:], buf.DecodeBytes(4)) + m.VrfID = buf.DecodeUint32() + return nil +} + +// Nat64AddDelInterface defines message 'nat64_add_del_interface'. +type Nat64AddDelInterface struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Nat64AddDelInterface) Reset() { *m = Nat64AddDelInterface{} } +func (*Nat64AddDelInterface) GetMessageName() string { return "nat64_add_del_interface" } +func (*Nat64AddDelInterface) GetCrcString() string { return "f3699b83" } +func (*Nat64AddDelInterface) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat64AddDelInterface) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.Flags + size += 4 // m.SwIfIndex + return size +} +func (m *Nat64AddDelInterface) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Nat64AddDelInterface) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Nat64AddDelInterfaceAddr defines message 'nat64_add_del_interface_addr'. +type Nat64AddDelInterfaceAddr struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Nat64AddDelInterfaceAddr) Reset() { *m = Nat64AddDelInterfaceAddr{} } +func (*Nat64AddDelInterfaceAddr) GetMessageName() string { return "nat64_add_del_interface_addr" } +func (*Nat64AddDelInterfaceAddr) GetCrcString() string { return "47d6e753" } +func (*Nat64AddDelInterfaceAddr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat64AddDelInterfaceAddr) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.SwIfIndex + return size +} +func (m *Nat64AddDelInterfaceAddr) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Nat64AddDelInterfaceAddr) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Nat64AddDelInterfaceAddrReply defines message 'nat64_add_del_interface_addr_reply'. +type Nat64AddDelInterfaceAddrReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat64AddDelInterfaceAddrReply) Reset() { *m = Nat64AddDelInterfaceAddrReply{} } +func (*Nat64AddDelInterfaceAddrReply) GetMessageName() string { + return "nat64_add_del_interface_addr_reply" +} +func (*Nat64AddDelInterfaceAddrReply) GetCrcString() string { return "e8d4e804" } +func (*Nat64AddDelInterfaceAddrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat64AddDelInterfaceAddrReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Nat64AddDelInterfaceAddrReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Nat64AddDelInterfaceAddrReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Nat64AddDelInterfaceReply defines message 'nat64_add_del_interface_reply'. +type Nat64AddDelInterfaceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat64AddDelInterfaceReply) Reset() { *m = Nat64AddDelInterfaceReply{} } +func (*Nat64AddDelInterfaceReply) GetMessageName() string { return "nat64_add_del_interface_reply" } +func (*Nat64AddDelInterfaceReply) GetCrcString() string { return "e8d4e804" } +func (*Nat64AddDelInterfaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat64AddDelInterfaceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Nat64AddDelInterfaceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Nat64AddDelInterfaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Nat64AddDelPoolAddrRange defines message 'nat64_add_del_pool_addr_range'. +type Nat64AddDelPoolAddrRange struct { + StartAddr ip_types.IP4Address `binapi:"ip4_address,name=start_addr" json:"start_addr,omitempty"` + EndAddr ip_types.IP4Address `binapi:"ip4_address,name=end_addr" json:"end_addr,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *Nat64AddDelPoolAddrRange) Reset() { *m = Nat64AddDelPoolAddrRange{} } +func (*Nat64AddDelPoolAddrRange) GetMessageName() string { return "nat64_add_del_pool_addr_range" } +func (*Nat64AddDelPoolAddrRange) GetCrcString() string { return "21234ef3" } +func (*Nat64AddDelPoolAddrRange) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat64AddDelPoolAddrRange) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.StartAddr + size += 1 * 4 // m.EndAddr + size += 4 // m.VrfID + size += 1 // m.IsAdd + return size +} +func (m *Nat64AddDelPoolAddrRange) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.StartAddr[:], 4) + buf.EncodeBytes(m.EndAddr[:], 4) + buf.EncodeUint32(uint32(m.VrfID)) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *Nat64AddDelPoolAddrRange) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.StartAddr[:], buf.DecodeBytes(4)) + copy(m.EndAddr[:], buf.DecodeBytes(4)) + m.VrfID = buf.DecodeUint32() + m.IsAdd = buf.DecodeBool() + return nil +} + +// Nat64AddDelPoolAddrRangeReply defines message 'nat64_add_del_pool_addr_range_reply'. +type Nat64AddDelPoolAddrRangeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat64AddDelPoolAddrRangeReply) Reset() { *m = Nat64AddDelPoolAddrRangeReply{} } +func (*Nat64AddDelPoolAddrRangeReply) GetMessageName() string { + return "nat64_add_del_pool_addr_range_reply" +} +func (*Nat64AddDelPoolAddrRangeReply) GetCrcString() string { return "e8d4e804" } +func (*Nat64AddDelPoolAddrRangeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat64AddDelPoolAddrRangeReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Nat64AddDelPoolAddrRangeReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Nat64AddDelPoolAddrRangeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Nat64AddDelPrefix defines message 'nat64_add_del_prefix'. +type Nat64AddDelPrefix struct { + Prefix ip_types.IP6Prefix `binapi:"ip6_prefix,name=prefix" json:"prefix,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *Nat64AddDelPrefix) Reset() { *m = Nat64AddDelPrefix{} } +func (*Nat64AddDelPrefix) GetMessageName() string { return "nat64_add_del_prefix" } +func (*Nat64AddDelPrefix) GetCrcString() string { return "727b2f4c" } +func (*Nat64AddDelPrefix) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat64AddDelPrefix) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 16 // m.Prefix.Address + size += 1 // m.Prefix.Len + size += 4 // m.VrfID + size += 1 // m.IsAdd + return size +} +func (m *Nat64AddDelPrefix) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.Prefix.Address[:], 16) + buf.EncodeUint8(uint8(m.Prefix.Len)) + buf.EncodeUint32(uint32(m.VrfID)) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *Nat64AddDelPrefix) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.Prefix.Address[:], buf.DecodeBytes(16)) + m.Prefix.Len = buf.DecodeUint8() + m.VrfID = buf.DecodeUint32() + m.IsAdd = buf.DecodeBool() + return nil +} + +// Nat64AddDelPrefixReply defines message 'nat64_add_del_prefix_reply'. +type Nat64AddDelPrefixReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat64AddDelPrefixReply) Reset() { *m = Nat64AddDelPrefixReply{} } +func (*Nat64AddDelPrefixReply) GetMessageName() string { return "nat64_add_del_prefix_reply" } +func (*Nat64AddDelPrefixReply) GetCrcString() string { return "e8d4e804" } +func (*Nat64AddDelPrefixReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat64AddDelPrefixReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Nat64AddDelPrefixReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Nat64AddDelPrefixReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Nat64AddDelStaticBib defines message 'nat64_add_del_static_bib'. +type Nat64AddDelStaticBib struct { + IAddr ip_types.IP6Address `binapi:"ip6_address,name=i_addr" json:"i_addr,omitempty"` + OAddr ip_types.IP4Address `binapi:"ip4_address,name=o_addr" json:"o_addr,omitempty"` + IPort uint16 `binapi:"u16,name=i_port" json:"i_port,omitempty"` + OPort uint16 `binapi:"u16,name=o_port" json:"o_port,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + Proto uint8 `binapi:"u8,name=proto" json:"proto,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *Nat64AddDelStaticBib) Reset() { *m = Nat64AddDelStaticBib{} } +func (*Nat64AddDelStaticBib) GetMessageName() string { return "nat64_add_del_static_bib" } +func (*Nat64AddDelStaticBib) GetCrcString() string { return "90fae58a" } +func (*Nat64AddDelStaticBib) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat64AddDelStaticBib) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 16 // m.IAddr + size += 1 * 4 // m.OAddr + size += 2 // m.IPort + size += 2 // m.OPort + size += 4 // m.VrfID + size += 1 // m.Proto + size += 1 // m.IsAdd + return size +} +func (m *Nat64AddDelStaticBib) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.IAddr[:], 16) + buf.EncodeBytes(m.OAddr[:], 4) + buf.EncodeUint16(uint16(m.IPort)) + buf.EncodeUint16(uint16(m.OPort)) + buf.EncodeUint32(uint32(m.VrfID)) + buf.EncodeUint8(uint8(m.Proto)) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *Nat64AddDelStaticBib) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IAddr[:], buf.DecodeBytes(16)) + copy(m.OAddr[:], buf.DecodeBytes(4)) + m.IPort = buf.DecodeUint16() + m.OPort = buf.DecodeUint16() + m.VrfID = buf.DecodeUint32() + m.Proto = buf.DecodeUint8() + m.IsAdd = buf.DecodeBool() + return nil +} + +// Nat64AddDelStaticBibReply defines message 'nat64_add_del_static_bib_reply'. +type Nat64AddDelStaticBibReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat64AddDelStaticBibReply) Reset() { *m = Nat64AddDelStaticBibReply{} } +func (*Nat64AddDelStaticBibReply) GetMessageName() string { return "nat64_add_del_static_bib_reply" } +func (*Nat64AddDelStaticBibReply) GetCrcString() string { return "e8d4e804" } +func (*Nat64AddDelStaticBibReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat64AddDelStaticBibReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Nat64AddDelStaticBibReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Nat64AddDelStaticBibReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Nat64BibDetails defines message 'nat64_bib_details'. +type Nat64BibDetails struct { + IAddr ip_types.IP6Address `binapi:"ip6_address,name=i_addr" json:"i_addr,omitempty"` + OAddr ip_types.IP4Address `binapi:"ip4_address,name=o_addr" json:"o_addr,omitempty"` + IPort uint16 `binapi:"u16,name=i_port" json:"i_port,omitempty"` + OPort uint16 `binapi:"u16,name=o_port" json:"o_port,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + Proto uint8 `binapi:"u8,name=proto" json:"proto,omitempty"` + Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + SesNum uint32 `binapi:"u32,name=ses_num" json:"ses_num,omitempty"` +} + +func (m *Nat64BibDetails) Reset() { *m = Nat64BibDetails{} } +func (*Nat64BibDetails) GetMessageName() string { return "nat64_bib_details" } +func (*Nat64BibDetails) GetCrcString() string { return "62c8541d" } +func (*Nat64BibDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat64BibDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 16 // m.IAddr + size += 1 * 4 // m.OAddr + size += 2 // m.IPort + size += 2 // m.OPort + size += 4 // m.VrfID + size += 1 // m.Proto + size += 1 // m.Flags + size += 4 // m.SesNum + return size +} +func (m *Nat64BibDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.IAddr[:], 16) + buf.EncodeBytes(m.OAddr[:], 4) + buf.EncodeUint16(uint16(m.IPort)) + buf.EncodeUint16(uint16(m.OPort)) + buf.EncodeUint32(uint32(m.VrfID)) + buf.EncodeUint8(uint8(m.Proto)) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint32(uint32(m.SesNum)) + return buf.Bytes(), nil +} +func (m *Nat64BibDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IAddr[:], buf.DecodeBytes(16)) + copy(m.OAddr[:], buf.DecodeBytes(4)) + m.IPort = buf.DecodeUint16() + m.OPort = buf.DecodeUint16() + m.VrfID = buf.DecodeUint32() + m.Proto = buf.DecodeUint8() + m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.SesNum = buf.DecodeUint32() + return nil +} + +// Nat64BibDump defines message 'nat64_bib_dump'. +type Nat64BibDump struct { + Proto uint8 `binapi:"u8,name=proto" json:"proto,omitempty"` +} + +func (m *Nat64BibDump) Reset() { *m = Nat64BibDump{} } +func (*Nat64BibDump) GetMessageName() string { return "nat64_bib_dump" } +func (*Nat64BibDump) GetCrcString() string { return "cfcb6b75" } +func (*Nat64BibDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat64BibDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Proto + return size +} +func (m *Nat64BibDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Proto)) + return buf.Bytes(), nil +} +func (m *Nat64BibDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Proto = buf.DecodeUint8() + return nil +} + +// Nat64InterfaceDetails defines message 'nat64_interface_details'. +type Nat64InterfaceDetails struct { + Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Nat64InterfaceDetails) Reset() { *m = Nat64InterfaceDetails{} } +func (*Nat64InterfaceDetails) GetMessageName() string { return "nat64_interface_details" } +func (*Nat64InterfaceDetails) GetCrcString() string { return "5d286289" } +func (*Nat64InterfaceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat64InterfaceDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Flags + size += 4 // m.SwIfIndex + return size +} +func (m *Nat64InterfaceDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Nat64InterfaceDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Nat64InterfaceDump defines message 'nat64_interface_dump'. +type Nat64InterfaceDump struct{} + +func (m *Nat64InterfaceDump) Reset() { *m = Nat64InterfaceDump{} } +func (*Nat64InterfaceDump) GetMessageName() string { return "nat64_interface_dump" } +func (*Nat64InterfaceDump) GetCrcString() string { return "51077d14" } +func (*Nat64InterfaceDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat64InterfaceDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *Nat64InterfaceDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *Nat64InterfaceDump) Unmarshal(b []byte) error { + return nil +} + +// Nat64PoolAddrDetails defines message 'nat64_pool_addr_details'. +type Nat64PoolAddrDetails struct { + Address ip_types.IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +func (m *Nat64PoolAddrDetails) Reset() { *m = Nat64PoolAddrDetails{} } +func (*Nat64PoolAddrDetails) GetMessageName() string { return "nat64_pool_addr_details" } +func (*Nat64PoolAddrDetails) GetCrcString() string { return "9bb99cdb" } +func (*Nat64PoolAddrDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat64PoolAddrDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.Address + size += 4 // m.VrfID + return size +} +func (m *Nat64PoolAddrDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.Address[:], 4) + buf.EncodeUint32(uint32(m.VrfID)) + return buf.Bytes(), nil +} +func (m *Nat64PoolAddrDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.Address[:], buf.DecodeBytes(4)) + m.VrfID = buf.DecodeUint32() + return nil +} + +// Nat64PoolAddrDump defines message 'nat64_pool_addr_dump'. +type Nat64PoolAddrDump struct{} + +func (m *Nat64PoolAddrDump) Reset() { *m = Nat64PoolAddrDump{} } +func (*Nat64PoolAddrDump) GetMessageName() string { return "nat64_pool_addr_dump" } +func (*Nat64PoolAddrDump) GetCrcString() string { return "51077d14" } +func (*Nat64PoolAddrDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat64PoolAddrDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *Nat64PoolAddrDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *Nat64PoolAddrDump) Unmarshal(b []byte) error { + return nil +} + +// Nat64PrefixDetails defines message 'nat64_prefix_details'. +type Nat64PrefixDetails struct { + Prefix ip_types.IP6Prefix `binapi:"ip6_prefix,name=prefix" json:"prefix,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +func (m *Nat64PrefixDetails) Reset() { *m = Nat64PrefixDetails{} } +func (*Nat64PrefixDetails) GetMessageName() string { return "nat64_prefix_details" } +func (*Nat64PrefixDetails) GetCrcString() string { return "20568de3" } +func (*Nat64PrefixDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat64PrefixDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 16 // m.Prefix.Address + size += 1 // m.Prefix.Len + size += 4 // m.VrfID + return size +} +func (m *Nat64PrefixDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.Prefix.Address[:], 16) + buf.EncodeUint8(uint8(m.Prefix.Len)) + buf.EncodeUint32(uint32(m.VrfID)) + return buf.Bytes(), nil +} +func (m *Nat64PrefixDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.Prefix.Address[:], buf.DecodeBytes(16)) + m.Prefix.Len = buf.DecodeUint8() + m.VrfID = buf.DecodeUint32() + return nil +} + +// Nat64PrefixDump defines message 'nat64_prefix_dump'. +type Nat64PrefixDump struct{} + +func (m *Nat64PrefixDump) Reset() { *m = Nat64PrefixDump{} } +func (*Nat64PrefixDump) GetMessageName() string { return "nat64_prefix_dump" } +func (*Nat64PrefixDump) GetCrcString() string { return "51077d14" } +func (*Nat64PrefixDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat64PrefixDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *Nat64PrefixDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *Nat64PrefixDump) Unmarshal(b []byte) error { + return nil +} + +// Nat64StDetails defines message 'nat64_st_details'. +type Nat64StDetails struct { + IlAddr ip_types.IP6Address `binapi:"ip6_address,name=il_addr" json:"il_addr,omitempty"` + OlAddr ip_types.IP4Address `binapi:"ip4_address,name=ol_addr" json:"ol_addr,omitempty"` + IlPort uint16 `binapi:"u16,name=il_port" json:"il_port,omitempty"` + OlPort uint16 `binapi:"u16,name=ol_port" json:"ol_port,omitempty"` + IrAddr ip_types.IP6Address `binapi:"ip6_address,name=ir_addr" json:"ir_addr,omitempty"` + OrAddr ip_types.IP4Address `binapi:"ip4_address,name=or_addr" json:"or_addr,omitempty"` + RPort uint16 `binapi:"u16,name=r_port" json:"r_port,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + Proto uint8 `binapi:"u8,name=proto" json:"proto,omitempty"` +} + +func (m *Nat64StDetails) Reset() { *m = Nat64StDetails{} } +func (*Nat64StDetails) GetMessageName() string { return "nat64_st_details" } +func (*Nat64StDetails) GetCrcString() string { return "c770d620" } +func (*Nat64StDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat64StDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 16 // m.IlAddr + size += 1 * 4 // m.OlAddr + size += 2 // m.IlPort + size += 2 // m.OlPort + size += 1 * 16 // m.IrAddr + size += 1 * 4 // m.OrAddr + size += 2 // m.RPort + size += 4 // m.VrfID + size += 1 // m.Proto + return size +} +func (m *Nat64StDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.IlAddr[:], 16) + buf.EncodeBytes(m.OlAddr[:], 4) + buf.EncodeUint16(uint16(m.IlPort)) + buf.EncodeUint16(uint16(m.OlPort)) + buf.EncodeBytes(m.IrAddr[:], 16) + buf.EncodeBytes(m.OrAddr[:], 4) + buf.EncodeUint16(uint16(m.RPort)) + buf.EncodeUint32(uint32(m.VrfID)) + buf.EncodeUint8(uint8(m.Proto)) + return buf.Bytes(), nil +} +func (m *Nat64StDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IlAddr[:], buf.DecodeBytes(16)) + copy(m.OlAddr[:], buf.DecodeBytes(4)) + m.IlPort = buf.DecodeUint16() + m.OlPort = buf.DecodeUint16() + copy(m.IrAddr[:], buf.DecodeBytes(16)) + copy(m.OrAddr[:], buf.DecodeBytes(4)) + m.RPort = buf.DecodeUint16() + m.VrfID = buf.DecodeUint32() + m.Proto = buf.DecodeUint8() + return nil +} + +// Nat64StDump defines message 'nat64_st_dump'. +type Nat64StDump struct { + Proto uint8 `binapi:"u8,name=proto" json:"proto,omitempty"` +} + +func (m *Nat64StDump) Reset() { *m = Nat64StDump{} } +func (*Nat64StDump) GetMessageName() string { return "nat64_st_dump" } +func (*Nat64StDump) GetCrcString() string { return "cfcb6b75" } +func (*Nat64StDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat64StDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Proto + return size +} +func (m *Nat64StDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Proto)) + return buf.Bytes(), nil +} +func (m *Nat64StDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Proto = buf.DecodeUint8() + return nil +} + +// Nat66AddDelInterface defines message 'nat66_add_del_interface'. +type Nat66AddDelInterface struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Nat66AddDelInterface) Reset() { *m = Nat66AddDelInterface{} } +func (*Nat66AddDelInterface) GetMessageName() string { return "nat66_add_del_interface" } +func (*Nat66AddDelInterface) GetCrcString() string { return "f3699b83" } +func (*Nat66AddDelInterface) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat66AddDelInterface) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.Flags + size += 4 // m.SwIfIndex + return size +} +func (m *Nat66AddDelInterface) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Nat66AddDelInterface) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Nat66AddDelInterfaceReply defines message 'nat66_add_del_interface_reply'. +type Nat66AddDelInterfaceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat66AddDelInterfaceReply) Reset() { *m = Nat66AddDelInterfaceReply{} } +func (*Nat66AddDelInterfaceReply) GetMessageName() string { return "nat66_add_del_interface_reply" } +func (*Nat66AddDelInterfaceReply) GetCrcString() string { return "e8d4e804" } +func (*Nat66AddDelInterfaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat66AddDelInterfaceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Nat66AddDelInterfaceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Nat66AddDelInterfaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Nat66AddDelStaticMapping defines message 'nat66_add_del_static_mapping'. +type Nat66AddDelStaticMapping struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + LocalIPAddress ip_types.IP6Address `binapi:"ip6_address,name=local_ip_address" json:"local_ip_address,omitempty"` + ExternalIPAddress ip_types.IP6Address `binapi:"ip6_address,name=external_ip_address" json:"external_ip_address,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +func (m *Nat66AddDelStaticMapping) Reset() { *m = Nat66AddDelStaticMapping{} } +func (*Nat66AddDelStaticMapping) GetMessageName() string { return "nat66_add_del_static_mapping" } +func (*Nat66AddDelStaticMapping) GetCrcString() string { return "fb64e50b" } +func (*Nat66AddDelStaticMapping) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat66AddDelStaticMapping) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 * 16 // m.LocalIPAddress + size += 1 * 16 // m.ExternalIPAddress + size += 4 // m.VrfID + return size +} +func (m *Nat66AddDelStaticMapping) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeBytes(m.LocalIPAddress[:], 16) + buf.EncodeBytes(m.ExternalIPAddress[:], 16) + buf.EncodeUint32(uint32(m.VrfID)) + return buf.Bytes(), nil +} +func (m *Nat66AddDelStaticMapping) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + copy(m.LocalIPAddress[:], buf.DecodeBytes(16)) + copy(m.ExternalIPAddress[:], buf.DecodeBytes(16)) + m.VrfID = buf.DecodeUint32() + return nil +} + +// Nat66AddDelStaticMappingReply defines message 'nat66_add_del_static_mapping_reply'. +type Nat66AddDelStaticMappingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Nat66AddDelStaticMappingReply) Reset() { *m = Nat66AddDelStaticMappingReply{} } +func (*Nat66AddDelStaticMappingReply) GetMessageName() string { + return "nat66_add_del_static_mapping_reply" +} +func (*Nat66AddDelStaticMappingReply) GetCrcString() string { return "e8d4e804" } +func (*Nat66AddDelStaticMappingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat66AddDelStaticMappingReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Nat66AddDelStaticMappingReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Nat66AddDelStaticMappingReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Nat66InterfaceDetails defines message 'nat66_interface_details'. +type Nat66InterfaceDetails struct { + Flags NatConfigFlags `binapi:"nat_config_flags,name=flags" json:"flags,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Nat66InterfaceDetails) Reset() { *m = Nat66InterfaceDetails{} } +func (*Nat66InterfaceDetails) GetMessageName() string { return "nat66_interface_details" } +func (*Nat66InterfaceDetails) GetCrcString() string { return "5d286289" } +func (*Nat66InterfaceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat66InterfaceDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Flags + size += 4 // m.SwIfIndex + return size +} +func (m *Nat66InterfaceDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Flags)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Nat66InterfaceDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Flags = NatConfigFlags(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Nat66InterfaceDump defines message 'nat66_interface_dump'. +type Nat66InterfaceDump struct{} + +func (m *Nat66InterfaceDump) Reset() { *m = Nat66InterfaceDump{} } +func (*Nat66InterfaceDump) GetMessageName() string { return "nat66_interface_dump" } +func (*Nat66InterfaceDump) GetCrcString() string { return "51077d14" } +func (*Nat66InterfaceDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat66InterfaceDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *Nat66InterfaceDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *Nat66InterfaceDump) Unmarshal(b []byte) error { + return nil +} + +// Nat66StaticMappingDetails defines message 'nat66_static_mapping_details'. +type Nat66StaticMappingDetails struct { + LocalIPAddress ip_types.IP6Address `binapi:"ip6_address,name=local_ip_address" json:"local_ip_address,omitempty"` + ExternalIPAddress ip_types.IP6Address `binapi:"ip6_address,name=external_ip_address" json:"external_ip_address,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + TotalBytes uint64 `binapi:"u64,name=total_bytes" json:"total_bytes,omitempty"` + TotalPkts uint64 `binapi:"u64,name=total_pkts" json:"total_pkts,omitempty"` +} + +func (m *Nat66StaticMappingDetails) Reset() { *m = Nat66StaticMappingDetails{} } +func (*Nat66StaticMappingDetails) GetMessageName() string { return "nat66_static_mapping_details" } +func (*Nat66StaticMappingDetails) GetCrcString() string { return "5c568448" } +func (*Nat66StaticMappingDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Nat66StaticMappingDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 16 // m.LocalIPAddress + size += 1 * 16 // m.ExternalIPAddress + size += 4 // m.VrfID + size += 8 // m.TotalBytes + size += 8 // m.TotalPkts + return size +} +func (m *Nat66StaticMappingDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.LocalIPAddress[:], 16) + buf.EncodeBytes(m.ExternalIPAddress[:], 16) + buf.EncodeUint32(uint32(m.VrfID)) + buf.EncodeUint64(uint64(m.TotalBytes)) + buf.EncodeUint64(uint64(m.TotalPkts)) + return buf.Bytes(), nil +} +func (m *Nat66StaticMappingDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.LocalIPAddress[:], buf.DecodeBytes(16)) + copy(m.ExternalIPAddress[:], buf.DecodeBytes(16)) + m.VrfID = buf.DecodeUint32() + m.TotalBytes = buf.DecodeUint64() + m.TotalPkts = buf.DecodeUint64() + return nil +} + +// Nat66StaticMappingDump defines message 'nat66_static_mapping_dump'. +type Nat66StaticMappingDump struct{} + +func (m *Nat66StaticMappingDump) Reset() { *m = Nat66StaticMappingDump{} } +func (*Nat66StaticMappingDump) GetMessageName() string { return "nat66_static_mapping_dump" } +func (*Nat66StaticMappingDump) GetCrcString() string { return "51077d14" } +func (*Nat66StaticMappingDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Nat66StaticMappingDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *Nat66StaticMappingDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *Nat66StaticMappingDump) Unmarshal(b []byte) error { + return nil +} + +// NatControlPing defines message 'nat_control_ping'. +type NatControlPing struct{} + +func (m *NatControlPing) Reset() { *m = NatControlPing{} } +func (*NatControlPing) GetMessageName() string { return "nat_control_ping" } +func (*NatControlPing) GetCrcString() string { return "51077d14" } +func (*NatControlPing) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatControlPing) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *NatControlPing) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *NatControlPing) Unmarshal(b []byte) error { + return nil +} + +// NatControlPingReply defines message 'nat_control_ping_reply'. +type NatControlPingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ClientIndex uint32 `binapi:"u32,name=client_index" json:"client_index,omitempty"` + VpePID uint32 `binapi:"u32,name=vpe_pid" json:"vpe_pid,omitempty"` +} + +func (m *NatControlPingReply) Reset() { *m = NatControlPingReply{} } +func (*NatControlPingReply) GetMessageName() string { return "nat_control_ping_reply" } +func (*NatControlPingReply) GetCrcString() string { return "f6b0b8ca" } +func (*NatControlPingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatControlPingReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.ClientIndex + size += 4 // m.VpePID + return size +} +func (m *NatControlPingReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.ClientIndex)) + buf.EncodeUint32(uint32(m.VpePID)) + return buf.Bytes(), nil +} +func (m *NatControlPingReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.ClientIndex = buf.DecodeUint32() + m.VpePID = buf.DecodeUint32() + return nil +} + +// NatDetAddDelMap defines message 'nat_det_add_del_map'. +type NatDetAddDelMap struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + InAddr ip_types.IP4Address `binapi:"ip4_address,name=in_addr" json:"in_addr,omitempty"` + InPlen uint8 `binapi:"u8,name=in_plen" json:"in_plen,omitempty"` + OutAddr ip_types.IP4Address `binapi:"ip4_address,name=out_addr" json:"out_addr,omitempty"` + OutPlen uint8 `binapi:"u8,name=out_plen" json:"out_plen,omitempty"` +} + +func (m *NatDetAddDelMap) Reset() { *m = NatDetAddDelMap{} } +func (*NatDetAddDelMap) GetMessageName() string { return "nat_det_add_del_map" } +func (*NatDetAddDelMap) GetCrcString() string { return "112fde05" } +func (*NatDetAddDelMap) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatDetAddDelMap) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 * 4 // m.InAddr + size += 1 // m.InPlen + size += 1 * 4 // m.OutAddr + size += 1 // m.OutPlen + return size +} +func (m *NatDetAddDelMap) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeBytes(m.InAddr[:], 4) + buf.EncodeUint8(uint8(m.InPlen)) + buf.EncodeBytes(m.OutAddr[:], 4) + buf.EncodeUint8(uint8(m.OutPlen)) + return buf.Bytes(), nil +} +func (m *NatDetAddDelMap) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + copy(m.InAddr[:], buf.DecodeBytes(4)) + m.InPlen = buf.DecodeUint8() + copy(m.OutAddr[:], buf.DecodeBytes(4)) + m.OutPlen = buf.DecodeUint8() + return nil +} + +// NatDetAddDelMapReply defines message 'nat_det_add_del_map_reply'. +type NatDetAddDelMapReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *NatDetAddDelMapReply) Reset() { *m = NatDetAddDelMapReply{} } +func (*NatDetAddDelMapReply) GetMessageName() string { return "nat_det_add_del_map_reply" } +func (*NatDetAddDelMapReply) GetCrcString() string { return "e8d4e804" } +func (*NatDetAddDelMapReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatDetAddDelMapReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *NatDetAddDelMapReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *NatDetAddDelMapReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// NatDetCloseSessionIn defines message 'nat_det_close_session_in'. +type NatDetCloseSessionIn struct { + InAddr ip_types.IP4Address `binapi:"ip4_address,name=in_addr" json:"in_addr,omitempty"` + InPort uint16 `binapi:"u16,name=in_port" json:"in_port,omitempty"` + ExtAddr ip_types.IP4Address `binapi:"ip4_address,name=ext_addr" json:"ext_addr,omitempty"` + ExtPort uint16 `binapi:"u16,name=ext_port" json:"ext_port,omitempty"` +} + +func (m *NatDetCloseSessionIn) Reset() { *m = NatDetCloseSessionIn{} } +func (*NatDetCloseSessionIn) GetMessageName() string { return "nat_det_close_session_in" } +func (*NatDetCloseSessionIn) GetCrcString() string { return "0a10ef64" } +func (*NatDetCloseSessionIn) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatDetCloseSessionIn) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.InAddr + size += 2 // m.InPort + size += 1 * 4 // m.ExtAddr + size += 2 // m.ExtPort + return size +} +func (m *NatDetCloseSessionIn) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.InAddr[:], 4) + buf.EncodeUint16(uint16(m.InPort)) + buf.EncodeBytes(m.ExtAddr[:], 4) + buf.EncodeUint16(uint16(m.ExtPort)) + return buf.Bytes(), nil +} +func (m *NatDetCloseSessionIn) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.InAddr[:], buf.DecodeBytes(4)) + m.InPort = buf.DecodeUint16() + copy(m.ExtAddr[:], buf.DecodeBytes(4)) + m.ExtPort = buf.DecodeUint16() + return nil +} + +// NatDetCloseSessionInReply defines message 'nat_det_close_session_in_reply'. +type NatDetCloseSessionInReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *NatDetCloseSessionInReply) Reset() { *m = NatDetCloseSessionInReply{} } +func (*NatDetCloseSessionInReply) GetMessageName() string { return "nat_det_close_session_in_reply" } +func (*NatDetCloseSessionInReply) GetCrcString() string { return "e8d4e804" } +func (*NatDetCloseSessionInReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatDetCloseSessionInReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *NatDetCloseSessionInReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *NatDetCloseSessionInReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// NatDetCloseSessionOut defines message 'nat_det_close_session_out'. +type NatDetCloseSessionOut struct { + OutAddr ip_types.IP4Address `binapi:"ip4_address,name=out_addr" json:"out_addr,omitempty"` + OutPort uint16 `binapi:"u16,name=out_port" json:"out_port,omitempty"` + ExtAddr ip_types.IP4Address `binapi:"ip4_address,name=ext_addr" json:"ext_addr,omitempty"` + ExtPort uint16 `binapi:"u16,name=ext_port" json:"ext_port,omitempty"` +} + +func (m *NatDetCloseSessionOut) Reset() { *m = NatDetCloseSessionOut{} } +func (*NatDetCloseSessionOut) GetMessageName() string { return "nat_det_close_session_out" } +func (*NatDetCloseSessionOut) GetCrcString() string { return "c1b6cbfb" } +func (*NatDetCloseSessionOut) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatDetCloseSessionOut) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.OutAddr + size += 2 // m.OutPort + size += 1 * 4 // m.ExtAddr + size += 2 // m.ExtPort + return size +} +func (m *NatDetCloseSessionOut) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.OutAddr[:], 4) + buf.EncodeUint16(uint16(m.OutPort)) + buf.EncodeBytes(m.ExtAddr[:], 4) + buf.EncodeUint16(uint16(m.ExtPort)) + return buf.Bytes(), nil +} +func (m *NatDetCloseSessionOut) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.OutAddr[:], buf.DecodeBytes(4)) + m.OutPort = buf.DecodeUint16() + copy(m.ExtAddr[:], buf.DecodeBytes(4)) + m.ExtPort = buf.DecodeUint16() + return nil +} + +// NatDetCloseSessionOutReply defines message 'nat_det_close_session_out_reply'. +type NatDetCloseSessionOutReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *NatDetCloseSessionOutReply) Reset() { *m = NatDetCloseSessionOutReply{} } +func (*NatDetCloseSessionOutReply) GetMessageName() string { return "nat_det_close_session_out_reply" } +func (*NatDetCloseSessionOutReply) GetCrcString() string { return "e8d4e804" } +func (*NatDetCloseSessionOutReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatDetCloseSessionOutReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *NatDetCloseSessionOutReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *NatDetCloseSessionOutReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// NatDetForward defines message 'nat_det_forward'. +type NatDetForward struct { + InAddr ip_types.IP4Address `binapi:"ip4_address,name=in_addr" json:"in_addr,omitempty"` +} + +func (m *NatDetForward) Reset() { *m = NatDetForward{} } +func (*NatDetForward) GetMessageName() string { return "nat_det_forward" } +func (*NatDetForward) GetCrcString() string { return "7f8a89cd" } +func (*NatDetForward) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatDetForward) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.InAddr + return size +} +func (m *NatDetForward) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.InAddr[:], 4) + return buf.Bytes(), nil +} +func (m *NatDetForward) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.InAddr[:], buf.DecodeBytes(4)) + return nil +} + +// NatDetForwardReply defines message 'nat_det_forward_reply'. +type NatDetForwardReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + OutPortLo uint16 `binapi:"u16,name=out_port_lo" json:"out_port_lo,omitempty"` + OutPortHi uint16 `binapi:"u16,name=out_port_hi" json:"out_port_hi,omitempty"` + OutAddr ip_types.IP4Address `binapi:"ip4_address,name=out_addr" json:"out_addr,omitempty"` +} + +func (m *NatDetForwardReply) Reset() { *m = NatDetForwardReply{} } +func (*NatDetForwardReply) GetMessageName() string { return "nat_det_forward_reply" } +func (*NatDetForwardReply) GetCrcString() string { return "a8ccbdc0" } +func (*NatDetForwardReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatDetForwardReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 2 // m.OutPortLo + size += 2 // m.OutPortHi + size += 1 * 4 // m.OutAddr + return size +} +func (m *NatDetForwardReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint16(uint16(m.OutPortLo)) + buf.EncodeUint16(uint16(m.OutPortHi)) + buf.EncodeBytes(m.OutAddr[:], 4) + return buf.Bytes(), nil +} +func (m *NatDetForwardReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.OutPortLo = buf.DecodeUint16() + m.OutPortHi = buf.DecodeUint16() + copy(m.OutAddr[:], buf.DecodeBytes(4)) + return nil +} + +// NatDetMapDetails defines message 'nat_det_map_details'. +type NatDetMapDetails struct { + InAddr ip_types.IP4Address `binapi:"ip4_address,name=in_addr" json:"in_addr,omitempty"` + InPlen uint8 `binapi:"u8,name=in_plen" json:"in_plen,omitempty"` + OutAddr ip_types.IP4Address `binapi:"ip4_address,name=out_addr" json:"out_addr,omitempty"` + OutPlen uint8 `binapi:"u8,name=out_plen" json:"out_plen,omitempty"` + SharingRatio uint32 `binapi:"u32,name=sharing_ratio" json:"sharing_ratio,omitempty"` + PortsPerHost uint16 `binapi:"u16,name=ports_per_host" json:"ports_per_host,omitempty"` + SesNum uint32 `binapi:"u32,name=ses_num" json:"ses_num,omitempty"` +} + +func (m *NatDetMapDetails) Reset() { *m = NatDetMapDetails{} } +func (*NatDetMapDetails) GetMessageName() string { return "nat_det_map_details" } +func (*NatDetMapDetails) GetCrcString() string { return "88000ee1" } +func (*NatDetMapDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatDetMapDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.InAddr + size += 1 // m.InPlen + size += 1 * 4 // m.OutAddr + size += 1 // m.OutPlen + size += 4 // m.SharingRatio + size += 2 // m.PortsPerHost + size += 4 // m.SesNum + return size +} +func (m *NatDetMapDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.InAddr[:], 4) + buf.EncodeUint8(uint8(m.InPlen)) + buf.EncodeBytes(m.OutAddr[:], 4) + buf.EncodeUint8(uint8(m.OutPlen)) + buf.EncodeUint32(uint32(m.SharingRatio)) + buf.EncodeUint16(uint16(m.PortsPerHost)) + buf.EncodeUint32(uint32(m.SesNum)) + return buf.Bytes(), nil +} +func (m *NatDetMapDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.InAddr[:], buf.DecodeBytes(4)) + m.InPlen = buf.DecodeUint8() + copy(m.OutAddr[:], buf.DecodeBytes(4)) + m.OutPlen = buf.DecodeUint8() + m.SharingRatio = buf.DecodeUint32() + m.PortsPerHost = buf.DecodeUint16() + m.SesNum = buf.DecodeUint32() + return nil +} + +// NatDetMapDump defines message 'nat_det_map_dump'. +type NatDetMapDump struct{} + +func (m *NatDetMapDump) Reset() { *m = NatDetMapDump{} } +func (*NatDetMapDump) GetMessageName() string { return "nat_det_map_dump" } +func (*NatDetMapDump) GetCrcString() string { return "51077d14" } +func (*NatDetMapDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatDetMapDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *NatDetMapDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *NatDetMapDump) Unmarshal(b []byte) error { + return nil +} + +// NatDetReverse defines message 'nat_det_reverse'. +type NatDetReverse struct { + OutPort uint16 `binapi:"u16,name=out_port" json:"out_port,omitempty"` + OutAddr ip_types.IP4Address `binapi:"ip4_address,name=out_addr" json:"out_addr,omitempty"` +} + +func (m *NatDetReverse) Reset() { *m = NatDetReverse{} } +func (*NatDetReverse) GetMessageName() string { return "nat_det_reverse" } +func (*NatDetReverse) GetCrcString() string { return "a7573fe1" } +func (*NatDetReverse) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatDetReverse) Size() int { + if m == nil { + return 0 + } + var size int + size += 2 // m.OutPort + size += 1 * 4 // m.OutAddr + return size +} +func (m *NatDetReverse) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint16(uint16(m.OutPort)) + buf.EncodeBytes(m.OutAddr[:], 4) + return buf.Bytes(), nil +} +func (m *NatDetReverse) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.OutPort = buf.DecodeUint16() + copy(m.OutAddr[:], buf.DecodeBytes(4)) + return nil +} + +// NatDetReverseReply defines message 'nat_det_reverse_reply'. +type NatDetReverseReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + InAddr ip_types.IP4Address `binapi:"ip4_address,name=in_addr" json:"in_addr,omitempty"` +} + +func (m *NatDetReverseReply) Reset() { *m = NatDetReverseReply{} } +func (*NatDetReverseReply) GetMessageName() string { return "nat_det_reverse_reply" } +func (*NatDetReverseReply) GetCrcString() string { return "34066d48" } +func (*NatDetReverseReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatDetReverseReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 * 4 // m.InAddr + return size +} +func (m *NatDetReverseReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBytes(m.InAddr[:], 4) + return buf.Bytes(), nil +} +func (m *NatDetReverseReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + copy(m.InAddr[:], buf.DecodeBytes(4)) + return nil +} + +// NatDetSessionDetails defines message 'nat_det_session_details'. +type NatDetSessionDetails struct { + InPort uint16 `binapi:"u16,name=in_port" json:"in_port,omitempty"` + ExtAddr ip_types.IP4Address `binapi:"ip4_address,name=ext_addr" json:"ext_addr,omitempty"` + ExtPort uint16 `binapi:"u16,name=ext_port" json:"ext_port,omitempty"` + OutPort uint16 `binapi:"u16,name=out_port" json:"out_port,omitempty"` + State uint8 `binapi:"u8,name=state" json:"state,omitempty"` + Expire uint32 `binapi:"u32,name=expire" json:"expire,omitempty"` +} + +func (m *NatDetSessionDetails) Reset() { *m = NatDetSessionDetails{} } +func (*NatDetSessionDetails) GetMessageName() string { return "nat_det_session_details" } +func (*NatDetSessionDetails) GetCrcString() string { return "27f3c171" } +func (*NatDetSessionDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatDetSessionDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 2 // m.InPort + size += 1 * 4 // m.ExtAddr + size += 2 // m.ExtPort + size += 2 // m.OutPort + size += 1 // m.State + size += 4 // m.Expire + return size +} +func (m *NatDetSessionDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint16(uint16(m.InPort)) + buf.EncodeBytes(m.ExtAddr[:], 4) + buf.EncodeUint16(uint16(m.ExtPort)) + buf.EncodeUint16(uint16(m.OutPort)) + buf.EncodeUint8(uint8(m.State)) + buf.EncodeUint32(uint32(m.Expire)) + return buf.Bytes(), nil +} +func (m *NatDetSessionDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.InPort = buf.DecodeUint16() + copy(m.ExtAddr[:], buf.DecodeBytes(4)) + m.ExtPort = buf.DecodeUint16() + m.OutPort = buf.DecodeUint16() + m.State = buf.DecodeUint8() + m.Expire = buf.DecodeUint32() + return nil +} + +// NatDetSessionDump defines message 'nat_det_session_dump'. +type NatDetSessionDump struct { + UserAddr ip_types.IP4Address `binapi:"ip4_address,name=user_addr" json:"user_addr,omitempty"` +} + +func (m *NatDetSessionDump) Reset() { *m = NatDetSessionDump{} } +func (*NatDetSessionDump) GetMessageName() string { return "nat_det_session_dump" } +func (*NatDetSessionDump) GetCrcString() string { return "e45a3af7" } +func (*NatDetSessionDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatDetSessionDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.UserAddr + return size +} +func (m *NatDetSessionDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.UserAddr[:], 4) + return buf.Bytes(), nil +} +func (m *NatDetSessionDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.UserAddr[:], buf.DecodeBytes(4)) + return nil +} + +// NatGetAddrAndPortAllocAlg defines message 'nat_get_addr_and_port_alloc_alg'. +type NatGetAddrAndPortAllocAlg struct{} + +func (m *NatGetAddrAndPortAllocAlg) Reset() { *m = NatGetAddrAndPortAllocAlg{} } +func (*NatGetAddrAndPortAllocAlg) GetMessageName() string { return "nat_get_addr_and_port_alloc_alg" } +func (*NatGetAddrAndPortAllocAlg) GetCrcString() string { return "51077d14" } +func (*NatGetAddrAndPortAllocAlg) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatGetAddrAndPortAllocAlg) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *NatGetAddrAndPortAllocAlg) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *NatGetAddrAndPortAllocAlg) Unmarshal(b []byte) error { + return nil +} + +// NatGetAddrAndPortAllocAlgReply defines message 'nat_get_addr_and_port_alloc_alg_reply'. +type NatGetAddrAndPortAllocAlgReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Alg uint8 `binapi:"u8,name=alg" json:"alg,omitempty"` + PsidOffset uint8 `binapi:"u8,name=psid_offset" json:"psid_offset,omitempty"` + PsidLength uint8 `binapi:"u8,name=psid_length" json:"psid_length,omitempty"` + Psid uint16 `binapi:"u16,name=psid" json:"psid,omitempty"` + StartPort uint16 `binapi:"u16,name=start_port" json:"start_port,omitempty"` + EndPort uint16 `binapi:"u16,name=end_port" json:"end_port,omitempty"` +} + +func (m *NatGetAddrAndPortAllocAlgReply) Reset() { *m = NatGetAddrAndPortAllocAlgReply{} } +func (*NatGetAddrAndPortAllocAlgReply) GetMessageName() string { + return "nat_get_addr_and_port_alloc_alg_reply" +} +func (*NatGetAddrAndPortAllocAlgReply) GetCrcString() string { return "3607a7d0" } +func (*NatGetAddrAndPortAllocAlgReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatGetAddrAndPortAllocAlgReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.Alg + size += 1 // m.PsidOffset + size += 1 // m.PsidLength + size += 2 // m.Psid + size += 2 // m.StartPort + size += 2 // m.EndPort + return size +} +func (m *NatGetAddrAndPortAllocAlgReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint8(uint8(m.Alg)) + buf.EncodeUint8(uint8(m.PsidOffset)) + buf.EncodeUint8(uint8(m.PsidLength)) + buf.EncodeUint16(uint16(m.Psid)) + buf.EncodeUint16(uint16(m.StartPort)) + buf.EncodeUint16(uint16(m.EndPort)) + return buf.Bytes(), nil +} +func (m *NatGetAddrAndPortAllocAlgReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Alg = buf.DecodeUint8() + m.PsidOffset = buf.DecodeUint8() + m.PsidLength = buf.DecodeUint8() + m.Psid = buf.DecodeUint16() + m.StartPort = buf.DecodeUint16() + m.EndPort = buf.DecodeUint16() + return nil +} + +// NatGetMssClamping defines message 'nat_get_mss_clamping'. +type NatGetMssClamping struct{} + +func (m *NatGetMssClamping) Reset() { *m = NatGetMssClamping{} } +func (*NatGetMssClamping) GetMessageName() string { return "nat_get_mss_clamping" } +func (*NatGetMssClamping) GetCrcString() string { return "51077d14" } +func (*NatGetMssClamping) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatGetMssClamping) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *NatGetMssClamping) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *NatGetMssClamping) Unmarshal(b []byte) error { + return nil +} + +// NatGetMssClampingReply defines message 'nat_get_mss_clamping_reply'. +type NatGetMssClampingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + MssValue uint16 `binapi:"u16,name=mss_value" json:"mss_value,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *NatGetMssClampingReply) Reset() { *m = NatGetMssClampingReply{} } +func (*NatGetMssClampingReply) GetMessageName() string { return "nat_get_mss_clamping_reply" } +func (*NatGetMssClampingReply) GetCrcString() string { return "1c0b2a78" } +func (*NatGetMssClampingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatGetMssClampingReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 2 // m.MssValue + size += 1 // m.Enable + return size +} +func (m *NatGetMssClampingReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint16(uint16(m.MssValue)) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *NatGetMssClampingReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.MssValue = buf.DecodeUint16() + m.Enable = buf.DecodeBool() + return nil +} + +// NatGetTimeouts defines message 'nat_get_timeouts'. +type NatGetTimeouts struct{} + +func (m *NatGetTimeouts) Reset() { *m = NatGetTimeouts{} } +func (*NatGetTimeouts) GetMessageName() string { return "nat_get_timeouts" } +func (*NatGetTimeouts) GetCrcString() string { return "51077d14" } +func (*NatGetTimeouts) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatGetTimeouts) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *NatGetTimeouts) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *NatGetTimeouts) Unmarshal(b []byte) error { + return nil +} + +// NatGetTimeoutsReply defines message 'nat_get_timeouts_reply'. +type NatGetTimeoutsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + UDP uint32 `binapi:"u32,name=udp" json:"udp,omitempty"` + TCPEstablished uint32 `binapi:"u32,name=tcp_established" json:"tcp_established,omitempty"` + TCPTransitory uint32 `binapi:"u32,name=tcp_transitory" json:"tcp_transitory,omitempty"` + ICMP uint32 `binapi:"u32,name=icmp" json:"icmp,omitempty"` +} + +func (m *NatGetTimeoutsReply) Reset() { *m = NatGetTimeoutsReply{} } +func (*NatGetTimeoutsReply) GetMessageName() string { return "nat_get_timeouts_reply" } +func (*NatGetTimeoutsReply) GetCrcString() string { return "3c4df4e1" } +func (*NatGetTimeoutsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatGetTimeoutsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.UDP + size += 4 // m.TCPEstablished + size += 4 // m.TCPTransitory + size += 4 // m.ICMP + return size +} +func (m *NatGetTimeoutsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.UDP)) + buf.EncodeUint32(uint32(m.TCPEstablished)) + buf.EncodeUint32(uint32(m.TCPTransitory)) + buf.EncodeUint32(uint32(m.ICMP)) + return buf.Bytes(), nil +} +func (m *NatGetTimeoutsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.UDP = buf.DecodeUint32() + m.TCPEstablished = buf.DecodeUint32() + m.TCPTransitory = buf.DecodeUint32() + m.ICMP = buf.DecodeUint32() + return nil +} + +// NatHaFlush defines message 'nat_ha_flush'. +type NatHaFlush struct{} + +func (m *NatHaFlush) Reset() { *m = NatHaFlush{} } +func (*NatHaFlush) GetMessageName() string { return "nat_ha_flush" } +func (*NatHaFlush) GetCrcString() string { return "51077d14" } +func (*NatHaFlush) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatHaFlush) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *NatHaFlush) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *NatHaFlush) Unmarshal(b []byte) error { + return nil +} + +// NatHaFlushReply defines message 'nat_ha_flush_reply'. +type NatHaFlushReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *NatHaFlushReply) Reset() { *m = NatHaFlushReply{} } +func (*NatHaFlushReply) GetMessageName() string { return "nat_ha_flush_reply" } +func (*NatHaFlushReply) GetCrcString() string { return "e8d4e804" } +func (*NatHaFlushReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatHaFlushReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *NatHaFlushReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *NatHaFlushReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// NatHaGetFailover defines message 'nat_ha_get_failover'. +type NatHaGetFailover struct{} + +func (m *NatHaGetFailover) Reset() { *m = NatHaGetFailover{} } +func (*NatHaGetFailover) GetMessageName() string { return "nat_ha_get_failover" } +func (*NatHaGetFailover) GetCrcString() string { return "51077d14" } +func (*NatHaGetFailover) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatHaGetFailover) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *NatHaGetFailover) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *NatHaGetFailover) Unmarshal(b []byte) error { + return nil +} + +// NatHaGetFailoverReply defines message 'nat_ha_get_failover_reply'. +type NatHaGetFailoverReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + SessionRefreshInterval uint32 `binapi:"u32,name=session_refresh_interval" json:"session_refresh_interval,omitempty"` +} + +func (m *NatHaGetFailoverReply) Reset() { *m = NatHaGetFailoverReply{} } +func (*NatHaGetFailoverReply) GetMessageName() string { return "nat_ha_get_failover_reply" } +func (*NatHaGetFailoverReply) GetCrcString() string { return "a67d8752" } +func (*NatHaGetFailoverReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatHaGetFailoverReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 * 4 // m.IPAddress + size += 2 // m.Port + size += 4 // m.SessionRefreshInterval + return size +} +func (m *NatHaGetFailoverReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBytes(m.IPAddress[:], 4) + buf.EncodeUint16(uint16(m.Port)) + buf.EncodeUint32(uint32(m.SessionRefreshInterval)) + return buf.Bytes(), nil +} +func (m *NatHaGetFailoverReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + copy(m.IPAddress[:], buf.DecodeBytes(4)) + m.Port = buf.DecodeUint16() + m.SessionRefreshInterval = buf.DecodeUint32() + return nil +} + +// NatHaGetListener defines message 'nat_ha_get_listener'. +type NatHaGetListener struct{} + +func (m *NatHaGetListener) Reset() { *m = NatHaGetListener{} } +func (*NatHaGetListener) GetMessageName() string { return "nat_ha_get_listener" } +func (*NatHaGetListener) GetCrcString() string { return "51077d14" } +func (*NatHaGetListener) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatHaGetListener) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *NatHaGetListener) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *NatHaGetListener) Unmarshal(b []byte) error { + return nil +} + +// NatHaGetListenerReply defines message 'nat_ha_get_listener_reply'. +type NatHaGetListenerReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + PathMtu uint32 `binapi:"u32,name=path_mtu" json:"path_mtu,omitempty"` +} + +func (m *NatHaGetListenerReply) Reset() { *m = NatHaGetListenerReply{} } +func (*NatHaGetListenerReply) GetMessageName() string { return "nat_ha_get_listener_reply" } +func (*NatHaGetListenerReply) GetCrcString() string { return "123ea41f" } +func (*NatHaGetListenerReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatHaGetListenerReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 * 4 // m.IPAddress + size += 2 // m.Port + size += 4 // m.PathMtu + return size +} +func (m *NatHaGetListenerReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBytes(m.IPAddress[:], 4) + buf.EncodeUint16(uint16(m.Port)) + buf.EncodeUint32(uint32(m.PathMtu)) + return buf.Bytes(), nil +} +func (m *NatHaGetListenerReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + copy(m.IPAddress[:], buf.DecodeBytes(4)) + m.Port = buf.DecodeUint16() + m.PathMtu = buf.DecodeUint32() + return nil +} + +// NatHaResync defines message 'nat_ha_resync'. +type NatHaResync struct { + WantResyncEvent uint8 `binapi:"u8,name=want_resync_event" json:"want_resync_event,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` +} + +func (m *NatHaResync) Reset() { *m = NatHaResync{} } +func (*NatHaResync) GetMessageName() string { return "nat_ha_resync" } +func (*NatHaResync) GetCrcString() string { return "c8ab9e03" } +func (*NatHaResync) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatHaResync) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.WantResyncEvent + size += 4 // m.PID + return size +} +func (m *NatHaResync) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.WantResyncEvent)) + buf.EncodeUint32(uint32(m.PID)) + return buf.Bytes(), nil +} +func (m *NatHaResync) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.WantResyncEvent = buf.DecodeUint8() + m.PID = buf.DecodeUint32() + return nil +} + +// NatHaResyncCompletedEvent defines message 'nat_ha_resync_completed_event'. +type NatHaResyncCompletedEvent struct { + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + MissedCount uint32 `binapi:"u32,name=missed_count" json:"missed_count,omitempty"` +} + +func (m *NatHaResyncCompletedEvent) Reset() { *m = NatHaResyncCompletedEvent{} } +func (*NatHaResyncCompletedEvent) GetMessageName() string { return "nat_ha_resync_completed_event" } +func (*NatHaResyncCompletedEvent) GetCrcString() string { return "fdc598fb" } +func (*NatHaResyncCompletedEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +func (m *NatHaResyncCompletedEvent) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.PID + size += 4 // m.MissedCount + return size +} +func (m *NatHaResyncCompletedEvent) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.PID)) + buf.EncodeUint32(uint32(m.MissedCount)) + return buf.Bytes(), nil +} +func (m *NatHaResyncCompletedEvent) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PID = buf.DecodeUint32() + m.MissedCount = buf.DecodeUint32() + return nil +} + +// NatHaResyncReply defines message 'nat_ha_resync_reply'. +type NatHaResyncReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *NatHaResyncReply) Reset() { *m = NatHaResyncReply{} } +func (*NatHaResyncReply) GetMessageName() string { return "nat_ha_resync_reply" } +func (*NatHaResyncReply) GetCrcString() string { return "e8d4e804" } +func (*NatHaResyncReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatHaResyncReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *NatHaResyncReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *NatHaResyncReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// NatHaSetFailover defines message 'nat_ha_set_failover'. +type NatHaSetFailover struct { + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + SessionRefreshInterval uint32 `binapi:"u32,name=session_refresh_interval" json:"session_refresh_interval,omitempty"` +} + +func (m *NatHaSetFailover) Reset() { *m = NatHaSetFailover{} } +func (*NatHaSetFailover) GetMessageName() string { return "nat_ha_set_failover" } +func (*NatHaSetFailover) GetCrcString() string { return "718246af" } +func (*NatHaSetFailover) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatHaSetFailover) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.IPAddress + size += 2 // m.Port + size += 4 // m.SessionRefreshInterval + return size +} +func (m *NatHaSetFailover) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.IPAddress[:], 4) + buf.EncodeUint16(uint16(m.Port)) + buf.EncodeUint32(uint32(m.SessionRefreshInterval)) + return buf.Bytes(), nil +} +func (m *NatHaSetFailover) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IPAddress[:], buf.DecodeBytes(4)) + m.Port = buf.DecodeUint16() + m.SessionRefreshInterval = buf.DecodeUint32() + return nil +} + +// NatHaSetFailoverReply defines message 'nat_ha_set_failover_reply'. +type NatHaSetFailoverReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *NatHaSetFailoverReply) Reset() { *m = NatHaSetFailoverReply{} } +func (*NatHaSetFailoverReply) GetMessageName() string { return "nat_ha_set_failover_reply" } +func (*NatHaSetFailoverReply) GetCrcString() string { return "e8d4e804" } +func (*NatHaSetFailoverReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatHaSetFailoverReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *NatHaSetFailoverReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *NatHaSetFailoverReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// NatHaSetListener defines message 'nat_ha_set_listener'. +type NatHaSetListener struct { + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + PathMtu uint32 `binapi:"u32,name=path_mtu" json:"path_mtu,omitempty"` +} + +func (m *NatHaSetListener) Reset() { *m = NatHaSetListener{} } +func (*NatHaSetListener) GetMessageName() string { return "nat_ha_set_listener" } +func (*NatHaSetListener) GetCrcString() string { return "e4a8cb4e" } +func (*NatHaSetListener) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatHaSetListener) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.IPAddress + size += 2 // m.Port + size += 4 // m.PathMtu + return size +} +func (m *NatHaSetListener) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.IPAddress[:], 4) + buf.EncodeUint16(uint16(m.Port)) + buf.EncodeUint32(uint32(m.PathMtu)) + return buf.Bytes(), nil +} +func (m *NatHaSetListener) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IPAddress[:], buf.DecodeBytes(4)) + m.Port = buf.DecodeUint16() + m.PathMtu = buf.DecodeUint32() + return nil +} + +// NatHaSetListenerReply defines message 'nat_ha_set_listener_reply'. +type NatHaSetListenerReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *NatHaSetListenerReply) Reset() { *m = NatHaSetListenerReply{} } +func (*NatHaSetListenerReply) GetMessageName() string { return "nat_ha_set_listener_reply" } +func (*NatHaSetListenerReply) GetCrcString() string { return "e8d4e804" } +func (*NatHaSetListenerReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatHaSetListenerReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *NatHaSetListenerReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *NatHaSetListenerReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// NatIpfixEnableDisable defines message 'nat_ipfix_enable_disable'. +type NatIpfixEnableDisable struct { + DomainID uint32 `binapi:"u32,name=domain_id" json:"domain_id,omitempty"` + SrcPort uint16 `binapi:"u16,name=src_port" json:"src_port,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *NatIpfixEnableDisable) Reset() { *m = NatIpfixEnableDisable{} } +func (*NatIpfixEnableDisable) GetMessageName() string { return "nat_ipfix_enable_disable" } +func (*NatIpfixEnableDisable) GetCrcString() string { return "9af4a2d2" } +func (*NatIpfixEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatIpfixEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.DomainID + size += 2 // m.SrcPort + size += 1 // m.Enable + return size +} +func (m *NatIpfixEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.DomainID)) + buf.EncodeUint16(uint16(m.SrcPort)) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *NatIpfixEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.DomainID = buf.DecodeUint32() + m.SrcPort = buf.DecodeUint16() + m.Enable = buf.DecodeBool() + return nil +} + +// NatIpfixEnableDisableReply defines message 'nat_ipfix_enable_disable_reply'. +type NatIpfixEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *NatIpfixEnableDisableReply) Reset() { *m = NatIpfixEnableDisableReply{} } +func (*NatIpfixEnableDisableReply) GetMessageName() string { return "nat_ipfix_enable_disable_reply" } +func (*NatIpfixEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*NatIpfixEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatIpfixEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *NatIpfixEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *NatIpfixEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// NatSetAddrAndPortAllocAlg defines message 'nat_set_addr_and_port_alloc_alg'. +type NatSetAddrAndPortAllocAlg struct { + Alg uint8 `binapi:"u8,name=alg" json:"alg,omitempty"` + PsidOffset uint8 `binapi:"u8,name=psid_offset" json:"psid_offset,omitempty"` + PsidLength uint8 `binapi:"u8,name=psid_length" json:"psid_length,omitempty"` + Psid uint16 `binapi:"u16,name=psid" json:"psid,omitempty"` + StartPort uint16 `binapi:"u16,name=start_port" json:"start_port,omitempty"` + EndPort uint16 `binapi:"u16,name=end_port" json:"end_port,omitempty"` +} + +func (m *NatSetAddrAndPortAllocAlg) Reset() { *m = NatSetAddrAndPortAllocAlg{} } +func (*NatSetAddrAndPortAllocAlg) GetMessageName() string { return "nat_set_addr_and_port_alloc_alg" } +func (*NatSetAddrAndPortAllocAlg) GetCrcString() string { return "deeb746f" } +func (*NatSetAddrAndPortAllocAlg) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatSetAddrAndPortAllocAlg) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Alg + size += 1 // m.PsidOffset + size += 1 // m.PsidLength + size += 2 // m.Psid + size += 2 // m.StartPort + size += 2 // m.EndPort + return size +} +func (m *NatSetAddrAndPortAllocAlg) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Alg)) + buf.EncodeUint8(uint8(m.PsidOffset)) + buf.EncodeUint8(uint8(m.PsidLength)) + buf.EncodeUint16(uint16(m.Psid)) + buf.EncodeUint16(uint16(m.StartPort)) + buf.EncodeUint16(uint16(m.EndPort)) + return buf.Bytes(), nil +} +func (m *NatSetAddrAndPortAllocAlg) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Alg = buf.DecodeUint8() + m.PsidOffset = buf.DecodeUint8() + m.PsidLength = buf.DecodeUint8() + m.Psid = buf.DecodeUint16() + m.StartPort = buf.DecodeUint16() + m.EndPort = buf.DecodeUint16() + return nil +} + +// NatSetAddrAndPortAllocAlgReply defines message 'nat_set_addr_and_port_alloc_alg_reply'. +type NatSetAddrAndPortAllocAlgReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *NatSetAddrAndPortAllocAlgReply) Reset() { *m = NatSetAddrAndPortAllocAlgReply{} } +func (*NatSetAddrAndPortAllocAlgReply) GetMessageName() string { + return "nat_set_addr_and_port_alloc_alg_reply" +} +func (*NatSetAddrAndPortAllocAlgReply) GetCrcString() string { return "e8d4e804" } +func (*NatSetAddrAndPortAllocAlgReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatSetAddrAndPortAllocAlgReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *NatSetAddrAndPortAllocAlgReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *NatSetAddrAndPortAllocAlgReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// NatSetLogLevel defines message 'nat_set_log_level'. +type NatSetLogLevel struct { + LogLevel NatLogLevel `binapi:"nat_log_level,name=log_level" json:"log_level,omitempty"` +} + +func (m *NatSetLogLevel) Reset() { *m = NatSetLogLevel{} } +func (*NatSetLogLevel) GetMessageName() string { return "nat_set_log_level" } +func (*NatSetLogLevel) GetCrcString() string { return "70076bfe" } +func (*NatSetLogLevel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatSetLogLevel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.LogLevel + return size +} +func (m *NatSetLogLevel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.LogLevel)) + return buf.Bytes(), nil +} +func (m *NatSetLogLevel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.LogLevel = NatLogLevel(buf.DecodeUint8()) + return nil +} + +// NatSetLogLevelReply defines message 'nat_set_log_level_reply'. +type NatSetLogLevelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *NatSetLogLevelReply) Reset() { *m = NatSetLogLevelReply{} } +func (*NatSetLogLevelReply) GetMessageName() string { return "nat_set_log_level_reply" } +func (*NatSetLogLevelReply) GetCrcString() string { return "e8d4e804" } +func (*NatSetLogLevelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatSetLogLevelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *NatSetLogLevelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *NatSetLogLevelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// NatSetMssClamping defines message 'nat_set_mss_clamping'. +type NatSetMssClamping struct { + MssValue uint16 `binapi:"u16,name=mss_value" json:"mss_value,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *NatSetMssClamping) Reset() { *m = NatSetMssClamping{} } +func (*NatSetMssClamping) GetMessageName() string { return "nat_set_mss_clamping" } +func (*NatSetMssClamping) GetCrcString() string { return "25e90abb" } +func (*NatSetMssClamping) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatSetMssClamping) Size() int { + if m == nil { + return 0 + } + var size int + size += 2 // m.MssValue + size += 1 // m.Enable + return size +} +func (m *NatSetMssClamping) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint16(uint16(m.MssValue)) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *NatSetMssClamping) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.MssValue = buf.DecodeUint16() + m.Enable = buf.DecodeBool() + return nil +} + +// NatSetMssClampingReply defines message 'nat_set_mss_clamping_reply'. +type NatSetMssClampingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *NatSetMssClampingReply) Reset() { *m = NatSetMssClampingReply{} } +func (*NatSetMssClampingReply) GetMessageName() string { return "nat_set_mss_clamping_reply" } +func (*NatSetMssClampingReply) GetCrcString() string { return "e8d4e804" } +func (*NatSetMssClampingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatSetMssClampingReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *NatSetMssClampingReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *NatSetMssClampingReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// NatSetTimeouts defines message 'nat_set_timeouts'. +type NatSetTimeouts struct { + UDP uint32 `binapi:"u32,name=udp" json:"udp,omitempty"` + TCPEstablished uint32 `binapi:"u32,name=tcp_established" json:"tcp_established,omitempty"` + TCPTransitory uint32 `binapi:"u32,name=tcp_transitory" json:"tcp_transitory,omitempty"` + ICMP uint32 `binapi:"u32,name=icmp" json:"icmp,omitempty"` +} + +func (m *NatSetTimeouts) Reset() { *m = NatSetTimeouts{} } +func (*NatSetTimeouts) GetMessageName() string { return "nat_set_timeouts" } +func (*NatSetTimeouts) GetCrcString() string { return "d4746b16" } +func (*NatSetTimeouts) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatSetTimeouts) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.UDP + size += 4 // m.TCPEstablished + size += 4 // m.TCPTransitory + size += 4 // m.ICMP + return size +} +func (m *NatSetTimeouts) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.UDP)) + buf.EncodeUint32(uint32(m.TCPEstablished)) + buf.EncodeUint32(uint32(m.TCPTransitory)) + buf.EncodeUint32(uint32(m.ICMP)) + return buf.Bytes(), nil +} +func (m *NatSetTimeouts) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.UDP = buf.DecodeUint32() + m.TCPEstablished = buf.DecodeUint32() + m.TCPTransitory = buf.DecodeUint32() + m.ICMP = buf.DecodeUint32() + return nil +} + +// NatSetTimeoutsReply defines message 'nat_set_timeouts_reply'. +type NatSetTimeoutsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *NatSetTimeoutsReply) Reset() { *m = NatSetTimeoutsReply{} } +func (*NatSetTimeoutsReply) GetMessageName() string { return "nat_set_timeouts_reply" } +func (*NatSetTimeoutsReply) GetCrcString() string { return "e8d4e804" } +func (*NatSetTimeoutsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatSetTimeoutsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *NatSetTimeoutsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *NatSetTimeoutsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// NatSetWorkers defines message 'nat_set_workers'. +type NatSetWorkers struct { + WorkerMask uint64 `binapi:"u64,name=worker_mask" json:"worker_mask,omitempty"` +} + +func (m *NatSetWorkers) Reset() { *m = NatSetWorkers{} } +func (*NatSetWorkers) GetMessageName() string { return "nat_set_workers" } +func (*NatSetWorkers) GetCrcString() string { return "da926638" } +func (*NatSetWorkers) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatSetWorkers) Size() int { + if m == nil { + return 0 + } + var size int + size += 8 // m.WorkerMask + return size +} +func (m *NatSetWorkers) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint64(uint64(m.WorkerMask)) + return buf.Bytes(), nil +} +func (m *NatSetWorkers) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.WorkerMask = buf.DecodeUint64() + return nil +} + +// NatSetWorkersReply defines message 'nat_set_workers_reply'. +type NatSetWorkersReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *NatSetWorkersReply) Reset() { *m = NatSetWorkersReply{} } +func (*NatSetWorkersReply) GetMessageName() string { return "nat_set_workers_reply" } +func (*NatSetWorkersReply) GetCrcString() string { return "e8d4e804" } +func (*NatSetWorkersReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatSetWorkersReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *NatSetWorkersReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *NatSetWorkersReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// NatShowConfig defines message 'nat_show_config'. +type NatShowConfig struct{} + +func (m *NatShowConfig) Reset() { *m = NatShowConfig{} } +func (*NatShowConfig) GetMessageName() string { return "nat_show_config" } +func (*NatShowConfig) GetCrcString() string { return "51077d14" } +func (*NatShowConfig) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatShowConfig) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *NatShowConfig) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *NatShowConfig) Unmarshal(b []byte) error { + return nil +} + +// NatShowConfigReply defines message 'nat_show_config_reply'. +type NatShowConfigReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + StaticMappingOnly bool `binapi:"bool,name=static_mapping_only" json:"static_mapping_only,omitempty"` + StaticMappingConnectionTracking bool `binapi:"bool,name=static_mapping_connection_tracking" json:"static_mapping_connection_tracking,omitempty"` + Deterministic bool `binapi:"bool,name=deterministic" json:"deterministic,omitempty"` + EndpointDependent bool `binapi:"bool,name=endpoint_dependent" json:"endpoint_dependent,omitempty"` + Out2inDpo bool `binapi:"bool,name=out2in_dpo" json:"out2in_dpo,omitempty"` + DsliteCe bool `binapi:"bool,name=dslite_ce" json:"dslite_ce,omitempty"` + TranslationBuckets uint32 `binapi:"u32,name=translation_buckets" json:"translation_buckets,omitempty"` + TranslationMemorySize uint32 `binapi:"u32,name=translation_memory_size" json:"translation_memory_size,omitempty"` + UserBuckets uint32 `binapi:"u32,name=user_buckets" json:"user_buckets,omitempty"` + UserMemorySize uint64 `binapi:"u64,name=user_memory_size" json:"user_memory_size,omitempty"` + MaxTranslationsPerUser uint32 `binapi:"u32,name=max_translations_per_user" json:"max_translations_per_user,omitempty"` + OutsideVrfID uint32 `binapi:"u32,name=outside_vrf_id" json:"outside_vrf_id,omitempty"` + InsideVrfID uint32 `binapi:"u32,name=inside_vrf_id" json:"inside_vrf_id,omitempty"` + Nat64BibBuckets uint32 `binapi:"u32,name=nat64_bib_buckets" json:"nat64_bib_buckets,omitempty"` + Nat64BibMemorySize uint64 `binapi:"u64,name=nat64_bib_memory_size" json:"nat64_bib_memory_size,omitempty"` + Nat64StBuckets uint32 `binapi:"u32,name=nat64_st_buckets" json:"nat64_st_buckets,omitempty"` + Nat64StMemorySize uint64 `binapi:"u64,name=nat64_st_memory_size" json:"nat64_st_memory_size,omitempty"` +} + +func (m *NatShowConfigReply) Reset() { *m = NatShowConfigReply{} } +func (*NatShowConfigReply) GetMessageName() string { return "nat_show_config_reply" } +func (*NatShowConfigReply) GetCrcString() string { return "7903ef06" } +func (*NatShowConfigReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatShowConfigReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.StaticMappingOnly + size += 1 // m.StaticMappingConnectionTracking + size += 1 // m.Deterministic + size += 1 // m.EndpointDependent + size += 1 // m.Out2inDpo + size += 1 // m.DsliteCe + size += 4 // m.TranslationBuckets + size += 4 // m.TranslationMemorySize + size += 4 // m.UserBuckets + size += 8 // m.UserMemorySize + size += 4 // m.MaxTranslationsPerUser + size += 4 // m.OutsideVrfID + size += 4 // m.InsideVrfID + size += 4 // m.Nat64BibBuckets + size += 8 // m.Nat64BibMemorySize + size += 4 // m.Nat64StBuckets + size += 8 // m.Nat64StMemorySize + return size +} +func (m *NatShowConfigReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBool(m.StaticMappingOnly) + buf.EncodeBool(m.StaticMappingConnectionTracking) + buf.EncodeBool(m.Deterministic) + buf.EncodeBool(m.EndpointDependent) + buf.EncodeBool(m.Out2inDpo) + buf.EncodeBool(m.DsliteCe) + buf.EncodeUint32(uint32(m.TranslationBuckets)) + buf.EncodeUint32(uint32(m.TranslationMemorySize)) + buf.EncodeUint32(uint32(m.UserBuckets)) + buf.EncodeUint64(uint64(m.UserMemorySize)) + buf.EncodeUint32(uint32(m.MaxTranslationsPerUser)) + buf.EncodeUint32(uint32(m.OutsideVrfID)) + buf.EncodeUint32(uint32(m.InsideVrfID)) + buf.EncodeUint32(uint32(m.Nat64BibBuckets)) + buf.EncodeUint64(uint64(m.Nat64BibMemorySize)) + buf.EncodeUint32(uint32(m.Nat64StBuckets)) + buf.EncodeUint64(uint64(m.Nat64StMemorySize)) + return buf.Bytes(), nil +} +func (m *NatShowConfigReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.StaticMappingOnly = buf.DecodeBool() + m.StaticMappingConnectionTracking = buf.DecodeBool() + m.Deterministic = buf.DecodeBool() + m.EndpointDependent = buf.DecodeBool() + m.Out2inDpo = buf.DecodeBool() + m.DsliteCe = buf.DecodeBool() + m.TranslationBuckets = buf.DecodeUint32() + m.TranslationMemorySize = buf.DecodeUint32() + m.UserBuckets = buf.DecodeUint32() + m.UserMemorySize = buf.DecodeUint64() + m.MaxTranslationsPerUser = buf.DecodeUint32() + m.OutsideVrfID = buf.DecodeUint32() + m.InsideVrfID = buf.DecodeUint32() + m.Nat64BibBuckets = buf.DecodeUint32() + m.Nat64BibMemorySize = buf.DecodeUint64() + m.Nat64StBuckets = buf.DecodeUint32() + m.Nat64StMemorySize = buf.DecodeUint64() + return nil +} + +// NatWorkerDetails defines message 'nat_worker_details'. +type NatWorkerDetails struct { + WorkerIndex uint32 `binapi:"u32,name=worker_index" json:"worker_index,omitempty"` + LcoreID uint32 `binapi:"u32,name=lcore_id" json:"lcore_id,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty"` +} + +func (m *NatWorkerDetails) Reset() { *m = NatWorkerDetails{} } +func (*NatWorkerDetails) GetMessageName() string { return "nat_worker_details" } +func (*NatWorkerDetails) GetCrcString() string { return "84bf06fc" } +func (*NatWorkerDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NatWorkerDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.WorkerIndex + size += 4 // m.LcoreID + size += 64 // m.Name + return size +} +func (m *NatWorkerDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.WorkerIndex)) + buf.EncodeUint32(uint32(m.LcoreID)) + buf.EncodeString(m.Name, 64) + return buf.Bytes(), nil +} +func (m *NatWorkerDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.WorkerIndex = buf.DecodeUint32() + m.LcoreID = buf.DecodeUint32() + m.Name = buf.DecodeString(64) + return nil +} + +// NatWorkerDump defines message 'nat_worker_dump'. +type NatWorkerDump struct{} + +func (m *NatWorkerDump) Reset() { *m = NatWorkerDump{} } +func (*NatWorkerDump) GetMessageName() string { return "nat_worker_dump" } +func (*NatWorkerDump) GetCrcString() string { return "51077d14" } +func (*NatWorkerDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NatWorkerDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *NatWorkerDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *NatWorkerDump) Unmarshal(b []byte) error { + return nil +} + +func init() { file_nat_binapi_init() } +func file_nat_binapi_init() { + api.RegisterMessage((*Nat44AddDelAddressRange)(nil), "nat44_add_del_address_range_d4c7568c") + api.RegisterMessage((*Nat44AddDelAddressRangeReply)(nil), "nat44_add_del_address_range_reply_e8d4e804") + api.RegisterMessage((*Nat44AddDelIdentityMapping)(nil), "nat44_add_del_identity_mapping_8e12743f") + api.RegisterMessage((*Nat44AddDelIdentityMappingReply)(nil), "nat44_add_del_identity_mapping_reply_e8d4e804") + api.RegisterMessage((*Nat44AddDelInterfaceAddr)(nil), "nat44_add_del_interface_addr_fc835325") + api.RegisterMessage((*Nat44AddDelInterfaceAddrReply)(nil), "nat44_add_del_interface_addr_reply_e8d4e804") + api.RegisterMessage((*Nat44AddDelLbStaticMapping)(nil), "nat44_add_del_lb_static_mapping_53b24611") + api.RegisterMessage((*Nat44AddDelLbStaticMappingReply)(nil), "nat44_add_del_lb_static_mapping_reply_e8d4e804") + api.RegisterMessage((*Nat44AddDelStaticMapping)(nil), "nat44_add_del_static_mapping_e165e83b") + api.RegisterMessage((*Nat44AddDelStaticMappingReply)(nil), "nat44_add_del_static_mapping_reply_e8d4e804") + api.RegisterMessage((*Nat44AddressDetails)(nil), "nat44_address_details_45410ac4") + api.RegisterMessage((*Nat44AddressDump)(nil), "nat44_address_dump_51077d14") + api.RegisterMessage((*Nat44DelSession)(nil), "nat44_del_session_4c49c387") + api.RegisterMessage((*Nat44DelSessionReply)(nil), "nat44_del_session_reply_e8d4e804") + api.RegisterMessage((*Nat44DelUser)(nil), "nat44_del_user_99a9f998") + api.RegisterMessage((*Nat44DelUserReply)(nil), "nat44_del_user_reply_e8d4e804") + api.RegisterMessage((*Nat44ForwardingEnableDisable)(nil), "nat44_forwarding_enable_disable_b3e225d2") + api.RegisterMessage((*Nat44ForwardingEnableDisableReply)(nil), "nat44_forwarding_enable_disable_reply_e8d4e804") + api.RegisterMessage((*Nat44ForwardingIsEnabled)(nil), "nat44_forwarding_is_enabled_51077d14") + api.RegisterMessage((*Nat44ForwardingIsEnabledReply)(nil), "nat44_forwarding_is_enabled_reply_46924a06") + api.RegisterMessage((*Nat44IdentityMappingDetails)(nil), "nat44_identity_mapping_details_36d21351") + api.RegisterMessage((*Nat44IdentityMappingDump)(nil), "nat44_identity_mapping_dump_51077d14") + api.RegisterMessage((*Nat44InterfaceAddDelFeature)(nil), "nat44_interface_add_del_feature_f3699b83") + api.RegisterMessage((*Nat44InterfaceAddDelFeatureReply)(nil), "nat44_interface_add_del_feature_reply_e8d4e804") + api.RegisterMessage((*Nat44InterfaceAddDelOutputFeature)(nil), "nat44_interface_add_del_output_feature_f3699b83") + api.RegisterMessage((*Nat44InterfaceAddDelOutputFeatureReply)(nil), "nat44_interface_add_del_output_feature_reply_e8d4e804") + api.RegisterMessage((*Nat44InterfaceAddrDetails)(nil), "nat44_interface_addr_details_3e687514") + api.RegisterMessage((*Nat44InterfaceAddrDump)(nil), "nat44_interface_addr_dump_51077d14") + api.RegisterMessage((*Nat44InterfaceDetails)(nil), "nat44_interface_details_5d286289") + api.RegisterMessage((*Nat44InterfaceDump)(nil), "nat44_interface_dump_51077d14") + api.RegisterMessage((*Nat44InterfaceOutputFeatureDetails)(nil), "nat44_interface_output_feature_details_5d286289") + api.RegisterMessage((*Nat44InterfaceOutputFeatureDump)(nil), "nat44_interface_output_feature_dump_51077d14") + api.RegisterMessage((*Nat44LbStaticMappingAddDelLocal)(nil), "nat44_lb_static_mapping_add_del_local_2910a151") + api.RegisterMessage((*Nat44LbStaticMappingAddDelLocalReply)(nil), "nat44_lb_static_mapping_add_del_local_reply_e8d4e804") + api.RegisterMessage((*Nat44LbStaticMappingDetails)(nil), "nat44_lb_static_mapping_details_2267b9e8") + api.RegisterMessage((*Nat44LbStaticMappingDump)(nil), "nat44_lb_static_mapping_dump_51077d14") + api.RegisterMessage((*Nat44SessionCleanup)(nil), "nat44_session_cleanup_51077d14") + api.RegisterMessage((*Nat44SessionCleanupReply)(nil), "nat44_session_cleanup_reply_e8d4e804") + api.RegisterMessage((*Nat44SetSessionLimit)(nil), "nat44_set_session_limit_8899bbb1") + api.RegisterMessage((*Nat44SetSessionLimitReply)(nil), "nat44_set_session_limit_reply_e8d4e804") + api.RegisterMessage((*Nat44StaticMappingDetails)(nil), "nat44_static_mapping_details_1a433ef7") + api.RegisterMessage((*Nat44StaticMappingDump)(nil), "nat44_static_mapping_dump_51077d14") + api.RegisterMessage((*Nat44UserDetails)(nil), "nat44_user_details_355896c2") + api.RegisterMessage((*Nat44UserDump)(nil), "nat44_user_dump_51077d14") + api.RegisterMessage((*Nat44UserSessionDetails)(nil), "nat44_user_session_details_1965fd69") + api.RegisterMessage((*Nat44UserSessionDump)(nil), "nat44_user_session_dump_e1899c98") + api.RegisterMessage((*Nat64AddDelInterface)(nil), "nat64_add_del_interface_f3699b83") + api.RegisterMessage((*Nat64AddDelInterfaceAddr)(nil), "nat64_add_del_interface_addr_47d6e753") + api.RegisterMessage((*Nat64AddDelInterfaceAddrReply)(nil), "nat64_add_del_interface_addr_reply_e8d4e804") + api.RegisterMessage((*Nat64AddDelInterfaceReply)(nil), "nat64_add_del_interface_reply_e8d4e804") + api.RegisterMessage((*Nat64AddDelPoolAddrRange)(nil), "nat64_add_del_pool_addr_range_21234ef3") + api.RegisterMessage((*Nat64AddDelPoolAddrRangeReply)(nil), "nat64_add_del_pool_addr_range_reply_e8d4e804") + api.RegisterMessage((*Nat64AddDelPrefix)(nil), "nat64_add_del_prefix_727b2f4c") + api.RegisterMessage((*Nat64AddDelPrefixReply)(nil), "nat64_add_del_prefix_reply_e8d4e804") + api.RegisterMessage((*Nat64AddDelStaticBib)(nil), "nat64_add_del_static_bib_90fae58a") + api.RegisterMessage((*Nat64AddDelStaticBibReply)(nil), "nat64_add_del_static_bib_reply_e8d4e804") + api.RegisterMessage((*Nat64BibDetails)(nil), "nat64_bib_details_62c8541d") + api.RegisterMessage((*Nat64BibDump)(nil), "nat64_bib_dump_cfcb6b75") + api.RegisterMessage((*Nat64InterfaceDetails)(nil), "nat64_interface_details_5d286289") + api.RegisterMessage((*Nat64InterfaceDump)(nil), "nat64_interface_dump_51077d14") + api.RegisterMessage((*Nat64PoolAddrDetails)(nil), "nat64_pool_addr_details_9bb99cdb") + api.RegisterMessage((*Nat64PoolAddrDump)(nil), "nat64_pool_addr_dump_51077d14") + api.RegisterMessage((*Nat64PrefixDetails)(nil), "nat64_prefix_details_20568de3") + api.RegisterMessage((*Nat64PrefixDump)(nil), "nat64_prefix_dump_51077d14") + api.RegisterMessage((*Nat64StDetails)(nil), "nat64_st_details_c770d620") + api.RegisterMessage((*Nat64StDump)(nil), "nat64_st_dump_cfcb6b75") + api.RegisterMessage((*Nat66AddDelInterface)(nil), "nat66_add_del_interface_f3699b83") + api.RegisterMessage((*Nat66AddDelInterfaceReply)(nil), "nat66_add_del_interface_reply_e8d4e804") + api.RegisterMessage((*Nat66AddDelStaticMapping)(nil), "nat66_add_del_static_mapping_fb64e50b") + api.RegisterMessage((*Nat66AddDelStaticMappingReply)(nil), "nat66_add_del_static_mapping_reply_e8d4e804") + api.RegisterMessage((*Nat66InterfaceDetails)(nil), "nat66_interface_details_5d286289") + api.RegisterMessage((*Nat66InterfaceDump)(nil), "nat66_interface_dump_51077d14") + api.RegisterMessage((*Nat66StaticMappingDetails)(nil), "nat66_static_mapping_details_5c568448") + api.RegisterMessage((*Nat66StaticMappingDump)(nil), "nat66_static_mapping_dump_51077d14") + api.RegisterMessage((*NatControlPing)(nil), "nat_control_ping_51077d14") + api.RegisterMessage((*NatControlPingReply)(nil), "nat_control_ping_reply_f6b0b8ca") + api.RegisterMessage((*NatDetAddDelMap)(nil), "nat_det_add_del_map_112fde05") + api.RegisterMessage((*NatDetAddDelMapReply)(nil), "nat_det_add_del_map_reply_e8d4e804") + api.RegisterMessage((*NatDetCloseSessionIn)(nil), "nat_det_close_session_in_0a10ef64") + api.RegisterMessage((*NatDetCloseSessionInReply)(nil), "nat_det_close_session_in_reply_e8d4e804") + api.RegisterMessage((*NatDetCloseSessionOut)(nil), "nat_det_close_session_out_c1b6cbfb") + api.RegisterMessage((*NatDetCloseSessionOutReply)(nil), "nat_det_close_session_out_reply_e8d4e804") + api.RegisterMessage((*NatDetForward)(nil), "nat_det_forward_7f8a89cd") + api.RegisterMessage((*NatDetForwardReply)(nil), "nat_det_forward_reply_a8ccbdc0") + api.RegisterMessage((*NatDetMapDetails)(nil), "nat_det_map_details_88000ee1") + api.RegisterMessage((*NatDetMapDump)(nil), "nat_det_map_dump_51077d14") + api.RegisterMessage((*NatDetReverse)(nil), "nat_det_reverse_a7573fe1") + api.RegisterMessage((*NatDetReverseReply)(nil), "nat_det_reverse_reply_34066d48") + api.RegisterMessage((*NatDetSessionDetails)(nil), "nat_det_session_details_27f3c171") + api.RegisterMessage((*NatDetSessionDump)(nil), "nat_det_session_dump_e45a3af7") + api.RegisterMessage((*NatGetAddrAndPortAllocAlg)(nil), "nat_get_addr_and_port_alloc_alg_51077d14") + api.RegisterMessage((*NatGetAddrAndPortAllocAlgReply)(nil), "nat_get_addr_and_port_alloc_alg_reply_3607a7d0") + api.RegisterMessage((*NatGetMssClamping)(nil), "nat_get_mss_clamping_51077d14") + api.RegisterMessage((*NatGetMssClampingReply)(nil), "nat_get_mss_clamping_reply_1c0b2a78") + api.RegisterMessage((*NatGetTimeouts)(nil), "nat_get_timeouts_51077d14") + api.RegisterMessage((*NatGetTimeoutsReply)(nil), "nat_get_timeouts_reply_3c4df4e1") + api.RegisterMessage((*NatHaFlush)(nil), "nat_ha_flush_51077d14") + api.RegisterMessage((*NatHaFlushReply)(nil), "nat_ha_flush_reply_e8d4e804") + api.RegisterMessage((*NatHaGetFailover)(nil), "nat_ha_get_failover_51077d14") + api.RegisterMessage((*NatHaGetFailoverReply)(nil), "nat_ha_get_failover_reply_a67d8752") + api.RegisterMessage((*NatHaGetListener)(nil), "nat_ha_get_listener_51077d14") + api.RegisterMessage((*NatHaGetListenerReply)(nil), "nat_ha_get_listener_reply_123ea41f") + api.RegisterMessage((*NatHaResync)(nil), "nat_ha_resync_c8ab9e03") + api.RegisterMessage((*NatHaResyncCompletedEvent)(nil), "nat_ha_resync_completed_event_fdc598fb") + api.RegisterMessage((*NatHaResyncReply)(nil), "nat_ha_resync_reply_e8d4e804") + api.RegisterMessage((*NatHaSetFailover)(nil), "nat_ha_set_failover_718246af") + api.RegisterMessage((*NatHaSetFailoverReply)(nil), "nat_ha_set_failover_reply_e8d4e804") + api.RegisterMessage((*NatHaSetListener)(nil), "nat_ha_set_listener_e4a8cb4e") + api.RegisterMessage((*NatHaSetListenerReply)(nil), "nat_ha_set_listener_reply_e8d4e804") + api.RegisterMessage((*NatIpfixEnableDisable)(nil), "nat_ipfix_enable_disable_9af4a2d2") + api.RegisterMessage((*NatIpfixEnableDisableReply)(nil), "nat_ipfix_enable_disable_reply_e8d4e804") + api.RegisterMessage((*NatSetAddrAndPortAllocAlg)(nil), "nat_set_addr_and_port_alloc_alg_deeb746f") + api.RegisterMessage((*NatSetAddrAndPortAllocAlgReply)(nil), "nat_set_addr_and_port_alloc_alg_reply_e8d4e804") + api.RegisterMessage((*NatSetLogLevel)(nil), "nat_set_log_level_70076bfe") + api.RegisterMessage((*NatSetLogLevelReply)(nil), "nat_set_log_level_reply_e8d4e804") + api.RegisterMessage((*NatSetMssClamping)(nil), "nat_set_mss_clamping_25e90abb") + api.RegisterMessage((*NatSetMssClampingReply)(nil), "nat_set_mss_clamping_reply_e8d4e804") + api.RegisterMessage((*NatSetTimeouts)(nil), "nat_set_timeouts_d4746b16") + api.RegisterMessage((*NatSetTimeoutsReply)(nil), "nat_set_timeouts_reply_e8d4e804") + api.RegisterMessage((*NatSetWorkers)(nil), "nat_set_workers_da926638") + api.RegisterMessage((*NatSetWorkersReply)(nil), "nat_set_workers_reply_e8d4e804") + api.RegisterMessage((*NatShowConfig)(nil), "nat_show_config_51077d14") + api.RegisterMessage((*NatShowConfigReply)(nil), "nat_show_config_reply_7903ef06") + api.RegisterMessage((*NatWorkerDetails)(nil), "nat_worker_details_84bf06fc") + api.RegisterMessage((*NatWorkerDump)(nil), "nat_worker_dump_51077d14") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*Nat44AddDelAddressRange)(nil), + (*Nat44AddDelAddressRangeReply)(nil), + (*Nat44AddDelIdentityMapping)(nil), + (*Nat44AddDelIdentityMappingReply)(nil), + (*Nat44AddDelInterfaceAddr)(nil), + (*Nat44AddDelInterfaceAddrReply)(nil), + (*Nat44AddDelLbStaticMapping)(nil), + (*Nat44AddDelLbStaticMappingReply)(nil), + (*Nat44AddDelStaticMapping)(nil), + (*Nat44AddDelStaticMappingReply)(nil), + (*Nat44AddressDetails)(nil), + (*Nat44AddressDump)(nil), + (*Nat44DelSession)(nil), + (*Nat44DelSessionReply)(nil), + (*Nat44DelUser)(nil), + (*Nat44DelUserReply)(nil), + (*Nat44ForwardingEnableDisable)(nil), + (*Nat44ForwardingEnableDisableReply)(nil), + (*Nat44ForwardingIsEnabled)(nil), + (*Nat44ForwardingIsEnabledReply)(nil), + (*Nat44IdentityMappingDetails)(nil), + (*Nat44IdentityMappingDump)(nil), + (*Nat44InterfaceAddDelFeature)(nil), + (*Nat44InterfaceAddDelFeatureReply)(nil), + (*Nat44InterfaceAddDelOutputFeature)(nil), + (*Nat44InterfaceAddDelOutputFeatureReply)(nil), + (*Nat44InterfaceAddrDetails)(nil), + (*Nat44InterfaceAddrDump)(nil), + (*Nat44InterfaceDetails)(nil), + (*Nat44InterfaceDump)(nil), + (*Nat44InterfaceOutputFeatureDetails)(nil), + (*Nat44InterfaceOutputFeatureDump)(nil), + (*Nat44LbStaticMappingAddDelLocal)(nil), + (*Nat44LbStaticMappingAddDelLocalReply)(nil), + (*Nat44LbStaticMappingDetails)(nil), + (*Nat44LbStaticMappingDump)(nil), + (*Nat44SessionCleanup)(nil), + (*Nat44SessionCleanupReply)(nil), + (*Nat44SetSessionLimit)(nil), + (*Nat44SetSessionLimitReply)(nil), + (*Nat44StaticMappingDetails)(nil), + (*Nat44StaticMappingDump)(nil), + (*Nat44UserDetails)(nil), + (*Nat44UserDump)(nil), + (*Nat44UserSessionDetails)(nil), + (*Nat44UserSessionDump)(nil), + (*Nat64AddDelInterface)(nil), + (*Nat64AddDelInterfaceAddr)(nil), + (*Nat64AddDelInterfaceAddrReply)(nil), + (*Nat64AddDelInterfaceReply)(nil), + (*Nat64AddDelPoolAddrRange)(nil), + (*Nat64AddDelPoolAddrRangeReply)(nil), + (*Nat64AddDelPrefix)(nil), + (*Nat64AddDelPrefixReply)(nil), + (*Nat64AddDelStaticBib)(nil), + (*Nat64AddDelStaticBibReply)(nil), + (*Nat64BibDetails)(nil), + (*Nat64BibDump)(nil), + (*Nat64InterfaceDetails)(nil), + (*Nat64InterfaceDump)(nil), + (*Nat64PoolAddrDetails)(nil), + (*Nat64PoolAddrDump)(nil), + (*Nat64PrefixDetails)(nil), + (*Nat64PrefixDump)(nil), + (*Nat64StDetails)(nil), + (*Nat64StDump)(nil), + (*Nat66AddDelInterface)(nil), + (*Nat66AddDelInterfaceReply)(nil), + (*Nat66AddDelStaticMapping)(nil), + (*Nat66AddDelStaticMappingReply)(nil), + (*Nat66InterfaceDetails)(nil), + (*Nat66InterfaceDump)(nil), + (*Nat66StaticMappingDetails)(nil), + (*Nat66StaticMappingDump)(nil), + (*NatControlPing)(nil), + (*NatControlPingReply)(nil), + (*NatDetAddDelMap)(nil), + (*NatDetAddDelMapReply)(nil), + (*NatDetCloseSessionIn)(nil), + (*NatDetCloseSessionInReply)(nil), + (*NatDetCloseSessionOut)(nil), + (*NatDetCloseSessionOutReply)(nil), + (*NatDetForward)(nil), + (*NatDetForwardReply)(nil), + (*NatDetMapDetails)(nil), + (*NatDetMapDump)(nil), + (*NatDetReverse)(nil), + (*NatDetReverseReply)(nil), + (*NatDetSessionDetails)(nil), + (*NatDetSessionDump)(nil), + (*NatGetAddrAndPortAllocAlg)(nil), + (*NatGetAddrAndPortAllocAlgReply)(nil), + (*NatGetMssClamping)(nil), + (*NatGetMssClampingReply)(nil), + (*NatGetTimeouts)(nil), + (*NatGetTimeoutsReply)(nil), + (*NatHaFlush)(nil), + (*NatHaFlushReply)(nil), + (*NatHaGetFailover)(nil), + (*NatHaGetFailoverReply)(nil), + (*NatHaGetListener)(nil), + (*NatHaGetListenerReply)(nil), + (*NatHaResync)(nil), + (*NatHaResyncCompletedEvent)(nil), + (*NatHaResyncReply)(nil), + (*NatHaSetFailover)(nil), + (*NatHaSetFailoverReply)(nil), + (*NatHaSetListener)(nil), + (*NatHaSetListenerReply)(nil), + (*NatIpfixEnableDisable)(nil), + (*NatIpfixEnableDisableReply)(nil), + (*NatSetAddrAndPortAllocAlg)(nil), + (*NatSetAddrAndPortAllocAlgReply)(nil), + (*NatSetLogLevel)(nil), + (*NatSetLogLevelReply)(nil), + (*NatSetMssClamping)(nil), + (*NatSetMssClampingReply)(nil), + (*NatSetTimeouts)(nil), + (*NatSetTimeoutsReply)(nil), + (*NatSetWorkers)(nil), + (*NatSetWorkersReply)(nil), + (*NatShowConfig)(nil), + (*NatShowConfigReply)(nil), + (*NatWorkerDetails)(nil), + (*NatWorkerDump)(nil), + } +} diff --git a/binapi/nat/nat_rest.ba.go b/binapi/nat/nat_rest.ba.go new file mode 100644 index 0000000..7740ea1 --- /dev/null +++ b/binapi/nat/nat_rest.ba.go @@ -0,0 +1,913 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package nat + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/nat44_add_del_address_range", func(w http.ResponseWriter, req *http.Request) { + var request = new(Nat44AddDelAddressRange) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Nat44AddDelAddressRange(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat44_add_del_identity_mapping", func(w http.ResponseWriter, req *http.Request) { + var request = new(Nat44AddDelIdentityMapping) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Nat44AddDelIdentityMapping(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat44_add_del_interface_addr", func(w http.ResponseWriter, req *http.Request) { + var request = new(Nat44AddDelInterfaceAddr) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Nat44AddDelInterfaceAddr(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat44_add_del_lb_static_mapping", func(w http.ResponseWriter, req *http.Request) { + var request = new(Nat44AddDelLbStaticMapping) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Nat44AddDelLbStaticMapping(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat44_add_del_static_mapping", func(w http.ResponseWriter, req *http.Request) { + var request = new(Nat44AddDelStaticMapping) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Nat44AddDelStaticMapping(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat44_del_session", func(w http.ResponseWriter, req *http.Request) { + var request = new(Nat44DelSession) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Nat44DelSession(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat44_del_user", func(w http.ResponseWriter, req *http.Request) { + var request = new(Nat44DelUser) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Nat44DelUser(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat44_forwarding_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(Nat44ForwardingEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Nat44ForwardingEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat44_forwarding_is_enabled", func(w http.ResponseWriter, req *http.Request) { + var request = new(Nat44ForwardingIsEnabled) + reply, err := rpc.Nat44ForwardingIsEnabled(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat44_interface_add_del_feature", func(w http.ResponseWriter, req *http.Request) { + var request = new(Nat44InterfaceAddDelFeature) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Nat44InterfaceAddDelFeature(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat44_interface_add_del_output_feature", func(w http.ResponseWriter, req *http.Request) { + var request = new(Nat44InterfaceAddDelOutputFeature) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Nat44InterfaceAddDelOutputFeature(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat44_lb_static_mapping_add_del_local", func(w http.ResponseWriter, req *http.Request) { + var request = new(Nat44LbStaticMappingAddDelLocal) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Nat44LbStaticMappingAddDelLocal(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat44_session_cleanup", func(w http.ResponseWriter, req *http.Request) { + var request = new(Nat44SessionCleanup) + reply, err := rpc.Nat44SessionCleanup(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat44_set_session_limit", func(w http.ResponseWriter, req *http.Request) { + var request = new(Nat44SetSessionLimit) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Nat44SetSessionLimit(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat64_add_del_interface", func(w http.ResponseWriter, req *http.Request) { + var request = new(Nat64AddDelInterface) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Nat64AddDelInterface(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat64_add_del_interface_addr", func(w http.ResponseWriter, req *http.Request) { + var request = new(Nat64AddDelInterfaceAddr) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Nat64AddDelInterfaceAddr(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat64_add_del_pool_addr_range", func(w http.ResponseWriter, req *http.Request) { + var request = new(Nat64AddDelPoolAddrRange) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Nat64AddDelPoolAddrRange(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat64_add_del_prefix", func(w http.ResponseWriter, req *http.Request) { + var request = new(Nat64AddDelPrefix) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Nat64AddDelPrefix(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat64_add_del_static_bib", func(w http.ResponseWriter, req *http.Request) { + var request = new(Nat64AddDelStaticBib) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Nat64AddDelStaticBib(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat66_add_del_interface", func(w http.ResponseWriter, req *http.Request) { + var request = new(Nat66AddDelInterface) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Nat66AddDelInterface(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat66_add_del_static_mapping", func(w http.ResponseWriter, req *http.Request) { + var request = new(Nat66AddDelStaticMapping) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Nat66AddDelStaticMapping(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat_control_ping", func(w http.ResponseWriter, req *http.Request) { + var request = new(NatControlPing) + reply, err := rpc.NatControlPing(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat_det_add_del_map", func(w http.ResponseWriter, req *http.Request) { + var request = new(NatDetAddDelMap) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.NatDetAddDelMap(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat_det_close_session_in", func(w http.ResponseWriter, req *http.Request) { + var request = new(NatDetCloseSessionIn) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.NatDetCloseSessionIn(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat_det_close_session_out", func(w http.ResponseWriter, req *http.Request) { + var request = new(NatDetCloseSessionOut) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.NatDetCloseSessionOut(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat_det_forward", func(w http.ResponseWriter, req *http.Request) { + var request = new(NatDetForward) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.NatDetForward(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat_det_reverse", func(w http.ResponseWriter, req *http.Request) { + var request = new(NatDetReverse) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.NatDetReverse(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat_get_addr_and_port_alloc_alg", func(w http.ResponseWriter, req *http.Request) { + var request = new(NatGetAddrAndPortAllocAlg) + reply, err := rpc.NatGetAddrAndPortAllocAlg(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat_get_mss_clamping", func(w http.ResponseWriter, req *http.Request) { + var request = new(NatGetMssClamping) + reply, err := rpc.NatGetMssClamping(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat_get_timeouts", func(w http.ResponseWriter, req *http.Request) { + var request = new(NatGetTimeouts) + reply, err := rpc.NatGetTimeouts(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat_ha_flush", func(w http.ResponseWriter, req *http.Request) { + var request = new(NatHaFlush) + reply, err := rpc.NatHaFlush(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat_ha_get_failover", func(w http.ResponseWriter, req *http.Request) { + var request = new(NatHaGetFailover) + reply, err := rpc.NatHaGetFailover(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat_ha_get_listener", func(w http.ResponseWriter, req *http.Request) { + var request = new(NatHaGetListener) + reply, err := rpc.NatHaGetListener(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat_ha_resync", func(w http.ResponseWriter, req *http.Request) { + var request = new(NatHaResync) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.NatHaResync(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat_ha_set_failover", func(w http.ResponseWriter, req *http.Request) { + var request = new(NatHaSetFailover) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.NatHaSetFailover(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat_ha_set_listener", func(w http.ResponseWriter, req *http.Request) { + var request = new(NatHaSetListener) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.NatHaSetListener(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat_ipfix_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(NatIpfixEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.NatIpfixEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat_set_addr_and_port_alloc_alg", func(w http.ResponseWriter, req *http.Request) { + var request = new(NatSetAddrAndPortAllocAlg) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.NatSetAddrAndPortAllocAlg(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat_set_log_level", func(w http.ResponseWriter, req *http.Request) { + var request = new(NatSetLogLevel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.NatSetLogLevel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat_set_mss_clamping", func(w http.ResponseWriter, req *http.Request) { + var request = new(NatSetMssClamping) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.NatSetMssClamping(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat_set_timeouts", func(w http.ResponseWriter, req *http.Request) { + var request = new(NatSetTimeouts) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.NatSetTimeouts(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat_set_workers", func(w http.ResponseWriter, req *http.Request) { + var request = new(NatSetWorkers) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.NatSetWorkers(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nat_show_config", func(w http.ResponseWriter, req *http.Request) { + var request = new(NatShowConfig) + reply, err := rpc.NatShowConfig(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/nat/nat_rpc.ba.go b/binapi/nat/nat_rpc.ba.go new file mode 100644 index 0000000..ad76f5d --- /dev/null +++ b/binapi/nat/nat_rpc.ba.go @@ -0,0 +1,1213 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package nat + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service nat. +type RPCService interface { + Nat44AddDelAddressRange(ctx context.Context, in *Nat44AddDelAddressRange) (*Nat44AddDelAddressRangeReply, error) + Nat44AddDelIdentityMapping(ctx context.Context, in *Nat44AddDelIdentityMapping) (*Nat44AddDelIdentityMappingReply, error) + Nat44AddDelInterfaceAddr(ctx context.Context, in *Nat44AddDelInterfaceAddr) (*Nat44AddDelInterfaceAddrReply, error) + Nat44AddDelLbStaticMapping(ctx context.Context, in *Nat44AddDelLbStaticMapping) (*Nat44AddDelLbStaticMappingReply, error) + Nat44AddDelStaticMapping(ctx context.Context, in *Nat44AddDelStaticMapping) (*Nat44AddDelStaticMappingReply, error) + Nat44AddressDump(ctx context.Context, in *Nat44AddressDump) (RPCService_Nat44AddressDumpClient, error) + Nat44DelSession(ctx context.Context, in *Nat44DelSession) (*Nat44DelSessionReply, error) + Nat44DelUser(ctx context.Context, in *Nat44DelUser) (*Nat44DelUserReply, error) + Nat44ForwardingEnableDisable(ctx context.Context, in *Nat44ForwardingEnableDisable) (*Nat44ForwardingEnableDisableReply, error) + Nat44ForwardingIsEnabled(ctx context.Context, in *Nat44ForwardingIsEnabled) (*Nat44ForwardingIsEnabledReply, error) + Nat44IdentityMappingDump(ctx context.Context, in *Nat44IdentityMappingDump) (RPCService_Nat44IdentityMappingDumpClient, error) + Nat44InterfaceAddDelFeature(ctx context.Context, in *Nat44InterfaceAddDelFeature) (*Nat44InterfaceAddDelFeatureReply, error) + Nat44InterfaceAddDelOutputFeature(ctx context.Context, in *Nat44InterfaceAddDelOutputFeature) (*Nat44InterfaceAddDelOutputFeatureReply, error) + Nat44InterfaceAddrDump(ctx context.Context, in *Nat44InterfaceAddrDump) (RPCService_Nat44InterfaceAddrDumpClient, error) + Nat44InterfaceDump(ctx context.Context, in *Nat44InterfaceDump) (RPCService_Nat44InterfaceDumpClient, error) + Nat44InterfaceOutputFeatureDump(ctx context.Context, in *Nat44InterfaceOutputFeatureDump) (RPCService_Nat44InterfaceOutputFeatureDumpClient, error) + Nat44LbStaticMappingAddDelLocal(ctx context.Context, in *Nat44LbStaticMappingAddDelLocal) (*Nat44LbStaticMappingAddDelLocalReply, error) + Nat44LbStaticMappingDump(ctx context.Context, in *Nat44LbStaticMappingDump) (RPCService_Nat44LbStaticMappingDumpClient, error) + Nat44SessionCleanup(ctx context.Context, in *Nat44SessionCleanup) (*Nat44SessionCleanupReply, error) + Nat44SetSessionLimit(ctx context.Context, in *Nat44SetSessionLimit) (*Nat44SetSessionLimitReply, error) + Nat44StaticMappingDump(ctx context.Context, in *Nat44StaticMappingDump) (RPCService_Nat44StaticMappingDumpClient, error) + Nat44UserDump(ctx context.Context, in *Nat44UserDump) (RPCService_Nat44UserDumpClient, error) + Nat44UserSessionDump(ctx context.Context, in *Nat44UserSessionDump) (RPCService_Nat44UserSessionDumpClient, error) + Nat64AddDelInterface(ctx context.Context, in *Nat64AddDelInterface) (*Nat64AddDelInterfaceReply, error) + Nat64AddDelInterfaceAddr(ctx context.Context, in *Nat64AddDelInterfaceAddr) (*Nat64AddDelInterfaceAddrReply, error) + Nat64AddDelPoolAddrRange(ctx context.Context, in *Nat64AddDelPoolAddrRange) (*Nat64AddDelPoolAddrRangeReply, error) + Nat64AddDelPrefix(ctx context.Context, in *Nat64AddDelPrefix) (*Nat64AddDelPrefixReply, error) + Nat64AddDelStaticBib(ctx context.Context, in *Nat64AddDelStaticBib) (*Nat64AddDelStaticBibReply, error) + Nat64BibDump(ctx context.Context, in *Nat64BibDump) (RPCService_Nat64BibDumpClient, error) + Nat64InterfaceDump(ctx context.Context, in *Nat64InterfaceDump) (RPCService_Nat64InterfaceDumpClient, error) + Nat64PoolAddrDump(ctx context.Context, in *Nat64PoolAddrDump) (RPCService_Nat64PoolAddrDumpClient, error) + Nat64PrefixDump(ctx context.Context, in *Nat64PrefixDump) (RPCService_Nat64PrefixDumpClient, error) + Nat64StDump(ctx context.Context, in *Nat64StDump) (RPCService_Nat64StDumpClient, error) + Nat66AddDelInterface(ctx context.Context, in *Nat66AddDelInterface) (*Nat66AddDelInterfaceReply, error) + Nat66AddDelStaticMapping(ctx context.Context, in *Nat66AddDelStaticMapping) (*Nat66AddDelStaticMappingReply, error) + Nat66InterfaceDump(ctx context.Context, in *Nat66InterfaceDump) (RPCService_Nat66InterfaceDumpClient, error) + Nat66StaticMappingDump(ctx context.Context, in *Nat66StaticMappingDump) (RPCService_Nat66StaticMappingDumpClient, error) + NatControlPing(ctx context.Context, in *NatControlPing) (*NatControlPingReply, error) + NatDetAddDelMap(ctx context.Context, in *NatDetAddDelMap) (*NatDetAddDelMapReply, error) + NatDetCloseSessionIn(ctx context.Context, in *NatDetCloseSessionIn) (*NatDetCloseSessionInReply, error) + NatDetCloseSessionOut(ctx context.Context, in *NatDetCloseSessionOut) (*NatDetCloseSessionOutReply, error) + NatDetForward(ctx context.Context, in *NatDetForward) (*NatDetForwardReply, error) + NatDetMapDump(ctx context.Context, in *NatDetMapDump) (RPCService_NatDetMapDumpClient, error) + NatDetReverse(ctx context.Context, in *NatDetReverse) (*NatDetReverseReply, error) + NatDetSessionDump(ctx context.Context, in *NatDetSessionDump) (RPCService_NatDetSessionDumpClient, error) + NatGetAddrAndPortAllocAlg(ctx context.Context, in *NatGetAddrAndPortAllocAlg) (*NatGetAddrAndPortAllocAlgReply, error) + NatGetMssClamping(ctx context.Context, in *NatGetMssClamping) (*NatGetMssClampingReply, error) + NatGetTimeouts(ctx context.Context, in *NatGetTimeouts) (*NatGetTimeoutsReply, error) + NatHaFlush(ctx context.Context, in *NatHaFlush) (*NatHaFlushReply, error) + NatHaGetFailover(ctx context.Context, in *NatHaGetFailover) (*NatHaGetFailoverReply, error) + NatHaGetListener(ctx context.Context, in *NatHaGetListener) (*NatHaGetListenerReply, error) + NatHaResync(ctx context.Context, in *NatHaResync) (*NatHaResyncReply, error) + NatHaSetFailover(ctx context.Context, in *NatHaSetFailover) (*NatHaSetFailoverReply, error) + NatHaSetListener(ctx context.Context, in *NatHaSetListener) (*NatHaSetListenerReply, error) + NatIpfixEnableDisable(ctx context.Context, in *NatIpfixEnableDisable) (*NatIpfixEnableDisableReply, error) + NatSetAddrAndPortAllocAlg(ctx context.Context, in *NatSetAddrAndPortAllocAlg) (*NatSetAddrAndPortAllocAlgReply, error) + NatSetLogLevel(ctx context.Context, in *NatSetLogLevel) (*NatSetLogLevelReply, error) + NatSetMssClamping(ctx context.Context, in *NatSetMssClamping) (*NatSetMssClampingReply, error) + NatSetTimeouts(ctx context.Context, in *NatSetTimeouts) (*NatSetTimeoutsReply, error) + NatSetWorkers(ctx context.Context, in *NatSetWorkers) (*NatSetWorkersReply, error) + NatShowConfig(ctx context.Context, in *NatShowConfig) (*NatShowConfigReply, error) + NatWorkerDump(ctx context.Context, in *NatWorkerDump) (RPCService_NatWorkerDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) Nat44AddDelAddressRange(ctx context.Context, in *Nat44AddDelAddressRange) (*Nat44AddDelAddressRangeReply, error) { + out := new(Nat44AddDelAddressRangeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44AddDelIdentityMapping(ctx context.Context, in *Nat44AddDelIdentityMapping) (*Nat44AddDelIdentityMappingReply, error) { + out := new(Nat44AddDelIdentityMappingReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44AddDelInterfaceAddr(ctx context.Context, in *Nat44AddDelInterfaceAddr) (*Nat44AddDelInterfaceAddrReply, error) { + out := new(Nat44AddDelInterfaceAddrReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44AddDelLbStaticMapping(ctx context.Context, in *Nat44AddDelLbStaticMapping) (*Nat44AddDelLbStaticMappingReply, error) { + out := new(Nat44AddDelLbStaticMappingReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44AddDelStaticMapping(ctx context.Context, in *Nat44AddDelStaticMapping) (*Nat44AddDelStaticMappingReply, error) { + out := new(Nat44AddDelStaticMappingReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44AddressDump(ctx context.Context, in *Nat44AddressDump) (RPCService_Nat44AddressDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat44AddressDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat44AddressDumpClient interface { + Recv() (*Nat44AddressDetails, error) + api.Stream +} + +type serviceClient_Nat44AddressDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat44AddressDumpClient) Recv() (*Nat44AddressDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat44AddressDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat44DelSession(ctx context.Context, in *Nat44DelSession) (*Nat44DelSessionReply, error) { + out := new(Nat44DelSessionReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44DelUser(ctx context.Context, in *Nat44DelUser) (*Nat44DelUserReply, error) { + out := new(Nat44DelUserReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44ForwardingEnableDisable(ctx context.Context, in *Nat44ForwardingEnableDisable) (*Nat44ForwardingEnableDisableReply, error) { + out := new(Nat44ForwardingEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44ForwardingIsEnabled(ctx context.Context, in *Nat44ForwardingIsEnabled) (*Nat44ForwardingIsEnabledReply, error) { + out := new(Nat44ForwardingIsEnabledReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44IdentityMappingDump(ctx context.Context, in *Nat44IdentityMappingDump) (RPCService_Nat44IdentityMappingDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat44IdentityMappingDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat44IdentityMappingDumpClient interface { + Recv() (*Nat44IdentityMappingDetails, error) + api.Stream +} + +type serviceClient_Nat44IdentityMappingDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat44IdentityMappingDumpClient) Recv() (*Nat44IdentityMappingDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat44IdentityMappingDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat44InterfaceAddDelFeature(ctx context.Context, in *Nat44InterfaceAddDelFeature) (*Nat44InterfaceAddDelFeatureReply, error) { + out := new(Nat44InterfaceAddDelFeatureReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44InterfaceAddDelOutputFeature(ctx context.Context, in *Nat44InterfaceAddDelOutputFeature) (*Nat44InterfaceAddDelOutputFeatureReply, error) { + out := new(Nat44InterfaceAddDelOutputFeatureReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44InterfaceAddrDump(ctx context.Context, in *Nat44InterfaceAddrDump) (RPCService_Nat44InterfaceAddrDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat44InterfaceAddrDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat44InterfaceAddrDumpClient interface { + Recv() (*Nat44InterfaceAddrDetails, error) + api.Stream +} + +type serviceClient_Nat44InterfaceAddrDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat44InterfaceAddrDumpClient) Recv() (*Nat44InterfaceAddrDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat44InterfaceAddrDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat44InterfaceDump(ctx context.Context, in *Nat44InterfaceDump) (RPCService_Nat44InterfaceDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat44InterfaceDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat44InterfaceDumpClient interface { + Recv() (*Nat44InterfaceDetails, error) + api.Stream +} + +type serviceClient_Nat44InterfaceDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat44InterfaceDumpClient) Recv() (*Nat44InterfaceDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat44InterfaceDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat44InterfaceOutputFeatureDump(ctx context.Context, in *Nat44InterfaceOutputFeatureDump) (RPCService_Nat44InterfaceOutputFeatureDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat44InterfaceOutputFeatureDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat44InterfaceOutputFeatureDumpClient interface { + Recv() (*Nat44InterfaceOutputFeatureDetails, error) + api.Stream +} + +type serviceClient_Nat44InterfaceOutputFeatureDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat44InterfaceOutputFeatureDumpClient) Recv() (*Nat44InterfaceOutputFeatureDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat44InterfaceOutputFeatureDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat44LbStaticMappingAddDelLocal(ctx context.Context, in *Nat44LbStaticMappingAddDelLocal) (*Nat44LbStaticMappingAddDelLocalReply, error) { + out := new(Nat44LbStaticMappingAddDelLocalReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44LbStaticMappingDump(ctx context.Context, in *Nat44LbStaticMappingDump) (RPCService_Nat44LbStaticMappingDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat44LbStaticMappingDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat44LbStaticMappingDumpClient interface { + Recv() (*Nat44LbStaticMappingDetails, error) + api.Stream +} + +type serviceClient_Nat44LbStaticMappingDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat44LbStaticMappingDumpClient) Recv() (*Nat44LbStaticMappingDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat44LbStaticMappingDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat44SessionCleanup(ctx context.Context, in *Nat44SessionCleanup) (*Nat44SessionCleanupReply, error) { + out := new(Nat44SessionCleanupReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44SetSessionLimit(ctx context.Context, in *Nat44SetSessionLimit) (*Nat44SetSessionLimitReply, error) { + out := new(Nat44SetSessionLimitReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44StaticMappingDump(ctx context.Context, in *Nat44StaticMappingDump) (RPCService_Nat44StaticMappingDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat44StaticMappingDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat44StaticMappingDumpClient interface { + Recv() (*Nat44StaticMappingDetails, error) + api.Stream +} + +type serviceClient_Nat44StaticMappingDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat44StaticMappingDumpClient) Recv() (*Nat44StaticMappingDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat44StaticMappingDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat44UserDump(ctx context.Context, in *Nat44UserDump) (RPCService_Nat44UserDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat44UserDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat44UserDumpClient interface { + Recv() (*Nat44UserDetails, error) + api.Stream +} + +type serviceClient_Nat44UserDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat44UserDumpClient) Recv() (*Nat44UserDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat44UserDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat44UserSessionDump(ctx context.Context, in *Nat44UserSessionDump) (RPCService_Nat44UserSessionDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat44UserSessionDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat44UserSessionDumpClient interface { + Recv() (*Nat44UserSessionDetails, error) + api.Stream +} + +type serviceClient_Nat44UserSessionDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat44UserSessionDumpClient) Recv() (*Nat44UserSessionDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat44UserSessionDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat64AddDelInterface(ctx context.Context, in *Nat64AddDelInterface) (*Nat64AddDelInterfaceReply, error) { + out := new(Nat64AddDelInterfaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat64AddDelInterfaceAddr(ctx context.Context, in *Nat64AddDelInterfaceAddr) (*Nat64AddDelInterfaceAddrReply, error) { + out := new(Nat64AddDelInterfaceAddrReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat64AddDelPoolAddrRange(ctx context.Context, in *Nat64AddDelPoolAddrRange) (*Nat64AddDelPoolAddrRangeReply, error) { + out := new(Nat64AddDelPoolAddrRangeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat64AddDelPrefix(ctx context.Context, in *Nat64AddDelPrefix) (*Nat64AddDelPrefixReply, error) { + out := new(Nat64AddDelPrefixReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat64AddDelStaticBib(ctx context.Context, in *Nat64AddDelStaticBib) (*Nat64AddDelStaticBibReply, error) { + out := new(Nat64AddDelStaticBibReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat64BibDump(ctx context.Context, in *Nat64BibDump) (RPCService_Nat64BibDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat64BibDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat64BibDumpClient interface { + Recv() (*Nat64BibDetails, error) + api.Stream +} + +type serviceClient_Nat64BibDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat64BibDumpClient) Recv() (*Nat64BibDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat64BibDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat64InterfaceDump(ctx context.Context, in *Nat64InterfaceDump) (RPCService_Nat64InterfaceDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat64InterfaceDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat64InterfaceDumpClient interface { + Recv() (*Nat64InterfaceDetails, error) + api.Stream +} + +type serviceClient_Nat64InterfaceDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat64InterfaceDumpClient) Recv() (*Nat64InterfaceDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat64InterfaceDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat64PoolAddrDump(ctx context.Context, in *Nat64PoolAddrDump) (RPCService_Nat64PoolAddrDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat64PoolAddrDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat64PoolAddrDumpClient interface { + Recv() (*Nat64PoolAddrDetails, error) + api.Stream +} + +type serviceClient_Nat64PoolAddrDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat64PoolAddrDumpClient) Recv() (*Nat64PoolAddrDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat64PoolAddrDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat64PrefixDump(ctx context.Context, in *Nat64PrefixDump) (RPCService_Nat64PrefixDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat64PrefixDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat64PrefixDumpClient interface { + Recv() (*Nat64PrefixDetails, error) + api.Stream +} + +type serviceClient_Nat64PrefixDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat64PrefixDumpClient) Recv() (*Nat64PrefixDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat64PrefixDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat64StDump(ctx context.Context, in *Nat64StDump) (RPCService_Nat64StDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat64StDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat64StDumpClient interface { + Recv() (*Nat64StDetails, error) + api.Stream +} + +type serviceClient_Nat64StDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat64StDumpClient) Recv() (*Nat64StDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat64StDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat66AddDelInterface(ctx context.Context, in *Nat66AddDelInterface) (*Nat66AddDelInterfaceReply, error) { + out := new(Nat66AddDelInterfaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat66AddDelStaticMapping(ctx context.Context, in *Nat66AddDelStaticMapping) (*Nat66AddDelStaticMappingReply, error) { + out := new(Nat66AddDelStaticMappingReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat66InterfaceDump(ctx context.Context, in *Nat66InterfaceDump) (RPCService_Nat66InterfaceDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat66InterfaceDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat66InterfaceDumpClient interface { + Recv() (*Nat66InterfaceDetails, error) + api.Stream +} + +type serviceClient_Nat66InterfaceDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat66InterfaceDumpClient) Recv() (*Nat66InterfaceDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat66InterfaceDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) Nat66StaticMappingDump(ctx context.Context, in *Nat66StaticMappingDump) (RPCService_Nat66StaticMappingDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Nat66StaticMappingDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Nat66StaticMappingDumpClient interface { + Recv() (*Nat66StaticMappingDetails, error) + api.Stream +} + +type serviceClient_Nat66StaticMappingDumpClient struct { + api.Stream +} + +func (c *serviceClient_Nat66StaticMappingDumpClient) Recv() (*Nat66StaticMappingDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Nat66StaticMappingDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) NatControlPing(ctx context.Context, in *NatControlPing) (*NatControlPingReply, error) { + out := new(NatControlPingReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatDetAddDelMap(ctx context.Context, in *NatDetAddDelMap) (*NatDetAddDelMapReply, error) { + out := new(NatDetAddDelMapReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatDetCloseSessionIn(ctx context.Context, in *NatDetCloseSessionIn) (*NatDetCloseSessionInReply, error) { + out := new(NatDetCloseSessionInReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatDetCloseSessionOut(ctx context.Context, in *NatDetCloseSessionOut) (*NatDetCloseSessionOutReply, error) { + out := new(NatDetCloseSessionOutReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatDetForward(ctx context.Context, in *NatDetForward) (*NatDetForwardReply, error) { + out := new(NatDetForwardReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatDetMapDump(ctx context.Context, in *NatDetMapDump) (RPCService_NatDetMapDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_NatDetMapDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_NatDetMapDumpClient interface { + Recv() (*NatDetMapDetails, error) + api.Stream +} + +type serviceClient_NatDetMapDumpClient struct { + api.Stream +} + +func (c *serviceClient_NatDetMapDumpClient) Recv() (*NatDetMapDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *NatDetMapDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) NatDetReverse(ctx context.Context, in *NatDetReverse) (*NatDetReverseReply, error) { + out := new(NatDetReverseReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatDetSessionDump(ctx context.Context, in *NatDetSessionDump) (RPCService_NatDetSessionDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_NatDetSessionDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_NatDetSessionDumpClient interface { + Recv() (*NatDetSessionDetails, error) + api.Stream +} + +type serviceClient_NatDetSessionDumpClient struct { + api.Stream +} + +func (c *serviceClient_NatDetSessionDumpClient) Recv() (*NatDetSessionDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *NatDetSessionDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) NatGetAddrAndPortAllocAlg(ctx context.Context, in *NatGetAddrAndPortAllocAlg) (*NatGetAddrAndPortAllocAlgReply, error) { + out := new(NatGetAddrAndPortAllocAlgReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatGetMssClamping(ctx context.Context, in *NatGetMssClamping) (*NatGetMssClampingReply, error) { + out := new(NatGetMssClampingReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatGetTimeouts(ctx context.Context, in *NatGetTimeouts) (*NatGetTimeoutsReply, error) { + out := new(NatGetTimeoutsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatHaFlush(ctx context.Context, in *NatHaFlush) (*NatHaFlushReply, error) { + out := new(NatHaFlushReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatHaGetFailover(ctx context.Context, in *NatHaGetFailover) (*NatHaGetFailoverReply, error) { + out := new(NatHaGetFailoverReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatHaGetListener(ctx context.Context, in *NatHaGetListener) (*NatHaGetListenerReply, error) { + out := new(NatHaGetListenerReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatHaResync(ctx context.Context, in *NatHaResync) (*NatHaResyncReply, error) { + out := new(NatHaResyncReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatHaSetFailover(ctx context.Context, in *NatHaSetFailover) (*NatHaSetFailoverReply, error) { + out := new(NatHaSetFailoverReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatHaSetListener(ctx context.Context, in *NatHaSetListener) (*NatHaSetListenerReply, error) { + out := new(NatHaSetListenerReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatIpfixEnableDisable(ctx context.Context, in *NatIpfixEnableDisable) (*NatIpfixEnableDisableReply, error) { + out := new(NatIpfixEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatSetAddrAndPortAllocAlg(ctx context.Context, in *NatSetAddrAndPortAllocAlg) (*NatSetAddrAndPortAllocAlgReply, error) { + out := new(NatSetAddrAndPortAllocAlgReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatSetLogLevel(ctx context.Context, in *NatSetLogLevel) (*NatSetLogLevelReply, error) { + out := new(NatSetLogLevelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatSetMssClamping(ctx context.Context, in *NatSetMssClamping) (*NatSetMssClampingReply, error) { + out := new(NatSetMssClampingReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatSetTimeouts(ctx context.Context, in *NatSetTimeouts) (*NatSetTimeoutsReply, error) { + out := new(NatSetTimeoutsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatSetWorkers(ctx context.Context, in *NatSetWorkers) (*NatSetWorkersReply, error) { + out := new(NatSetWorkersReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatShowConfig(ctx context.Context, in *NatShowConfig) (*NatShowConfigReply, error) { + out := new(NatShowConfigReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatWorkerDump(ctx context.Context, in *NatWorkerDump) (RPCService_NatWorkerDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_NatWorkerDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_NatWorkerDumpClient interface { + Recv() (*NatWorkerDetails, error) + api.Stream +} + +type serviceClient_NatWorkerDumpClient struct { + api.Stream +} + +func (c *serviceClient_NatWorkerDumpClient) Recv() (*NatWorkerDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *NatWorkerDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/nsh/nsh.ba.go b/binapi/nsh/nsh.ba.go new file mode 100644 index 0000000..a918c98 --- /dev/null +++ b/binapi/nsh/nsh.ba.go @@ -0,0 +1,496 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/nsh.api.json + +// Package nsh contains generated bindings for API file nsh.api. +// +// Contents: +// 8 messages +// +package nsh + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "nsh" + APIVersion = "1.0.0" + VersionCrc = 0x43be6707 +) + +// NshAddDelEntry defines message 'nsh_add_del_entry'. +type NshAddDelEntry struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + NspNsi uint32 `binapi:"u32,name=nsp_nsi" json:"nsp_nsi,omitempty"` + MdType uint8 `binapi:"u8,name=md_type" json:"md_type,omitempty"` + VerOC uint8 `binapi:"u8,name=ver_o_c" json:"ver_o_c,omitempty"` + TTL uint8 `binapi:"u8,name=ttl" json:"ttl,omitempty"` + Length uint8 `binapi:"u8,name=length" json:"length,omitempty"` + NextProtocol uint8 `binapi:"u8,name=next_protocol" json:"next_protocol,omitempty"` + C1 uint32 `binapi:"u32,name=c1" json:"c1,omitempty"` + C2 uint32 `binapi:"u32,name=c2" json:"c2,omitempty"` + C3 uint32 `binapi:"u32,name=c3" json:"c3,omitempty"` + C4 uint32 `binapi:"u32,name=c4" json:"c4,omitempty"` + TlvLength uint8 `binapi:"u8,name=tlv_length" json:"tlv_length,omitempty"` + Tlv []byte `binapi:"u8[248],name=tlv" json:"tlv,omitempty"` +} + +func (m *NshAddDelEntry) Reset() { *m = NshAddDelEntry{} } +func (*NshAddDelEntry) GetMessageName() string { return "nsh_add_del_entry" } +func (*NshAddDelEntry) GetCrcString() string { return "7dea480b" } +func (*NshAddDelEntry) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NshAddDelEntry) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.NspNsi + size += 1 // m.MdType + size += 1 // m.VerOC + size += 1 // m.TTL + size += 1 // m.Length + size += 1 // m.NextProtocol + size += 4 // m.C1 + size += 4 // m.C2 + size += 4 // m.C3 + size += 4 // m.C4 + size += 1 // m.TlvLength + size += 1 * 248 // m.Tlv + return size +} +func (m *NshAddDelEntry) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.NspNsi)) + buf.EncodeUint8(uint8(m.MdType)) + buf.EncodeUint8(uint8(m.VerOC)) + buf.EncodeUint8(uint8(m.TTL)) + buf.EncodeUint8(uint8(m.Length)) + buf.EncodeUint8(uint8(m.NextProtocol)) + buf.EncodeUint32(uint32(m.C1)) + buf.EncodeUint32(uint32(m.C2)) + buf.EncodeUint32(uint32(m.C3)) + buf.EncodeUint32(uint32(m.C4)) + buf.EncodeUint8(uint8(m.TlvLength)) + buf.EncodeBytes(m.Tlv[:], 248) + return buf.Bytes(), nil +} +func (m *NshAddDelEntry) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.NspNsi = buf.DecodeUint32() + m.MdType = buf.DecodeUint8() + m.VerOC = buf.DecodeUint8() + m.TTL = buf.DecodeUint8() + m.Length = buf.DecodeUint8() + m.NextProtocol = buf.DecodeUint8() + m.C1 = buf.DecodeUint32() + m.C2 = buf.DecodeUint32() + m.C3 = buf.DecodeUint32() + m.C4 = buf.DecodeUint32() + m.TlvLength = buf.DecodeUint8() + copy(m.Tlv[:], buf.DecodeBytes(248)) + return nil +} + +// NshAddDelEntryReply defines message 'nsh_add_del_entry_reply'. +type NshAddDelEntryReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + EntryIndex uint32 `binapi:"u32,name=entry_index" json:"entry_index,omitempty"` +} + +func (m *NshAddDelEntryReply) Reset() { *m = NshAddDelEntryReply{} } +func (*NshAddDelEntryReply) GetMessageName() string { return "nsh_add_del_entry_reply" } +func (*NshAddDelEntryReply) GetCrcString() string { return "6296a9eb" } +func (*NshAddDelEntryReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NshAddDelEntryReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.EntryIndex + return size +} +func (m *NshAddDelEntryReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.EntryIndex)) + return buf.Bytes(), nil +} +func (m *NshAddDelEntryReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.EntryIndex = buf.DecodeUint32() + return nil +} + +// NshAddDelMap defines message 'nsh_add_del_map'. +type NshAddDelMap struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + NspNsi uint32 `binapi:"u32,name=nsp_nsi" json:"nsp_nsi,omitempty"` + MappedNspNsi uint32 `binapi:"u32,name=mapped_nsp_nsi" json:"mapped_nsp_nsi,omitempty"` + NshAction uint32 `binapi:"u32,name=nsh_action" json:"nsh_action,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + RxSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=rx_sw_if_index" json:"rx_sw_if_index,omitempty"` + NextNode uint32 `binapi:"u32,name=next_node" json:"next_node,omitempty"` +} + +func (m *NshAddDelMap) Reset() { *m = NshAddDelMap{} } +func (*NshAddDelMap) GetMessageName() string { return "nsh_add_del_map" } +func (*NshAddDelMap) GetCrcString() string { return "898d857d" } +func (*NshAddDelMap) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NshAddDelMap) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.NspNsi + size += 4 // m.MappedNspNsi + size += 4 // m.NshAction + size += 4 // m.SwIfIndex + size += 4 // m.RxSwIfIndex + size += 4 // m.NextNode + return size +} +func (m *NshAddDelMap) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.NspNsi)) + buf.EncodeUint32(uint32(m.MappedNspNsi)) + buf.EncodeUint32(uint32(m.NshAction)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.RxSwIfIndex)) + buf.EncodeUint32(uint32(m.NextNode)) + return buf.Bytes(), nil +} +func (m *NshAddDelMap) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.NspNsi = buf.DecodeUint32() + m.MappedNspNsi = buf.DecodeUint32() + m.NshAction = buf.DecodeUint32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.RxSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.NextNode = buf.DecodeUint32() + return nil +} + +// NshAddDelMapReply defines message 'nsh_add_del_map_reply'. +type NshAddDelMapReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + MapIndex uint32 `binapi:"u32,name=map_index" json:"map_index,omitempty"` +} + +func (m *NshAddDelMapReply) Reset() { *m = NshAddDelMapReply{} } +func (*NshAddDelMapReply) GetMessageName() string { return "nsh_add_del_map_reply" } +func (*NshAddDelMapReply) GetCrcString() string { return "b2b127ef" } +func (*NshAddDelMapReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NshAddDelMapReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.MapIndex + return size +} +func (m *NshAddDelMapReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.MapIndex)) + return buf.Bytes(), nil +} +func (m *NshAddDelMapReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.MapIndex = buf.DecodeUint32() + return nil +} + +// NshEntryDetails defines message 'nsh_entry_details'. +type NshEntryDetails struct { + EntryIndex uint32 `binapi:"u32,name=entry_index" json:"entry_index,omitempty"` + NspNsi uint32 `binapi:"u32,name=nsp_nsi" json:"nsp_nsi,omitempty"` + MdType uint8 `binapi:"u8,name=md_type" json:"md_type,omitempty"` + VerOC uint8 `binapi:"u8,name=ver_o_c" json:"ver_o_c,omitempty"` + TTL uint8 `binapi:"u8,name=ttl" json:"ttl,omitempty"` + Length uint8 `binapi:"u8,name=length" json:"length,omitempty"` + NextProtocol uint8 `binapi:"u8,name=next_protocol" json:"next_protocol,omitempty"` + C1 uint32 `binapi:"u32,name=c1" json:"c1,omitempty"` + C2 uint32 `binapi:"u32,name=c2" json:"c2,omitempty"` + C3 uint32 `binapi:"u32,name=c3" json:"c3,omitempty"` + C4 uint32 `binapi:"u32,name=c4" json:"c4,omitempty"` + TlvLength uint8 `binapi:"u8,name=tlv_length" json:"tlv_length,omitempty"` + Tlv []byte `binapi:"u8[248],name=tlv" json:"tlv,omitempty"` +} + +func (m *NshEntryDetails) Reset() { *m = NshEntryDetails{} } +func (*NshEntryDetails) GetMessageName() string { return "nsh_entry_details" } +func (*NshEntryDetails) GetCrcString() string { return "046fb556" } +func (*NshEntryDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NshEntryDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.EntryIndex + size += 4 // m.NspNsi + size += 1 // m.MdType + size += 1 // m.VerOC + size += 1 // m.TTL + size += 1 // m.Length + size += 1 // m.NextProtocol + size += 4 // m.C1 + size += 4 // m.C2 + size += 4 // m.C3 + size += 4 // m.C4 + size += 1 // m.TlvLength + size += 1 * 248 // m.Tlv + return size +} +func (m *NshEntryDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.EntryIndex)) + buf.EncodeUint32(uint32(m.NspNsi)) + buf.EncodeUint8(uint8(m.MdType)) + buf.EncodeUint8(uint8(m.VerOC)) + buf.EncodeUint8(uint8(m.TTL)) + buf.EncodeUint8(uint8(m.Length)) + buf.EncodeUint8(uint8(m.NextProtocol)) + buf.EncodeUint32(uint32(m.C1)) + buf.EncodeUint32(uint32(m.C2)) + buf.EncodeUint32(uint32(m.C3)) + buf.EncodeUint32(uint32(m.C4)) + buf.EncodeUint8(uint8(m.TlvLength)) + buf.EncodeBytes(m.Tlv[:], 248) + return buf.Bytes(), nil +} +func (m *NshEntryDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EntryIndex = buf.DecodeUint32() + m.NspNsi = buf.DecodeUint32() + m.MdType = buf.DecodeUint8() + m.VerOC = buf.DecodeUint8() + m.TTL = buf.DecodeUint8() + m.Length = buf.DecodeUint8() + m.NextProtocol = buf.DecodeUint8() + m.C1 = buf.DecodeUint32() + m.C2 = buf.DecodeUint32() + m.C3 = buf.DecodeUint32() + m.C4 = buf.DecodeUint32() + m.TlvLength = buf.DecodeUint8() + copy(m.Tlv[:], buf.DecodeBytes(248)) + return nil +} + +// NshEntryDump defines message 'nsh_entry_dump'. +type NshEntryDump struct { + EntryIndex uint32 `binapi:"u32,name=entry_index" json:"entry_index,omitempty"` +} + +func (m *NshEntryDump) Reset() { *m = NshEntryDump{} } +func (*NshEntryDump) GetMessageName() string { return "nsh_entry_dump" } +func (*NshEntryDump) GetCrcString() string { return "cdaf8ccb" } +func (*NshEntryDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NshEntryDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.EntryIndex + return size +} +func (m *NshEntryDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.EntryIndex)) + return buf.Bytes(), nil +} +func (m *NshEntryDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EntryIndex = buf.DecodeUint32() + return nil +} + +// NshMapDetails defines message 'nsh_map_details'. +type NshMapDetails struct { + MapIndex uint32 `binapi:"u32,name=map_index" json:"map_index,omitempty"` + NspNsi uint32 `binapi:"u32,name=nsp_nsi" json:"nsp_nsi,omitempty"` + MappedNspNsi uint32 `binapi:"u32,name=mapped_nsp_nsi" json:"mapped_nsp_nsi,omitempty"` + NshAction uint32 `binapi:"u32,name=nsh_action" json:"nsh_action,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + RxSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=rx_sw_if_index" json:"rx_sw_if_index,omitempty"` + NextNode uint32 `binapi:"u32,name=next_node" json:"next_node,omitempty"` +} + +func (m *NshMapDetails) Reset() { *m = NshMapDetails{} } +func (*NshMapDetails) GetMessageName() string { return "nsh_map_details" } +func (*NshMapDetails) GetCrcString() string { return "b34ac8a1" } +func (*NshMapDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NshMapDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.MapIndex + size += 4 // m.NspNsi + size += 4 // m.MappedNspNsi + size += 4 // m.NshAction + size += 4 // m.SwIfIndex + size += 4 // m.RxSwIfIndex + size += 4 // m.NextNode + return size +} +func (m *NshMapDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.MapIndex)) + buf.EncodeUint32(uint32(m.NspNsi)) + buf.EncodeUint32(uint32(m.MappedNspNsi)) + buf.EncodeUint32(uint32(m.NshAction)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.RxSwIfIndex)) + buf.EncodeUint32(uint32(m.NextNode)) + return buf.Bytes(), nil +} +func (m *NshMapDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.MapIndex = buf.DecodeUint32() + m.NspNsi = buf.DecodeUint32() + m.MappedNspNsi = buf.DecodeUint32() + m.NshAction = buf.DecodeUint32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.RxSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.NextNode = buf.DecodeUint32() + return nil +} + +// NshMapDump defines message 'nsh_map_dump'. +type NshMapDump struct { + MapIndex uint32 `binapi:"u32,name=map_index" json:"map_index,omitempty"` +} + +func (m *NshMapDump) Reset() { *m = NshMapDump{} } +func (*NshMapDump) GetMessageName() string { return "nsh_map_dump" } +func (*NshMapDump) GetCrcString() string { return "8fc06b82" } +func (*NshMapDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NshMapDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.MapIndex + return size +} +func (m *NshMapDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.MapIndex)) + return buf.Bytes(), nil +} +func (m *NshMapDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.MapIndex = buf.DecodeUint32() + return nil +} + +func init() { file_nsh_binapi_init() } +func file_nsh_binapi_init() { + api.RegisterMessage((*NshAddDelEntry)(nil), "nsh_add_del_entry_7dea480b") + api.RegisterMessage((*NshAddDelEntryReply)(nil), "nsh_add_del_entry_reply_6296a9eb") + api.RegisterMessage((*NshAddDelMap)(nil), "nsh_add_del_map_898d857d") + api.RegisterMessage((*NshAddDelMapReply)(nil), "nsh_add_del_map_reply_b2b127ef") + api.RegisterMessage((*NshEntryDetails)(nil), "nsh_entry_details_046fb556") + api.RegisterMessage((*NshEntryDump)(nil), "nsh_entry_dump_cdaf8ccb") + api.RegisterMessage((*NshMapDetails)(nil), "nsh_map_details_b34ac8a1") + api.RegisterMessage((*NshMapDump)(nil), "nsh_map_dump_8fc06b82") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*NshAddDelEntry)(nil), + (*NshAddDelEntryReply)(nil), + (*NshAddDelMap)(nil), + (*NshAddDelMapReply)(nil), + (*NshEntryDetails)(nil), + (*NshEntryDump)(nil), + (*NshMapDetails)(nil), + (*NshMapDump)(nil), + } +} diff --git a/binapi/nsh/nsh_rest.ba.go b/binapi/nsh/nsh_rest.ba.go new file mode 100644 index 0000000..87b29e4 --- /dev/null +++ b/binapi/nsh/nsh_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package nsh + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/nsh_add_del_entry", func(w http.ResponseWriter, req *http.Request) { + var request = new(NshAddDelEntry) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.NshAddDelEntry(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nsh_add_del_map", func(w http.ResponseWriter, req *http.Request) { + var request = new(NshAddDelMap) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.NshAddDelMap(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/nsh/nsh_rpc.ba.go b/binapi/nsh/nsh_rpc.ba.go new file mode 100644 index 0000000..c91c85f --- /dev/null +++ b/binapi/nsh/nsh_rpc.ba.go @@ -0,0 +1,123 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package nsh + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service nsh. +type RPCService interface { + NshAddDelEntry(ctx context.Context, in *NshAddDelEntry) (*NshAddDelEntryReply, error) + NshAddDelMap(ctx context.Context, in *NshAddDelMap) (*NshAddDelMapReply, error) + NshEntryDump(ctx context.Context, in *NshEntryDump) (RPCService_NshEntryDumpClient, error) + NshMapDump(ctx context.Context, in *NshMapDump) (RPCService_NshMapDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) NshAddDelEntry(ctx context.Context, in *NshAddDelEntry) (*NshAddDelEntryReply, error) { + out := new(NshAddDelEntryReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NshAddDelMap(ctx context.Context, in *NshAddDelMap) (*NshAddDelMapReply, error) { + out := new(NshAddDelMapReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NshEntryDump(ctx context.Context, in *NshEntryDump) (RPCService_NshEntryDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_NshEntryDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_NshEntryDumpClient interface { + Recv() (*NshEntryDetails, error) + api.Stream +} + +type serviceClient_NshEntryDumpClient struct { + api.Stream +} + +func (c *serviceClient_NshEntryDumpClient) Recv() (*NshEntryDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *NshEntryDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) NshMapDump(ctx context.Context, in *NshMapDump) (RPCService_NshMapDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_NshMapDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_NshMapDumpClient interface { + Recv() (*NshMapDetails, error) + api.Stream +} + +type serviceClient_NshMapDumpClient struct { + api.Stream +} + +func (c *serviceClient_NshMapDumpClient) Recv() (*NshMapDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *NshMapDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/nsim/nsim.ba.go b/binapi/nsim/nsim.ba.go new file mode 100644 index 0000000..5b751b8 --- /dev/null +++ b/binapi/nsim/nsim.ba.go @@ -0,0 +1,300 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/nsim.api.json + +// Package nsim contains generated bindings for API file nsim.api. +// +// Contents: +// 6 messages +// +package nsim + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "nsim" + APIVersion = "2.1.1" + VersionCrc = 0xcd5b42e8 +) + +// NsimConfigure defines message 'nsim_configure'. +type NsimConfigure struct { + DelayInUsec uint32 `binapi:"u32,name=delay_in_usec" json:"delay_in_usec,omitempty"` + AveragePacketSize uint32 `binapi:"u32,name=average_packet_size" json:"average_packet_size,omitempty"` + BandwidthInBitsPerSecond uint64 `binapi:"u64,name=bandwidth_in_bits_per_second" json:"bandwidth_in_bits_per_second,omitempty"` + PacketsPerDrop uint32 `binapi:"u32,name=packets_per_drop" json:"packets_per_drop,omitempty"` +} + +func (m *NsimConfigure) Reset() { *m = NsimConfigure{} } +func (*NsimConfigure) GetMessageName() string { return "nsim_configure" } +func (*NsimConfigure) GetCrcString() string { return "16ed400f" } +func (*NsimConfigure) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NsimConfigure) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.DelayInUsec + size += 4 // m.AveragePacketSize + size += 8 // m.BandwidthInBitsPerSecond + size += 4 // m.PacketsPerDrop + return size +} +func (m *NsimConfigure) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.DelayInUsec)) + buf.EncodeUint32(uint32(m.AveragePacketSize)) + buf.EncodeUint64(uint64(m.BandwidthInBitsPerSecond)) + buf.EncodeUint32(uint32(m.PacketsPerDrop)) + return buf.Bytes(), nil +} +func (m *NsimConfigure) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.DelayInUsec = buf.DecodeUint32() + m.AveragePacketSize = buf.DecodeUint32() + m.BandwidthInBitsPerSecond = buf.DecodeUint64() + m.PacketsPerDrop = buf.DecodeUint32() + return nil +} + +// NsimConfigureReply defines message 'nsim_configure_reply'. +type NsimConfigureReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *NsimConfigureReply) Reset() { *m = NsimConfigureReply{} } +func (*NsimConfigureReply) GetMessageName() string { return "nsim_configure_reply" } +func (*NsimConfigureReply) GetCrcString() string { return "e8d4e804" } +func (*NsimConfigureReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NsimConfigureReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *NsimConfigureReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *NsimConfigureReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// NsimCrossConnectEnableDisable defines message 'nsim_cross_connect_enable_disable'. +type NsimCrossConnectEnableDisable struct { + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` + SwIfIndex0 interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index0" json:"sw_if_index0,omitempty"` + SwIfIndex1 interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index1" json:"sw_if_index1,omitempty"` +} + +func (m *NsimCrossConnectEnableDisable) Reset() { *m = NsimCrossConnectEnableDisable{} } +func (*NsimCrossConnectEnableDisable) GetMessageName() string { + return "nsim_cross_connect_enable_disable" +} +func (*NsimCrossConnectEnableDisable) GetCrcString() string { return "16f70bdf" } +func (*NsimCrossConnectEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NsimCrossConnectEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.EnableDisable + size += 4 // m.SwIfIndex0 + size += 4 // m.SwIfIndex1 + return size +} +func (m *NsimCrossConnectEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.EnableDisable) + buf.EncodeUint32(uint32(m.SwIfIndex0)) + buf.EncodeUint32(uint32(m.SwIfIndex1)) + return buf.Bytes(), nil +} +func (m *NsimCrossConnectEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EnableDisable = buf.DecodeBool() + m.SwIfIndex0 = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.SwIfIndex1 = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// NsimCrossConnectEnableDisableReply defines message 'nsim_cross_connect_enable_disable_reply'. +type NsimCrossConnectEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *NsimCrossConnectEnableDisableReply) Reset() { *m = NsimCrossConnectEnableDisableReply{} } +func (*NsimCrossConnectEnableDisableReply) GetMessageName() string { + return "nsim_cross_connect_enable_disable_reply" +} +func (*NsimCrossConnectEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*NsimCrossConnectEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NsimCrossConnectEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *NsimCrossConnectEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *NsimCrossConnectEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// NsimOutputFeatureEnableDisable defines message 'nsim_output_feature_enable_disable'. +type NsimOutputFeatureEnableDisable struct { + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *NsimOutputFeatureEnableDisable) Reset() { *m = NsimOutputFeatureEnableDisable{} } +func (*NsimOutputFeatureEnableDisable) GetMessageName() string { + return "nsim_output_feature_enable_disable" +} +func (*NsimOutputFeatureEnableDisable) GetCrcString() string { return "3865946c" } +func (*NsimOutputFeatureEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *NsimOutputFeatureEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.EnableDisable + size += 4 // m.SwIfIndex + return size +} +func (m *NsimOutputFeatureEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.EnableDisable) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *NsimOutputFeatureEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EnableDisable = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// NsimOutputFeatureEnableDisableReply defines message 'nsim_output_feature_enable_disable_reply'. +type NsimOutputFeatureEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *NsimOutputFeatureEnableDisableReply) Reset() { *m = NsimOutputFeatureEnableDisableReply{} } +func (*NsimOutputFeatureEnableDisableReply) GetMessageName() string { + return "nsim_output_feature_enable_disable_reply" +} +func (*NsimOutputFeatureEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*NsimOutputFeatureEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *NsimOutputFeatureEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *NsimOutputFeatureEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *NsimOutputFeatureEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_nsim_binapi_init() } +func file_nsim_binapi_init() { + api.RegisterMessage((*NsimConfigure)(nil), "nsim_configure_16ed400f") + api.RegisterMessage((*NsimConfigureReply)(nil), "nsim_configure_reply_e8d4e804") + api.RegisterMessage((*NsimCrossConnectEnableDisable)(nil), "nsim_cross_connect_enable_disable_16f70bdf") + api.RegisterMessage((*NsimCrossConnectEnableDisableReply)(nil), "nsim_cross_connect_enable_disable_reply_e8d4e804") + api.RegisterMessage((*NsimOutputFeatureEnableDisable)(nil), "nsim_output_feature_enable_disable_3865946c") + api.RegisterMessage((*NsimOutputFeatureEnableDisableReply)(nil), "nsim_output_feature_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*NsimConfigure)(nil), + (*NsimConfigureReply)(nil), + (*NsimCrossConnectEnableDisable)(nil), + (*NsimCrossConnectEnableDisableReply)(nil), + (*NsimOutputFeatureEnableDisable)(nil), + (*NsimOutputFeatureEnableDisableReply)(nil), + } +} diff --git a/binapi/nsim/nsim_rest.ba.go b/binapi/nsim/nsim_rest.ba.go new file mode 100644 index 0000000..ba53f21 --- /dev/null +++ b/binapi/nsim/nsim_rest.ba.go @@ -0,0 +1,83 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package nsim + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/nsim_configure", func(w http.ResponseWriter, req *http.Request) { + var request = new(NsimConfigure) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.NsimConfigure(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nsim_cross_connect_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(NsimCrossConnectEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.NsimCrossConnectEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/nsim_output_feature_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(NsimOutputFeatureEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.NsimOutputFeatureEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/nsim/nsim_rpc.ba.go b/binapi/nsim/nsim_rpc.ba.go new file mode 100644 index 0000000..f35e6b3 --- /dev/null +++ b/binapi/nsim/nsim_rpc.ba.go @@ -0,0 +1,50 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package nsim + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service nsim. +type RPCService interface { + NsimConfigure(ctx context.Context, in *NsimConfigure) (*NsimConfigureReply, error) + NsimCrossConnectEnableDisable(ctx context.Context, in *NsimCrossConnectEnableDisable) (*NsimCrossConnectEnableDisableReply, error) + NsimOutputFeatureEnableDisable(ctx context.Context, in *NsimOutputFeatureEnableDisable) (*NsimOutputFeatureEnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) NsimConfigure(ctx context.Context, in *NsimConfigure) (*NsimConfigureReply, error) { + out := new(NsimConfigureReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NsimCrossConnectEnableDisable(ctx context.Context, in *NsimCrossConnectEnableDisable) (*NsimCrossConnectEnableDisableReply, error) { + out := new(NsimCrossConnectEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NsimOutputFeatureEnableDisable(ctx context.Context, in *NsimOutputFeatureEnableDisable) (*NsimOutputFeatureEnableDisableReply, error) { + out := new(NsimOutputFeatureEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/oddbuf/oddbuf.ba.go b/binapi/oddbuf/oddbuf.ba.go new file mode 100644 index 0000000..ceceaae --- /dev/null +++ b/binapi/oddbuf/oddbuf.ba.go @@ -0,0 +1,120 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/oddbuf.api.json + +// Package oddbuf contains generated bindings for API file oddbuf.api. +// +// Contents: +// 2 messages +// +package oddbuf + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "oddbuf" + APIVersion = "0.1.0" + VersionCrc = 0x95757869 +) + +// OddbufEnableDisable defines message 'oddbuf_enable_disable'. +type OddbufEnableDisable struct { + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *OddbufEnableDisable) Reset() { *m = OddbufEnableDisable{} } +func (*OddbufEnableDisable) GetMessageName() string { return "oddbuf_enable_disable" } +func (*OddbufEnableDisable) GetCrcString() string { return "3865946c" } +func (*OddbufEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OddbufEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.EnableDisable + size += 4 // m.SwIfIndex + return size +} +func (m *OddbufEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.EnableDisable) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *OddbufEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EnableDisable = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// OddbufEnableDisableReply defines message 'oddbuf_enable_disable_reply'. +type OddbufEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OddbufEnableDisableReply) Reset() { *m = OddbufEnableDisableReply{} } +func (*OddbufEnableDisableReply) GetMessageName() string { return "oddbuf_enable_disable_reply" } +func (*OddbufEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*OddbufEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OddbufEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OddbufEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OddbufEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_oddbuf_binapi_init() } +func file_oddbuf_binapi_init() { + api.RegisterMessage((*OddbufEnableDisable)(nil), "oddbuf_enable_disable_3865946c") + api.RegisterMessage((*OddbufEnableDisableReply)(nil), "oddbuf_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*OddbufEnableDisable)(nil), + (*OddbufEnableDisableReply)(nil), + } +} diff --git a/binapi/oddbuf/oddbuf_rest.ba.go b/binapi/oddbuf/oddbuf_rest.ba.go new file mode 100644 index 0000000..b50418c --- /dev/null +++ b/binapi/oddbuf/oddbuf_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package oddbuf + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/oddbuf_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(OddbufEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OddbufEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/oddbuf/oddbuf_rpc.ba.go b/binapi/oddbuf/oddbuf_rpc.ba.go new file mode 100644 index 0000000..a8c245e --- /dev/null +++ b/binapi/oddbuf/oddbuf_rpc.ba.go @@ -0,0 +1,30 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package oddbuf + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service oddbuf. +type RPCService interface { + OddbufEnableDisable(ctx context.Context, in *OddbufEnableDisable) (*OddbufEnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) OddbufEnableDisable(ctx context.Context, in *OddbufEnableDisable) (*OddbufEnableDisableReply, error) { + out := new(OddbufEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/one/one.ba.go b/binapi/one/one.ba.go new file mode 100644 index 0000000..259e3f2 --- /dev/null +++ b/binapi/one/one.ba.go @@ -0,0 +1,4690 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/one.api.json + +// Package one contains generated bindings for API file one.api. +// +// Contents: +// 2 enums +// 3 structs +// 108 messages +// +package one + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + lisp_types "git.fd.io/govpp.git/binapi/lisp_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "one" + APIVersion = "2.0.0" + VersionCrc = 0x288aaf5d +) + +// OneFilter defines enum 'one_filter'. +type OneFilter uint32 + +const ( + ONE_FILTER_API_ALL OneFilter = 0 + ONE_FILTER_API_LOCAL OneFilter = 1 + ONE_FILTER_API_REMOTE OneFilter = 2 +) + +var ( + OneFilter_name = map[uint32]string{ + 0: "ONE_FILTER_API_ALL", + 1: "ONE_FILTER_API_LOCAL", + 2: "ONE_FILTER_API_REMOTE", + } + OneFilter_value = map[string]uint32{ + "ONE_FILTER_API_ALL": 0, + "ONE_FILTER_API_LOCAL": 1, + "ONE_FILTER_API_REMOTE": 2, + } +) + +func (x OneFilter) String() string { + s, ok := OneFilter_name[uint32(x)] + if ok { + return s + } + return "OneFilter(" + strconv.Itoa(int(x)) + ")" +} + +// OneMapMode defines enum 'one_map_mode'. +type OneMapMode uint32 + +const ( + ONE_MAP_MODE_API_DST_ONLY OneMapMode = 0 + ONE_MAP_MODE_API_SRC_DST OneMapMode = 1 +) + +var ( + OneMapMode_name = map[uint32]string{ + 0: "ONE_MAP_MODE_API_DST_ONLY", + 1: "ONE_MAP_MODE_API_SRC_DST", + } + OneMapMode_value = map[string]uint32{ + "ONE_MAP_MODE_API_DST_ONLY": 0, + "ONE_MAP_MODE_API_SRC_DST": 1, + } +) + +func (x OneMapMode) String() string { + s, ok := OneMapMode_name[uint32(x)] + if ok { + return s + } + return "OneMapMode(" + strconv.Itoa(int(x)) + ")" +} + +// OneAdjacency defines type 'one_adjacency'. +type OneAdjacency struct { + Reid lisp_types.Eid `binapi:"eid,name=reid" json:"reid,omitempty"` + Leid lisp_types.Eid `binapi:"eid,name=leid" json:"leid,omitempty"` +} + +// OneL2ArpEntry defines type 'one_l2_arp_entry'. +type OneL2ArpEntry struct { + Mac ethernet_types.MacAddress `binapi:"mac_address,name=mac" json:"mac,omitempty"` + IP4 ip_types.IP4Address `binapi:"ip4_address,name=ip4" json:"ip4,omitempty"` +} + +// OneNdpEntry defines type 'one_ndp_entry'. +type OneNdpEntry struct { + Mac ethernet_types.MacAddress `binapi:"mac_address,name=mac" json:"mac,omitempty"` + IP6 ip_types.IP6Address `binapi:"ip6_address,name=ip6" json:"ip6,omitempty"` +} + +// OneAddDelAdjacency defines message 'one_add_del_adjacency'. +type OneAddDelAdjacency struct { + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + Reid lisp_types.Eid `binapi:"eid,name=reid" json:"reid,omitempty"` + Leid lisp_types.Eid `binapi:"eid,name=leid" json:"leid,omitempty"` +} + +func (m *OneAddDelAdjacency) Reset() { *m = OneAddDelAdjacency{} } +func (*OneAddDelAdjacency) GetMessageName() string { return "one_add_del_adjacency" } +func (*OneAddDelAdjacency) GetCrcString() string { return "e48e7afe" } +func (*OneAddDelAdjacency) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneAddDelAdjacency) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Vni + size += 1 // m.Reid.Type + size += 1 * 6 // m.Reid.Address + size += 1 // m.Leid.Type + size += 1 * 6 // m.Leid.Address + return size +} +func (m *OneAddDelAdjacency) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.IsAdd)) + buf.EncodeUint32(uint32(m.Vni)) + buf.EncodeUint8(uint8(m.Reid.Type)) + buf.EncodeBytes(m.Reid.Address.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Leid.Type)) + buf.EncodeBytes(m.Leid.Address.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *OneAddDelAdjacency) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeUint8() + m.Vni = buf.DecodeUint32() + m.Reid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Reid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + m.Leid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Leid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + return nil +} + +// OneAddDelAdjacencyReply defines message 'one_add_del_adjacency_reply'. +type OneAddDelAdjacencyReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneAddDelAdjacencyReply) Reset() { *m = OneAddDelAdjacencyReply{} } +func (*OneAddDelAdjacencyReply) GetMessageName() string { return "one_add_del_adjacency_reply" } +func (*OneAddDelAdjacencyReply) GetCrcString() string { return "e8d4e804" } +func (*OneAddDelAdjacencyReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneAddDelAdjacencyReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneAddDelAdjacencyReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneAddDelAdjacencyReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OneAddDelL2ArpEntry defines message 'one_add_del_l2_arp_entry'. +type OneAddDelL2ArpEntry struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Bd uint32 `binapi:"u32,name=bd" json:"bd,omitempty"` + Entry OneL2ArpEntry `binapi:"one_l2_arp_entry,name=entry" json:"entry,omitempty"` +} + +func (m *OneAddDelL2ArpEntry) Reset() { *m = OneAddDelL2ArpEntry{} } +func (*OneAddDelL2ArpEntry) GetMessageName() string { return "one_add_del_l2_arp_entry" } +func (*OneAddDelL2ArpEntry) GetCrcString() string { return "33209078" } +func (*OneAddDelL2ArpEntry) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneAddDelL2ArpEntry) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Bd + size += 1 * 6 // m.Entry.Mac + size += 1 * 4 // m.Entry.IP4 + return size +} +func (m *OneAddDelL2ArpEntry) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Bd)) + buf.EncodeBytes(m.Entry.Mac[:], 6) + buf.EncodeBytes(m.Entry.IP4[:], 4) + return buf.Bytes(), nil +} +func (m *OneAddDelL2ArpEntry) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Bd = buf.DecodeUint32() + copy(m.Entry.Mac[:], buf.DecodeBytes(6)) + copy(m.Entry.IP4[:], buf.DecodeBytes(4)) + return nil +} + +// OneAddDelL2ArpEntryReply defines message 'one_add_del_l2_arp_entry_reply'. +type OneAddDelL2ArpEntryReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneAddDelL2ArpEntryReply) Reset() { *m = OneAddDelL2ArpEntryReply{} } +func (*OneAddDelL2ArpEntryReply) GetMessageName() string { return "one_add_del_l2_arp_entry_reply" } +func (*OneAddDelL2ArpEntryReply) GetCrcString() string { return "e8d4e804" } +func (*OneAddDelL2ArpEntryReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneAddDelL2ArpEntryReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneAddDelL2ArpEntryReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneAddDelL2ArpEntryReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OneAddDelLocalEid defines message 'one_add_del_local_eid'. +type OneAddDelLocalEid struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Eid lisp_types.Eid `binapi:"eid,name=eid" json:"eid,omitempty"` + LocatorSetName string `binapi:"string[64],name=locator_set_name" json:"locator_set_name,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + Key lisp_types.HmacKey `binapi:"hmac_key,name=key" json:"key,omitempty"` +} + +func (m *OneAddDelLocalEid) Reset() { *m = OneAddDelLocalEid{} } +func (*OneAddDelLocalEid) GetMessageName() string { return "one_add_del_local_eid" } +func (*OneAddDelLocalEid) GetCrcString() string { return "21f573bd" } +func (*OneAddDelLocalEid) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneAddDelLocalEid) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.Eid.Type + size += 1 * 6 // m.Eid.Address + size += 64 // m.LocatorSetName + size += 4 // m.Vni + size += 1 // m.Key.ID + size += 1 * 64 // m.Key.Key + return size +} +func (m *OneAddDelLocalEid) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.Eid.Type)) + buf.EncodeBytes(m.Eid.Address.XXX_UnionData[:], 0) + buf.EncodeString(m.LocatorSetName, 64) + buf.EncodeUint32(uint32(m.Vni)) + buf.EncodeUint8(uint8(m.Key.ID)) + buf.EncodeBytes(m.Key.Key[:], 64) + return buf.Bytes(), nil +} +func (m *OneAddDelLocalEid) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Eid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Eid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + m.LocatorSetName = buf.DecodeString(64) + m.Vni = buf.DecodeUint32() + m.Key.ID = lisp_types.HmacKeyID(buf.DecodeUint8()) + copy(m.Key.Key[:], buf.DecodeBytes(64)) + return nil +} + +// OneAddDelLocalEidReply defines message 'one_add_del_local_eid_reply'. +type OneAddDelLocalEidReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneAddDelLocalEidReply) Reset() { *m = OneAddDelLocalEidReply{} } +func (*OneAddDelLocalEidReply) GetMessageName() string { return "one_add_del_local_eid_reply" } +func (*OneAddDelLocalEidReply) GetCrcString() string { return "e8d4e804" } +func (*OneAddDelLocalEidReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneAddDelLocalEidReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneAddDelLocalEidReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneAddDelLocalEidReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OneAddDelLocator defines message 'one_add_del_locator'. +type OneAddDelLocator struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + LocatorSetName string `binapi:"string[64],name=locator_set_name" json:"locator_set_name,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Priority uint8 `binapi:"u8,name=priority" json:"priority,omitempty"` + Weight uint8 `binapi:"u8,name=weight" json:"weight,omitempty"` +} + +func (m *OneAddDelLocator) Reset() { *m = OneAddDelLocator{} } +func (*OneAddDelLocator) GetMessageName() string { return "one_add_del_locator" } +func (*OneAddDelLocator) GetCrcString() string { return "af4d8f13" } +func (*OneAddDelLocator) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneAddDelLocator) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 64 // m.LocatorSetName + size += 4 // m.SwIfIndex + size += 1 // m.Priority + size += 1 // m.Weight + return size +} +func (m *OneAddDelLocator) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeString(m.LocatorSetName, 64) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.Priority)) + buf.EncodeUint8(uint8(m.Weight)) + return buf.Bytes(), nil +} +func (m *OneAddDelLocator) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.LocatorSetName = buf.DecodeString(64) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Priority = buf.DecodeUint8() + m.Weight = buf.DecodeUint8() + return nil +} + +// OneAddDelLocatorReply defines message 'one_add_del_locator_reply'. +type OneAddDelLocatorReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneAddDelLocatorReply) Reset() { *m = OneAddDelLocatorReply{} } +func (*OneAddDelLocatorReply) GetMessageName() string { return "one_add_del_locator_reply" } +func (*OneAddDelLocatorReply) GetCrcString() string { return "e8d4e804" } +func (*OneAddDelLocatorReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneAddDelLocatorReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneAddDelLocatorReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneAddDelLocatorReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OneAddDelLocatorSet defines message 'one_add_del_locator_set'. +type OneAddDelLocatorSet struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + LocatorSetName string `binapi:"string[64],name=locator_set_name" json:"locator_set_name,omitempty"` + LocatorNum uint32 `binapi:"u32,name=locator_num" json:"-"` + Locators []lisp_types.LocalLocator `binapi:"local_locator[locator_num],name=locators" json:"locators,omitempty"` +} + +func (m *OneAddDelLocatorSet) Reset() { *m = OneAddDelLocatorSet{} } +func (*OneAddDelLocatorSet) GetMessageName() string { return "one_add_del_locator_set" } +func (*OneAddDelLocatorSet) GetCrcString() string { return "6fcd6471" } +func (*OneAddDelLocatorSet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneAddDelLocatorSet) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 64 // m.LocatorSetName + size += 4 // m.LocatorNum + for j1 := 0; j1 < len(m.Locators); j1++ { + var s1 lisp_types.LocalLocator + _ = s1 + if j1 < len(m.Locators) { + s1 = m.Locators[j1] + } + size += 4 // s1.SwIfIndex + size += 1 // s1.Priority + size += 1 // s1.Weight + } + return size +} +func (m *OneAddDelLocatorSet) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeString(m.LocatorSetName, 64) + buf.EncodeUint32(uint32(len(m.Locators))) + for j0 := 0; j0 < len(m.Locators); j0++ { + var v0 lisp_types.LocalLocator + if j0 < len(m.Locators) { + v0 = m.Locators[j0] + } + buf.EncodeUint32(uint32(v0.SwIfIndex)) + buf.EncodeUint8(uint8(v0.Priority)) + buf.EncodeUint8(uint8(v0.Weight)) + } + return buf.Bytes(), nil +} +func (m *OneAddDelLocatorSet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.LocatorSetName = buf.DecodeString(64) + m.LocatorNum = buf.DecodeUint32() + m.Locators = make([]lisp_types.LocalLocator, int(m.LocatorNum)) + for j0 := 0; j0 < len(m.Locators); j0++ { + m.Locators[j0].SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Locators[j0].Priority = buf.DecodeUint8() + m.Locators[j0].Weight = buf.DecodeUint8() + } + return nil +} + +// OneAddDelLocatorSetReply defines message 'one_add_del_locator_set_reply'. +type OneAddDelLocatorSetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + LsIndex uint32 `binapi:"u32,name=ls_index" json:"ls_index,omitempty"` +} + +func (m *OneAddDelLocatorSetReply) Reset() { *m = OneAddDelLocatorSetReply{} } +func (*OneAddDelLocatorSetReply) GetMessageName() string { return "one_add_del_locator_set_reply" } +func (*OneAddDelLocatorSetReply) GetCrcString() string { return "b6666db4" } +func (*OneAddDelLocatorSetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneAddDelLocatorSetReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.LsIndex + return size +} +func (m *OneAddDelLocatorSetReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.LsIndex)) + return buf.Bytes(), nil +} +func (m *OneAddDelLocatorSetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.LsIndex = buf.DecodeUint32() + return nil +} + +// OneAddDelMapRequestItrRlocs defines message 'one_add_del_map_request_itr_rlocs'. +type OneAddDelMapRequestItrRlocs struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + LocatorSetName string `binapi:"string[64],name=locator_set_name" json:"locator_set_name,omitempty"` +} + +func (m *OneAddDelMapRequestItrRlocs) Reset() { *m = OneAddDelMapRequestItrRlocs{} } +func (*OneAddDelMapRequestItrRlocs) GetMessageName() string { + return "one_add_del_map_request_itr_rlocs" +} +func (*OneAddDelMapRequestItrRlocs) GetCrcString() string { return "6be88e45" } +func (*OneAddDelMapRequestItrRlocs) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneAddDelMapRequestItrRlocs) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 64 // m.LocatorSetName + return size +} +func (m *OneAddDelMapRequestItrRlocs) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeString(m.LocatorSetName, 64) + return buf.Bytes(), nil +} +func (m *OneAddDelMapRequestItrRlocs) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.LocatorSetName = buf.DecodeString(64) + return nil +} + +// OneAddDelMapRequestItrRlocsReply defines message 'one_add_del_map_request_itr_rlocs_reply'. +type OneAddDelMapRequestItrRlocsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneAddDelMapRequestItrRlocsReply) Reset() { *m = OneAddDelMapRequestItrRlocsReply{} } +func (*OneAddDelMapRequestItrRlocsReply) GetMessageName() string { + return "one_add_del_map_request_itr_rlocs_reply" +} +func (*OneAddDelMapRequestItrRlocsReply) GetCrcString() string { return "e8d4e804" } +func (*OneAddDelMapRequestItrRlocsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneAddDelMapRequestItrRlocsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneAddDelMapRequestItrRlocsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneAddDelMapRequestItrRlocsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OneAddDelMapResolver defines message 'one_add_del_map_resolver'. +type OneAddDelMapResolver struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"` +} + +func (m *OneAddDelMapResolver) Reset() { *m = OneAddDelMapResolver{} } +func (*OneAddDelMapResolver) GetMessageName() string { return "one_add_del_map_resolver" } +func (*OneAddDelMapResolver) GetCrcString() string { return "6598ea7c" } +func (*OneAddDelMapResolver) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneAddDelMapResolver) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.IPAddress.Af + size += 1 * 16 // m.IPAddress.Un + return size +} +func (m *OneAddDelMapResolver) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.IPAddress.Af)) + buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *OneAddDelMapResolver) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// OneAddDelMapResolverReply defines message 'one_add_del_map_resolver_reply'. +type OneAddDelMapResolverReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneAddDelMapResolverReply) Reset() { *m = OneAddDelMapResolverReply{} } +func (*OneAddDelMapResolverReply) GetMessageName() string { return "one_add_del_map_resolver_reply" } +func (*OneAddDelMapResolverReply) GetCrcString() string { return "e8d4e804" } +func (*OneAddDelMapResolverReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneAddDelMapResolverReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneAddDelMapResolverReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneAddDelMapResolverReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OneAddDelMapServer defines message 'one_add_del_map_server'. +type OneAddDelMapServer struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"` +} + +func (m *OneAddDelMapServer) Reset() { *m = OneAddDelMapServer{} } +func (*OneAddDelMapServer) GetMessageName() string { return "one_add_del_map_server" } +func (*OneAddDelMapServer) GetCrcString() string { return "6598ea7c" } +func (*OneAddDelMapServer) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneAddDelMapServer) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.IPAddress.Af + size += 1 * 16 // m.IPAddress.Un + return size +} +func (m *OneAddDelMapServer) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.IPAddress.Af)) + buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *OneAddDelMapServer) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// OneAddDelMapServerReply defines message 'one_add_del_map_server_reply'. +type OneAddDelMapServerReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneAddDelMapServerReply) Reset() { *m = OneAddDelMapServerReply{} } +func (*OneAddDelMapServerReply) GetMessageName() string { return "one_add_del_map_server_reply" } +func (*OneAddDelMapServerReply) GetCrcString() string { return "e8d4e804" } +func (*OneAddDelMapServerReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneAddDelMapServerReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneAddDelMapServerReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneAddDelMapServerReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OneAddDelNdpEntry defines message 'one_add_del_ndp_entry'. +type OneAddDelNdpEntry struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Bd uint32 `binapi:"u32,name=bd" json:"bd,omitempty"` + Entry OneNdpEntry `binapi:"one_ndp_entry,name=entry" json:"entry,omitempty"` +} + +func (m *OneAddDelNdpEntry) Reset() { *m = OneAddDelNdpEntry{} } +func (*OneAddDelNdpEntry) GetMessageName() string { return "one_add_del_ndp_entry" } +func (*OneAddDelNdpEntry) GetCrcString() string { return "d1629a2f" } +func (*OneAddDelNdpEntry) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneAddDelNdpEntry) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Bd + size += 1 * 6 // m.Entry.Mac + size += 1 * 16 // m.Entry.IP6 + return size +} +func (m *OneAddDelNdpEntry) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Bd)) + buf.EncodeBytes(m.Entry.Mac[:], 6) + buf.EncodeBytes(m.Entry.IP6[:], 16) + return buf.Bytes(), nil +} +func (m *OneAddDelNdpEntry) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Bd = buf.DecodeUint32() + copy(m.Entry.Mac[:], buf.DecodeBytes(6)) + copy(m.Entry.IP6[:], buf.DecodeBytes(16)) + return nil +} + +// OneAddDelNdpEntryReply defines message 'one_add_del_ndp_entry_reply'. +type OneAddDelNdpEntryReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneAddDelNdpEntryReply) Reset() { *m = OneAddDelNdpEntryReply{} } +func (*OneAddDelNdpEntryReply) GetMessageName() string { return "one_add_del_ndp_entry_reply" } +func (*OneAddDelNdpEntryReply) GetCrcString() string { return "e8d4e804" } +func (*OneAddDelNdpEntryReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneAddDelNdpEntryReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneAddDelNdpEntryReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneAddDelNdpEntryReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OneAddDelRemoteMapping defines message 'one_add_del_remote_mapping'. +type OneAddDelRemoteMapping struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IsSrcDst bool `binapi:"bool,name=is_src_dst" json:"is_src_dst,omitempty"` + DelAll bool `binapi:"bool,name=del_all" json:"del_all,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + Action uint8 `binapi:"u8,name=action" json:"action,omitempty"` + Deid lisp_types.Eid `binapi:"eid,name=deid" json:"deid,omitempty"` + Seid lisp_types.Eid `binapi:"eid,name=seid" json:"seid,omitempty"` + RlocNum uint32 `binapi:"u32,name=rloc_num" json:"-"` + Rlocs []lisp_types.RemoteLocator `binapi:"remote_locator[rloc_num],name=rlocs" json:"rlocs,omitempty"` +} + +func (m *OneAddDelRemoteMapping) Reset() { *m = OneAddDelRemoteMapping{} } +func (*OneAddDelRemoteMapping) GetMessageName() string { return "one_add_del_remote_mapping" } +func (*OneAddDelRemoteMapping) GetCrcString() string { return "fae8ed77" } +func (*OneAddDelRemoteMapping) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneAddDelRemoteMapping) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.IsSrcDst + size += 1 // m.DelAll + size += 4 // m.Vni + size += 1 // m.Action + size += 1 // m.Deid.Type + size += 1 * 6 // m.Deid.Address + size += 1 // m.Seid.Type + size += 1 * 6 // m.Seid.Address + size += 4 // m.RlocNum + for j1 := 0; j1 < len(m.Rlocs); j1++ { + var s1 lisp_types.RemoteLocator + _ = s1 + if j1 < len(m.Rlocs) { + s1 = m.Rlocs[j1] + } + size += 1 // s1.Priority + size += 1 // s1.Weight + size += 1 // s1.IPAddress.Af + size += 1 * 16 // s1.IPAddress.Un + } + return size +} +func (m *OneAddDelRemoteMapping) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeBool(m.IsSrcDst) + buf.EncodeBool(m.DelAll) + buf.EncodeUint32(uint32(m.Vni)) + buf.EncodeUint8(uint8(m.Action)) + buf.EncodeUint8(uint8(m.Deid.Type)) + buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Seid.Type)) + buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(len(m.Rlocs))) + for j0 := 0; j0 < len(m.Rlocs); j0++ { + var v0 lisp_types.RemoteLocator + if j0 < len(m.Rlocs) { + v0 = m.Rlocs[j0] + } + buf.EncodeUint8(uint8(v0.Priority)) + buf.EncodeUint8(uint8(v0.Weight)) + buf.EncodeUint8(uint8(v0.IPAddress.Af)) + buf.EncodeBytes(v0.IPAddress.Un.XXX_UnionData[:], 0) + } + return buf.Bytes(), nil +} +func (m *OneAddDelRemoteMapping) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.IsSrcDst = buf.DecodeBool() + m.DelAll = buf.DecodeBool() + m.Vni = buf.DecodeUint32() + m.Action = buf.DecodeUint8() + m.Deid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Deid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + m.Seid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Seid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + m.RlocNum = buf.DecodeUint32() + m.Rlocs = make([]lisp_types.RemoteLocator, int(m.RlocNum)) + for j0 := 0; j0 < len(m.Rlocs); j0++ { + m.Rlocs[j0].Priority = buf.DecodeUint8() + m.Rlocs[j0].Weight = buf.DecodeUint8() + m.Rlocs[j0].IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Rlocs[j0].IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + } + return nil +} + +// OneAddDelRemoteMappingReply defines message 'one_add_del_remote_mapping_reply'. +type OneAddDelRemoteMappingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneAddDelRemoteMappingReply) Reset() { *m = OneAddDelRemoteMappingReply{} } +func (*OneAddDelRemoteMappingReply) GetMessageName() string { + return "one_add_del_remote_mapping_reply" +} +func (*OneAddDelRemoteMappingReply) GetCrcString() string { return "e8d4e804" } +func (*OneAddDelRemoteMappingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneAddDelRemoteMappingReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneAddDelRemoteMappingReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneAddDelRemoteMappingReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OneAdjacenciesGet defines message 'one_adjacencies_get'. +type OneAdjacenciesGet struct { + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` +} + +func (m *OneAdjacenciesGet) Reset() { *m = OneAdjacenciesGet{} } +func (*OneAdjacenciesGet) GetMessageName() string { return "one_adjacencies_get" } +func (*OneAdjacenciesGet) GetCrcString() string { return "8d1f2fe9" } +func (*OneAdjacenciesGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneAdjacenciesGet) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Vni + return size +} +func (m *OneAdjacenciesGet) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Vni)) + return buf.Bytes(), nil +} +func (m *OneAdjacenciesGet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Vni = buf.DecodeUint32() + return nil +} + +// OneAdjacenciesGetReply defines message 'one_adjacencies_get_reply'. +type OneAdjacenciesGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + Adjacencies []OneAdjacency `binapi:"one_adjacency[count],name=adjacencies" json:"adjacencies,omitempty"` +} + +func (m *OneAdjacenciesGetReply) Reset() { *m = OneAdjacenciesGetReply{} } +func (*OneAdjacenciesGetReply) GetMessageName() string { return "one_adjacencies_get_reply" } +func (*OneAdjacenciesGetReply) GetCrcString() string { return "a8ed89a5" } +func (*OneAdjacenciesGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneAdjacenciesGetReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.Count + for j1 := 0; j1 < len(m.Adjacencies); j1++ { + var s1 OneAdjacency + _ = s1 + if j1 < len(m.Adjacencies) { + s1 = m.Adjacencies[j1] + } + size += 1 // s1.Reid.Type + size += 1 * 6 // s1.Reid.Address + size += 1 // s1.Leid.Type + size += 1 * 6 // s1.Leid.Address + } + return size +} +func (m *OneAdjacenciesGetReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(len(m.Adjacencies))) + for j0 := 0; j0 < len(m.Adjacencies); j0++ { + var v0 OneAdjacency + if j0 < len(m.Adjacencies) { + v0 = m.Adjacencies[j0] + } + buf.EncodeUint8(uint8(v0.Reid.Type)) + buf.EncodeBytes(v0.Reid.Address.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(v0.Leid.Type)) + buf.EncodeBytes(v0.Leid.Address.XXX_UnionData[:], 0) + } + return buf.Bytes(), nil +} +func (m *OneAdjacenciesGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Count = buf.DecodeUint32() + m.Adjacencies = make([]OneAdjacency, int(m.Count)) + for j0 := 0; j0 < len(m.Adjacencies); j0++ { + m.Adjacencies[j0].Reid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Adjacencies[j0].Reid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + m.Adjacencies[j0].Leid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Adjacencies[j0].Leid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + } + return nil +} + +// OneEidTableAddDelMap defines message 'one_eid_table_add_del_map'. +type OneEidTableAddDelMap struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + DpTable uint32 `binapi:"u32,name=dp_table" json:"dp_table,omitempty"` + IsL2 bool `binapi:"bool,name=is_l2" json:"is_l2,omitempty"` +} + +func (m *OneEidTableAddDelMap) Reset() { *m = OneEidTableAddDelMap{} } +func (*OneEidTableAddDelMap) GetMessageName() string { return "one_eid_table_add_del_map" } +func (*OneEidTableAddDelMap) GetCrcString() string { return "9481416b" } +func (*OneEidTableAddDelMap) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneEidTableAddDelMap) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Vni + size += 4 // m.DpTable + size += 1 // m.IsL2 + return size +} +func (m *OneEidTableAddDelMap) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Vni)) + buf.EncodeUint32(uint32(m.DpTable)) + buf.EncodeBool(m.IsL2) + return buf.Bytes(), nil +} +func (m *OneEidTableAddDelMap) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Vni = buf.DecodeUint32() + m.DpTable = buf.DecodeUint32() + m.IsL2 = buf.DecodeBool() + return nil +} + +// OneEidTableAddDelMapReply defines message 'one_eid_table_add_del_map_reply'. +type OneEidTableAddDelMapReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneEidTableAddDelMapReply) Reset() { *m = OneEidTableAddDelMapReply{} } +func (*OneEidTableAddDelMapReply) GetMessageName() string { return "one_eid_table_add_del_map_reply" } +func (*OneEidTableAddDelMapReply) GetCrcString() string { return "e8d4e804" } +func (*OneEidTableAddDelMapReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneEidTableAddDelMapReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneEidTableAddDelMapReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneEidTableAddDelMapReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OneEidTableDetails defines message 'one_eid_table_details'. +type OneEidTableDetails struct { + LocatorSetIndex uint32 `binapi:"u32,name=locator_set_index" json:"locator_set_index,omitempty"` + Action uint8 `binapi:"u8,name=action" json:"action,omitempty"` + IsLocal bool `binapi:"bool,name=is_local" json:"is_local,omitempty"` + IsSrcDst bool `binapi:"bool,name=is_src_dst" json:"is_src_dst,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + Deid lisp_types.Eid `binapi:"eid,name=deid" json:"deid,omitempty"` + Seid lisp_types.Eid `binapi:"eid,name=seid" json:"seid,omitempty"` + TTL uint32 `binapi:"u32,name=ttl" json:"ttl,omitempty"` + Authoritative uint8 `binapi:"u8,name=authoritative" json:"authoritative,omitempty"` + Key lisp_types.HmacKey `binapi:"hmac_key,name=key" json:"key,omitempty"` +} + +func (m *OneEidTableDetails) Reset() { *m = OneEidTableDetails{} } +func (*OneEidTableDetails) GetMessageName() string { return "one_eid_table_details" } +func (*OneEidTableDetails) GetCrcString() string { return "4bc32e3a" } +func (*OneEidTableDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneEidTableDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.LocatorSetIndex + size += 1 // m.Action + size += 1 // m.IsLocal + size += 1 // m.IsSrcDst + size += 4 // m.Vni + size += 1 // m.Deid.Type + size += 1 * 6 // m.Deid.Address + size += 1 // m.Seid.Type + size += 1 * 6 // m.Seid.Address + size += 4 // m.TTL + size += 1 // m.Authoritative + size += 1 // m.Key.ID + size += 1 * 64 // m.Key.Key + return size +} +func (m *OneEidTableDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.LocatorSetIndex)) + buf.EncodeUint8(uint8(m.Action)) + buf.EncodeBool(m.IsLocal) + buf.EncodeBool(m.IsSrcDst) + buf.EncodeUint32(uint32(m.Vni)) + buf.EncodeUint8(uint8(m.Deid.Type)) + buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Seid.Type)) + buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.TTL)) + buf.EncodeUint8(uint8(m.Authoritative)) + buf.EncodeUint8(uint8(m.Key.ID)) + buf.EncodeBytes(m.Key.Key[:], 64) + return buf.Bytes(), nil +} +func (m *OneEidTableDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.LocatorSetIndex = buf.DecodeUint32() + m.Action = buf.DecodeUint8() + m.IsLocal = buf.DecodeBool() + m.IsSrcDst = buf.DecodeBool() + m.Vni = buf.DecodeUint32() + m.Deid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Deid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + m.Seid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Seid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + m.TTL = buf.DecodeUint32() + m.Authoritative = buf.DecodeUint8() + m.Key.ID = lisp_types.HmacKeyID(buf.DecodeUint8()) + copy(m.Key.Key[:], buf.DecodeBytes(64)) + return nil +} + +// OneEidTableDump defines message 'one_eid_table_dump'. +type OneEidTableDump struct { + EidSet bool `binapi:"bool,name=eid_set" json:"eid_set,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + Eid lisp_types.Eid `binapi:"eid,name=eid" json:"eid,omitempty"` + Filter OneFilter `binapi:"one_filter,name=filter" json:"filter,omitempty"` +} + +func (m *OneEidTableDump) Reset() { *m = OneEidTableDump{} } +func (*OneEidTableDump) GetMessageName() string { return "one_eid_table_dump" } +func (*OneEidTableDump) GetCrcString() string { return "95151038" } +func (*OneEidTableDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneEidTableDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.EidSet + size += 4 // m.Vni + size += 1 // m.Eid.Type + size += 1 * 6 // m.Eid.Address + size += 4 // m.Filter + return size +} +func (m *OneEidTableDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.EidSet) + buf.EncodeUint32(uint32(m.Vni)) + buf.EncodeUint8(uint8(m.Eid.Type)) + buf.EncodeBytes(m.Eid.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.Filter)) + return buf.Bytes(), nil +} +func (m *OneEidTableDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EidSet = buf.DecodeBool() + m.Vni = buf.DecodeUint32() + m.Eid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Eid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + m.Filter = OneFilter(buf.DecodeUint32()) + return nil +} + +// OneEidTableMapDetails defines message 'one_eid_table_map_details'. +type OneEidTableMapDetails struct { + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + DpTable uint32 `binapi:"u32,name=dp_table" json:"dp_table,omitempty"` +} + +func (m *OneEidTableMapDetails) Reset() { *m = OneEidTableMapDetails{} } +func (*OneEidTableMapDetails) GetMessageName() string { return "one_eid_table_map_details" } +func (*OneEidTableMapDetails) GetCrcString() string { return "0b6859e2" } +func (*OneEidTableMapDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneEidTableMapDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Vni + size += 4 // m.DpTable + return size +} +func (m *OneEidTableMapDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Vni)) + buf.EncodeUint32(uint32(m.DpTable)) + return buf.Bytes(), nil +} +func (m *OneEidTableMapDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Vni = buf.DecodeUint32() + m.DpTable = buf.DecodeUint32() + return nil +} + +// OneEidTableMapDump defines message 'one_eid_table_map_dump'. +type OneEidTableMapDump struct { + IsL2 bool `binapi:"bool,name=is_l2" json:"is_l2,omitempty"` +} + +func (m *OneEidTableMapDump) Reset() { *m = OneEidTableMapDump{} } +func (*OneEidTableMapDump) GetMessageName() string { return "one_eid_table_map_dump" } +func (*OneEidTableMapDump) GetCrcString() string { return "d6cf0c3d" } +func (*OneEidTableMapDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneEidTableMapDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsL2 + return size +} +func (m *OneEidTableMapDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsL2) + return buf.Bytes(), nil +} +func (m *OneEidTableMapDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsL2 = buf.DecodeBool() + return nil +} + +// OneEidTableVniDetails defines message 'one_eid_table_vni_details'. +type OneEidTableVniDetails struct { + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` +} + +func (m *OneEidTableVniDetails) Reset() { *m = OneEidTableVniDetails{} } +func (*OneEidTableVniDetails) GetMessageName() string { return "one_eid_table_vni_details" } +func (*OneEidTableVniDetails) GetCrcString() string { return "64abc01e" } +func (*OneEidTableVniDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneEidTableVniDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Vni + return size +} +func (m *OneEidTableVniDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Vni)) + return buf.Bytes(), nil +} +func (m *OneEidTableVniDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Vni = buf.DecodeUint32() + return nil +} + +// OneEidTableVniDump defines message 'one_eid_table_vni_dump'. +type OneEidTableVniDump struct{} + +func (m *OneEidTableVniDump) Reset() { *m = OneEidTableVniDump{} } +func (*OneEidTableVniDump) GetMessageName() string { return "one_eid_table_vni_dump" } +func (*OneEidTableVniDump) GetCrcString() string { return "51077d14" } +func (*OneEidTableVniDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneEidTableVniDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *OneEidTableVniDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *OneEidTableVniDump) Unmarshal(b []byte) error { + return nil +} + +// OneEnableDisable defines message 'one_enable_disable'. +type OneEnableDisable struct { + IsEnable bool `binapi:"bool,name=is_enable,default=true" json:"is_enable,omitempty"` +} + +func (m *OneEnableDisable) Reset() { *m = OneEnableDisable{} } +func (*OneEnableDisable) GetMessageName() string { return "one_enable_disable" } +func (*OneEnableDisable) GetCrcString() string { return "c264d7bf" } +func (*OneEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsEnable + return size +} +func (m *OneEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsEnable) + return buf.Bytes(), nil +} +func (m *OneEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsEnable = buf.DecodeBool() + return nil +} + +// OneEnableDisablePetrMode defines message 'one_enable_disable_petr_mode'. +type OneEnableDisablePetrMode struct { + IsEnable bool `binapi:"bool,name=is_enable,default=true" json:"is_enable,omitempty"` +} + +func (m *OneEnableDisablePetrMode) Reset() { *m = OneEnableDisablePetrMode{} } +func (*OneEnableDisablePetrMode) GetMessageName() string { return "one_enable_disable_petr_mode" } +func (*OneEnableDisablePetrMode) GetCrcString() string { return "c264d7bf" } +func (*OneEnableDisablePetrMode) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneEnableDisablePetrMode) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsEnable + return size +} +func (m *OneEnableDisablePetrMode) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsEnable) + return buf.Bytes(), nil +} +func (m *OneEnableDisablePetrMode) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsEnable = buf.DecodeBool() + return nil +} + +// OneEnableDisablePetrModeReply defines message 'one_enable_disable_petr_mode_reply'. +type OneEnableDisablePetrModeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneEnableDisablePetrModeReply) Reset() { *m = OneEnableDisablePetrModeReply{} } +func (*OneEnableDisablePetrModeReply) GetMessageName() string { + return "one_enable_disable_petr_mode_reply" +} +func (*OneEnableDisablePetrModeReply) GetCrcString() string { return "e8d4e804" } +func (*OneEnableDisablePetrModeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneEnableDisablePetrModeReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneEnableDisablePetrModeReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneEnableDisablePetrModeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OneEnableDisablePitrMode defines message 'one_enable_disable_pitr_mode'. +type OneEnableDisablePitrMode struct { + IsEnable bool `binapi:"bool,name=is_enable,default=true" json:"is_enable,omitempty"` +} + +func (m *OneEnableDisablePitrMode) Reset() { *m = OneEnableDisablePitrMode{} } +func (*OneEnableDisablePitrMode) GetMessageName() string { return "one_enable_disable_pitr_mode" } +func (*OneEnableDisablePitrMode) GetCrcString() string { return "c264d7bf" } +func (*OneEnableDisablePitrMode) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneEnableDisablePitrMode) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsEnable + return size +} +func (m *OneEnableDisablePitrMode) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsEnable) + return buf.Bytes(), nil +} +func (m *OneEnableDisablePitrMode) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsEnable = buf.DecodeBool() + return nil +} + +// OneEnableDisablePitrModeReply defines message 'one_enable_disable_pitr_mode_reply'. +type OneEnableDisablePitrModeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneEnableDisablePitrModeReply) Reset() { *m = OneEnableDisablePitrModeReply{} } +func (*OneEnableDisablePitrModeReply) GetMessageName() string { + return "one_enable_disable_pitr_mode_reply" +} +func (*OneEnableDisablePitrModeReply) GetCrcString() string { return "e8d4e804" } +func (*OneEnableDisablePitrModeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneEnableDisablePitrModeReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneEnableDisablePitrModeReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneEnableDisablePitrModeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OneEnableDisableReply defines message 'one_enable_disable_reply'. +type OneEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneEnableDisableReply) Reset() { *m = OneEnableDisableReply{} } +func (*OneEnableDisableReply) GetMessageName() string { return "one_enable_disable_reply" } +func (*OneEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*OneEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OneEnableDisableXtrMode defines message 'one_enable_disable_xtr_mode'. +type OneEnableDisableXtrMode struct { + IsEnable bool `binapi:"bool,name=is_enable,default=true" json:"is_enable,omitempty"` +} + +func (m *OneEnableDisableXtrMode) Reset() { *m = OneEnableDisableXtrMode{} } +func (*OneEnableDisableXtrMode) GetMessageName() string { return "one_enable_disable_xtr_mode" } +func (*OneEnableDisableXtrMode) GetCrcString() string { return "c264d7bf" } +func (*OneEnableDisableXtrMode) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneEnableDisableXtrMode) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsEnable + return size +} +func (m *OneEnableDisableXtrMode) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsEnable) + return buf.Bytes(), nil +} +func (m *OneEnableDisableXtrMode) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsEnable = buf.DecodeBool() + return nil +} + +// OneEnableDisableXtrModeReply defines message 'one_enable_disable_xtr_mode_reply'. +type OneEnableDisableXtrModeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneEnableDisableXtrModeReply) Reset() { *m = OneEnableDisableXtrModeReply{} } +func (*OneEnableDisableXtrModeReply) GetMessageName() string { + return "one_enable_disable_xtr_mode_reply" +} +func (*OneEnableDisableXtrModeReply) GetCrcString() string { return "e8d4e804" } +func (*OneEnableDisableXtrModeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneEnableDisableXtrModeReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneEnableDisableXtrModeReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneEnableDisableXtrModeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OneGetMapRequestItrRlocs defines message 'one_get_map_request_itr_rlocs'. +type OneGetMapRequestItrRlocs struct{} + +func (m *OneGetMapRequestItrRlocs) Reset() { *m = OneGetMapRequestItrRlocs{} } +func (*OneGetMapRequestItrRlocs) GetMessageName() string { return "one_get_map_request_itr_rlocs" } +func (*OneGetMapRequestItrRlocs) GetCrcString() string { return "51077d14" } +func (*OneGetMapRequestItrRlocs) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneGetMapRequestItrRlocs) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *OneGetMapRequestItrRlocs) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *OneGetMapRequestItrRlocs) Unmarshal(b []byte) error { + return nil +} + +// OneGetMapRequestItrRlocsReply defines message 'one_get_map_request_itr_rlocs_reply'. +type OneGetMapRequestItrRlocsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + LocatorSetName string `binapi:"string[64],name=locator_set_name" json:"locator_set_name,omitempty"` +} + +func (m *OneGetMapRequestItrRlocsReply) Reset() { *m = OneGetMapRequestItrRlocsReply{} } +func (*OneGetMapRequestItrRlocsReply) GetMessageName() string { + return "one_get_map_request_itr_rlocs_reply" +} +func (*OneGetMapRequestItrRlocsReply) GetCrcString() string { return "76580f3a" } +func (*OneGetMapRequestItrRlocsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneGetMapRequestItrRlocsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 64 // m.LocatorSetName + return size +} +func (m *OneGetMapRequestItrRlocsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeString(m.LocatorSetName, 64) + return buf.Bytes(), nil +} +func (m *OneGetMapRequestItrRlocsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.LocatorSetName = buf.DecodeString(64) + return nil +} + +// OneGetTransportProtocol defines message 'one_get_transport_protocol'. +type OneGetTransportProtocol struct{} + +func (m *OneGetTransportProtocol) Reset() { *m = OneGetTransportProtocol{} } +func (*OneGetTransportProtocol) GetMessageName() string { return "one_get_transport_protocol" } +func (*OneGetTransportProtocol) GetCrcString() string { return "51077d14" } +func (*OneGetTransportProtocol) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneGetTransportProtocol) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *OneGetTransportProtocol) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *OneGetTransportProtocol) Unmarshal(b []byte) error { + return nil +} + +// OneGetTransportProtocolReply defines message 'one_get_transport_protocol_reply'. +type OneGetTransportProtocolReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` +} + +func (m *OneGetTransportProtocolReply) Reset() { *m = OneGetTransportProtocolReply{} } +func (*OneGetTransportProtocolReply) GetMessageName() string { + return "one_get_transport_protocol_reply" +} +func (*OneGetTransportProtocolReply) GetCrcString() string { return "62a28eb3" } +func (*OneGetTransportProtocolReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneGetTransportProtocolReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.Protocol + return size +} +func (m *OneGetTransportProtocolReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint8(uint8(m.Protocol)) + return buf.Bytes(), nil +} +func (m *OneGetTransportProtocolReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Protocol = buf.DecodeUint8() + return nil +} + +// OneL2ArpBdGet defines message 'one_l2_arp_bd_get'. +type OneL2ArpBdGet struct{} + +func (m *OneL2ArpBdGet) Reset() { *m = OneL2ArpBdGet{} } +func (*OneL2ArpBdGet) GetMessageName() string { return "one_l2_arp_bd_get" } +func (*OneL2ArpBdGet) GetCrcString() string { return "51077d14" } +func (*OneL2ArpBdGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneL2ArpBdGet) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *OneL2ArpBdGet) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *OneL2ArpBdGet) Unmarshal(b []byte) error { + return nil +} + +// OneL2ArpBdGetReply defines message 'one_l2_arp_bd_get_reply'. +type OneL2ArpBdGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + BridgeDomains []uint32 `binapi:"u32[count],name=bridge_domains" json:"bridge_domains,omitempty"` +} + +func (m *OneL2ArpBdGetReply) Reset() { *m = OneL2ArpBdGetReply{} } +func (*OneL2ArpBdGetReply) GetMessageName() string { return "one_l2_arp_bd_get_reply" } +func (*OneL2ArpBdGetReply) GetCrcString() string { return "221ac888" } +func (*OneL2ArpBdGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneL2ArpBdGetReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.Count + size += 4 * len(m.BridgeDomains) // m.BridgeDomains + return size +} +func (m *OneL2ArpBdGetReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(len(m.BridgeDomains))) + for i := 0; i < len(m.BridgeDomains); i++ { + var x uint32 + if i < len(m.BridgeDomains) { + x = uint32(m.BridgeDomains[i]) + } + buf.EncodeUint32(uint32(x)) + } + return buf.Bytes(), nil +} +func (m *OneL2ArpBdGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Count = buf.DecodeUint32() + m.BridgeDomains = make([]uint32, m.Count) + for i := 0; i < len(m.BridgeDomains); i++ { + m.BridgeDomains[i] = buf.DecodeUint32() + } + return nil +} + +// OneL2ArpEntriesGet defines message 'one_l2_arp_entries_get'. +type OneL2ArpEntriesGet struct { + Bd uint32 `binapi:"u32,name=bd" json:"bd,omitempty"` +} + +func (m *OneL2ArpEntriesGet) Reset() { *m = OneL2ArpEntriesGet{} } +func (*OneL2ArpEntriesGet) GetMessageName() string { return "one_l2_arp_entries_get" } +func (*OneL2ArpEntriesGet) GetCrcString() string { return "4d418cf4" } +func (*OneL2ArpEntriesGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneL2ArpEntriesGet) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Bd + return size +} +func (m *OneL2ArpEntriesGet) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Bd)) + return buf.Bytes(), nil +} +func (m *OneL2ArpEntriesGet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Bd = buf.DecodeUint32() + return nil +} + +// OneL2ArpEntriesGetReply defines message 'one_l2_arp_entries_get_reply'. +type OneL2ArpEntriesGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + Entries []OneL2ArpEntry `binapi:"one_l2_arp_entry[count],name=entries" json:"entries,omitempty"` +} + +func (m *OneL2ArpEntriesGetReply) Reset() { *m = OneL2ArpEntriesGetReply{} } +func (*OneL2ArpEntriesGetReply) GetMessageName() string { return "one_l2_arp_entries_get_reply" } +func (*OneL2ArpEntriesGetReply) GetCrcString() string { return "b0a47bbe" } +func (*OneL2ArpEntriesGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneL2ArpEntriesGetReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.Count + for j1 := 0; j1 < len(m.Entries); j1++ { + var s1 OneL2ArpEntry + _ = s1 + if j1 < len(m.Entries) { + s1 = m.Entries[j1] + } + size += 1 * 6 // s1.Mac + size += 1 * 4 // s1.IP4 + } + return size +} +func (m *OneL2ArpEntriesGetReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(len(m.Entries))) + for j0 := 0; j0 < len(m.Entries); j0++ { + var v0 OneL2ArpEntry + if j0 < len(m.Entries) { + v0 = m.Entries[j0] + } + buf.EncodeBytes(v0.Mac[:], 6) + buf.EncodeBytes(v0.IP4[:], 4) + } + return buf.Bytes(), nil +} +func (m *OneL2ArpEntriesGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Count = buf.DecodeUint32() + m.Entries = make([]OneL2ArpEntry, int(m.Count)) + for j0 := 0; j0 < len(m.Entries); j0++ { + copy(m.Entries[j0].Mac[:], buf.DecodeBytes(6)) + copy(m.Entries[j0].IP4[:], buf.DecodeBytes(4)) + } + return nil +} + +// OneLocatorDetails defines message 'one_locator_details'. +type OneLocatorDetails struct { + Local uint8 `binapi:"u8,name=local" json:"local,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"` + Priority uint8 `binapi:"u8,name=priority" json:"priority,omitempty"` + Weight uint8 `binapi:"u8,name=weight" json:"weight,omitempty"` +} + +func (m *OneLocatorDetails) Reset() { *m = OneLocatorDetails{} } +func (*OneLocatorDetails) GetMessageName() string { return "one_locator_details" } +func (*OneLocatorDetails) GetCrcString() string { return "c0c4c2a7" } +func (*OneLocatorDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneLocatorDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Local + size += 4 // m.SwIfIndex + size += 1 // m.IPAddress.Af + size += 1 * 16 // m.IPAddress.Un + size += 1 // m.Priority + size += 1 // m.Weight + return size +} +func (m *OneLocatorDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Local)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.IPAddress.Af)) + buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Priority)) + buf.EncodeUint8(uint8(m.Weight)) + return buf.Bytes(), nil +} +func (m *OneLocatorDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Local = buf.DecodeUint8() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Priority = buf.DecodeUint8() + m.Weight = buf.DecodeUint8() + return nil +} + +// OneLocatorDump defines message 'one_locator_dump'. +type OneLocatorDump struct { + LsIndex uint32 `binapi:"u32,name=ls_index" json:"ls_index,omitempty"` + LsName string `binapi:"string[64],name=ls_name" json:"ls_name,omitempty"` + IsIndexSet bool `binapi:"bool,name=is_index_set" json:"is_index_set,omitempty"` +} + +func (m *OneLocatorDump) Reset() { *m = OneLocatorDump{} } +func (*OneLocatorDump) GetMessageName() string { return "one_locator_dump" } +func (*OneLocatorDump) GetCrcString() string { return "9b11076c" } +func (*OneLocatorDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneLocatorDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.LsIndex + size += 64 // m.LsName + size += 1 // m.IsIndexSet + return size +} +func (m *OneLocatorDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.LsIndex)) + buf.EncodeString(m.LsName, 64) + buf.EncodeBool(m.IsIndexSet) + return buf.Bytes(), nil +} +func (m *OneLocatorDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.LsIndex = buf.DecodeUint32() + m.LsName = buf.DecodeString(64) + m.IsIndexSet = buf.DecodeBool() + return nil +} + +// OneLocatorSetDetails defines message 'one_locator_set_details'. +type OneLocatorSetDetails struct { + LsIndex uint32 `binapi:"u32,name=ls_index" json:"ls_index,omitempty"` + LsName string `binapi:"string[64],name=ls_name" json:"ls_name,omitempty"` +} + +func (m *OneLocatorSetDetails) Reset() { *m = OneLocatorSetDetails{} } +func (*OneLocatorSetDetails) GetMessageName() string { return "one_locator_set_details" } +func (*OneLocatorSetDetails) GetCrcString() string { return "5b33a105" } +func (*OneLocatorSetDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneLocatorSetDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.LsIndex + size += 64 // m.LsName + return size +} +func (m *OneLocatorSetDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.LsIndex)) + buf.EncodeString(m.LsName, 64) + return buf.Bytes(), nil +} +func (m *OneLocatorSetDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.LsIndex = buf.DecodeUint32() + m.LsName = buf.DecodeString(64) + return nil +} + +// OneLocatorSetDump defines message 'one_locator_set_dump'. +type OneLocatorSetDump struct { + Filter OneFilter `binapi:"one_filter,name=filter" json:"filter,omitempty"` +} + +func (m *OneLocatorSetDump) Reset() { *m = OneLocatorSetDump{} } +func (*OneLocatorSetDump) GetMessageName() string { return "one_locator_set_dump" } +func (*OneLocatorSetDump) GetCrcString() string { return "71190768" } +func (*OneLocatorSetDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneLocatorSetDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Filter + return size +} +func (m *OneLocatorSetDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Filter)) + return buf.Bytes(), nil +} +func (m *OneLocatorSetDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Filter = OneFilter(buf.DecodeUint32()) + return nil +} + +// OneMapRegisterEnableDisable defines message 'one_map_register_enable_disable'. +type OneMapRegisterEnableDisable struct { + IsEnable bool `binapi:"bool,name=is_enable,default=true" json:"is_enable,omitempty"` +} + +func (m *OneMapRegisterEnableDisable) Reset() { *m = OneMapRegisterEnableDisable{} } +func (*OneMapRegisterEnableDisable) GetMessageName() string { return "one_map_register_enable_disable" } +func (*OneMapRegisterEnableDisable) GetCrcString() string { return "c264d7bf" } +func (*OneMapRegisterEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneMapRegisterEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsEnable + return size +} +func (m *OneMapRegisterEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsEnable) + return buf.Bytes(), nil +} +func (m *OneMapRegisterEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsEnable = buf.DecodeBool() + return nil +} + +// OneMapRegisterEnableDisableReply defines message 'one_map_register_enable_disable_reply'. +type OneMapRegisterEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneMapRegisterEnableDisableReply) Reset() { *m = OneMapRegisterEnableDisableReply{} } +func (*OneMapRegisterEnableDisableReply) GetMessageName() string { + return "one_map_register_enable_disable_reply" +} +func (*OneMapRegisterEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*OneMapRegisterEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneMapRegisterEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneMapRegisterEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneMapRegisterEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OneMapRegisterFallbackThreshold defines message 'one_map_register_fallback_threshold'. +type OneMapRegisterFallbackThreshold struct { + Value uint32 `binapi:"u32,name=value" json:"value,omitempty"` +} + +func (m *OneMapRegisterFallbackThreshold) Reset() { *m = OneMapRegisterFallbackThreshold{} } +func (*OneMapRegisterFallbackThreshold) GetMessageName() string { + return "one_map_register_fallback_threshold" +} +func (*OneMapRegisterFallbackThreshold) GetCrcString() string { return "f7d4a475" } +func (*OneMapRegisterFallbackThreshold) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneMapRegisterFallbackThreshold) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Value + return size +} +func (m *OneMapRegisterFallbackThreshold) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Value)) + return buf.Bytes(), nil +} +func (m *OneMapRegisterFallbackThreshold) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Value = buf.DecodeUint32() + return nil +} + +// OneMapRegisterFallbackThresholdReply defines message 'one_map_register_fallback_threshold_reply'. +type OneMapRegisterFallbackThresholdReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneMapRegisterFallbackThresholdReply) Reset() { *m = OneMapRegisterFallbackThresholdReply{} } +func (*OneMapRegisterFallbackThresholdReply) GetMessageName() string { + return "one_map_register_fallback_threshold_reply" +} +func (*OneMapRegisterFallbackThresholdReply) GetCrcString() string { return "e8d4e804" } +func (*OneMapRegisterFallbackThresholdReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneMapRegisterFallbackThresholdReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneMapRegisterFallbackThresholdReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneMapRegisterFallbackThresholdReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OneMapRegisterSetTTL defines message 'one_map_register_set_ttl'. +type OneMapRegisterSetTTL struct { + TTL uint32 `binapi:"u32,name=ttl" json:"ttl,omitempty"` +} + +func (m *OneMapRegisterSetTTL) Reset() { *m = OneMapRegisterSetTTL{} } +func (*OneMapRegisterSetTTL) GetMessageName() string { return "one_map_register_set_ttl" } +func (*OneMapRegisterSetTTL) GetCrcString() string { return "dd59f1f3" } +func (*OneMapRegisterSetTTL) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneMapRegisterSetTTL) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.TTL + return size +} +func (m *OneMapRegisterSetTTL) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.TTL)) + return buf.Bytes(), nil +} +func (m *OneMapRegisterSetTTL) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.TTL = buf.DecodeUint32() + return nil +} + +// OneMapRegisterSetTTLReply defines message 'one_map_register_set_ttl_reply'. +type OneMapRegisterSetTTLReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneMapRegisterSetTTLReply) Reset() { *m = OneMapRegisterSetTTLReply{} } +func (*OneMapRegisterSetTTLReply) GetMessageName() string { return "one_map_register_set_ttl_reply" } +func (*OneMapRegisterSetTTLReply) GetCrcString() string { return "e8d4e804" } +func (*OneMapRegisterSetTTLReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneMapRegisterSetTTLReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneMapRegisterSetTTLReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneMapRegisterSetTTLReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OneMapRequestMode defines message 'one_map_request_mode'. +type OneMapRequestMode struct { + Mode OneMapMode `binapi:"one_map_mode,name=mode" json:"mode,omitempty"` +} + +func (m *OneMapRequestMode) Reset() { *m = OneMapRequestMode{} } +func (*OneMapRequestMode) GetMessageName() string { return "one_map_request_mode" } +func (*OneMapRequestMode) GetCrcString() string { return "ffa5d2f5" } +func (*OneMapRequestMode) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneMapRequestMode) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Mode + return size +} +func (m *OneMapRequestMode) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Mode)) + return buf.Bytes(), nil +} +func (m *OneMapRequestMode) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Mode = OneMapMode(buf.DecodeUint32()) + return nil +} + +// OneMapRequestModeReply defines message 'one_map_request_mode_reply'. +type OneMapRequestModeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneMapRequestModeReply) Reset() { *m = OneMapRequestModeReply{} } +func (*OneMapRequestModeReply) GetMessageName() string { return "one_map_request_mode_reply" } +func (*OneMapRequestModeReply) GetCrcString() string { return "e8d4e804" } +func (*OneMapRequestModeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneMapRequestModeReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneMapRequestModeReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneMapRequestModeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OneMapResolverDetails defines message 'one_map_resolver_details'. +type OneMapResolverDetails struct { + IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"` +} + +func (m *OneMapResolverDetails) Reset() { *m = OneMapResolverDetails{} } +func (*OneMapResolverDetails) GetMessageName() string { return "one_map_resolver_details" } +func (*OneMapResolverDetails) GetCrcString() string { return "82a09deb" } +func (*OneMapResolverDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneMapResolverDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IPAddress.Af + size += 1 * 16 // m.IPAddress.Un + return size +} +func (m *OneMapResolverDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.IPAddress.Af)) + buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *OneMapResolverDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// OneMapResolverDump defines message 'one_map_resolver_dump'. +type OneMapResolverDump struct{} + +func (m *OneMapResolverDump) Reset() { *m = OneMapResolverDump{} } +func (*OneMapResolverDump) GetMessageName() string { return "one_map_resolver_dump" } +func (*OneMapResolverDump) GetCrcString() string { return "51077d14" } +func (*OneMapResolverDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneMapResolverDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *OneMapResolverDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *OneMapResolverDump) Unmarshal(b []byte) error { + return nil +} + +// OneMapServerDetails defines message 'one_map_server_details'. +type OneMapServerDetails struct { + IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"` +} + +func (m *OneMapServerDetails) Reset() { *m = OneMapServerDetails{} } +func (*OneMapServerDetails) GetMessageName() string { return "one_map_server_details" } +func (*OneMapServerDetails) GetCrcString() string { return "82a09deb" } +func (*OneMapServerDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneMapServerDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IPAddress.Af + size += 1 * 16 // m.IPAddress.Un + return size +} +func (m *OneMapServerDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.IPAddress.Af)) + buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *OneMapServerDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// OneMapServerDump defines message 'one_map_server_dump'. +type OneMapServerDump struct{} + +func (m *OneMapServerDump) Reset() { *m = OneMapServerDump{} } +func (*OneMapServerDump) GetMessageName() string { return "one_map_server_dump" } +func (*OneMapServerDump) GetCrcString() string { return "51077d14" } +func (*OneMapServerDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneMapServerDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *OneMapServerDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *OneMapServerDump) Unmarshal(b []byte) error { + return nil +} + +// OneNdpBdGet defines message 'one_ndp_bd_get'. +type OneNdpBdGet struct{} + +func (m *OneNdpBdGet) Reset() { *m = OneNdpBdGet{} } +func (*OneNdpBdGet) GetMessageName() string { return "one_ndp_bd_get" } +func (*OneNdpBdGet) GetCrcString() string { return "51077d14" } +func (*OneNdpBdGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneNdpBdGet) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *OneNdpBdGet) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *OneNdpBdGet) Unmarshal(b []byte) error { + return nil +} + +// OneNdpBdGetReply defines message 'one_ndp_bd_get_reply'. +type OneNdpBdGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + BridgeDomains []uint32 `binapi:"u32[count],name=bridge_domains" json:"bridge_domains,omitempty"` +} + +func (m *OneNdpBdGetReply) Reset() { *m = OneNdpBdGetReply{} } +func (*OneNdpBdGetReply) GetMessageName() string { return "one_ndp_bd_get_reply" } +func (*OneNdpBdGetReply) GetCrcString() string { return "221ac888" } +func (*OneNdpBdGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneNdpBdGetReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.Count + size += 4 * len(m.BridgeDomains) // m.BridgeDomains + return size +} +func (m *OneNdpBdGetReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(len(m.BridgeDomains))) + for i := 0; i < len(m.BridgeDomains); i++ { + var x uint32 + if i < len(m.BridgeDomains) { + x = uint32(m.BridgeDomains[i]) + } + buf.EncodeUint32(uint32(x)) + } + return buf.Bytes(), nil +} +func (m *OneNdpBdGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Count = buf.DecodeUint32() + m.BridgeDomains = make([]uint32, m.Count) + for i := 0; i < len(m.BridgeDomains); i++ { + m.BridgeDomains[i] = buf.DecodeUint32() + } + return nil +} + +// OneNdpEntriesGet defines message 'one_ndp_entries_get'. +type OneNdpEntriesGet struct { + Bd uint32 `binapi:"u32,name=bd" json:"bd,omitempty"` +} + +func (m *OneNdpEntriesGet) Reset() { *m = OneNdpEntriesGet{} } +func (*OneNdpEntriesGet) GetMessageName() string { return "one_ndp_entries_get" } +func (*OneNdpEntriesGet) GetCrcString() string { return "4d418cf4" } +func (*OneNdpEntriesGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneNdpEntriesGet) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Bd + return size +} +func (m *OneNdpEntriesGet) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Bd)) + return buf.Bytes(), nil +} +func (m *OneNdpEntriesGet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Bd = buf.DecodeUint32() + return nil +} + +// OneNdpEntriesGetReply defines message 'one_ndp_entries_get_reply'. +type OneNdpEntriesGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + Entries []OneNdpEntry `binapi:"one_ndp_entry[count],name=entries" json:"entries,omitempty"` +} + +func (m *OneNdpEntriesGetReply) Reset() { *m = OneNdpEntriesGetReply{} } +func (*OneNdpEntriesGetReply) GetMessageName() string { return "one_ndp_entries_get_reply" } +func (*OneNdpEntriesGetReply) GetCrcString() string { return "0bd34161" } +func (*OneNdpEntriesGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneNdpEntriesGetReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.Count + for j1 := 0; j1 < len(m.Entries); j1++ { + var s1 OneNdpEntry + _ = s1 + if j1 < len(m.Entries) { + s1 = m.Entries[j1] + } + size += 1 * 6 // s1.Mac + size += 1 * 16 // s1.IP6 + } + return size +} +func (m *OneNdpEntriesGetReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(len(m.Entries))) + for j0 := 0; j0 < len(m.Entries); j0++ { + var v0 OneNdpEntry + if j0 < len(m.Entries) { + v0 = m.Entries[j0] + } + buf.EncodeBytes(v0.Mac[:], 6) + buf.EncodeBytes(v0.IP6[:], 16) + } + return buf.Bytes(), nil +} +func (m *OneNdpEntriesGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Count = buf.DecodeUint32() + m.Entries = make([]OneNdpEntry, int(m.Count)) + for j0 := 0; j0 < len(m.Entries); j0++ { + copy(m.Entries[j0].Mac[:], buf.DecodeBytes(6)) + copy(m.Entries[j0].IP6[:], buf.DecodeBytes(16)) + } + return nil +} + +// OneNshSetLocatorSet defines message 'one_nsh_set_locator_set'. +type OneNshSetLocatorSet struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + LsName string `binapi:"string[64],name=ls_name" json:"ls_name,omitempty"` +} + +func (m *OneNshSetLocatorSet) Reset() { *m = OneNshSetLocatorSet{} } +func (*OneNshSetLocatorSet) GetMessageName() string { return "one_nsh_set_locator_set" } +func (*OneNshSetLocatorSet) GetCrcString() string { return "486e2b76" } +func (*OneNshSetLocatorSet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneNshSetLocatorSet) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 64 // m.LsName + return size +} +func (m *OneNshSetLocatorSet) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeString(m.LsName, 64) + return buf.Bytes(), nil +} +func (m *OneNshSetLocatorSet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.LsName = buf.DecodeString(64) + return nil +} + +// OneNshSetLocatorSetReply defines message 'one_nsh_set_locator_set_reply'. +type OneNshSetLocatorSetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneNshSetLocatorSetReply) Reset() { *m = OneNshSetLocatorSetReply{} } +func (*OneNshSetLocatorSetReply) GetMessageName() string { return "one_nsh_set_locator_set_reply" } +func (*OneNshSetLocatorSetReply) GetCrcString() string { return "e8d4e804" } +func (*OneNshSetLocatorSetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneNshSetLocatorSetReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneNshSetLocatorSetReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneNshSetLocatorSetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OnePitrSetLocatorSet defines message 'one_pitr_set_locator_set'. +type OnePitrSetLocatorSet struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + LsName string `binapi:"string[64],name=ls_name" json:"ls_name,omitempty"` +} + +func (m *OnePitrSetLocatorSet) Reset() { *m = OnePitrSetLocatorSet{} } +func (*OnePitrSetLocatorSet) GetMessageName() string { return "one_pitr_set_locator_set" } +func (*OnePitrSetLocatorSet) GetCrcString() string { return "486e2b76" } +func (*OnePitrSetLocatorSet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OnePitrSetLocatorSet) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 64 // m.LsName + return size +} +func (m *OnePitrSetLocatorSet) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeString(m.LsName, 64) + return buf.Bytes(), nil +} +func (m *OnePitrSetLocatorSet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.LsName = buf.DecodeString(64) + return nil +} + +// OnePitrSetLocatorSetReply defines message 'one_pitr_set_locator_set_reply'. +type OnePitrSetLocatorSetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OnePitrSetLocatorSetReply) Reset() { *m = OnePitrSetLocatorSetReply{} } +func (*OnePitrSetLocatorSetReply) GetMessageName() string { return "one_pitr_set_locator_set_reply" } +func (*OnePitrSetLocatorSetReply) GetCrcString() string { return "e8d4e804" } +func (*OnePitrSetLocatorSetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OnePitrSetLocatorSetReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OnePitrSetLocatorSetReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OnePitrSetLocatorSetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OneRlocProbeEnableDisable defines message 'one_rloc_probe_enable_disable'. +type OneRlocProbeEnableDisable struct { + IsEnable bool `binapi:"bool,name=is_enable,default=true" json:"is_enable,omitempty"` +} + +func (m *OneRlocProbeEnableDisable) Reset() { *m = OneRlocProbeEnableDisable{} } +func (*OneRlocProbeEnableDisable) GetMessageName() string { return "one_rloc_probe_enable_disable" } +func (*OneRlocProbeEnableDisable) GetCrcString() string { return "c264d7bf" } +func (*OneRlocProbeEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneRlocProbeEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsEnable + return size +} +func (m *OneRlocProbeEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsEnable) + return buf.Bytes(), nil +} +func (m *OneRlocProbeEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsEnable = buf.DecodeBool() + return nil +} + +// OneRlocProbeEnableDisableReply defines message 'one_rloc_probe_enable_disable_reply'. +type OneRlocProbeEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneRlocProbeEnableDisableReply) Reset() { *m = OneRlocProbeEnableDisableReply{} } +func (*OneRlocProbeEnableDisableReply) GetMessageName() string { + return "one_rloc_probe_enable_disable_reply" +} +func (*OneRlocProbeEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*OneRlocProbeEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneRlocProbeEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneRlocProbeEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneRlocProbeEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OneSetTransportProtocol defines message 'one_set_transport_protocol'. +type OneSetTransportProtocol struct { + Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` +} + +func (m *OneSetTransportProtocol) Reset() { *m = OneSetTransportProtocol{} } +func (*OneSetTransportProtocol) GetMessageName() string { return "one_set_transport_protocol" } +func (*OneSetTransportProtocol) GetCrcString() string { return "07b6b85f" } +func (*OneSetTransportProtocol) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneSetTransportProtocol) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Protocol + return size +} +func (m *OneSetTransportProtocol) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Protocol)) + return buf.Bytes(), nil +} +func (m *OneSetTransportProtocol) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Protocol = buf.DecodeUint8() + return nil +} + +// OneSetTransportProtocolReply defines message 'one_set_transport_protocol_reply'. +type OneSetTransportProtocolReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneSetTransportProtocolReply) Reset() { *m = OneSetTransportProtocolReply{} } +func (*OneSetTransportProtocolReply) GetMessageName() string { + return "one_set_transport_protocol_reply" +} +func (*OneSetTransportProtocolReply) GetCrcString() string { return "e8d4e804" } +func (*OneSetTransportProtocolReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneSetTransportProtocolReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneSetTransportProtocolReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneSetTransportProtocolReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OneShowPetrMode defines message 'one_show_petr_mode'. +type OneShowPetrMode struct{} + +func (m *OneShowPetrMode) Reset() { *m = OneShowPetrMode{} } +func (*OneShowPetrMode) GetMessageName() string { return "one_show_petr_mode" } +func (*OneShowPetrMode) GetCrcString() string { return "51077d14" } +func (*OneShowPetrMode) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneShowPetrMode) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *OneShowPetrMode) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *OneShowPetrMode) Unmarshal(b []byte) error { + return nil +} + +// OneShowPetrModeReply defines message 'one_show_petr_mode_reply'. +type OneShowPetrModeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IsEnable bool `binapi:"bool,name=is_enable" json:"is_enable,omitempty"` +} + +func (m *OneShowPetrModeReply) Reset() { *m = OneShowPetrModeReply{} } +func (*OneShowPetrModeReply) GetMessageName() string { return "one_show_petr_mode_reply" } +func (*OneShowPetrModeReply) GetCrcString() string { return "f15abb16" } +func (*OneShowPetrModeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneShowPetrModeReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.IsEnable + return size +} +func (m *OneShowPetrModeReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBool(m.IsEnable) + return buf.Bytes(), nil +} +func (m *OneShowPetrModeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.IsEnable = buf.DecodeBool() + return nil +} + +// OneShowPitrMode defines message 'one_show_pitr_mode'. +type OneShowPitrMode struct{} + +func (m *OneShowPitrMode) Reset() { *m = OneShowPitrMode{} } +func (*OneShowPitrMode) GetMessageName() string { return "one_show_pitr_mode" } +func (*OneShowPitrMode) GetCrcString() string { return "51077d14" } +func (*OneShowPitrMode) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneShowPitrMode) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *OneShowPitrMode) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *OneShowPitrMode) Unmarshal(b []byte) error { + return nil +} + +// OneShowPitrModeReply defines message 'one_show_pitr_mode_reply'. +type OneShowPitrModeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IsEnable bool `binapi:"bool,name=is_enable" json:"is_enable,omitempty"` +} + +func (m *OneShowPitrModeReply) Reset() { *m = OneShowPitrModeReply{} } +func (*OneShowPitrModeReply) GetMessageName() string { return "one_show_pitr_mode_reply" } +func (*OneShowPitrModeReply) GetCrcString() string { return "f15abb16" } +func (*OneShowPitrModeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneShowPitrModeReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.IsEnable + return size +} +func (m *OneShowPitrModeReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBool(m.IsEnable) + return buf.Bytes(), nil +} +func (m *OneShowPitrModeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.IsEnable = buf.DecodeBool() + return nil +} + +// OneShowXtrMode defines message 'one_show_xtr_mode'. +type OneShowXtrMode struct{} + +func (m *OneShowXtrMode) Reset() { *m = OneShowXtrMode{} } +func (*OneShowXtrMode) GetMessageName() string { return "one_show_xtr_mode" } +func (*OneShowXtrMode) GetCrcString() string { return "51077d14" } +func (*OneShowXtrMode) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneShowXtrMode) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *OneShowXtrMode) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *OneShowXtrMode) Unmarshal(b []byte) error { + return nil +} + +// OneShowXtrModeReply defines message 'one_show_xtr_mode_reply'. +type OneShowXtrModeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IsEnable bool `binapi:"bool,name=is_enable" json:"is_enable,omitempty"` +} + +func (m *OneShowXtrModeReply) Reset() { *m = OneShowXtrModeReply{} } +func (*OneShowXtrModeReply) GetMessageName() string { return "one_show_xtr_mode_reply" } +func (*OneShowXtrModeReply) GetCrcString() string { return "f15abb16" } +func (*OneShowXtrModeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneShowXtrModeReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.IsEnable + return size +} +func (m *OneShowXtrModeReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBool(m.IsEnable) + return buf.Bytes(), nil +} +func (m *OneShowXtrModeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.IsEnable = buf.DecodeBool() + return nil +} + +// OneStatsDetails defines message 'one_stats_details'. +type OneStatsDetails struct { + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + Deid lisp_types.Eid `binapi:"eid,name=deid" json:"deid,omitempty"` + Seid lisp_types.Eid `binapi:"eid,name=seid" json:"seid,omitempty"` + Rloc ip_types.Address `binapi:"address,name=rloc" json:"rloc,omitempty"` + Lloc ip_types.Address `binapi:"address,name=lloc" json:"lloc,omitempty"` + PktCount uint32 `binapi:"u32,name=pkt_count" json:"pkt_count,omitempty"` + Bytes uint32 `binapi:"u32,name=bytes" json:"bytes,omitempty"` +} + +func (m *OneStatsDetails) Reset() { *m = OneStatsDetails{} } +func (*OneStatsDetails) GetMessageName() string { return "one_stats_details" } +func (*OneStatsDetails) GetCrcString() string { return "ff6ef238" } +func (*OneStatsDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneStatsDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Vni + size += 1 // m.Deid.Type + size += 1 * 6 // m.Deid.Address + size += 1 // m.Seid.Type + size += 1 * 6 // m.Seid.Address + size += 1 // m.Rloc.Af + size += 1 * 16 // m.Rloc.Un + size += 1 // m.Lloc.Af + size += 1 * 16 // m.Lloc.Un + size += 4 // m.PktCount + size += 4 // m.Bytes + return size +} +func (m *OneStatsDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Vni)) + buf.EncodeUint8(uint8(m.Deid.Type)) + buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Seid.Type)) + buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Rloc.Af)) + buf.EncodeBytes(m.Rloc.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Lloc.Af)) + buf.EncodeBytes(m.Lloc.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.PktCount)) + buf.EncodeUint32(uint32(m.Bytes)) + return buf.Bytes(), nil +} +func (m *OneStatsDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Vni = buf.DecodeUint32() + m.Deid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Deid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + m.Seid.Type = lisp_types.EidType(buf.DecodeUint8()) + copy(m.Seid.Address.XXX_UnionData[:], buf.DecodeBytes(6)) + m.Rloc.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Rloc.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Lloc.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Lloc.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.PktCount = buf.DecodeUint32() + m.Bytes = buf.DecodeUint32() + return nil +} + +// OneStatsDump defines message 'one_stats_dump'. +type OneStatsDump struct{} + +func (m *OneStatsDump) Reset() { *m = OneStatsDump{} } +func (*OneStatsDump) GetMessageName() string { return "one_stats_dump" } +func (*OneStatsDump) GetCrcString() string { return "51077d14" } +func (*OneStatsDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneStatsDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *OneStatsDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *OneStatsDump) Unmarshal(b []byte) error { + return nil +} + +// OneStatsEnableDisable defines message 'one_stats_enable_disable'. +type OneStatsEnableDisable struct { + IsEnable bool `binapi:"bool,name=is_enable,default=true" json:"is_enable,omitempty"` +} + +func (m *OneStatsEnableDisable) Reset() { *m = OneStatsEnableDisable{} } +func (*OneStatsEnableDisable) GetMessageName() string { return "one_stats_enable_disable" } +func (*OneStatsEnableDisable) GetCrcString() string { return "c264d7bf" } +func (*OneStatsEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneStatsEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsEnable + return size +} +func (m *OneStatsEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsEnable) + return buf.Bytes(), nil +} +func (m *OneStatsEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsEnable = buf.DecodeBool() + return nil +} + +// OneStatsEnableDisableReply defines message 'one_stats_enable_disable_reply'. +type OneStatsEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneStatsEnableDisableReply) Reset() { *m = OneStatsEnableDisableReply{} } +func (*OneStatsEnableDisableReply) GetMessageName() string { return "one_stats_enable_disable_reply" } +func (*OneStatsEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*OneStatsEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneStatsEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneStatsEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneStatsEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OneStatsFlush defines message 'one_stats_flush'. +type OneStatsFlush struct{} + +func (m *OneStatsFlush) Reset() { *m = OneStatsFlush{} } +func (*OneStatsFlush) GetMessageName() string { return "one_stats_flush" } +func (*OneStatsFlush) GetCrcString() string { return "51077d14" } +func (*OneStatsFlush) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneStatsFlush) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *OneStatsFlush) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *OneStatsFlush) Unmarshal(b []byte) error { + return nil +} + +// OneStatsFlushReply defines message 'one_stats_flush_reply'. +type OneStatsFlushReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneStatsFlushReply) Reset() { *m = OneStatsFlushReply{} } +func (*OneStatsFlushReply) GetMessageName() string { return "one_stats_flush_reply" } +func (*OneStatsFlushReply) GetCrcString() string { return "e8d4e804" } +func (*OneStatsFlushReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneStatsFlushReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneStatsFlushReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneStatsFlushReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OneUsePetr defines message 'one_use_petr'. +type OneUsePetr struct { + IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` +} + +func (m *OneUsePetr) Reset() { *m = OneUsePetr{} } +func (*OneUsePetr) GetMessageName() string { return "one_use_petr" } +func (*OneUsePetr) GetCrcString() string { return "9e141831" } +func (*OneUsePetr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OneUsePetr) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IPAddress.Af + size += 1 * 16 // m.IPAddress.Un + size += 1 // m.IsAdd + return size +} +func (m *OneUsePetr) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.IPAddress.Af)) + buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *OneUsePetr) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.IsAdd = buf.DecodeBool() + return nil +} + +// OneUsePetrReply defines message 'one_use_petr_reply'. +type OneUsePetrReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OneUsePetrReply) Reset() { *m = OneUsePetrReply{} } +func (*OneUsePetrReply) GetMessageName() string { return "one_use_petr_reply" } +func (*OneUsePetrReply) GetCrcString() string { return "e8d4e804" } +func (*OneUsePetrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OneUsePetrReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OneUsePetrReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OneUsePetrReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// ShowOneMapRegisterFallbackThreshold defines message 'show_one_map_register_fallback_threshold'. +type ShowOneMapRegisterFallbackThreshold struct{} + +func (m *ShowOneMapRegisterFallbackThreshold) Reset() { *m = ShowOneMapRegisterFallbackThreshold{} } +func (*ShowOneMapRegisterFallbackThreshold) GetMessageName() string { + return "show_one_map_register_fallback_threshold" +} +func (*ShowOneMapRegisterFallbackThreshold) GetCrcString() string { return "51077d14" } +func (*ShowOneMapRegisterFallbackThreshold) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ShowOneMapRegisterFallbackThreshold) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowOneMapRegisterFallbackThreshold) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ShowOneMapRegisterFallbackThreshold) Unmarshal(b []byte) error { + return nil +} + +// ShowOneMapRegisterFallbackThresholdReply defines message 'show_one_map_register_fallback_threshold_reply'. +type ShowOneMapRegisterFallbackThresholdReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Value uint32 `binapi:"u32,name=value" json:"value,omitempty"` +} + +func (m *ShowOneMapRegisterFallbackThresholdReply) Reset() { + *m = ShowOneMapRegisterFallbackThresholdReply{} +} +func (*ShowOneMapRegisterFallbackThresholdReply) GetMessageName() string { + return "show_one_map_register_fallback_threshold_reply" +} +func (*ShowOneMapRegisterFallbackThresholdReply) GetCrcString() string { return "c93a9113" } +func (*ShowOneMapRegisterFallbackThresholdReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ShowOneMapRegisterFallbackThresholdReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.Value + return size +} +func (m *ShowOneMapRegisterFallbackThresholdReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.Value)) + return buf.Bytes(), nil +} +func (m *ShowOneMapRegisterFallbackThresholdReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Value = buf.DecodeUint32() + return nil +} + +// ShowOneMapRegisterState defines message 'show_one_map_register_state'. +type ShowOneMapRegisterState struct{} + +func (m *ShowOneMapRegisterState) Reset() { *m = ShowOneMapRegisterState{} } +func (*ShowOneMapRegisterState) GetMessageName() string { return "show_one_map_register_state" } +func (*ShowOneMapRegisterState) GetCrcString() string { return "51077d14" } +func (*ShowOneMapRegisterState) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ShowOneMapRegisterState) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowOneMapRegisterState) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ShowOneMapRegisterState) Unmarshal(b []byte) error { + return nil +} + +// ShowOneMapRegisterStateReply defines message 'show_one_map_register_state_reply'. +type ShowOneMapRegisterStateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IsEnable bool `binapi:"bool,name=is_enable" json:"is_enable,omitempty"` +} + +func (m *ShowOneMapRegisterStateReply) Reset() { *m = ShowOneMapRegisterStateReply{} } +func (*ShowOneMapRegisterStateReply) GetMessageName() string { + return "show_one_map_register_state_reply" +} +func (*ShowOneMapRegisterStateReply) GetCrcString() string { return "f15abb16" } +func (*ShowOneMapRegisterStateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ShowOneMapRegisterStateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.IsEnable + return size +} +func (m *ShowOneMapRegisterStateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBool(m.IsEnable) + return buf.Bytes(), nil +} +func (m *ShowOneMapRegisterStateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.IsEnable = buf.DecodeBool() + return nil +} + +// ShowOneMapRegisterTTL defines message 'show_one_map_register_ttl'. +type ShowOneMapRegisterTTL struct{} + +func (m *ShowOneMapRegisterTTL) Reset() { *m = ShowOneMapRegisterTTL{} } +func (*ShowOneMapRegisterTTL) GetMessageName() string { return "show_one_map_register_ttl" } +func (*ShowOneMapRegisterTTL) GetCrcString() string { return "51077d14" } +func (*ShowOneMapRegisterTTL) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ShowOneMapRegisterTTL) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowOneMapRegisterTTL) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ShowOneMapRegisterTTL) Unmarshal(b []byte) error { + return nil +} + +// ShowOneMapRegisterTTLReply defines message 'show_one_map_register_ttl_reply'. +type ShowOneMapRegisterTTLReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + TTL uint32 `binapi:"u32,name=ttl" json:"ttl,omitempty"` +} + +func (m *ShowOneMapRegisterTTLReply) Reset() { *m = ShowOneMapRegisterTTLReply{} } +func (*ShowOneMapRegisterTTLReply) GetMessageName() string { return "show_one_map_register_ttl_reply" } +func (*ShowOneMapRegisterTTLReply) GetCrcString() string { return "fa83dd66" } +func (*ShowOneMapRegisterTTLReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ShowOneMapRegisterTTLReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.TTL + return size +} +func (m *ShowOneMapRegisterTTLReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.TTL)) + return buf.Bytes(), nil +} +func (m *ShowOneMapRegisterTTLReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.TTL = buf.DecodeUint32() + return nil +} + +// ShowOneMapRequestMode defines message 'show_one_map_request_mode'. +type ShowOneMapRequestMode struct{} + +func (m *ShowOneMapRequestMode) Reset() { *m = ShowOneMapRequestMode{} } +func (*ShowOneMapRequestMode) GetMessageName() string { return "show_one_map_request_mode" } +func (*ShowOneMapRequestMode) GetCrcString() string { return "51077d14" } +func (*ShowOneMapRequestMode) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ShowOneMapRequestMode) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowOneMapRequestMode) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ShowOneMapRequestMode) Unmarshal(b []byte) error { + return nil +} + +// ShowOneMapRequestModeReply defines message 'show_one_map_request_mode_reply'. +type ShowOneMapRequestModeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Mode OneMapMode `binapi:"one_map_mode,name=mode" json:"mode,omitempty"` +} + +func (m *ShowOneMapRequestModeReply) Reset() { *m = ShowOneMapRequestModeReply{} } +func (*ShowOneMapRequestModeReply) GetMessageName() string { return "show_one_map_request_mode_reply" } +func (*ShowOneMapRequestModeReply) GetCrcString() string { return "d41f3c1d" } +func (*ShowOneMapRequestModeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ShowOneMapRequestModeReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.Mode + return size +} +func (m *ShowOneMapRequestModeReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.Mode)) + return buf.Bytes(), nil +} +func (m *ShowOneMapRequestModeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Mode = OneMapMode(buf.DecodeUint32()) + return nil +} + +// ShowOneNshMapping defines message 'show_one_nsh_mapping'. +type ShowOneNshMapping struct{} + +func (m *ShowOneNshMapping) Reset() { *m = ShowOneNshMapping{} } +func (*ShowOneNshMapping) GetMessageName() string { return "show_one_nsh_mapping" } +func (*ShowOneNshMapping) GetCrcString() string { return "51077d14" } +func (*ShowOneNshMapping) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ShowOneNshMapping) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowOneNshMapping) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ShowOneNshMapping) Unmarshal(b []byte) error { + return nil +} + +// ShowOneNshMappingReply defines message 'show_one_nsh_mapping_reply'. +type ShowOneNshMappingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IsSet bool `binapi:"bool,name=is_set" json:"is_set,omitempty"` + LocatorSetName string `binapi:"string[64],name=locator_set_name" json:"locator_set_name,omitempty"` +} + +func (m *ShowOneNshMappingReply) Reset() { *m = ShowOneNshMappingReply{} } +func (*ShowOneNshMappingReply) GetMessageName() string { return "show_one_nsh_mapping_reply" } +func (*ShowOneNshMappingReply) GetCrcString() string { return "46478c02" } +func (*ShowOneNshMappingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ShowOneNshMappingReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.IsSet + size += 64 // m.LocatorSetName + return size +} +func (m *ShowOneNshMappingReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBool(m.IsSet) + buf.EncodeString(m.LocatorSetName, 64) + return buf.Bytes(), nil +} +func (m *ShowOneNshMappingReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.IsSet = buf.DecodeBool() + m.LocatorSetName = buf.DecodeString(64) + return nil +} + +// ShowOnePitr defines message 'show_one_pitr'. +type ShowOnePitr struct{} + +func (m *ShowOnePitr) Reset() { *m = ShowOnePitr{} } +func (*ShowOnePitr) GetMessageName() string { return "show_one_pitr" } +func (*ShowOnePitr) GetCrcString() string { return "51077d14" } +func (*ShowOnePitr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ShowOnePitr) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowOnePitr) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ShowOnePitr) Unmarshal(b []byte) error { + return nil +} + +// ShowOnePitrReply defines message 'show_one_pitr_reply'. +type ShowOnePitrReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Status bool `binapi:"bool,name=status" json:"status,omitempty"` + LocatorSetName string `binapi:"string[64],name=locator_set_name" json:"locator_set_name,omitempty"` +} + +func (m *ShowOnePitrReply) Reset() { *m = ShowOnePitrReply{} } +func (*ShowOnePitrReply) GetMessageName() string { return "show_one_pitr_reply" } +func (*ShowOnePitrReply) GetCrcString() string { return "a2d1a49f" } +func (*ShowOnePitrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ShowOnePitrReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.Status + size += 64 // m.LocatorSetName + return size +} +func (m *ShowOnePitrReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBool(m.Status) + buf.EncodeString(m.LocatorSetName, 64) + return buf.Bytes(), nil +} +func (m *ShowOnePitrReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Status = buf.DecodeBool() + m.LocatorSetName = buf.DecodeString(64) + return nil +} + +// ShowOneRlocProbeState defines message 'show_one_rloc_probe_state'. +type ShowOneRlocProbeState struct{} + +func (m *ShowOneRlocProbeState) Reset() { *m = ShowOneRlocProbeState{} } +func (*ShowOneRlocProbeState) GetMessageName() string { return "show_one_rloc_probe_state" } +func (*ShowOneRlocProbeState) GetCrcString() string { return "51077d14" } +func (*ShowOneRlocProbeState) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ShowOneRlocProbeState) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowOneRlocProbeState) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ShowOneRlocProbeState) Unmarshal(b []byte) error { + return nil +} + +// ShowOneRlocProbeStateReply defines message 'show_one_rloc_probe_state_reply'. +type ShowOneRlocProbeStateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IsEnable bool `binapi:"bool,name=is_enable" json:"is_enable,omitempty"` +} + +func (m *ShowOneRlocProbeStateReply) Reset() { *m = ShowOneRlocProbeStateReply{} } +func (*ShowOneRlocProbeStateReply) GetMessageName() string { return "show_one_rloc_probe_state_reply" } +func (*ShowOneRlocProbeStateReply) GetCrcString() string { return "f15abb16" } +func (*ShowOneRlocProbeStateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ShowOneRlocProbeStateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.IsEnable + return size +} +func (m *ShowOneRlocProbeStateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBool(m.IsEnable) + return buf.Bytes(), nil +} +func (m *ShowOneRlocProbeStateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.IsEnable = buf.DecodeBool() + return nil +} + +// ShowOneStatsEnableDisable defines message 'show_one_stats_enable_disable'. +type ShowOneStatsEnableDisable struct{} + +func (m *ShowOneStatsEnableDisable) Reset() { *m = ShowOneStatsEnableDisable{} } +func (*ShowOneStatsEnableDisable) GetMessageName() string { return "show_one_stats_enable_disable" } +func (*ShowOneStatsEnableDisable) GetCrcString() string { return "51077d14" } +func (*ShowOneStatsEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ShowOneStatsEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowOneStatsEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ShowOneStatsEnableDisable) Unmarshal(b []byte) error { + return nil +} + +// ShowOneStatsEnableDisableReply defines message 'show_one_stats_enable_disable_reply'. +type ShowOneStatsEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IsEnable bool `binapi:"bool,name=is_enable" json:"is_enable,omitempty"` +} + +func (m *ShowOneStatsEnableDisableReply) Reset() { *m = ShowOneStatsEnableDisableReply{} } +func (*ShowOneStatsEnableDisableReply) GetMessageName() string { + return "show_one_stats_enable_disable_reply" +} +func (*ShowOneStatsEnableDisableReply) GetCrcString() string { return "f15abb16" } +func (*ShowOneStatsEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ShowOneStatsEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.IsEnable + return size +} +func (m *ShowOneStatsEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBool(m.IsEnable) + return buf.Bytes(), nil +} +func (m *ShowOneStatsEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.IsEnable = buf.DecodeBool() + return nil +} + +// ShowOneStatus defines message 'show_one_status'. +type ShowOneStatus struct{} + +func (m *ShowOneStatus) Reset() { *m = ShowOneStatus{} } +func (*ShowOneStatus) GetMessageName() string { return "show_one_status" } +func (*ShowOneStatus) GetCrcString() string { return "51077d14" } +func (*ShowOneStatus) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ShowOneStatus) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowOneStatus) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ShowOneStatus) Unmarshal(b []byte) error { + return nil +} + +// ShowOneStatusReply defines message 'show_one_status_reply'. +type ShowOneStatusReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + FeatureStatus bool `binapi:"bool,name=feature_status" json:"feature_status,omitempty"` + GpeStatus bool `binapi:"bool,name=gpe_status" json:"gpe_status,omitempty"` +} + +func (m *ShowOneStatusReply) Reset() { *m = ShowOneStatusReply{} } +func (*ShowOneStatusReply) GetMessageName() string { return "show_one_status_reply" } +func (*ShowOneStatusReply) GetCrcString() string { return "961bb25b" } +func (*ShowOneStatusReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ShowOneStatusReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.FeatureStatus + size += 1 // m.GpeStatus + return size +} +func (m *ShowOneStatusReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBool(m.FeatureStatus) + buf.EncodeBool(m.GpeStatus) + return buf.Bytes(), nil +} +func (m *ShowOneStatusReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.FeatureStatus = buf.DecodeBool() + m.GpeStatus = buf.DecodeBool() + return nil +} + +// ShowOneUsePetr defines message 'show_one_use_petr'. +type ShowOneUsePetr struct{} + +func (m *ShowOneUsePetr) Reset() { *m = ShowOneUsePetr{} } +func (*ShowOneUsePetr) GetMessageName() string { return "show_one_use_petr" } +func (*ShowOneUsePetr) GetCrcString() string { return "51077d14" } +func (*ShowOneUsePetr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ShowOneUsePetr) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowOneUsePetr) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ShowOneUsePetr) Unmarshal(b []byte) error { + return nil +} + +// ShowOneUsePetrReply defines message 'show_one_use_petr_reply'. +type ShowOneUsePetrReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Status bool `binapi:"bool,name=status" json:"status,omitempty"` + IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"` +} + +func (m *ShowOneUsePetrReply) Reset() { *m = ShowOneUsePetrReply{} } +func (*ShowOneUsePetrReply) GetMessageName() string { return "show_one_use_petr_reply" } +func (*ShowOneUsePetrReply) GetCrcString() string { return "10e744a6" } +func (*ShowOneUsePetrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ShowOneUsePetrReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.Status + size += 1 // m.IPAddress.Af + size += 1 * 16 // m.IPAddress.Un + return size +} +func (m *ShowOneUsePetrReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBool(m.Status) + buf.EncodeUint8(uint8(m.IPAddress.Af)) + buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *ShowOneUsePetrReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Status = buf.DecodeBool() + m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +func init() { file_one_binapi_init() } +func file_one_binapi_init() { + api.RegisterMessage((*OneAddDelAdjacency)(nil), "one_add_del_adjacency_e48e7afe") + api.RegisterMessage((*OneAddDelAdjacencyReply)(nil), "one_add_del_adjacency_reply_e8d4e804") + api.RegisterMessage((*OneAddDelL2ArpEntry)(nil), "one_add_del_l2_arp_entry_33209078") + api.RegisterMessage((*OneAddDelL2ArpEntryReply)(nil), "one_add_del_l2_arp_entry_reply_e8d4e804") + api.RegisterMessage((*OneAddDelLocalEid)(nil), "one_add_del_local_eid_21f573bd") + api.RegisterMessage((*OneAddDelLocalEidReply)(nil), "one_add_del_local_eid_reply_e8d4e804") + api.RegisterMessage((*OneAddDelLocator)(nil), "one_add_del_locator_af4d8f13") + api.RegisterMessage((*OneAddDelLocatorReply)(nil), "one_add_del_locator_reply_e8d4e804") + api.RegisterMessage((*OneAddDelLocatorSet)(nil), "one_add_del_locator_set_6fcd6471") + api.RegisterMessage((*OneAddDelLocatorSetReply)(nil), "one_add_del_locator_set_reply_b6666db4") + api.RegisterMessage((*OneAddDelMapRequestItrRlocs)(nil), "one_add_del_map_request_itr_rlocs_6be88e45") + api.RegisterMessage((*OneAddDelMapRequestItrRlocsReply)(nil), "one_add_del_map_request_itr_rlocs_reply_e8d4e804") + api.RegisterMessage((*OneAddDelMapResolver)(nil), "one_add_del_map_resolver_6598ea7c") + api.RegisterMessage((*OneAddDelMapResolverReply)(nil), "one_add_del_map_resolver_reply_e8d4e804") + api.RegisterMessage((*OneAddDelMapServer)(nil), "one_add_del_map_server_6598ea7c") + api.RegisterMessage((*OneAddDelMapServerReply)(nil), "one_add_del_map_server_reply_e8d4e804") + api.RegisterMessage((*OneAddDelNdpEntry)(nil), "one_add_del_ndp_entry_d1629a2f") + api.RegisterMessage((*OneAddDelNdpEntryReply)(nil), "one_add_del_ndp_entry_reply_e8d4e804") + api.RegisterMessage((*OneAddDelRemoteMapping)(nil), "one_add_del_remote_mapping_fae8ed77") + api.RegisterMessage((*OneAddDelRemoteMappingReply)(nil), "one_add_del_remote_mapping_reply_e8d4e804") + api.RegisterMessage((*OneAdjacenciesGet)(nil), "one_adjacencies_get_8d1f2fe9") + api.RegisterMessage((*OneAdjacenciesGetReply)(nil), "one_adjacencies_get_reply_a8ed89a5") + api.RegisterMessage((*OneEidTableAddDelMap)(nil), "one_eid_table_add_del_map_9481416b") + api.RegisterMessage((*OneEidTableAddDelMapReply)(nil), "one_eid_table_add_del_map_reply_e8d4e804") + api.RegisterMessage((*OneEidTableDetails)(nil), "one_eid_table_details_4bc32e3a") + api.RegisterMessage((*OneEidTableDump)(nil), "one_eid_table_dump_95151038") + api.RegisterMessage((*OneEidTableMapDetails)(nil), "one_eid_table_map_details_0b6859e2") + api.RegisterMessage((*OneEidTableMapDump)(nil), "one_eid_table_map_dump_d6cf0c3d") + api.RegisterMessage((*OneEidTableVniDetails)(nil), "one_eid_table_vni_details_64abc01e") + api.RegisterMessage((*OneEidTableVniDump)(nil), "one_eid_table_vni_dump_51077d14") + api.RegisterMessage((*OneEnableDisable)(nil), "one_enable_disable_c264d7bf") + api.RegisterMessage((*OneEnableDisablePetrMode)(nil), "one_enable_disable_petr_mode_c264d7bf") + api.RegisterMessage((*OneEnableDisablePetrModeReply)(nil), "one_enable_disable_petr_mode_reply_e8d4e804") + api.RegisterMessage((*OneEnableDisablePitrMode)(nil), "one_enable_disable_pitr_mode_c264d7bf") + api.RegisterMessage((*OneEnableDisablePitrModeReply)(nil), "one_enable_disable_pitr_mode_reply_e8d4e804") + api.RegisterMessage((*OneEnableDisableReply)(nil), "one_enable_disable_reply_e8d4e804") + api.RegisterMessage((*OneEnableDisableXtrMode)(nil), "one_enable_disable_xtr_mode_c264d7bf") + api.RegisterMessage((*OneEnableDisableXtrModeReply)(nil), "one_enable_disable_xtr_mode_reply_e8d4e804") + api.RegisterMessage((*OneGetMapRequestItrRlocs)(nil), "one_get_map_request_itr_rlocs_51077d14") + api.RegisterMessage((*OneGetMapRequestItrRlocsReply)(nil), "one_get_map_request_itr_rlocs_reply_76580f3a") + api.RegisterMessage((*OneGetTransportProtocol)(nil), "one_get_transport_protocol_51077d14") + api.RegisterMessage((*OneGetTransportProtocolReply)(nil), "one_get_transport_protocol_reply_62a28eb3") + api.RegisterMessage((*OneL2ArpBdGet)(nil), "one_l2_arp_bd_get_51077d14") + api.RegisterMessage((*OneL2ArpBdGetReply)(nil), "one_l2_arp_bd_get_reply_221ac888") + api.RegisterMessage((*OneL2ArpEntriesGet)(nil), "one_l2_arp_entries_get_4d418cf4") + api.RegisterMessage((*OneL2ArpEntriesGetReply)(nil), "one_l2_arp_entries_get_reply_b0a47bbe") + api.RegisterMessage((*OneLocatorDetails)(nil), "one_locator_details_c0c4c2a7") + api.RegisterMessage((*OneLocatorDump)(nil), "one_locator_dump_9b11076c") + api.RegisterMessage((*OneLocatorSetDetails)(nil), "one_locator_set_details_5b33a105") + api.RegisterMessage((*OneLocatorSetDump)(nil), "one_locator_set_dump_71190768") + api.RegisterMessage((*OneMapRegisterEnableDisable)(nil), "one_map_register_enable_disable_c264d7bf") + api.RegisterMessage((*OneMapRegisterEnableDisableReply)(nil), "one_map_register_enable_disable_reply_e8d4e804") + api.RegisterMessage((*OneMapRegisterFallbackThreshold)(nil), "one_map_register_fallback_threshold_f7d4a475") + api.RegisterMessage((*OneMapRegisterFallbackThresholdReply)(nil), "one_map_register_fallback_threshold_reply_e8d4e804") + api.RegisterMessage((*OneMapRegisterSetTTL)(nil), "one_map_register_set_ttl_dd59f1f3") + api.RegisterMessage((*OneMapRegisterSetTTLReply)(nil), "one_map_register_set_ttl_reply_e8d4e804") + api.RegisterMessage((*OneMapRequestMode)(nil), "one_map_request_mode_ffa5d2f5") + api.RegisterMessage((*OneMapRequestModeReply)(nil), "one_map_request_mode_reply_e8d4e804") + api.RegisterMessage((*OneMapResolverDetails)(nil), "one_map_resolver_details_82a09deb") + api.RegisterMessage((*OneMapResolverDump)(nil), "one_map_resolver_dump_51077d14") + api.RegisterMessage((*OneMapServerDetails)(nil), "one_map_server_details_82a09deb") + api.RegisterMessage((*OneMapServerDump)(nil), "one_map_server_dump_51077d14") + api.RegisterMessage((*OneNdpBdGet)(nil), "one_ndp_bd_get_51077d14") + api.RegisterMessage((*OneNdpBdGetReply)(nil), "one_ndp_bd_get_reply_221ac888") + api.RegisterMessage((*OneNdpEntriesGet)(nil), "one_ndp_entries_get_4d418cf4") + api.RegisterMessage((*OneNdpEntriesGetReply)(nil), "one_ndp_entries_get_reply_0bd34161") + api.RegisterMessage((*OneNshSetLocatorSet)(nil), "one_nsh_set_locator_set_486e2b76") + api.RegisterMessage((*OneNshSetLocatorSetReply)(nil), "one_nsh_set_locator_set_reply_e8d4e804") + api.RegisterMessage((*OnePitrSetLocatorSet)(nil), "one_pitr_set_locator_set_486e2b76") + api.RegisterMessage((*OnePitrSetLocatorSetReply)(nil), "one_pitr_set_locator_set_reply_e8d4e804") + api.RegisterMessage((*OneRlocProbeEnableDisable)(nil), "one_rloc_probe_enable_disable_c264d7bf") + api.RegisterMessage((*OneRlocProbeEnableDisableReply)(nil), "one_rloc_probe_enable_disable_reply_e8d4e804") + api.RegisterMessage((*OneSetTransportProtocol)(nil), "one_set_transport_protocol_07b6b85f") + api.RegisterMessage((*OneSetTransportProtocolReply)(nil), "one_set_transport_protocol_reply_e8d4e804") + api.RegisterMessage((*OneShowPetrMode)(nil), "one_show_petr_mode_51077d14") + api.RegisterMessage((*OneShowPetrModeReply)(nil), "one_show_petr_mode_reply_f15abb16") + api.RegisterMessage((*OneShowPitrMode)(nil), "one_show_pitr_mode_51077d14") + api.RegisterMessage((*OneShowPitrModeReply)(nil), "one_show_pitr_mode_reply_f15abb16") + api.RegisterMessage((*OneShowXtrMode)(nil), "one_show_xtr_mode_51077d14") + api.RegisterMessage((*OneShowXtrModeReply)(nil), "one_show_xtr_mode_reply_f15abb16") + api.RegisterMessage((*OneStatsDetails)(nil), "one_stats_details_ff6ef238") + api.RegisterMessage((*OneStatsDump)(nil), "one_stats_dump_51077d14") + api.RegisterMessage((*OneStatsEnableDisable)(nil), "one_stats_enable_disable_c264d7bf") + api.RegisterMessage((*OneStatsEnableDisableReply)(nil), "one_stats_enable_disable_reply_e8d4e804") + api.RegisterMessage((*OneStatsFlush)(nil), "one_stats_flush_51077d14") + api.RegisterMessage((*OneStatsFlushReply)(nil), "one_stats_flush_reply_e8d4e804") + api.RegisterMessage((*OneUsePetr)(nil), "one_use_petr_9e141831") + api.RegisterMessage((*OneUsePetrReply)(nil), "one_use_petr_reply_e8d4e804") + api.RegisterMessage((*ShowOneMapRegisterFallbackThreshold)(nil), "show_one_map_register_fallback_threshold_51077d14") + api.RegisterMessage((*ShowOneMapRegisterFallbackThresholdReply)(nil), "show_one_map_register_fallback_threshold_reply_c93a9113") + api.RegisterMessage((*ShowOneMapRegisterState)(nil), "show_one_map_register_state_51077d14") + api.RegisterMessage((*ShowOneMapRegisterStateReply)(nil), "show_one_map_register_state_reply_f15abb16") + api.RegisterMessage((*ShowOneMapRegisterTTL)(nil), "show_one_map_register_ttl_51077d14") + api.RegisterMessage((*ShowOneMapRegisterTTLReply)(nil), "show_one_map_register_ttl_reply_fa83dd66") + api.RegisterMessage((*ShowOneMapRequestMode)(nil), "show_one_map_request_mode_51077d14") + api.RegisterMessage((*ShowOneMapRequestModeReply)(nil), "show_one_map_request_mode_reply_d41f3c1d") + api.RegisterMessage((*ShowOneNshMapping)(nil), "show_one_nsh_mapping_51077d14") + api.RegisterMessage((*ShowOneNshMappingReply)(nil), "show_one_nsh_mapping_reply_46478c02") + api.RegisterMessage((*ShowOnePitr)(nil), "show_one_pitr_51077d14") + api.RegisterMessage((*ShowOnePitrReply)(nil), "show_one_pitr_reply_a2d1a49f") + api.RegisterMessage((*ShowOneRlocProbeState)(nil), "show_one_rloc_probe_state_51077d14") + api.RegisterMessage((*ShowOneRlocProbeStateReply)(nil), "show_one_rloc_probe_state_reply_f15abb16") + api.RegisterMessage((*ShowOneStatsEnableDisable)(nil), "show_one_stats_enable_disable_51077d14") + api.RegisterMessage((*ShowOneStatsEnableDisableReply)(nil), "show_one_stats_enable_disable_reply_f15abb16") + api.RegisterMessage((*ShowOneStatus)(nil), "show_one_status_51077d14") + api.RegisterMessage((*ShowOneStatusReply)(nil), "show_one_status_reply_961bb25b") + api.RegisterMessage((*ShowOneUsePetr)(nil), "show_one_use_petr_51077d14") + api.RegisterMessage((*ShowOneUsePetrReply)(nil), "show_one_use_petr_reply_10e744a6") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*OneAddDelAdjacency)(nil), + (*OneAddDelAdjacencyReply)(nil), + (*OneAddDelL2ArpEntry)(nil), + (*OneAddDelL2ArpEntryReply)(nil), + (*OneAddDelLocalEid)(nil), + (*OneAddDelLocalEidReply)(nil), + (*OneAddDelLocator)(nil), + (*OneAddDelLocatorReply)(nil), + (*OneAddDelLocatorSet)(nil), + (*OneAddDelLocatorSetReply)(nil), + (*OneAddDelMapRequestItrRlocs)(nil), + (*OneAddDelMapRequestItrRlocsReply)(nil), + (*OneAddDelMapResolver)(nil), + (*OneAddDelMapResolverReply)(nil), + (*OneAddDelMapServer)(nil), + (*OneAddDelMapServerReply)(nil), + (*OneAddDelNdpEntry)(nil), + (*OneAddDelNdpEntryReply)(nil), + (*OneAddDelRemoteMapping)(nil), + (*OneAddDelRemoteMappingReply)(nil), + (*OneAdjacenciesGet)(nil), + (*OneAdjacenciesGetReply)(nil), + (*OneEidTableAddDelMap)(nil), + (*OneEidTableAddDelMapReply)(nil), + (*OneEidTableDetails)(nil), + (*OneEidTableDump)(nil), + (*OneEidTableMapDetails)(nil), + (*OneEidTableMapDump)(nil), + (*OneEidTableVniDetails)(nil), + (*OneEidTableVniDump)(nil), + (*OneEnableDisable)(nil), + (*OneEnableDisablePetrMode)(nil), + (*OneEnableDisablePetrModeReply)(nil), + (*OneEnableDisablePitrMode)(nil), + (*OneEnableDisablePitrModeReply)(nil), + (*OneEnableDisableReply)(nil), + (*OneEnableDisableXtrMode)(nil), + (*OneEnableDisableXtrModeReply)(nil), + (*OneGetMapRequestItrRlocs)(nil), + (*OneGetMapRequestItrRlocsReply)(nil), + (*OneGetTransportProtocol)(nil), + (*OneGetTransportProtocolReply)(nil), + (*OneL2ArpBdGet)(nil), + (*OneL2ArpBdGetReply)(nil), + (*OneL2ArpEntriesGet)(nil), + (*OneL2ArpEntriesGetReply)(nil), + (*OneLocatorDetails)(nil), + (*OneLocatorDump)(nil), + (*OneLocatorSetDetails)(nil), + (*OneLocatorSetDump)(nil), + (*OneMapRegisterEnableDisable)(nil), + (*OneMapRegisterEnableDisableReply)(nil), + (*OneMapRegisterFallbackThreshold)(nil), + (*OneMapRegisterFallbackThresholdReply)(nil), + (*OneMapRegisterSetTTL)(nil), + (*OneMapRegisterSetTTLReply)(nil), + (*OneMapRequestMode)(nil), + (*OneMapRequestModeReply)(nil), + (*OneMapResolverDetails)(nil), + (*OneMapResolverDump)(nil), + (*OneMapServerDetails)(nil), + (*OneMapServerDump)(nil), + (*OneNdpBdGet)(nil), + (*OneNdpBdGetReply)(nil), + (*OneNdpEntriesGet)(nil), + (*OneNdpEntriesGetReply)(nil), + (*OneNshSetLocatorSet)(nil), + (*OneNshSetLocatorSetReply)(nil), + (*OnePitrSetLocatorSet)(nil), + (*OnePitrSetLocatorSetReply)(nil), + (*OneRlocProbeEnableDisable)(nil), + (*OneRlocProbeEnableDisableReply)(nil), + (*OneSetTransportProtocol)(nil), + (*OneSetTransportProtocolReply)(nil), + (*OneShowPetrMode)(nil), + (*OneShowPetrModeReply)(nil), + (*OneShowPitrMode)(nil), + (*OneShowPitrModeReply)(nil), + (*OneShowXtrMode)(nil), + (*OneShowXtrModeReply)(nil), + (*OneStatsDetails)(nil), + (*OneStatsDump)(nil), + (*OneStatsEnableDisable)(nil), + (*OneStatsEnableDisableReply)(nil), + (*OneStatsFlush)(nil), + (*OneStatsFlushReply)(nil), + (*OneUsePetr)(nil), + (*OneUsePetrReply)(nil), + (*ShowOneMapRegisterFallbackThreshold)(nil), + (*ShowOneMapRegisterFallbackThresholdReply)(nil), + (*ShowOneMapRegisterState)(nil), + (*ShowOneMapRegisterStateReply)(nil), + (*ShowOneMapRegisterTTL)(nil), + (*ShowOneMapRegisterTTLReply)(nil), + (*ShowOneMapRequestMode)(nil), + (*ShowOneMapRequestModeReply)(nil), + (*ShowOneNshMapping)(nil), + (*ShowOneNshMappingReply)(nil), + (*ShowOnePitr)(nil), + (*ShowOnePitrReply)(nil), + (*ShowOneRlocProbeState)(nil), + (*ShowOneRlocProbeStateReply)(nil), + (*ShowOneStatsEnableDisable)(nil), + (*ShowOneStatsEnableDisableReply)(nil), + (*ShowOneStatus)(nil), + (*ShowOneStatusReply)(nil), + (*ShowOneUsePetr)(nil), + (*ShowOneUsePetrReply)(nil), + } +} diff --git a/binapi/one/one_rest.ba.go b/binapi/one/one_rest.ba.go new file mode 100644 index 0000000..2c3caca --- /dev/null +++ b/binapi/one/one_rest.ba.go @@ -0,0 +1,910 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package one + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/one_add_del_adjacency", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneAddDelAdjacency) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneAddDelAdjacency(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_add_del_l2_arp_entry", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneAddDelL2ArpEntry) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneAddDelL2ArpEntry(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_add_del_local_eid", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneAddDelLocalEid) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneAddDelLocalEid(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_add_del_locator", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneAddDelLocator) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneAddDelLocator(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_add_del_locator_set", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneAddDelLocatorSet) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneAddDelLocatorSet(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_add_del_map_request_itr_rlocs", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneAddDelMapRequestItrRlocs) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneAddDelMapRequestItrRlocs(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_add_del_map_resolver", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneAddDelMapResolver) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneAddDelMapResolver(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_add_del_map_server", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneAddDelMapServer) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneAddDelMapServer(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_add_del_ndp_entry", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneAddDelNdpEntry) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneAddDelNdpEntry(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_add_del_remote_mapping", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneAddDelRemoteMapping) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneAddDelRemoteMapping(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_adjacencies_get", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneAdjacenciesGet) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneAdjacenciesGet(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_eid_table_add_del_map", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneEidTableAddDelMap) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneEidTableAddDelMap(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_enable_disable_petr_mode", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneEnableDisablePetrMode) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneEnableDisablePetrMode(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_enable_disable_pitr_mode", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneEnableDisablePitrMode) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneEnableDisablePitrMode(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_enable_disable_xtr_mode", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneEnableDisableXtrMode) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneEnableDisableXtrMode(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_get_map_request_itr_rlocs", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneGetMapRequestItrRlocs) + reply, err := rpc.OneGetMapRequestItrRlocs(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_get_transport_protocol", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneGetTransportProtocol) + reply, err := rpc.OneGetTransportProtocol(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_l2_arp_bd_get", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneL2ArpBdGet) + reply, err := rpc.OneL2ArpBdGet(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_l2_arp_entries_get", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneL2ArpEntriesGet) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneL2ArpEntriesGet(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_map_register_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneMapRegisterEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneMapRegisterEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_map_register_fallback_threshold", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneMapRegisterFallbackThreshold) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneMapRegisterFallbackThreshold(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_map_register_set_ttl", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneMapRegisterSetTTL) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneMapRegisterSetTTL(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_map_request_mode", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneMapRequestMode) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneMapRequestMode(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_ndp_bd_get", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneNdpBdGet) + reply, err := rpc.OneNdpBdGet(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_ndp_entries_get", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneNdpEntriesGet) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneNdpEntriesGet(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_nsh_set_locator_set", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneNshSetLocatorSet) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneNshSetLocatorSet(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_pitr_set_locator_set", func(w http.ResponseWriter, req *http.Request) { + var request = new(OnePitrSetLocatorSet) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OnePitrSetLocatorSet(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_rloc_probe_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneRlocProbeEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneRlocProbeEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_set_transport_protocol", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneSetTransportProtocol) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneSetTransportProtocol(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_show_petr_mode", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneShowPetrMode) + reply, err := rpc.OneShowPetrMode(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_show_pitr_mode", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneShowPitrMode) + reply, err := rpc.OneShowPitrMode(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_show_xtr_mode", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneShowXtrMode) + reply, err := rpc.OneShowXtrMode(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_stats_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneStatsEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneStatsEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_stats_flush", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneStatsFlush) + reply, err := rpc.OneStatsFlush(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/one_use_petr", func(w http.ResponseWriter, req *http.Request) { + var request = new(OneUsePetr) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OneUsePetr(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/show_one_map_register_fallback_threshold", func(w http.ResponseWriter, req *http.Request) { + var request = new(ShowOneMapRegisterFallbackThreshold) + reply, err := rpc.ShowOneMapRegisterFallbackThreshold(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/show_one_map_register_state", func(w http.ResponseWriter, req *http.Request) { + var request = new(ShowOneMapRegisterState) + reply, err := rpc.ShowOneMapRegisterState(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/show_one_map_register_ttl", func(w http.ResponseWriter, req *http.Request) { + var request = new(ShowOneMapRegisterTTL) + reply, err := rpc.ShowOneMapRegisterTTL(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/show_one_map_request_mode", func(w http.ResponseWriter, req *http.Request) { + var request = new(ShowOneMapRequestMode) + reply, err := rpc.ShowOneMapRequestMode(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/show_one_nsh_mapping", func(w http.ResponseWriter, req *http.Request) { + var request = new(ShowOneNshMapping) + reply, err := rpc.ShowOneNshMapping(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/show_one_pitr", func(w http.ResponseWriter, req *http.Request) { + var request = new(ShowOnePitr) + reply, err := rpc.ShowOnePitr(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/show_one_rloc_probe_state", func(w http.ResponseWriter, req *http.Request) { + var request = new(ShowOneRlocProbeState) + reply, err := rpc.ShowOneRlocProbeState(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/show_one_stats_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(ShowOneStatsEnableDisable) + reply, err := rpc.ShowOneStatsEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/show_one_status", func(w http.ResponseWriter, req *http.Request) { + var request = new(ShowOneStatus) + reply, err := rpc.ShowOneStatus(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/show_one_use_petr", func(w http.ResponseWriter, req *http.Request) { + var request = new(ShowOneUsePetr) + reply, err := rpc.ShowOneUsePetr(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/one/one_rpc.ba.go b/binapi/one/one_rpc.ba.go new file mode 100644 index 0000000..46bf36c --- /dev/null +++ b/binapi/one/one_rpc.ba.go @@ -0,0 +1,803 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package one + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service one. +type RPCService interface { + OneAddDelAdjacency(ctx context.Context, in *OneAddDelAdjacency) (*OneAddDelAdjacencyReply, error) + OneAddDelL2ArpEntry(ctx context.Context, in *OneAddDelL2ArpEntry) (*OneAddDelL2ArpEntryReply, error) + OneAddDelLocalEid(ctx context.Context, in *OneAddDelLocalEid) (*OneAddDelLocalEidReply, error) + OneAddDelLocator(ctx context.Context, in *OneAddDelLocator) (*OneAddDelLocatorReply, error) + OneAddDelLocatorSet(ctx context.Context, in *OneAddDelLocatorSet) (*OneAddDelLocatorSetReply, error) + OneAddDelMapRequestItrRlocs(ctx context.Context, in *OneAddDelMapRequestItrRlocs) (*OneAddDelMapRequestItrRlocsReply, error) + OneAddDelMapResolver(ctx context.Context, in *OneAddDelMapResolver) (*OneAddDelMapResolverReply, error) + OneAddDelMapServer(ctx context.Context, in *OneAddDelMapServer) (*OneAddDelMapServerReply, error) + OneAddDelNdpEntry(ctx context.Context, in *OneAddDelNdpEntry) (*OneAddDelNdpEntryReply, error) + OneAddDelRemoteMapping(ctx context.Context, in *OneAddDelRemoteMapping) (*OneAddDelRemoteMappingReply, error) + OneAdjacenciesGet(ctx context.Context, in *OneAdjacenciesGet) (*OneAdjacenciesGetReply, error) + OneEidTableAddDelMap(ctx context.Context, in *OneEidTableAddDelMap) (*OneEidTableAddDelMapReply, error) + OneEidTableDump(ctx context.Context, in *OneEidTableDump) (RPCService_OneEidTableDumpClient, error) + OneEidTableMapDump(ctx context.Context, in *OneEidTableMapDump) (RPCService_OneEidTableMapDumpClient, error) + OneEidTableVniDump(ctx context.Context, in *OneEidTableVniDump) (RPCService_OneEidTableVniDumpClient, error) + OneEnableDisable(ctx context.Context, in *OneEnableDisable) (*OneEnableDisableReply, error) + OneEnableDisablePetrMode(ctx context.Context, in *OneEnableDisablePetrMode) (*OneEnableDisablePetrModeReply, error) + OneEnableDisablePitrMode(ctx context.Context, in *OneEnableDisablePitrMode) (*OneEnableDisablePitrModeReply, error) + OneEnableDisableXtrMode(ctx context.Context, in *OneEnableDisableXtrMode) (*OneEnableDisableXtrModeReply, error) + OneGetMapRequestItrRlocs(ctx context.Context, in *OneGetMapRequestItrRlocs) (*OneGetMapRequestItrRlocsReply, error) + OneGetTransportProtocol(ctx context.Context, in *OneGetTransportProtocol) (*OneGetTransportProtocolReply, error) + OneL2ArpBdGet(ctx context.Context, in *OneL2ArpBdGet) (*OneL2ArpBdGetReply, error) + OneL2ArpEntriesGet(ctx context.Context, in *OneL2ArpEntriesGet) (*OneL2ArpEntriesGetReply, error) + OneLocatorDump(ctx context.Context, in *OneLocatorDump) (RPCService_OneLocatorDumpClient, error) + OneLocatorSetDump(ctx context.Context, in *OneLocatorSetDump) (RPCService_OneLocatorSetDumpClient, error) + OneMapRegisterEnableDisable(ctx context.Context, in *OneMapRegisterEnableDisable) (*OneMapRegisterEnableDisableReply, error) + OneMapRegisterFallbackThreshold(ctx context.Context, in *OneMapRegisterFallbackThreshold) (*OneMapRegisterFallbackThresholdReply, error) + OneMapRegisterSetTTL(ctx context.Context, in *OneMapRegisterSetTTL) (*OneMapRegisterSetTTLReply, error) + OneMapRequestMode(ctx context.Context, in *OneMapRequestMode) (*OneMapRequestModeReply, error) + OneMapResolverDump(ctx context.Context, in *OneMapResolverDump) (RPCService_OneMapResolverDumpClient, error) + OneMapServerDump(ctx context.Context, in *OneMapServerDump) (RPCService_OneMapServerDumpClient, error) + OneNdpBdGet(ctx context.Context, in *OneNdpBdGet) (*OneNdpBdGetReply, error) + OneNdpEntriesGet(ctx context.Context, in *OneNdpEntriesGet) (*OneNdpEntriesGetReply, error) + OneNshSetLocatorSet(ctx context.Context, in *OneNshSetLocatorSet) (*OneNshSetLocatorSetReply, error) + OnePitrSetLocatorSet(ctx context.Context, in *OnePitrSetLocatorSet) (*OnePitrSetLocatorSetReply, error) + OneRlocProbeEnableDisable(ctx context.Context, in *OneRlocProbeEnableDisable) (*OneRlocProbeEnableDisableReply, error) + OneSetTransportProtocol(ctx context.Context, in *OneSetTransportProtocol) (*OneSetTransportProtocolReply, error) + OneShowPetrMode(ctx context.Context, in *OneShowPetrMode) (*OneShowPetrModeReply, error) + OneShowPitrMode(ctx context.Context, in *OneShowPitrMode) (*OneShowPitrModeReply, error) + OneShowXtrMode(ctx context.Context, in *OneShowXtrMode) (*OneShowXtrModeReply, error) + OneStatsDump(ctx context.Context, in *OneStatsDump) (RPCService_OneStatsDumpClient, error) + OneStatsEnableDisable(ctx context.Context, in *OneStatsEnableDisable) (*OneStatsEnableDisableReply, error) + OneStatsFlush(ctx context.Context, in *OneStatsFlush) (*OneStatsFlushReply, error) + OneUsePetr(ctx context.Context, in *OneUsePetr) (*OneUsePetrReply, error) + ShowOneMapRegisterFallbackThreshold(ctx context.Context, in *ShowOneMapRegisterFallbackThreshold) (*ShowOneMapRegisterFallbackThresholdReply, error) + ShowOneMapRegisterState(ctx context.Context, in *ShowOneMapRegisterState) (*ShowOneMapRegisterStateReply, error) + ShowOneMapRegisterTTL(ctx context.Context, in *ShowOneMapRegisterTTL) (*ShowOneMapRegisterTTLReply, error) + ShowOneMapRequestMode(ctx context.Context, in *ShowOneMapRequestMode) (*ShowOneMapRequestModeReply, error) + ShowOneNshMapping(ctx context.Context, in *ShowOneNshMapping) (*ShowOneNshMappingReply, error) + ShowOnePitr(ctx context.Context, in *ShowOnePitr) (*ShowOnePitrReply, error) + ShowOneRlocProbeState(ctx context.Context, in *ShowOneRlocProbeState) (*ShowOneRlocProbeStateReply, error) + ShowOneStatsEnableDisable(ctx context.Context, in *ShowOneStatsEnableDisable) (*ShowOneStatsEnableDisableReply, error) + ShowOneStatus(ctx context.Context, in *ShowOneStatus) (*ShowOneStatusReply, error) + ShowOneUsePetr(ctx context.Context, in *ShowOneUsePetr) (*ShowOneUsePetrReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) OneAddDelAdjacency(ctx context.Context, in *OneAddDelAdjacency) (*OneAddDelAdjacencyReply, error) { + out := new(OneAddDelAdjacencyReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneAddDelL2ArpEntry(ctx context.Context, in *OneAddDelL2ArpEntry) (*OneAddDelL2ArpEntryReply, error) { + out := new(OneAddDelL2ArpEntryReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneAddDelLocalEid(ctx context.Context, in *OneAddDelLocalEid) (*OneAddDelLocalEidReply, error) { + out := new(OneAddDelLocalEidReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneAddDelLocator(ctx context.Context, in *OneAddDelLocator) (*OneAddDelLocatorReply, error) { + out := new(OneAddDelLocatorReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneAddDelLocatorSet(ctx context.Context, in *OneAddDelLocatorSet) (*OneAddDelLocatorSetReply, error) { + out := new(OneAddDelLocatorSetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneAddDelMapRequestItrRlocs(ctx context.Context, in *OneAddDelMapRequestItrRlocs) (*OneAddDelMapRequestItrRlocsReply, error) { + out := new(OneAddDelMapRequestItrRlocsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneAddDelMapResolver(ctx context.Context, in *OneAddDelMapResolver) (*OneAddDelMapResolverReply, error) { + out := new(OneAddDelMapResolverReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneAddDelMapServer(ctx context.Context, in *OneAddDelMapServer) (*OneAddDelMapServerReply, error) { + out := new(OneAddDelMapServerReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneAddDelNdpEntry(ctx context.Context, in *OneAddDelNdpEntry) (*OneAddDelNdpEntryReply, error) { + out := new(OneAddDelNdpEntryReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneAddDelRemoteMapping(ctx context.Context, in *OneAddDelRemoteMapping) (*OneAddDelRemoteMappingReply, error) { + out := new(OneAddDelRemoteMappingReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneAdjacenciesGet(ctx context.Context, in *OneAdjacenciesGet) (*OneAdjacenciesGetReply, error) { + out := new(OneAdjacenciesGetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneEidTableAddDelMap(ctx context.Context, in *OneEidTableAddDelMap) (*OneEidTableAddDelMapReply, error) { + out := new(OneEidTableAddDelMapReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneEidTableDump(ctx context.Context, in *OneEidTableDump) (RPCService_OneEidTableDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_OneEidTableDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_OneEidTableDumpClient interface { + Recv() (*OneEidTableDetails, error) + api.Stream +} + +type serviceClient_OneEidTableDumpClient struct { + api.Stream +} + +func (c *serviceClient_OneEidTableDumpClient) Recv() (*OneEidTableDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *OneEidTableDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) OneEidTableMapDump(ctx context.Context, in *OneEidTableMapDump) (RPCService_OneEidTableMapDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_OneEidTableMapDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_OneEidTableMapDumpClient interface { + Recv() (*OneEidTableMapDetails, error) + api.Stream +} + +type serviceClient_OneEidTableMapDumpClient struct { + api.Stream +} + +func (c *serviceClient_OneEidTableMapDumpClient) Recv() (*OneEidTableMapDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *OneEidTableMapDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) OneEidTableVniDump(ctx context.Context, in *OneEidTableVniDump) (RPCService_OneEidTableVniDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_OneEidTableVniDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_OneEidTableVniDumpClient interface { + Recv() (*OneEidTableVniDetails, error) + api.Stream +} + +type serviceClient_OneEidTableVniDumpClient struct { + api.Stream +} + +func (c *serviceClient_OneEidTableVniDumpClient) Recv() (*OneEidTableVniDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *OneEidTableVniDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) OneEnableDisable(ctx context.Context, in *OneEnableDisable) (*OneEnableDisableReply, error) { + out := new(OneEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneEnableDisablePetrMode(ctx context.Context, in *OneEnableDisablePetrMode) (*OneEnableDisablePetrModeReply, error) { + out := new(OneEnableDisablePetrModeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneEnableDisablePitrMode(ctx context.Context, in *OneEnableDisablePitrMode) (*OneEnableDisablePitrModeReply, error) { + out := new(OneEnableDisablePitrModeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneEnableDisableXtrMode(ctx context.Context, in *OneEnableDisableXtrMode) (*OneEnableDisableXtrModeReply, error) { + out := new(OneEnableDisableXtrModeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneGetMapRequestItrRlocs(ctx context.Context, in *OneGetMapRequestItrRlocs) (*OneGetMapRequestItrRlocsReply, error) { + out := new(OneGetMapRequestItrRlocsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneGetTransportProtocol(ctx context.Context, in *OneGetTransportProtocol) (*OneGetTransportProtocolReply, error) { + out := new(OneGetTransportProtocolReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneL2ArpBdGet(ctx context.Context, in *OneL2ArpBdGet) (*OneL2ArpBdGetReply, error) { + out := new(OneL2ArpBdGetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneL2ArpEntriesGet(ctx context.Context, in *OneL2ArpEntriesGet) (*OneL2ArpEntriesGetReply, error) { + out := new(OneL2ArpEntriesGetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneLocatorDump(ctx context.Context, in *OneLocatorDump) (RPCService_OneLocatorDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_OneLocatorDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_OneLocatorDumpClient interface { + Recv() (*OneLocatorDetails, error) + api.Stream +} + +type serviceClient_OneLocatorDumpClient struct { + api.Stream +} + +func (c *serviceClient_OneLocatorDumpClient) Recv() (*OneLocatorDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *OneLocatorDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) OneLocatorSetDump(ctx context.Context, in *OneLocatorSetDump) (RPCService_OneLocatorSetDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_OneLocatorSetDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_OneLocatorSetDumpClient interface { + Recv() (*OneLocatorSetDetails, error) + api.Stream +} + +type serviceClient_OneLocatorSetDumpClient struct { + api.Stream +} + +func (c *serviceClient_OneLocatorSetDumpClient) Recv() (*OneLocatorSetDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *OneLocatorSetDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) OneMapRegisterEnableDisable(ctx context.Context, in *OneMapRegisterEnableDisable) (*OneMapRegisterEnableDisableReply, error) { + out := new(OneMapRegisterEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneMapRegisterFallbackThreshold(ctx context.Context, in *OneMapRegisterFallbackThreshold) (*OneMapRegisterFallbackThresholdReply, error) { + out := new(OneMapRegisterFallbackThresholdReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneMapRegisterSetTTL(ctx context.Context, in *OneMapRegisterSetTTL) (*OneMapRegisterSetTTLReply, error) { + out := new(OneMapRegisterSetTTLReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneMapRequestMode(ctx context.Context, in *OneMapRequestMode) (*OneMapRequestModeReply, error) { + out := new(OneMapRequestModeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneMapResolverDump(ctx context.Context, in *OneMapResolverDump) (RPCService_OneMapResolverDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_OneMapResolverDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_OneMapResolverDumpClient interface { + Recv() (*OneMapResolverDetails, error) + api.Stream +} + +type serviceClient_OneMapResolverDumpClient struct { + api.Stream +} + +func (c *serviceClient_OneMapResolverDumpClient) Recv() (*OneMapResolverDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *OneMapResolverDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) OneMapServerDump(ctx context.Context, in *OneMapServerDump) (RPCService_OneMapServerDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_OneMapServerDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_OneMapServerDumpClient interface { + Recv() (*OneMapServerDetails, error) + api.Stream +} + +type serviceClient_OneMapServerDumpClient struct { + api.Stream +} + +func (c *serviceClient_OneMapServerDumpClient) Recv() (*OneMapServerDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *OneMapServerDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) OneNdpBdGet(ctx context.Context, in *OneNdpBdGet) (*OneNdpBdGetReply, error) { + out := new(OneNdpBdGetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneNdpEntriesGet(ctx context.Context, in *OneNdpEntriesGet) (*OneNdpEntriesGetReply, error) { + out := new(OneNdpEntriesGetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneNshSetLocatorSet(ctx context.Context, in *OneNshSetLocatorSet) (*OneNshSetLocatorSetReply, error) { + out := new(OneNshSetLocatorSetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OnePitrSetLocatorSet(ctx context.Context, in *OnePitrSetLocatorSet) (*OnePitrSetLocatorSetReply, error) { + out := new(OnePitrSetLocatorSetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneRlocProbeEnableDisable(ctx context.Context, in *OneRlocProbeEnableDisable) (*OneRlocProbeEnableDisableReply, error) { + out := new(OneRlocProbeEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneSetTransportProtocol(ctx context.Context, in *OneSetTransportProtocol) (*OneSetTransportProtocolReply, error) { + out := new(OneSetTransportProtocolReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneShowPetrMode(ctx context.Context, in *OneShowPetrMode) (*OneShowPetrModeReply, error) { + out := new(OneShowPetrModeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneShowPitrMode(ctx context.Context, in *OneShowPitrMode) (*OneShowPitrModeReply, error) { + out := new(OneShowPitrModeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneShowXtrMode(ctx context.Context, in *OneShowXtrMode) (*OneShowXtrModeReply, error) { + out := new(OneShowXtrModeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneStatsDump(ctx context.Context, in *OneStatsDump) (RPCService_OneStatsDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_OneStatsDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_OneStatsDumpClient interface { + Recv() (*OneStatsDetails, error) + api.Stream +} + +type serviceClient_OneStatsDumpClient struct { + api.Stream +} + +func (c *serviceClient_OneStatsDumpClient) Recv() (*OneStatsDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *OneStatsDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) OneStatsEnableDisable(ctx context.Context, in *OneStatsEnableDisable) (*OneStatsEnableDisableReply, error) { + out := new(OneStatsEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneStatsFlush(ctx context.Context, in *OneStatsFlush) (*OneStatsFlushReply, error) { + out := new(OneStatsFlushReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OneUsePetr(ctx context.Context, in *OneUsePetr) (*OneUsePetrReply, error) { + out := new(OneUsePetrReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowOneMapRegisterFallbackThreshold(ctx context.Context, in *ShowOneMapRegisterFallbackThreshold) (*ShowOneMapRegisterFallbackThresholdReply, error) { + out := new(ShowOneMapRegisterFallbackThresholdReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowOneMapRegisterState(ctx context.Context, in *ShowOneMapRegisterState) (*ShowOneMapRegisterStateReply, error) { + out := new(ShowOneMapRegisterStateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowOneMapRegisterTTL(ctx context.Context, in *ShowOneMapRegisterTTL) (*ShowOneMapRegisterTTLReply, error) { + out := new(ShowOneMapRegisterTTLReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowOneMapRequestMode(ctx context.Context, in *ShowOneMapRequestMode) (*ShowOneMapRequestModeReply, error) { + out := new(ShowOneMapRequestModeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowOneNshMapping(ctx context.Context, in *ShowOneNshMapping) (*ShowOneNshMappingReply, error) { + out := new(ShowOneNshMappingReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowOnePitr(ctx context.Context, in *ShowOnePitr) (*ShowOnePitrReply, error) { + out := new(ShowOnePitrReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowOneRlocProbeState(ctx context.Context, in *ShowOneRlocProbeState) (*ShowOneRlocProbeStateReply, error) { + out := new(ShowOneRlocProbeStateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowOneStatsEnableDisable(ctx context.Context, in *ShowOneStatsEnableDisable) (*ShowOneStatsEnableDisableReply, error) { + out := new(ShowOneStatsEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowOneStatus(ctx context.Context, in *ShowOneStatus) (*ShowOneStatusReply, error) { + out := new(ShowOneStatusReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowOneUsePetr(ctx context.Context, in *ShowOneUsePetr) (*ShowOneUsePetrReply, error) { + out := new(ShowOneUsePetrReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/p2p_ethernet/p2p_ethernet.ba.go b/binapi/p2p_ethernet/p2p_ethernet.ba.go new file mode 100644 index 0000000..5435390 --- /dev/null +++ b/binapi/p2p_ethernet/p2p_ethernet.ba.go @@ -0,0 +1,209 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/p2p_ethernet.api.json + +// Package p2p_ethernet contains generated bindings for API file p2p_ethernet.api. +// +// Contents: +// 4 messages +// +package p2p_ethernet + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "p2p_ethernet" + APIVersion = "1.0.0" + VersionCrc = 0xe34f63cd +) + +// P2pEthernetAdd defines message 'p2p_ethernet_add'. +type P2pEthernetAdd struct { + ParentIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=parent_if_index" json:"parent_if_index,omitempty"` + SubifID uint32 `binapi:"u32,name=subif_id" json:"subif_id,omitempty"` + RemoteMac ethernet_types.MacAddress `binapi:"mac_address,name=remote_mac" json:"remote_mac,omitempty"` +} + +func (m *P2pEthernetAdd) Reset() { *m = P2pEthernetAdd{} } +func (*P2pEthernetAdd) GetMessageName() string { return "p2p_ethernet_add" } +func (*P2pEthernetAdd) GetCrcString() string { return "eeb8e717" } +func (*P2pEthernetAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *P2pEthernetAdd) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ParentIfIndex + size += 4 // m.SubifID + size += 1 * 6 // m.RemoteMac + return size +} +func (m *P2pEthernetAdd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ParentIfIndex)) + buf.EncodeUint32(uint32(m.SubifID)) + buf.EncodeBytes(m.RemoteMac[:], 6) + return buf.Bytes(), nil +} +func (m *P2pEthernetAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ParentIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.SubifID = buf.DecodeUint32() + copy(m.RemoteMac[:], buf.DecodeBytes(6)) + return nil +} + +// P2pEthernetAddReply defines message 'p2p_ethernet_add_reply'. +type P2pEthernetAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *P2pEthernetAddReply) Reset() { *m = P2pEthernetAddReply{} } +func (*P2pEthernetAddReply) GetMessageName() string { return "p2p_ethernet_add_reply" } +func (*P2pEthernetAddReply) GetCrcString() string { return "5383d31f" } +func (*P2pEthernetAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *P2pEthernetAddReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *P2pEthernetAddReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *P2pEthernetAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// P2pEthernetDel defines message 'p2p_ethernet_del'. +type P2pEthernetDel struct { + ParentIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=parent_if_index" json:"parent_if_index,omitempty"` + RemoteMac ethernet_types.MacAddress `binapi:"mac_address,name=remote_mac" json:"remote_mac,omitempty"` +} + +func (m *P2pEthernetDel) Reset() { *m = P2pEthernetDel{} } +func (*P2pEthernetDel) GetMessageName() string { return "p2p_ethernet_del" } +func (*P2pEthernetDel) GetCrcString() string { return "0b62c386" } +func (*P2pEthernetDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *P2pEthernetDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ParentIfIndex + size += 1 * 6 // m.RemoteMac + return size +} +func (m *P2pEthernetDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ParentIfIndex)) + buf.EncodeBytes(m.RemoteMac[:], 6) + return buf.Bytes(), nil +} +func (m *P2pEthernetDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ParentIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + copy(m.RemoteMac[:], buf.DecodeBytes(6)) + return nil +} + +// P2pEthernetDelReply defines message 'p2p_ethernet_del_reply'. +type P2pEthernetDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *P2pEthernetDelReply) Reset() { *m = P2pEthernetDelReply{} } +func (*P2pEthernetDelReply) GetMessageName() string { return "p2p_ethernet_del_reply" } +func (*P2pEthernetDelReply) GetCrcString() string { return "e8d4e804" } +func (*P2pEthernetDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *P2pEthernetDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *P2pEthernetDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *P2pEthernetDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_p2p_ethernet_binapi_init() } +func file_p2p_ethernet_binapi_init() { + api.RegisterMessage((*P2pEthernetAdd)(nil), "p2p_ethernet_add_eeb8e717") + api.RegisterMessage((*P2pEthernetAddReply)(nil), "p2p_ethernet_add_reply_5383d31f") + api.RegisterMessage((*P2pEthernetDel)(nil), "p2p_ethernet_del_0b62c386") + api.RegisterMessage((*P2pEthernetDelReply)(nil), "p2p_ethernet_del_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*P2pEthernetAdd)(nil), + (*P2pEthernetAddReply)(nil), + (*P2pEthernetDel)(nil), + (*P2pEthernetDelReply)(nil), + } +} diff --git a/binapi/p2p_ethernet/p2p_ethernet_rest.ba.go b/binapi/p2p_ethernet/p2p_ethernet_rest.ba.go new file mode 100644 index 0000000..e154276 --- /dev/null +++ b/binapi/p2p_ethernet/p2p_ethernet_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package p2p_ethernet + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/p2p_ethernet_add", func(w http.ResponseWriter, req *http.Request) { + var request = new(P2pEthernetAdd) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.P2pEthernetAdd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/p2p_ethernet_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(P2pEthernetDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.P2pEthernetDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/p2p_ethernet/p2p_ethernet_rpc.ba.go b/binapi/p2p_ethernet/p2p_ethernet_rpc.ba.go new file mode 100644 index 0000000..ed1e012 --- /dev/null +++ b/binapi/p2p_ethernet/p2p_ethernet_rpc.ba.go @@ -0,0 +1,40 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package p2p_ethernet + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service p2p_ethernet. +type RPCService interface { + P2pEthernetAdd(ctx context.Context, in *P2pEthernetAdd) (*P2pEthernetAddReply, error) + P2pEthernetDel(ctx context.Context, in *P2pEthernetDel) (*P2pEthernetDelReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) P2pEthernetAdd(ctx context.Context, in *P2pEthernetAdd) (*P2pEthernetAddReply, error) { + out := new(P2pEthernetAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) P2pEthernetDel(ctx context.Context, in *P2pEthernetDel) (*P2pEthernetDelReply, error) { + out := new(P2pEthernetDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/pci_types/pci_types.ba.go b/binapi/pci_types/pci_types.ba.go new file mode 100644 index 0000000..7b0d00c --- /dev/null +++ b/binapi/pci_types/pci_types.ba.go @@ -0,0 +1,30 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/pci_types.api.json + +// Package pci_types contains generated bindings for API file pci_types.api. +// +// Contents: +// 1 struct +// +package pci_types + +import ( + api "git.fd.io/govpp.git/api" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +// PciAddress defines type 'pci_address'. +type PciAddress struct { + Domain uint16 `binapi:"u16,name=domain" json:"domain,omitempty"` + Bus uint8 `binapi:"u8,name=bus" json:"bus,omitempty"` + Slot uint8 `binapi:"u8,name=slot" json:"slot,omitempty"` + Function uint8 `binapi:"u8,name=function" json:"function,omitempty"` +} diff --git a/binapi/pg/pg.ba.go b/binapi/pg/pg.ba.go new file mode 100644 index 0000000..2f45135 --- /dev/null +++ b/binapi/pg/pg.ba.go @@ -0,0 +1,296 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/pg.api.json + +// Package pg contains generated bindings for API file pg.api. +// +// Contents: +// 6 messages +// +package pg + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "pg" + APIVersion = "2.0.0" + VersionCrc = 0xb7fe86ae +) + +// PgCapture defines message 'pg_capture'. +type PgCapture struct { + InterfaceID interface_types.InterfaceIndex `binapi:"interface_index,name=interface_id" json:"interface_id,omitempty"` + IsEnabled bool `binapi:"bool,name=is_enabled,default=true" json:"is_enabled,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"count,omitempty"` + PcapFileName string `binapi:"string[],name=pcap_file_name" json:"pcap_file_name,omitempty"` +} + +func (m *PgCapture) Reset() { *m = PgCapture{} } +func (*PgCapture) GetMessageName() string { return "pg_capture" } +func (*PgCapture) GetCrcString() string { return "3712fb6c" } +func (*PgCapture) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PgCapture) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.InterfaceID + size += 1 // m.IsEnabled + size += 4 // m.Count + size += 4 + len(m.PcapFileName) // m.PcapFileName + return size +} +func (m *PgCapture) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.InterfaceID)) + buf.EncodeBool(m.IsEnabled) + buf.EncodeUint32(uint32(m.Count)) + buf.EncodeString(m.PcapFileName, 0) + return buf.Bytes(), nil +} +func (m *PgCapture) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.InterfaceID = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsEnabled = buf.DecodeBool() + m.Count = buf.DecodeUint32() + m.PcapFileName = buf.DecodeString(0) + return nil +} + +// PgCaptureReply defines message 'pg_capture_reply'. +type PgCaptureReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *PgCaptureReply) Reset() { *m = PgCaptureReply{} } +func (*PgCaptureReply) GetMessageName() string { return "pg_capture_reply" } +func (*PgCaptureReply) GetCrcString() string { return "e8d4e804" } +func (*PgCaptureReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PgCaptureReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *PgCaptureReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *PgCaptureReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// PgCreateInterface defines message 'pg_create_interface'. +type PgCreateInterface struct { + InterfaceID interface_types.InterfaceIndex `binapi:"interface_index,name=interface_id" json:"interface_id,omitempty"` + GsoEnabled bool `binapi:"bool,name=gso_enabled" json:"gso_enabled,omitempty"` + GsoSize uint32 `binapi:"u32,name=gso_size" json:"gso_size,omitempty"` +} + +func (m *PgCreateInterface) Reset() { *m = PgCreateInterface{} } +func (*PgCreateInterface) GetMessageName() string { return "pg_create_interface" } +func (*PgCreateInterface) GetCrcString() string { return "b7c893d7" } +func (*PgCreateInterface) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PgCreateInterface) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.InterfaceID + size += 1 // m.GsoEnabled + size += 4 // m.GsoSize + return size +} +func (m *PgCreateInterface) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.InterfaceID)) + buf.EncodeBool(m.GsoEnabled) + buf.EncodeUint32(uint32(m.GsoSize)) + return buf.Bytes(), nil +} +func (m *PgCreateInterface) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.InterfaceID = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.GsoEnabled = buf.DecodeBool() + m.GsoSize = buf.DecodeUint32() + return nil +} + +// PgCreateInterfaceReply defines message 'pg_create_interface_reply'. +type PgCreateInterfaceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *PgCreateInterfaceReply) Reset() { *m = PgCreateInterfaceReply{} } +func (*PgCreateInterfaceReply) GetMessageName() string { return "pg_create_interface_reply" } +func (*PgCreateInterfaceReply) GetCrcString() string { return "5383d31f" } +func (*PgCreateInterfaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PgCreateInterfaceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *PgCreateInterfaceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *PgCreateInterfaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// PgEnableDisable defines message 'pg_enable_disable'. +type PgEnableDisable struct { + IsEnabled bool `binapi:"bool,name=is_enabled,default=true" json:"is_enabled,omitempty"` + StreamName string `binapi:"string[],name=stream_name" json:"stream_name,omitempty"` +} + +func (m *PgEnableDisable) Reset() { *m = PgEnableDisable{} } +func (*PgEnableDisable) GetMessageName() string { return "pg_enable_disable" } +func (*PgEnableDisable) GetCrcString() string { return "01f94f3a" } +func (*PgEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PgEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsEnabled + size += 4 + len(m.StreamName) // m.StreamName + return size +} +func (m *PgEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsEnabled) + buf.EncodeString(m.StreamName, 0) + return buf.Bytes(), nil +} +func (m *PgEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsEnabled = buf.DecodeBool() + m.StreamName = buf.DecodeString(0) + return nil +} + +// PgEnableDisableReply defines message 'pg_enable_disable_reply'. +type PgEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *PgEnableDisableReply) Reset() { *m = PgEnableDisableReply{} } +func (*PgEnableDisableReply) GetMessageName() string { return "pg_enable_disable_reply" } +func (*PgEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*PgEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PgEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *PgEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *PgEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_pg_binapi_init() } +func file_pg_binapi_init() { + api.RegisterMessage((*PgCapture)(nil), "pg_capture_3712fb6c") + api.RegisterMessage((*PgCaptureReply)(nil), "pg_capture_reply_e8d4e804") + api.RegisterMessage((*PgCreateInterface)(nil), "pg_create_interface_b7c893d7") + api.RegisterMessage((*PgCreateInterfaceReply)(nil), "pg_create_interface_reply_5383d31f") + api.RegisterMessage((*PgEnableDisable)(nil), "pg_enable_disable_01f94f3a") + api.RegisterMessage((*PgEnableDisableReply)(nil), "pg_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*PgCapture)(nil), + (*PgCaptureReply)(nil), + (*PgCreateInterface)(nil), + (*PgCreateInterfaceReply)(nil), + (*PgEnableDisable)(nil), + (*PgEnableDisableReply)(nil), + } +} diff --git a/binapi/pg/pg_rest.ba.go b/binapi/pg/pg_rest.ba.go new file mode 100644 index 0000000..6384ac4 --- /dev/null +++ b/binapi/pg/pg_rest.ba.go @@ -0,0 +1,83 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package pg + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/pg_capture", func(w http.ResponseWriter, req *http.Request) { + var request = new(PgCapture) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.PgCapture(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/pg_create_interface", func(w http.ResponseWriter, req *http.Request) { + var request = new(PgCreateInterface) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.PgCreateInterface(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/pg_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(PgEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.PgEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/pg/pg_rpc.ba.go b/binapi/pg/pg_rpc.ba.go new file mode 100644 index 0000000..1d905d0 --- /dev/null +++ b/binapi/pg/pg_rpc.ba.go @@ -0,0 +1,50 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package pg + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service pg. +type RPCService interface { + PgCapture(ctx context.Context, in *PgCapture) (*PgCaptureReply, error) + PgCreateInterface(ctx context.Context, in *PgCreateInterface) (*PgCreateInterfaceReply, error) + PgEnableDisable(ctx context.Context, in *PgEnableDisable) (*PgEnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) PgCapture(ctx context.Context, in *PgCapture) (*PgCaptureReply, error) { + out := new(PgCaptureReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) PgCreateInterface(ctx context.Context, in *PgCreateInterface) (*PgCreateInterfaceReply, error) { + out := new(PgCreateInterfaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) PgEnableDisable(ctx context.Context, in *PgEnableDisable) (*PgEnableDisableReply, error) { + out := new(PgEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/pipe/pipe.ba.go b/binapi/pipe/pipe.ba.go new file mode 100644 index 0000000..24881cc --- /dev/null +++ b/binapi/pipe/pipe.ba.go @@ -0,0 +1,312 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/pipe.api.json + +// Package pipe contains generated bindings for API file pipe.api. +// +// Contents: +// 6 messages +// +package pipe + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "pipe" + APIVersion = "1.0.1" + VersionCrc = 0xd22736c9 +) + +// PipeCreate defines message 'pipe_create'. +type PipeCreate struct { + IsSpecified bool `binapi:"bool,name=is_specified" json:"is_specified,omitempty"` + UserInstance uint32 `binapi:"u32,name=user_instance" json:"user_instance,omitempty"` +} + +func (m *PipeCreate) Reset() { *m = PipeCreate{} } +func (*PipeCreate) GetMessageName() string { return "pipe_create" } +func (*PipeCreate) GetCrcString() string { return "bb263bd3" } +func (*PipeCreate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PipeCreate) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsSpecified + size += 4 // m.UserInstance + return size +} +func (m *PipeCreate) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsSpecified) + buf.EncodeUint32(uint32(m.UserInstance)) + return buf.Bytes(), nil +} +func (m *PipeCreate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsSpecified = buf.DecodeBool() + m.UserInstance = buf.DecodeUint32() + return nil +} + +// PipeCreateReply defines message 'pipe_create_reply'. +type PipeCreateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + PipeSwIfIndex [2]interface_types.InterfaceIndex `binapi:"interface_index[2],name=pipe_sw_if_index" json:"pipe_sw_if_index,omitempty"` +} + +func (m *PipeCreateReply) Reset() { *m = PipeCreateReply{} } +func (*PipeCreateReply) GetMessageName() string { return "pipe_create_reply" } +func (*PipeCreateReply) GetCrcString() string { return "d4c2c2b3" } +func (*PipeCreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PipeCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + for j1 := 0; j1 < 2; j1++ { + var s1 interface_types.InterfaceIndex + _ = s1 + if j1 < len(m.PipeSwIfIndex) { + s1 = m.PipeSwIfIndex[j1] + } + size += 4 // s1 + } + return size +} +func (m *PipeCreateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + for j0 := 0; j0 < 2; j0++ { + var v0 interface_types.InterfaceIndex + if j0 < len(m.PipeSwIfIndex) { + v0 = m.PipeSwIfIndex[j0] + } + buf.EncodeUint32(uint32(v0)) + } + return buf.Bytes(), nil +} +func (m *PipeCreateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + for j0 := 0; j0 < 2; j0++ { + m.PipeSwIfIndex[j0] = interface_types.InterfaceIndex(buf.DecodeUint32()) + } + return nil +} + +// PipeDelete defines message 'pipe_delete'. +type PipeDelete struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *PipeDelete) Reset() { *m = PipeDelete{} } +func (*PipeDelete) GetMessageName() string { return "pipe_delete" } +func (*PipeDelete) GetCrcString() string { return "f9e6675e" } +func (*PipeDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PipeDelete) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *PipeDelete) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *PipeDelete) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// PipeDeleteReply defines message 'pipe_delete_reply'. +type PipeDeleteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *PipeDeleteReply) Reset() { *m = PipeDeleteReply{} } +func (*PipeDeleteReply) GetMessageName() string { return "pipe_delete_reply" } +func (*PipeDeleteReply) GetCrcString() string { return "e8d4e804" } +func (*PipeDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PipeDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *PipeDeleteReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *PipeDeleteReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// PipeDetails defines message 'pipe_details'. +type PipeDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + PipeSwIfIndex [2]interface_types.InterfaceIndex `binapi:"interface_index[2],name=pipe_sw_if_index" json:"pipe_sw_if_index,omitempty"` + Instance uint32 `binapi:"u32,name=instance" json:"instance,omitempty"` +} + +func (m *PipeDetails) Reset() { *m = PipeDetails{} } +func (*PipeDetails) GetMessageName() string { return "pipe_details" } +func (*PipeDetails) GetCrcString() string { return "43ac107a" } +func (*PipeDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PipeDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + for j1 := 0; j1 < 2; j1++ { + var s1 interface_types.InterfaceIndex + _ = s1 + if j1 < len(m.PipeSwIfIndex) { + s1 = m.PipeSwIfIndex[j1] + } + size += 4 // s1 + } + size += 4 // m.Instance + return size +} +func (m *PipeDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + for j0 := 0; j0 < 2; j0++ { + var v0 interface_types.InterfaceIndex + if j0 < len(m.PipeSwIfIndex) { + v0 = m.PipeSwIfIndex[j0] + } + buf.EncodeUint32(uint32(v0)) + } + buf.EncodeUint32(uint32(m.Instance)) + return buf.Bytes(), nil +} +func (m *PipeDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + for j0 := 0; j0 < 2; j0++ { + m.PipeSwIfIndex[j0] = interface_types.InterfaceIndex(buf.DecodeUint32()) + } + m.Instance = buf.DecodeUint32() + return nil +} + +// PipeDump defines message 'pipe_dump'. +type PipeDump struct{} + +func (m *PipeDump) Reset() { *m = PipeDump{} } +func (*PipeDump) GetMessageName() string { return "pipe_dump" } +func (*PipeDump) GetCrcString() string { return "51077d14" } +func (*PipeDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PipeDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *PipeDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *PipeDump) Unmarshal(b []byte) error { + return nil +} + +func init() { file_pipe_binapi_init() } +func file_pipe_binapi_init() { + api.RegisterMessage((*PipeCreate)(nil), "pipe_create_bb263bd3") + api.RegisterMessage((*PipeCreateReply)(nil), "pipe_create_reply_d4c2c2b3") + api.RegisterMessage((*PipeDelete)(nil), "pipe_delete_f9e6675e") + api.RegisterMessage((*PipeDeleteReply)(nil), "pipe_delete_reply_e8d4e804") + api.RegisterMessage((*PipeDetails)(nil), "pipe_details_43ac107a") + api.RegisterMessage((*PipeDump)(nil), "pipe_dump_51077d14") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*PipeCreate)(nil), + (*PipeCreateReply)(nil), + (*PipeDelete)(nil), + (*PipeDeleteReply)(nil), + (*PipeDetails)(nil), + (*PipeDump)(nil), + } +} diff --git a/binapi/pipe/pipe_rest.ba.go b/binapi/pipe/pipe_rest.ba.go new file mode 100644 index 0000000..8a2b900 --- /dev/null +++ b/binapi/pipe/pipe_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package pipe + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/pipe_create", func(w http.ResponseWriter, req *http.Request) { + var request = new(PipeCreate) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.PipeCreate(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/pipe_delete", func(w http.ResponseWriter, req *http.Request) { + var request = new(PipeDelete) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.PipeDelete(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/pipe/pipe_rpc.ba.go b/binapi/pipe/pipe_rpc.ba.go new file mode 100644 index 0000000..3350ace --- /dev/null +++ b/binapi/pipe/pipe_rpc.ba.go @@ -0,0 +1,83 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package pipe + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service pipe. +type RPCService interface { + PipeCreate(ctx context.Context, in *PipeCreate) (*PipeCreateReply, error) + PipeDelete(ctx context.Context, in *PipeDelete) (*PipeDeleteReply, error) + PipeDump(ctx context.Context, in *PipeDump) (RPCService_PipeDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) PipeCreate(ctx context.Context, in *PipeCreate) (*PipeCreateReply, error) { + out := new(PipeCreateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) PipeDelete(ctx context.Context, in *PipeDelete) (*PipeDeleteReply, error) { + out := new(PipeDeleteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) PipeDump(ctx context.Context, in *PipeDump) (RPCService_PipeDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_PipeDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_PipeDumpClient interface { + Recv() (*PipeDetails, error) + api.Stream +} + +type serviceClient_PipeDumpClient struct { + api.Stream +} + +func (c *serviceClient_PipeDumpClient) Recv() (*PipeDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *PipeDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/policer/policer.ba.go b/binapi/policer/policer.ba.go new file mode 100644 index 0000000..f529a38 --- /dev/null +++ b/binapi/policer/policer.ba.go @@ -0,0 +1,346 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/policer.api.json + +// Package policer contains generated bindings for API file policer.api. +// +// Contents: +// 4 messages +// +package policer + +import ( + api "git.fd.io/govpp.git/api" + policer_types "git.fd.io/govpp.git/binapi/policer_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "policer" + APIVersion = "2.0.0" + VersionCrc = 0xd9188811 +) + +// PolicerAddDel defines message 'policer_add_del'. +type PolicerAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + Cir uint32 `binapi:"u32,name=cir" json:"cir,omitempty"` + Eir uint32 `binapi:"u32,name=eir" json:"eir,omitempty"` + Cb uint64 `binapi:"u64,name=cb" json:"cb,omitempty"` + Eb uint64 `binapi:"u64,name=eb" json:"eb,omitempty"` + RateType policer_types.Sse2QosRateType `binapi:"sse2_qos_rate_type,name=rate_type" json:"rate_type,omitempty"` + RoundType policer_types.Sse2QosRoundType `binapi:"sse2_qos_round_type,name=round_type" json:"round_type,omitempty"` + Type policer_types.Sse2QosPolicerType `binapi:"sse2_qos_policer_type,name=type" json:"type,omitempty"` + ColorAware bool `binapi:"bool,name=color_aware" json:"color_aware,omitempty"` + ConformAction policer_types.Sse2QosAction `binapi:"sse2_qos_action,name=conform_action" json:"conform_action,omitempty"` + ExceedAction policer_types.Sse2QosAction `binapi:"sse2_qos_action,name=exceed_action" json:"exceed_action,omitempty"` + ViolateAction policer_types.Sse2QosAction `binapi:"sse2_qos_action,name=violate_action" json:"violate_action,omitempty"` +} + +func (m *PolicerAddDel) Reset() { *m = PolicerAddDel{} } +func (*PolicerAddDel) GetMessageName() string { return "policer_add_del" } +func (*PolicerAddDel) GetCrcString() string { return "cb948f6e" } +func (*PolicerAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PolicerAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 64 // m.Name + size += 4 // m.Cir + size += 4 // m.Eir + size += 8 // m.Cb + size += 8 // m.Eb + size += 1 // m.RateType + size += 1 // m.RoundType + size += 1 // m.Type + size += 1 // m.ColorAware + size += 1 // m.ConformAction.Type + size += 1 // m.ConformAction.Dscp + size += 1 // m.ExceedAction.Type + size += 1 // m.ExceedAction.Dscp + size += 1 // m.ViolateAction.Type + size += 1 // m.ViolateAction.Dscp + return size +} +func (m *PolicerAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeString(m.Name, 64) + buf.EncodeUint32(uint32(m.Cir)) + buf.EncodeUint32(uint32(m.Eir)) + buf.EncodeUint64(uint64(m.Cb)) + buf.EncodeUint64(uint64(m.Eb)) + buf.EncodeUint8(uint8(m.RateType)) + buf.EncodeUint8(uint8(m.RoundType)) + buf.EncodeUint8(uint8(m.Type)) + buf.EncodeBool(m.ColorAware) + buf.EncodeUint8(uint8(m.ConformAction.Type)) + buf.EncodeUint8(uint8(m.ConformAction.Dscp)) + buf.EncodeUint8(uint8(m.ExceedAction.Type)) + buf.EncodeUint8(uint8(m.ExceedAction.Dscp)) + buf.EncodeUint8(uint8(m.ViolateAction.Type)) + buf.EncodeUint8(uint8(m.ViolateAction.Dscp)) + return buf.Bytes(), nil +} +func (m *PolicerAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Name = buf.DecodeString(64) + m.Cir = buf.DecodeUint32() + m.Eir = buf.DecodeUint32() + m.Cb = buf.DecodeUint64() + m.Eb = buf.DecodeUint64() + m.RateType = policer_types.Sse2QosRateType(buf.DecodeUint8()) + m.RoundType = policer_types.Sse2QosRoundType(buf.DecodeUint8()) + m.Type = policer_types.Sse2QosPolicerType(buf.DecodeUint8()) + m.ColorAware = buf.DecodeBool() + m.ConformAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8()) + m.ConformAction.Dscp = buf.DecodeUint8() + m.ExceedAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8()) + m.ExceedAction.Dscp = buf.DecodeUint8() + m.ViolateAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8()) + m.ViolateAction.Dscp = buf.DecodeUint8() + return nil +} + +// PolicerAddDelReply defines message 'policer_add_del_reply'. +type PolicerAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + PolicerIndex uint32 `binapi:"u32,name=policer_index" json:"policer_index,omitempty"` +} + +func (m *PolicerAddDelReply) Reset() { *m = PolicerAddDelReply{} } +func (*PolicerAddDelReply) GetMessageName() string { return "policer_add_del_reply" } +func (*PolicerAddDelReply) GetCrcString() string { return "a177cef2" } +func (*PolicerAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PolicerAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.PolicerIndex + return size +} +func (m *PolicerAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.PolicerIndex)) + return buf.Bytes(), nil +} +func (m *PolicerAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.PolicerIndex = buf.DecodeUint32() + return nil +} + +// PolicerDetails defines message 'policer_details'. +type PolicerDetails struct { + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + Cir uint32 `binapi:"u32,name=cir" json:"cir,omitempty"` + Eir uint32 `binapi:"u32,name=eir" json:"eir,omitempty"` + Cb uint64 `binapi:"u64,name=cb" json:"cb,omitempty"` + Eb uint64 `binapi:"u64,name=eb" json:"eb,omitempty"` + RateType policer_types.Sse2QosRateType `binapi:"sse2_qos_rate_type,name=rate_type" json:"rate_type,omitempty"` + RoundType policer_types.Sse2QosRoundType `binapi:"sse2_qos_round_type,name=round_type" json:"round_type,omitempty"` + Type policer_types.Sse2QosPolicerType `binapi:"sse2_qos_policer_type,name=type" json:"type,omitempty"` + ConformAction policer_types.Sse2QosAction `binapi:"sse2_qos_action,name=conform_action" json:"conform_action,omitempty"` + ExceedAction policer_types.Sse2QosAction `binapi:"sse2_qos_action,name=exceed_action" json:"exceed_action,omitempty"` + ViolateAction policer_types.Sse2QosAction `binapi:"sse2_qos_action,name=violate_action" json:"violate_action,omitempty"` + SingleRate bool `binapi:"bool,name=single_rate" json:"single_rate,omitempty"` + ColorAware bool `binapi:"bool,name=color_aware" json:"color_aware,omitempty"` + Scale uint32 `binapi:"u32,name=scale" json:"scale,omitempty"` + CirTokensPerPeriod uint32 `binapi:"u32,name=cir_tokens_per_period" json:"cir_tokens_per_period,omitempty"` + PirTokensPerPeriod uint32 `binapi:"u32,name=pir_tokens_per_period" json:"pir_tokens_per_period,omitempty"` + CurrentLimit uint32 `binapi:"u32,name=current_limit" json:"current_limit,omitempty"` + CurrentBucket uint32 `binapi:"u32,name=current_bucket" json:"current_bucket,omitempty"` + ExtendedLimit uint32 `binapi:"u32,name=extended_limit" json:"extended_limit,omitempty"` + ExtendedBucket uint32 `binapi:"u32,name=extended_bucket" json:"extended_bucket,omitempty"` + LastUpdateTime uint64 `binapi:"u64,name=last_update_time" json:"last_update_time,omitempty"` +} + +func (m *PolicerDetails) Reset() { *m = PolicerDetails{} } +func (*PolicerDetails) GetMessageName() string { return "policer_details" } +func (*PolicerDetails) GetCrcString() string { return "a43f781a" } +func (*PolicerDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PolicerDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 64 // m.Name + size += 4 // m.Cir + size += 4 // m.Eir + size += 8 // m.Cb + size += 8 // m.Eb + size += 1 // m.RateType + size += 1 // m.RoundType + size += 1 // m.Type + size += 1 // m.ConformAction.Type + size += 1 // m.ConformAction.Dscp + size += 1 // m.ExceedAction.Type + size += 1 // m.ExceedAction.Dscp + size += 1 // m.ViolateAction.Type + size += 1 // m.ViolateAction.Dscp + size += 1 // m.SingleRate + size += 1 // m.ColorAware + size += 4 // m.Scale + size += 4 // m.CirTokensPerPeriod + size += 4 // m.PirTokensPerPeriod + size += 4 // m.CurrentLimit + size += 4 // m.CurrentBucket + size += 4 // m.ExtendedLimit + size += 4 // m.ExtendedBucket + size += 8 // m.LastUpdateTime + return size +} +func (m *PolicerDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.Name, 64) + buf.EncodeUint32(uint32(m.Cir)) + buf.EncodeUint32(uint32(m.Eir)) + buf.EncodeUint64(uint64(m.Cb)) + buf.EncodeUint64(uint64(m.Eb)) + buf.EncodeUint8(uint8(m.RateType)) + buf.EncodeUint8(uint8(m.RoundType)) + buf.EncodeUint8(uint8(m.Type)) + buf.EncodeUint8(uint8(m.ConformAction.Type)) + buf.EncodeUint8(uint8(m.ConformAction.Dscp)) + buf.EncodeUint8(uint8(m.ExceedAction.Type)) + buf.EncodeUint8(uint8(m.ExceedAction.Dscp)) + buf.EncodeUint8(uint8(m.ViolateAction.Type)) + buf.EncodeUint8(uint8(m.ViolateAction.Dscp)) + buf.EncodeBool(m.SingleRate) + buf.EncodeBool(m.ColorAware) + buf.EncodeUint32(uint32(m.Scale)) + buf.EncodeUint32(uint32(m.CirTokensPerPeriod)) + buf.EncodeUint32(uint32(m.PirTokensPerPeriod)) + buf.EncodeUint32(uint32(m.CurrentLimit)) + buf.EncodeUint32(uint32(m.CurrentBucket)) + buf.EncodeUint32(uint32(m.ExtendedLimit)) + buf.EncodeUint32(uint32(m.ExtendedBucket)) + buf.EncodeUint64(uint64(m.LastUpdateTime)) + return buf.Bytes(), nil +} +func (m *PolicerDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Name = buf.DecodeString(64) + m.Cir = buf.DecodeUint32() + m.Eir = buf.DecodeUint32() + m.Cb = buf.DecodeUint64() + m.Eb = buf.DecodeUint64() + m.RateType = policer_types.Sse2QosRateType(buf.DecodeUint8()) + m.RoundType = policer_types.Sse2QosRoundType(buf.DecodeUint8()) + m.Type = policer_types.Sse2QosPolicerType(buf.DecodeUint8()) + m.ConformAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8()) + m.ConformAction.Dscp = buf.DecodeUint8() + m.ExceedAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8()) + m.ExceedAction.Dscp = buf.DecodeUint8() + m.ViolateAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8()) + m.ViolateAction.Dscp = buf.DecodeUint8() + m.SingleRate = buf.DecodeBool() + m.ColorAware = buf.DecodeBool() + m.Scale = buf.DecodeUint32() + m.CirTokensPerPeriod = buf.DecodeUint32() + m.PirTokensPerPeriod = buf.DecodeUint32() + m.CurrentLimit = buf.DecodeUint32() + m.CurrentBucket = buf.DecodeUint32() + m.ExtendedLimit = buf.DecodeUint32() + m.ExtendedBucket = buf.DecodeUint32() + m.LastUpdateTime = buf.DecodeUint64() + return nil +} + +// PolicerDump defines message 'policer_dump'. +type PolicerDump struct { + MatchNameValid bool `binapi:"bool,name=match_name_valid" json:"match_name_valid,omitempty"` + MatchName string `binapi:"string[64],name=match_name" json:"match_name,omitempty"` +} + +func (m *PolicerDump) Reset() { *m = PolicerDump{} } +func (*PolicerDump) GetMessageName() string { return "policer_dump" } +func (*PolicerDump) GetCrcString() string { return "35f1ae0f" } +func (*PolicerDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PolicerDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.MatchNameValid + size += 64 // m.MatchName + return size +} +func (m *PolicerDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.MatchNameValid) + buf.EncodeString(m.MatchName, 64) + return buf.Bytes(), nil +} +func (m *PolicerDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.MatchNameValid = buf.DecodeBool() + m.MatchName = buf.DecodeString(64) + return nil +} + +func init() { file_policer_binapi_init() } +func file_policer_binapi_init() { + api.RegisterMessage((*PolicerAddDel)(nil), "policer_add_del_cb948f6e") + api.RegisterMessage((*PolicerAddDelReply)(nil), "policer_add_del_reply_a177cef2") + api.RegisterMessage((*PolicerDetails)(nil), "policer_details_a43f781a") + api.RegisterMessage((*PolicerDump)(nil), "policer_dump_35f1ae0f") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*PolicerAddDel)(nil), + (*PolicerAddDelReply)(nil), + (*PolicerDetails)(nil), + (*PolicerDump)(nil), + } +} diff --git a/binapi/policer/policer_rest.ba.go b/binapi/policer/policer_rest.ba.go new file mode 100644 index 0000000..e53e42d --- /dev/null +++ b/binapi/policer/policer_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package policer + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/policer_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(PolicerAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.PolicerAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/policer/policer_rpc.ba.go b/binapi/policer/policer_rpc.ba.go new file mode 100644 index 0000000..9a7d8bf --- /dev/null +++ b/binapi/policer/policer_rpc.ba.go @@ -0,0 +1,73 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package policer + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service policer. +type RPCService interface { + PolicerAddDel(ctx context.Context, in *PolicerAddDel) (*PolicerAddDelReply, error) + PolicerDump(ctx context.Context, in *PolicerDump) (RPCService_PolicerDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) PolicerAddDel(ctx context.Context, in *PolicerAddDel) (*PolicerAddDelReply, error) { + out := new(PolicerAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) PolicerDump(ctx context.Context, in *PolicerDump) (RPCService_PolicerDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_PolicerDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_PolicerDumpClient interface { + Recv() (*PolicerDetails, error) + api.Stream +} + +type serviceClient_PolicerDumpClient struct { + api.Stream +} + +func (c *serviceClient_PolicerDumpClient) Recv() (*PolicerDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *PolicerDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/policer_types/policer_types.ba.go b/binapi/policer_types/policer_types.ba.go new file mode 100644 index 0000000..5056fe5 --- /dev/null +++ b/binapi/policer_types/policer_types.ba.go @@ -0,0 +1,162 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/policer_types.api.json + +// Package policer_types contains generated bindings for API file policer_types.api. +// +// Contents: +// 4 enums +// 1 struct +// +package policer_types + +import ( + api "git.fd.io/govpp.git/api" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +// Sse2QosActionType defines enum 'sse2_qos_action_type'. +type Sse2QosActionType uint8 + +const ( + SSE2_QOS_ACTION_API_DROP Sse2QosActionType = 0 + SSE2_QOS_ACTION_API_TRANSMIT Sse2QosActionType = 1 + SSE2_QOS_ACTION_API_MARK_AND_TRANSMIT Sse2QosActionType = 2 +) + +var ( + Sse2QosActionType_name = map[uint8]string{ + 0: "SSE2_QOS_ACTION_API_DROP", + 1: "SSE2_QOS_ACTION_API_TRANSMIT", + 2: "SSE2_QOS_ACTION_API_MARK_AND_TRANSMIT", + } + Sse2QosActionType_value = map[string]uint8{ + "SSE2_QOS_ACTION_API_DROP": 0, + "SSE2_QOS_ACTION_API_TRANSMIT": 1, + "SSE2_QOS_ACTION_API_MARK_AND_TRANSMIT": 2, + } +) + +func (x Sse2QosActionType) String() string { + s, ok := Sse2QosActionType_name[uint8(x)] + if ok { + return s + } + return "Sse2QosActionType(" + strconv.Itoa(int(x)) + ")" +} + +// Sse2QosPolicerType defines enum 'sse2_qos_policer_type'. +type Sse2QosPolicerType uint8 + +const ( + SSE2_QOS_POLICER_TYPE_API_1R2C Sse2QosPolicerType = 0 + SSE2_QOS_POLICER_TYPE_API_1R3C_RFC_2697 Sse2QosPolicerType = 1 + SSE2_QOS_POLICER_TYPE_API_2R3C_RFC_2698 Sse2QosPolicerType = 2 + SSE2_QOS_POLICER_TYPE_API_2R3C_RFC_4115 Sse2QosPolicerType = 3 + SSE2_QOS_POLICER_TYPE_API_2R3C_RFC_MEF5CF1 Sse2QosPolicerType = 4 + SSE2_QOS_POLICER_TYPE_API_MAX Sse2QosPolicerType = 5 +) + +var ( + Sse2QosPolicerType_name = map[uint8]string{ + 0: "SSE2_QOS_POLICER_TYPE_API_1R2C", + 1: "SSE2_QOS_POLICER_TYPE_API_1R3C_RFC_2697", + 2: "SSE2_QOS_POLICER_TYPE_API_2R3C_RFC_2698", + 3: "SSE2_QOS_POLICER_TYPE_API_2R3C_RFC_4115", + 4: "SSE2_QOS_POLICER_TYPE_API_2R3C_RFC_MEF5CF1", + 5: "SSE2_QOS_POLICER_TYPE_API_MAX", + } + Sse2QosPolicerType_value = map[string]uint8{ + "SSE2_QOS_POLICER_TYPE_API_1R2C": 0, + "SSE2_QOS_POLICER_TYPE_API_1R3C_RFC_2697": 1, + "SSE2_QOS_POLICER_TYPE_API_2R3C_RFC_2698": 2, + "SSE2_QOS_POLICER_TYPE_API_2R3C_RFC_4115": 3, + "SSE2_QOS_POLICER_TYPE_API_2R3C_RFC_MEF5CF1": 4, + "SSE2_QOS_POLICER_TYPE_API_MAX": 5, + } +) + +func (x Sse2QosPolicerType) String() string { + s, ok := Sse2QosPolicerType_name[uint8(x)] + if ok { + return s + } + return "Sse2QosPolicerType(" + strconv.Itoa(int(x)) + ")" +} + +// Sse2QosRateType defines enum 'sse2_qos_rate_type'. +type Sse2QosRateType uint8 + +const ( + SSE2_QOS_RATE_API_KBPS Sse2QosRateType = 0 + SSE2_QOS_RATE_API_PPS Sse2QosRateType = 1 + SSE2_QOS_RATE_API_INVALID Sse2QosRateType = 2 +) + +var ( + Sse2QosRateType_name = map[uint8]string{ + 0: "SSE2_QOS_RATE_API_KBPS", + 1: "SSE2_QOS_RATE_API_PPS", + 2: "SSE2_QOS_RATE_API_INVALID", + } + Sse2QosRateType_value = map[string]uint8{ + "SSE2_QOS_RATE_API_KBPS": 0, + "SSE2_QOS_RATE_API_PPS": 1, + "SSE2_QOS_RATE_API_INVALID": 2, + } +) + +func (x Sse2QosRateType) String() string { + s, ok := Sse2QosRateType_name[uint8(x)] + if ok { + return s + } + return "Sse2QosRateType(" + strconv.Itoa(int(x)) + ")" +} + +// Sse2QosRoundType defines enum 'sse2_qos_round_type'. +type Sse2QosRoundType uint8 + +const ( + SSE2_QOS_ROUND_API_TO_CLOSEST Sse2QosRoundType = 0 + SSE2_QOS_ROUND_API_TO_UP Sse2QosRoundType = 1 + SSE2_QOS_ROUND_API_TO_DOWN Sse2QosRoundType = 2 + SSE2_QOS_ROUND_API_INVALID Sse2QosRoundType = 3 +) + +var ( + Sse2QosRoundType_name = map[uint8]string{ + 0: "SSE2_QOS_ROUND_API_TO_CLOSEST", + 1: "SSE2_QOS_ROUND_API_TO_UP", + 2: "SSE2_QOS_ROUND_API_TO_DOWN", + 3: "SSE2_QOS_ROUND_API_INVALID", + } + Sse2QosRoundType_value = map[string]uint8{ + "SSE2_QOS_ROUND_API_TO_CLOSEST": 0, + "SSE2_QOS_ROUND_API_TO_UP": 1, + "SSE2_QOS_ROUND_API_TO_DOWN": 2, + "SSE2_QOS_ROUND_API_INVALID": 3, + } +) + +func (x Sse2QosRoundType) String() string { + s, ok := Sse2QosRoundType_name[uint8(x)] + if ok { + return s + } + return "Sse2QosRoundType(" + strconv.Itoa(int(x)) + ")" +} + +// Sse2QosAction defines type 'sse2_qos_action'. +type Sse2QosAction struct { + Type Sse2QosActionType `binapi:"sse2_qos_action_type,name=type" json:"type,omitempty"` + Dscp uint8 `binapi:"u8,name=dscp" json:"dscp,omitempty"` +} diff --git a/binapi/pot/pot.ba.go b/binapi/pot/pot.ba.go new file mode 100644 index 0000000..f037a53 --- /dev/null +++ b/binapi/pot/pot.ba.go @@ -0,0 +1,411 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/pot.api.json + +// Package pot contains generated bindings for API file pot.api. +// +// Contents: +// 8 messages +// +package pot + +import ( + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "pot" + APIVersion = "1.0.0" + VersionCrc = 0xa9d8e55c +) + +// PotProfileActivate defines message 'pot_profile_activate'. +type PotProfileActivate struct { + ID uint8 `binapi:"u8,name=id" json:"id,omitempty"` + ListName string `binapi:"string[],name=list_name" json:"list_name,omitempty"` +} + +func (m *PotProfileActivate) Reset() { *m = PotProfileActivate{} } +func (*PotProfileActivate) GetMessageName() string { return "pot_profile_activate" } +func (*PotProfileActivate) GetCrcString() string { return "0770af98" } +func (*PotProfileActivate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PotProfileActivate) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.ID + size += 4 + len(m.ListName) // m.ListName + return size +} +func (m *PotProfileActivate) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.ID)) + buf.EncodeString(m.ListName, 0) + return buf.Bytes(), nil +} +func (m *PotProfileActivate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ID = buf.DecodeUint8() + m.ListName = buf.DecodeString(0) + return nil +} + +// PotProfileActivateReply defines message 'pot_profile_activate_reply'. +type PotProfileActivateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *PotProfileActivateReply) Reset() { *m = PotProfileActivateReply{} } +func (*PotProfileActivateReply) GetMessageName() string { return "pot_profile_activate_reply" } +func (*PotProfileActivateReply) GetCrcString() string { return "e8d4e804" } +func (*PotProfileActivateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PotProfileActivateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *PotProfileActivateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *PotProfileActivateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// PotProfileAdd defines message 'pot_profile_add'. +type PotProfileAdd struct { + ID uint8 `binapi:"u8,name=id" json:"id,omitempty"` + Validator uint8 `binapi:"u8,name=validator" json:"validator,omitempty"` + SecretKey uint64 `binapi:"u64,name=secret_key" json:"secret_key,omitempty"` + SecretShare uint64 `binapi:"u64,name=secret_share" json:"secret_share,omitempty"` + Prime uint64 `binapi:"u64,name=prime" json:"prime,omitempty"` + MaxBits uint8 `binapi:"u8,name=max_bits" json:"max_bits,omitempty"` + Lpc uint64 `binapi:"u64,name=lpc" json:"lpc,omitempty"` + PolynomialPublic uint64 `binapi:"u64,name=polynomial_public" json:"polynomial_public,omitempty"` + ListName string `binapi:"string[],name=list_name" json:"list_name,omitempty"` +} + +func (m *PotProfileAdd) Reset() { *m = PotProfileAdd{} } +func (*PotProfileAdd) GetMessageName() string { return "pot_profile_add" } +func (*PotProfileAdd) GetCrcString() string { return "ad5da3a3" } +func (*PotProfileAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PotProfileAdd) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.ID + size += 1 // m.Validator + size += 8 // m.SecretKey + size += 8 // m.SecretShare + size += 8 // m.Prime + size += 1 // m.MaxBits + size += 8 // m.Lpc + size += 8 // m.PolynomialPublic + size += 4 + len(m.ListName) // m.ListName + return size +} +func (m *PotProfileAdd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.ID)) + buf.EncodeUint8(uint8(m.Validator)) + buf.EncodeUint64(uint64(m.SecretKey)) + buf.EncodeUint64(uint64(m.SecretShare)) + buf.EncodeUint64(uint64(m.Prime)) + buf.EncodeUint8(uint8(m.MaxBits)) + buf.EncodeUint64(uint64(m.Lpc)) + buf.EncodeUint64(uint64(m.PolynomialPublic)) + buf.EncodeString(m.ListName, 0) + return buf.Bytes(), nil +} +func (m *PotProfileAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ID = buf.DecodeUint8() + m.Validator = buf.DecodeUint8() + m.SecretKey = buf.DecodeUint64() + m.SecretShare = buf.DecodeUint64() + m.Prime = buf.DecodeUint64() + m.MaxBits = buf.DecodeUint8() + m.Lpc = buf.DecodeUint64() + m.PolynomialPublic = buf.DecodeUint64() + m.ListName = buf.DecodeString(0) + return nil +} + +// PotProfileAddReply defines message 'pot_profile_add_reply'. +type PotProfileAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *PotProfileAddReply) Reset() { *m = PotProfileAddReply{} } +func (*PotProfileAddReply) GetMessageName() string { return "pot_profile_add_reply" } +func (*PotProfileAddReply) GetCrcString() string { return "e8d4e804" } +func (*PotProfileAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PotProfileAddReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *PotProfileAddReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *PotProfileAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// PotProfileDel defines message 'pot_profile_del'. +type PotProfileDel struct { + ListName string `binapi:"string[],name=list_name" json:"list_name,omitempty"` +} + +func (m *PotProfileDel) Reset() { *m = PotProfileDel{} } +func (*PotProfileDel) GetMessageName() string { return "pot_profile_del" } +func (*PotProfileDel) GetCrcString() string { return "cd63f53b" } +func (*PotProfileDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PotProfileDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 + len(m.ListName) // m.ListName + return size +} +func (m *PotProfileDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.ListName, 0) + return buf.Bytes(), nil +} +func (m *PotProfileDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ListName = buf.DecodeString(0) + return nil +} + +// PotProfileDelReply defines message 'pot_profile_del_reply'. +type PotProfileDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *PotProfileDelReply) Reset() { *m = PotProfileDelReply{} } +func (*PotProfileDelReply) GetMessageName() string { return "pot_profile_del_reply" } +func (*PotProfileDelReply) GetCrcString() string { return "e8d4e804" } +func (*PotProfileDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PotProfileDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *PotProfileDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *PotProfileDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// PotProfileShowConfigDetails defines message 'pot_profile_show_config_details'. +type PotProfileShowConfigDetails struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ID uint8 `binapi:"u8,name=id" json:"id,omitempty"` + Validator uint8 `binapi:"u8,name=validator" json:"validator,omitempty"` + SecretKey uint64 `binapi:"u64,name=secret_key" json:"secret_key,omitempty"` + SecretShare uint64 `binapi:"u64,name=secret_share" json:"secret_share,omitempty"` + Prime uint64 `binapi:"u64,name=prime" json:"prime,omitempty"` + BitMask uint64 `binapi:"u64,name=bit_mask" json:"bit_mask,omitempty"` + Lpc uint64 `binapi:"u64,name=lpc" json:"lpc,omitempty"` + PolynomialPublic uint64 `binapi:"u64,name=polynomial_public" json:"polynomial_public,omitempty"` +} + +func (m *PotProfileShowConfigDetails) Reset() { *m = PotProfileShowConfigDetails{} } +func (*PotProfileShowConfigDetails) GetMessageName() string { return "pot_profile_show_config_details" } +func (*PotProfileShowConfigDetails) GetCrcString() string { return "b7ce0618" } +func (*PotProfileShowConfigDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PotProfileShowConfigDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.ID + size += 1 // m.Validator + size += 8 // m.SecretKey + size += 8 // m.SecretShare + size += 8 // m.Prime + size += 8 // m.BitMask + size += 8 // m.Lpc + size += 8 // m.PolynomialPublic + return size +} +func (m *PotProfileShowConfigDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint8(uint8(m.ID)) + buf.EncodeUint8(uint8(m.Validator)) + buf.EncodeUint64(uint64(m.SecretKey)) + buf.EncodeUint64(uint64(m.SecretShare)) + buf.EncodeUint64(uint64(m.Prime)) + buf.EncodeUint64(uint64(m.BitMask)) + buf.EncodeUint64(uint64(m.Lpc)) + buf.EncodeUint64(uint64(m.PolynomialPublic)) + return buf.Bytes(), nil +} +func (m *PotProfileShowConfigDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.ID = buf.DecodeUint8() + m.Validator = buf.DecodeUint8() + m.SecretKey = buf.DecodeUint64() + m.SecretShare = buf.DecodeUint64() + m.Prime = buf.DecodeUint64() + m.BitMask = buf.DecodeUint64() + m.Lpc = buf.DecodeUint64() + m.PolynomialPublic = buf.DecodeUint64() + return nil +} + +// PotProfileShowConfigDump defines message 'pot_profile_show_config_dump'. +type PotProfileShowConfigDump struct { + ID uint8 `binapi:"u8,name=id" json:"id,omitempty"` +} + +func (m *PotProfileShowConfigDump) Reset() { *m = PotProfileShowConfigDump{} } +func (*PotProfileShowConfigDump) GetMessageName() string { return "pot_profile_show_config_dump" } +func (*PotProfileShowConfigDump) GetCrcString() string { return "005b7d59" } +func (*PotProfileShowConfigDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PotProfileShowConfigDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.ID + return size +} +func (m *PotProfileShowConfigDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.ID)) + return buf.Bytes(), nil +} +func (m *PotProfileShowConfigDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ID = buf.DecodeUint8() + return nil +} + +func init() { file_pot_binapi_init() } +func file_pot_binapi_init() { + api.RegisterMessage((*PotProfileActivate)(nil), "pot_profile_activate_0770af98") + api.RegisterMessage((*PotProfileActivateReply)(nil), "pot_profile_activate_reply_e8d4e804") + api.RegisterMessage((*PotProfileAdd)(nil), "pot_profile_add_ad5da3a3") + api.RegisterMessage((*PotProfileAddReply)(nil), "pot_profile_add_reply_e8d4e804") + api.RegisterMessage((*PotProfileDel)(nil), "pot_profile_del_cd63f53b") + api.RegisterMessage((*PotProfileDelReply)(nil), "pot_profile_del_reply_e8d4e804") + api.RegisterMessage((*PotProfileShowConfigDetails)(nil), "pot_profile_show_config_details_b7ce0618") + api.RegisterMessage((*PotProfileShowConfigDump)(nil), "pot_profile_show_config_dump_005b7d59") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*PotProfileActivate)(nil), + (*PotProfileActivateReply)(nil), + (*PotProfileAdd)(nil), + (*PotProfileAddReply)(nil), + (*PotProfileDel)(nil), + (*PotProfileDelReply)(nil), + (*PotProfileShowConfigDetails)(nil), + (*PotProfileShowConfigDump)(nil), + } +} diff --git a/binapi/pot/pot_rest.ba.go b/binapi/pot/pot_rest.ba.go new file mode 100644 index 0000000..0cf6474 --- /dev/null +++ b/binapi/pot/pot_rest.ba.go @@ -0,0 +1,83 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package pot + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/pot_profile_activate", func(w http.ResponseWriter, req *http.Request) { + var request = new(PotProfileActivate) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.PotProfileActivate(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/pot_profile_add", func(w http.ResponseWriter, req *http.Request) { + var request = new(PotProfileAdd) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.PotProfileAdd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/pot_profile_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(PotProfileDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.PotProfileDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/pot/pot_rpc.ba.go b/binapi/pot/pot_rpc.ba.go new file mode 100644 index 0000000..7426e49 --- /dev/null +++ b/binapi/pot/pot_rpc.ba.go @@ -0,0 +1,93 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package pot + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service pot. +type RPCService interface { + PotProfileActivate(ctx context.Context, in *PotProfileActivate) (*PotProfileActivateReply, error) + PotProfileAdd(ctx context.Context, in *PotProfileAdd) (*PotProfileAddReply, error) + PotProfileDel(ctx context.Context, in *PotProfileDel) (*PotProfileDelReply, error) + PotProfileShowConfigDump(ctx context.Context, in *PotProfileShowConfigDump) (RPCService_PotProfileShowConfigDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) PotProfileActivate(ctx context.Context, in *PotProfileActivate) (*PotProfileActivateReply, error) { + out := new(PotProfileActivateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) PotProfileAdd(ctx context.Context, in *PotProfileAdd) (*PotProfileAddReply, error) { + out := new(PotProfileAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) PotProfileDel(ctx context.Context, in *PotProfileDel) (*PotProfileDelReply, error) { + out := new(PotProfileDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) PotProfileShowConfigDump(ctx context.Context, in *PotProfileShowConfigDump) (RPCService_PotProfileShowConfigDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_PotProfileShowConfigDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_PotProfileShowConfigDumpClient interface { + Recv() (*PotProfileShowConfigDetails, error) + api.Stream +} + +type serviceClient_PotProfileShowConfigDumpClient struct { + api.Stream +} + +func (c *serviceClient_PotProfileShowConfigDumpClient) Recv() (*PotProfileShowConfigDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *PotProfileShowConfigDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/pppoe/pppoe.ba.go b/binapi/pppoe/pppoe.ba.go new file mode 100644 index 0000000..0b7cafb --- /dev/null +++ b/binapi/pppoe/pppoe.ba.go @@ -0,0 +1,244 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/pppoe.api.json + +// Package pppoe contains generated bindings for API file pppoe.api. +// +// Contents: +// 4 messages +// +package pppoe + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "pppoe" + APIVersion = "2.0.0" + VersionCrc = 0x24ebf557 +) + +// PppoeAddDelSession defines message 'pppoe_add_del_session'. +type PppoeAddDelSession struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SessionID uint16 `binapi:"u16,name=session_id" json:"session_id,omitempty"` + ClientIP ip_types.Address `binapi:"address,name=client_ip" json:"client_ip,omitempty"` + DecapVrfID uint32 `binapi:"u32,name=decap_vrf_id" json:"decap_vrf_id,omitempty"` + ClientMac ethernet_types.MacAddress `binapi:"mac_address,name=client_mac" json:"client_mac,omitempty"` +} + +func (m *PppoeAddDelSession) Reset() { *m = PppoeAddDelSession{} } +func (*PppoeAddDelSession) GetMessageName() string { return "pppoe_add_del_session" } +func (*PppoeAddDelSession) GetCrcString() string { return "46ace853" } +func (*PppoeAddDelSession) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PppoeAddDelSession) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 2 // m.SessionID + size += 1 // m.ClientIP.Af + size += 1 * 16 // m.ClientIP.Un + size += 4 // m.DecapVrfID + size += 1 * 6 // m.ClientMac + return size +} +func (m *PppoeAddDelSession) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint16(uint16(m.SessionID)) + buf.EncodeUint8(uint8(m.ClientIP.Af)) + buf.EncodeBytes(m.ClientIP.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.DecapVrfID)) + buf.EncodeBytes(m.ClientMac[:], 6) + return buf.Bytes(), nil +} +func (m *PppoeAddDelSession) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.SessionID = buf.DecodeUint16() + m.ClientIP.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.ClientIP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.DecapVrfID = buf.DecodeUint32() + copy(m.ClientMac[:], buf.DecodeBytes(6)) + return nil +} + +// PppoeAddDelSessionReply defines message 'pppoe_add_del_session_reply'. +type PppoeAddDelSessionReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *PppoeAddDelSessionReply) Reset() { *m = PppoeAddDelSessionReply{} } +func (*PppoeAddDelSessionReply) GetMessageName() string { return "pppoe_add_del_session_reply" } +func (*PppoeAddDelSessionReply) GetCrcString() string { return "5383d31f" } +func (*PppoeAddDelSessionReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PppoeAddDelSessionReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *PppoeAddDelSessionReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *PppoeAddDelSessionReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// PppoeSessionDetails defines message 'pppoe_session_details'. +type PppoeSessionDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SessionID uint16 `binapi:"u16,name=session_id" json:"session_id,omitempty"` + ClientIP ip_types.Address `binapi:"address,name=client_ip" json:"client_ip,omitempty"` + EncapIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=encap_if_index" json:"encap_if_index,omitempty"` + DecapVrfID uint32 `binapi:"u32,name=decap_vrf_id" json:"decap_vrf_id,omitempty"` + LocalMac ethernet_types.MacAddress `binapi:"mac_address,name=local_mac" json:"local_mac,omitempty"` + ClientMac ethernet_types.MacAddress `binapi:"mac_address,name=client_mac" json:"client_mac,omitempty"` +} + +func (m *PppoeSessionDetails) Reset() { *m = PppoeSessionDetails{} } +func (*PppoeSessionDetails) GetMessageName() string { return "pppoe_session_details" } +func (*PppoeSessionDetails) GetCrcString() string { return "332bc742" } +func (*PppoeSessionDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PppoeSessionDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 2 // m.SessionID + size += 1 // m.ClientIP.Af + size += 1 * 16 // m.ClientIP.Un + size += 4 // m.EncapIfIndex + size += 4 // m.DecapVrfID + size += 1 * 6 // m.LocalMac + size += 1 * 6 // m.ClientMac + return size +} +func (m *PppoeSessionDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint16(uint16(m.SessionID)) + buf.EncodeUint8(uint8(m.ClientIP.Af)) + buf.EncodeBytes(m.ClientIP.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.EncapIfIndex)) + buf.EncodeUint32(uint32(m.DecapVrfID)) + buf.EncodeBytes(m.LocalMac[:], 6) + buf.EncodeBytes(m.ClientMac[:], 6) + return buf.Bytes(), nil +} +func (m *PppoeSessionDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.SessionID = buf.DecodeUint16() + m.ClientIP.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.ClientIP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.EncapIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.DecapVrfID = buf.DecodeUint32() + copy(m.LocalMac[:], buf.DecodeBytes(6)) + copy(m.ClientMac[:], buf.DecodeBytes(6)) + return nil +} + +// PppoeSessionDump defines message 'pppoe_session_dump'. +type PppoeSessionDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *PppoeSessionDump) Reset() { *m = PppoeSessionDump{} } +func (*PppoeSessionDump) GetMessageName() string { return "pppoe_session_dump" } +func (*PppoeSessionDump) GetCrcString() string { return "f9e6675e" } +func (*PppoeSessionDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PppoeSessionDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *PppoeSessionDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *PppoeSessionDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +func init() { file_pppoe_binapi_init() } +func file_pppoe_binapi_init() { + api.RegisterMessage((*PppoeAddDelSession)(nil), "pppoe_add_del_session_46ace853") + api.RegisterMessage((*PppoeAddDelSessionReply)(nil), "pppoe_add_del_session_reply_5383d31f") + api.RegisterMessage((*PppoeSessionDetails)(nil), "pppoe_session_details_332bc742") + api.RegisterMessage((*PppoeSessionDump)(nil), "pppoe_session_dump_f9e6675e") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*PppoeAddDelSession)(nil), + (*PppoeAddDelSessionReply)(nil), + (*PppoeSessionDetails)(nil), + (*PppoeSessionDump)(nil), + } +} diff --git a/binapi/pppoe/pppoe_rest.ba.go b/binapi/pppoe/pppoe_rest.ba.go new file mode 100644 index 0000000..6b01227 --- /dev/null +++ b/binapi/pppoe/pppoe_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package pppoe + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/pppoe_add_del_session", func(w http.ResponseWriter, req *http.Request) { + var request = new(PppoeAddDelSession) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.PppoeAddDelSession(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/pppoe/pppoe_rpc.ba.go b/binapi/pppoe/pppoe_rpc.ba.go new file mode 100644 index 0000000..384d5a8 --- /dev/null +++ b/binapi/pppoe/pppoe_rpc.ba.go @@ -0,0 +1,73 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package pppoe + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service pppoe. +type RPCService interface { + PppoeAddDelSession(ctx context.Context, in *PppoeAddDelSession) (*PppoeAddDelSessionReply, error) + PppoeSessionDump(ctx context.Context, in *PppoeSessionDump) (RPCService_PppoeSessionDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) PppoeAddDelSession(ctx context.Context, in *PppoeAddDelSession) (*PppoeAddDelSessionReply, error) { + out := new(PppoeAddDelSessionReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) PppoeSessionDump(ctx context.Context, in *PppoeSessionDump) (RPCService_PppoeSessionDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_PppoeSessionDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_PppoeSessionDumpClient interface { + Recv() (*PppoeSessionDetails, error) + api.Stream +} + +type serviceClient_PppoeSessionDumpClient struct { + api.Stream +} + +func (c *serviceClient_PppoeSessionDumpClient) Recv() (*PppoeSessionDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *PppoeSessionDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/punt/punt.ba.go b/binapi/punt/punt.ba.go new file mode 100644 index 0000000..53af1a3 --- /dev/null +++ b/binapi/punt/punt.ba.go @@ -0,0 +1,578 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/punt.api.json + +// Package punt contains generated bindings for API file punt.api. +// +// Contents: +// 1 enum +// 5 structs +// 1 union +// 10 messages +// +package punt + +import ( + api "git.fd.io/govpp.git/api" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "punt" + APIVersion = "2.2.1" + VersionCrc = 0x31354154 +) + +// PuntType defines enum 'punt_type'. +type PuntType uint32 + +const ( + PUNT_API_TYPE_L4 PuntType = 1 + PUNT_API_TYPE_IP_PROTO PuntType = 2 + PUNT_API_TYPE_EXCEPTION PuntType = 3 +) + +var ( + PuntType_name = map[uint32]string{ + 1: "PUNT_API_TYPE_L4", + 2: "PUNT_API_TYPE_IP_PROTO", + 3: "PUNT_API_TYPE_EXCEPTION", + } + PuntType_value = map[string]uint32{ + "PUNT_API_TYPE_L4": 1, + "PUNT_API_TYPE_IP_PROTO": 2, + "PUNT_API_TYPE_EXCEPTION": 3, + } +) + +func (x PuntType) String() string { + s, ok := PuntType_name[uint32(x)] + if ok { + return s + } + return "PuntType(" + strconv.Itoa(int(x)) + ")" +} + +// Punt defines type 'punt'. +type Punt struct { + Type PuntType `binapi:"punt_type,name=type" json:"type,omitempty"` + Punt PuntUnion `binapi:"punt_union,name=punt" json:"punt,omitempty"` +} + +// PuntException defines type 'punt_exception'. +type PuntException struct { + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` +} + +// PuntIPProto defines type 'punt_ip_proto'. +type PuntIPProto struct { + Af ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + Protocol ip_types.IPProto `binapi:"ip_proto,name=protocol" json:"protocol,omitempty"` +} + +// PuntL4 defines type 'punt_l4'. +type PuntL4 struct { + Af ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + Protocol ip_types.IPProto `binapi:"ip_proto,name=protocol" json:"protocol,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` +} + +// PuntReason defines type 'punt_reason'. +type PuntReason struct { + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` + Name string `binapi:"string[],name=name" json:"name,omitempty"` +} + +// PuntUnion defines union 'punt_union'. +type PuntUnion struct { + // Exception *PuntException + // L4 *PuntL4 + // IPProto *PuntIPProto + XXX_UnionData [4]byte +} + +func PuntUnionException(a PuntException) (u PuntUnion) { + u.SetException(a) + return +} +func (u *PuntUnion) SetException(a PuntException) { + var buf = codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeUint32(uint32(a.ID)) +} +func (u *PuntUnion) GetException() (a PuntException) { + var buf = codec.NewBuffer(u.XXX_UnionData[:]) + a.ID = buf.DecodeUint32() + return +} + +func PuntUnionL4(a PuntL4) (u PuntUnion) { + u.SetL4(a) + return +} +func (u *PuntUnion) SetL4(a PuntL4) { + var buf = codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeUint8(uint8(a.Af)) + buf.EncodeUint8(uint8(a.Protocol)) + buf.EncodeUint16(uint16(a.Port)) +} +func (u *PuntUnion) GetL4() (a PuntL4) { + var buf = codec.NewBuffer(u.XXX_UnionData[:]) + a.Af = ip_types.AddressFamily(buf.DecodeUint8()) + a.Protocol = ip_types.IPProto(buf.DecodeUint8()) + a.Port = buf.DecodeUint16() + return +} + +func PuntUnionIPProto(a PuntIPProto) (u PuntUnion) { + u.SetIPProto(a) + return +} +func (u *PuntUnion) SetIPProto(a PuntIPProto) { + var buf = codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeUint8(uint8(a.Af)) + buf.EncodeUint8(uint8(a.Protocol)) +} +func (u *PuntUnion) GetIPProto() (a PuntIPProto) { + var buf = codec.NewBuffer(u.XXX_UnionData[:]) + a.Af = ip_types.AddressFamily(buf.DecodeUint8()) + a.Protocol = ip_types.IPProto(buf.DecodeUint8()) + return +} + +// PuntReasonDetails defines message 'punt_reason_details'. +type PuntReasonDetails struct { + Reason PuntReason `binapi:"punt_reason,name=reason" json:"reason,omitempty"` +} + +func (m *PuntReasonDetails) Reset() { *m = PuntReasonDetails{} } +func (*PuntReasonDetails) GetMessageName() string { return "punt_reason_details" } +func (*PuntReasonDetails) GetCrcString() string { return "2c9d4a40" } +func (*PuntReasonDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PuntReasonDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Reason.ID + size += 4 + len(m.Reason.Name) // m.Reason.Name + return size +} +func (m *PuntReasonDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Reason.ID)) + buf.EncodeString(m.Reason.Name, 0) + return buf.Bytes(), nil +} +func (m *PuntReasonDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Reason.ID = buf.DecodeUint32() + m.Reason.Name = buf.DecodeString(0) + return nil +} + +// PuntReasonDump defines message 'punt_reason_dump'. +type PuntReasonDump struct { + Reason PuntReason `binapi:"punt_reason,name=reason" json:"reason,omitempty"` +} + +func (m *PuntReasonDump) Reset() { *m = PuntReasonDump{} } +func (*PuntReasonDump) GetMessageName() string { return "punt_reason_dump" } +func (*PuntReasonDump) GetCrcString() string { return "5c0dd4fe" } +func (*PuntReasonDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PuntReasonDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Reason.ID + size += 4 + len(m.Reason.Name) // m.Reason.Name + return size +} +func (m *PuntReasonDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Reason.ID)) + buf.EncodeString(m.Reason.Name, 0) + return buf.Bytes(), nil +} +func (m *PuntReasonDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Reason.ID = buf.DecodeUint32() + m.Reason.Name = buf.DecodeString(0) + return nil +} + +// PuntSocketDeregister defines message 'punt_socket_deregister'. +type PuntSocketDeregister struct { + Punt Punt `binapi:"punt,name=punt" json:"punt,omitempty"` +} + +func (m *PuntSocketDeregister) Reset() { *m = PuntSocketDeregister{} } +func (*PuntSocketDeregister) GetMessageName() string { return "punt_socket_deregister" } +func (*PuntSocketDeregister) GetCrcString() string { return "98a444f4" } +func (*PuntSocketDeregister) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PuntSocketDeregister) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Punt.Type + size += 1 * 4 // m.Punt.Punt + return size +} +func (m *PuntSocketDeregister) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Punt.Type)) + buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *PuntSocketDeregister) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Punt.Type = PuntType(buf.DecodeUint32()) + copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(4)) + return nil +} + +// PuntSocketDeregisterReply defines message 'punt_socket_deregister_reply'. +type PuntSocketDeregisterReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *PuntSocketDeregisterReply) Reset() { *m = PuntSocketDeregisterReply{} } +func (*PuntSocketDeregisterReply) GetMessageName() string { return "punt_socket_deregister_reply" } +func (*PuntSocketDeregisterReply) GetCrcString() string { return "e8d4e804" } +func (*PuntSocketDeregisterReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PuntSocketDeregisterReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *PuntSocketDeregisterReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *PuntSocketDeregisterReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// PuntSocketDetails defines message 'punt_socket_details'. +type PuntSocketDetails struct { + Punt Punt `binapi:"punt,name=punt" json:"punt,omitempty"` + Pathname string `binapi:"string[108],name=pathname" json:"pathname,omitempty"` +} + +func (m *PuntSocketDetails) Reset() { *m = PuntSocketDetails{} } +func (*PuntSocketDetails) GetMessageName() string { return "punt_socket_details" } +func (*PuntSocketDetails) GetCrcString() string { return "1de0ce75" } +func (*PuntSocketDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PuntSocketDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Punt.Type + size += 1 * 4 // m.Punt.Punt + size += 108 // m.Pathname + return size +} +func (m *PuntSocketDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Punt.Type)) + buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 0) + buf.EncodeString(m.Pathname, 108) + return buf.Bytes(), nil +} +func (m *PuntSocketDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Punt.Type = PuntType(buf.DecodeUint32()) + copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(4)) + m.Pathname = buf.DecodeString(108) + return nil +} + +// PuntSocketDump defines message 'punt_socket_dump'. +type PuntSocketDump struct { + Type PuntType `binapi:"punt_type,name=type" json:"type,omitempty"` +} + +func (m *PuntSocketDump) Reset() { *m = PuntSocketDump{} } +func (*PuntSocketDump) GetMessageName() string { return "punt_socket_dump" } +func (*PuntSocketDump) GetCrcString() string { return "52974935" } +func (*PuntSocketDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PuntSocketDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Type + return size +} +func (m *PuntSocketDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Type)) + return buf.Bytes(), nil +} +func (m *PuntSocketDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Type = PuntType(buf.DecodeUint32()) + return nil +} + +// PuntSocketRegister defines message 'punt_socket_register'. +type PuntSocketRegister struct { + HeaderVersion uint32 `binapi:"u32,name=header_version" json:"header_version,omitempty"` + Punt Punt `binapi:"punt,name=punt" json:"punt,omitempty"` + Pathname string `binapi:"string[108],name=pathname" json:"pathname,omitempty"` +} + +func (m *PuntSocketRegister) Reset() { *m = PuntSocketRegister{} } +func (*PuntSocketRegister) GetMessageName() string { return "punt_socket_register" } +func (*PuntSocketRegister) GetCrcString() string { return "c8cd10fa" } +func (*PuntSocketRegister) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PuntSocketRegister) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.HeaderVersion + size += 4 // m.Punt.Type + size += 1 * 4 // m.Punt.Punt + size += 108 // m.Pathname + return size +} +func (m *PuntSocketRegister) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.HeaderVersion)) + buf.EncodeUint32(uint32(m.Punt.Type)) + buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 0) + buf.EncodeString(m.Pathname, 108) + return buf.Bytes(), nil +} +func (m *PuntSocketRegister) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.HeaderVersion = buf.DecodeUint32() + m.Punt.Type = PuntType(buf.DecodeUint32()) + copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(4)) + m.Pathname = buf.DecodeString(108) + return nil +} + +// PuntSocketRegisterReply defines message 'punt_socket_register_reply'. +type PuntSocketRegisterReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Pathname string `binapi:"string[108],name=pathname" json:"pathname,omitempty"` +} + +func (m *PuntSocketRegisterReply) Reset() { *m = PuntSocketRegisterReply{} } +func (*PuntSocketRegisterReply) GetMessageName() string { return "punt_socket_register_reply" } +func (*PuntSocketRegisterReply) GetCrcString() string { return "bd30ae90" } +func (*PuntSocketRegisterReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PuntSocketRegisterReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 108 // m.Pathname + return size +} +func (m *PuntSocketRegisterReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeString(m.Pathname, 108) + return buf.Bytes(), nil +} +func (m *PuntSocketRegisterReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Pathname = buf.DecodeString(108) + return nil +} + +// SetPunt defines message 'set_punt'. +type SetPunt struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Punt Punt `binapi:"punt,name=punt" json:"punt,omitempty"` +} + +func (m *SetPunt) Reset() { *m = SetPunt{} } +func (*SetPunt) GetMessageName() string { return "set_punt" } +func (*SetPunt) GetCrcString() string { return "83799618" } +func (*SetPunt) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SetPunt) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Punt.Type + size += 1 * 4 // m.Punt.Punt + return size +} +func (m *SetPunt) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Punt.Type)) + buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *SetPunt) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Punt.Type = PuntType(buf.DecodeUint32()) + copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(4)) + return nil +} + +// SetPuntReply defines message 'set_punt_reply'. +type SetPuntReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SetPuntReply) Reset() { *m = SetPuntReply{} } +func (*SetPuntReply) GetMessageName() string { return "set_punt_reply" } +func (*SetPuntReply) GetCrcString() string { return "e8d4e804" } +func (*SetPuntReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SetPuntReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SetPuntReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SetPuntReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_punt_binapi_init() } +func file_punt_binapi_init() { + api.RegisterMessage((*PuntReasonDetails)(nil), "punt_reason_details_2c9d4a40") + api.RegisterMessage((*PuntReasonDump)(nil), "punt_reason_dump_5c0dd4fe") + api.RegisterMessage((*PuntSocketDeregister)(nil), "punt_socket_deregister_98a444f4") + api.RegisterMessage((*PuntSocketDeregisterReply)(nil), "punt_socket_deregister_reply_e8d4e804") + api.RegisterMessage((*PuntSocketDetails)(nil), "punt_socket_details_1de0ce75") + api.RegisterMessage((*PuntSocketDump)(nil), "punt_socket_dump_52974935") + api.RegisterMessage((*PuntSocketRegister)(nil), "punt_socket_register_c8cd10fa") + api.RegisterMessage((*PuntSocketRegisterReply)(nil), "punt_socket_register_reply_bd30ae90") + api.RegisterMessage((*SetPunt)(nil), "set_punt_83799618") + api.RegisterMessage((*SetPuntReply)(nil), "set_punt_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*PuntReasonDetails)(nil), + (*PuntReasonDump)(nil), + (*PuntSocketDeregister)(nil), + (*PuntSocketDeregisterReply)(nil), + (*PuntSocketDetails)(nil), + (*PuntSocketDump)(nil), + (*PuntSocketRegister)(nil), + (*PuntSocketRegisterReply)(nil), + (*SetPunt)(nil), + (*SetPuntReply)(nil), + } +} diff --git a/binapi/punt/punt_rest.ba.go b/binapi/punt/punt_rest.ba.go new file mode 100644 index 0000000..5b999b9 --- /dev/null +++ b/binapi/punt/punt_rest.ba.go @@ -0,0 +1,83 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package punt + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/punt_socket_deregister", func(w http.ResponseWriter, req *http.Request) { + var request = new(PuntSocketDeregister) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.PuntSocketDeregister(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/punt_socket_register", func(w http.ResponseWriter, req *http.Request) { + var request = new(PuntSocketRegister) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.PuntSocketRegister(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/set_punt", func(w http.ResponseWriter, req *http.Request) { + var request = new(SetPunt) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SetPunt(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/punt/punt_rpc.ba.go b/binapi/punt/punt_rpc.ba.go new file mode 100644 index 0000000..e2150ed --- /dev/null +++ b/binapi/punt/punt_rpc.ba.go @@ -0,0 +1,133 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package punt + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service punt. +type RPCService interface { + PuntReasonDump(ctx context.Context, in *PuntReasonDump) (RPCService_PuntReasonDumpClient, error) + PuntSocketDeregister(ctx context.Context, in *PuntSocketDeregister) (*PuntSocketDeregisterReply, error) + PuntSocketDump(ctx context.Context, in *PuntSocketDump) (RPCService_PuntSocketDumpClient, error) + PuntSocketRegister(ctx context.Context, in *PuntSocketRegister) (*PuntSocketRegisterReply, error) + SetPunt(ctx context.Context, in *SetPunt) (*SetPuntReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) PuntReasonDump(ctx context.Context, in *PuntReasonDump) (RPCService_PuntReasonDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_PuntReasonDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_PuntReasonDumpClient interface { + Recv() (*PuntReasonDetails, error) + api.Stream +} + +type serviceClient_PuntReasonDumpClient struct { + api.Stream +} + +func (c *serviceClient_PuntReasonDumpClient) Recv() (*PuntReasonDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *PuntReasonDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) PuntSocketDeregister(ctx context.Context, in *PuntSocketDeregister) (*PuntSocketDeregisterReply, error) { + out := new(PuntSocketDeregisterReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) PuntSocketDump(ctx context.Context, in *PuntSocketDump) (RPCService_PuntSocketDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_PuntSocketDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_PuntSocketDumpClient interface { + Recv() (*PuntSocketDetails, error) + api.Stream +} + +type serviceClient_PuntSocketDumpClient struct { + api.Stream +} + +func (c *serviceClient_PuntSocketDumpClient) Recv() (*PuntSocketDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *PuntSocketDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) PuntSocketRegister(ctx context.Context, in *PuntSocketRegister) (*PuntSocketRegisterReply, error) { + out := new(PuntSocketRegisterReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SetPunt(ctx context.Context, in *SetPunt) (*SetPuntReply, error) { + out := new(SetPuntReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/qos/qos.ba.go b/binapi/qos/qos.ba.go new file mode 100644 index 0000000..9ff70dd --- /dev/null +++ b/binapi/qos/qos.ba.go @@ -0,0 +1,890 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/qos.api.json + +// Package qos contains generated bindings for API file qos.api. +// +// Contents: +// 1 enum +// 5 structs +// 19 messages +// +package qos + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + _ "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "qos" + APIVersion = "1.1.1" + VersionCrc = 0x1749d12c +) + +// QosSource defines enum 'qos_source'. +type QosSource uint8 + +const ( + QOS_API_SOURCE_EXT QosSource = 0 + QOS_API_SOURCE_VLAN QosSource = 1 + QOS_API_SOURCE_MPLS QosSource = 2 + QOS_API_SOURCE_IP QosSource = 3 +) + +var ( + QosSource_name = map[uint8]string{ + 0: "QOS_API_SOURCE_EXT", + 1: "QOS_API_SOURCE_VLAN", + 2: "QOS_API_SOURCE_MPLS", + 3: "QOS_API_SOURCE_IP", + } + QosSource_value = map[string]uint8{ + "QOS_API_SOURCE_EXT": 0, + "QOS_API_SOURCE_VLAN": 1, + "QOS_API_SOURCE_MPLS": 2, + "QOS_API_SOURCE_IP": 3, + } +) + +func (x QosSource) String() string { + s, ok := QosSource_name[uint8(x)] + if ok { + return s + } + return "QosSource(" + strconv.Itoa(int(x)) + ")" +} + +// QosEgressMap defines type 'qos_egress_map'. +type QosEgressMap struct { + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` + Rows [4]QosEgressMapRow `binapi:"qos_egress_map_row[4],name=rows" json:"rows,omitempty"` +} + +// QosEgressMapRow defines type 'qos_egress_map_row'. +type QosEgressMapRow struct { + Outputs []byte `binapi:"u8[256],name=outputs" json:"outputs,omitempty"` +} + +// QosMark defines type 'qos_mark'. +type QosMark struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + MapID uint32 `binapi:"u32,name=map_id" json:"map_id,omitempty"` + OutputSource QosSource `binapi:"qos_source,name=output_source" json:"output_source,omitempty"` +} + +// QosRecord defines type 'qos_record'. +type QosRecord struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + InputSource QosSource `binapi:"qos_source,name=input_source" json:"input_source,omitempty"` +} + +// QosStore defines type 'qos_store'. +type QosStore struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + InputSource QosSource `binapi:"qos_source,name=input_source" json:"input_source,omitempty"` + Value uint8 `binapi:"u8,name=value" json:"value,omitempty"` +} + +// QosEgressMapDelete defines message 'qos_egress_map_delete'. +type QosEgressMapDelete struct { + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` +} + +func (m *QosEgressMapDelete) Reset() { *m = QosEgressMapDelete{} } +func (*QosEgressMapDelete) GetMessageName() string { return "qos_egress_map_delete" } +func (*QosEgressMapDelete) GetCrcString() string { return "3a91bde5" } +func (*QosEgressMapDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *QosEgressMapDelete) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ID + return size +} +func (m *QosEgressMapDelete) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ID)) + return buf.Bytes(), nil +} +func (m *QosEgressMapDelete) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ID = buf.DecodeUint32() + return nil +} + +// QosEgressMapDeleteReply defines message 'qos_egress_map_delete_reply'. +type QosEgressMapDeleteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *QosEgressMapDeleteReply) Reset() { *m = QosEgressMapDeleteReply{} } +func (*QosEgressMapDeleteReply) GetMessageName() string { return "qos_egress_map_delete_reply" } +func (*QosEgressMapDeleteReply) GetCrcString() string { return "e8d4e804" } +func (*QosEgressMapDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *QosEgressMapDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *QosEgressMapDeleteReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *QosEgressMapDeleteReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// QosEgressMapDetails defines message 'qos_egress_map_details'. +type QosEgressMapDetails struct { + Map QosEgressMap `binapi:"qos_egress_map,name=map" json:"map,omitempty"` +} + +func (m *QosEgressMapDetails) Reset() { *m = QosEgressMapDetails{} } +func (*QosEgressMapDetails) GetMessageName() string { return "qos_egress_map_details" } +func (*QosEgressMapDetails) GetCrcString() string { return "46c5653c" } +func (*QosEgressMapDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *QosEgressMapDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Map.ID + for j2 := 0; j2 < 4; j2++ { + var s2 QosEgressMapRow + _ = s2 + if j2 < len(m.Map.Rows) { + s2 = m.Map.Rows[j2] + } + size += 1 * 256 // s2.Outputs + } + return size +} +func (m *QosEgressMapDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Map.ID)) + for j1 := 0; j1 < 4; j1++ { + var v1 QosEgressMapRow + if j1 < len(m.Map.Rows) { + v1 = m.Map.Rows[j1] + } + buf.EncodeBytes(v1.Outputs[:], 256) + } + return buf.Bytes(), nil +} +func (m *QosEgressMapDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Map.ID = buf.DecodeUint32() + for j1 := 0; j1 < 4; j1++ { + copy(m.Map.Rows[j1].Outputs[:], buf.DecodeBytes(256)) + } + return nil +} + +// QosEgressMapDump defines message 'qos_egress_map_dump'. +type QosEgressMapDump struct{} + +func (m *QosEgressMapDump) Reset() { *m = QosEgressMapDump{} } +func (*QosEgressMapDump) GetMessageName() string { return "qos_egress_map_dump" } +func (*QosEgressMapDump) GetCrcString() string { return "51077d14" } +func (*QosEgressMapDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *QosEgressMapDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *QosEgressMapDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *QosEgressMapDump) Unmarshal(b []byte) error { + return nil +} + +// QosEgressMapUpdate defines message 'qos_egress_map_update'. +type QosEgressMapUpdate struct { + Map QosEgressMap `binapi:"qos_egress_map,name=map" json:"map,omitempty"` +} + +func (m *QosEgressMapUpdate) Reset() { *m = QosEgressMapUpdate{} } +func (*QosEgressMapUpdate) GetMessageName() string { return "qos_egress_map_update" } +func (*QosEgressMapUpdate) GetCrcString() string { return "6d1c065f" } +func (*QosEgressMapUpdate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *QosEgressMapUpdate) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Map.ID + for j2 := 0; j2 < 4; j2++ { + var s2 QosEgressMapRow + _ = s2 + if j2 < len(m.Map.Rows) { + s2 = m.Map.Rows[j2] + } + size += 1 * 256 // s2.Outputs + } + return size +} +func (m *QosEgressMapUpdate) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Map.ID)) + for j1 := 0; j1 < 4; j1++ { + var v1 QosEgressMapRow + if j1 < len(m.Map.Rows) { + v1 = m.Map.Rows[j1] + } + buf.EncodeBytes(v1.Outputs[:], 256) + } + return buf.Bytes(), nil +} +func (m *QosEgressMapUpdate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Map.ID = buf.DecodeUint32() + for j1 := 0; j1 < 4; j1++ { + copy(m.Map.Rows[j1].Outputs[:], buf.DecodeBytes(256)) + } + return nil +} + +// QosEgressMapUpdateReply defines message 'qos_egress_map_update_reply'. +type QosEgressMapUpdateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *QosEgressMapUpdateReply) Reset() { *m = QosEgressMapUpdateReply{} } +func (*QosEgressMapUpdateReply) GetMessageName() string { return "qos_egress_map_update_reply" } +func (*QosEgressMapUpdateReply) GetCrcString() string { return "e8d4e804" } +func (*QosEgressMapUpdateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *QosEgressMapUpdateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *QosEgressMapUpdateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *QosEgressMapUpdateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// QosMarkDetails defines message 'qos_mark_details'. +type QosMarkDetails struct { + Mark QosMark `binapi:"qos_mark,name=mark" json:"mark,omitempty"` +} + +func (m *QosMarkDetails) Reset() { *m = QosMarkDetails{} } +func (*QosMarkDetails) GetMessageName() string { return "qos_mark_details" } +func (*QosMarkDetails) GetCrcString() string { return "89fe81a9" } +func (*QosMarkDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *QosMarkDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Mark.SwIfIndex + size += 4 // m.Mark.MapID + size += 1 // m.Mark.OutputSource + return size +} +func (m *QosMarkDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Mark.SwIfIndex)) + buf.EncodeUint32(uint32(m.Mark.MapID)) + buf.EncodeUint8(uint8(m.Mark.OutputSource)) + return buf.Bytes(), nil +} +func (m *QosMarkDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Mark.SwIfIndex = buf.DecodeUint32() + m.Mark.MapID = buf.DecodeUint32() + m.Mark.OutputSource = QosSource(buf.DecodeUint8()) + return nil +} + +// QosMarkDetailsReply defines message 'qos_mark_details_reply'. +type QosMarkDetailsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *QosMarkDetailsReply) Reset() { *m = QosMarkDetailsReply{} } +func (*QosMarkDetailsReply) GetMessageName() string { return "qos_mark_details_reply" } +func (*QosMarkDetailsReply) GetCrcString() string { return "e8d4e804" } +func (*QosMarkDetailsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *QosMarkDetailsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *QosMarkDetailsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *QosMarkDetailsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// QosMarkDump defines message 'qos_mark_dump'. +type QosMarkDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *QosMarkDump) Reset() { *m = QosMarkDump{} } +func (*QosMarkDump) GetMessageName() string { return "qos_mark_dump" } +func (*QosMarkDump) GetCrcString() string { return "f9e6675e" } +func (*QosMarkDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *QosMarkDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *QosMarkDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *QosMarkDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// QosMarkEnableDisable defines message 'qos_mark_enable_disable'. +type QosMarkEnableDisable struct { + Enable bool `binapi:"bool,name=enable,default=true" json:"enable,omitempty"` + Mark QosMark `binapi:"qos_mark,name=mark" json:"mark,omitempty"` +} + +func (m *QosMarkEnableDisable) Reset() { *m = QosMarkEnableDisable{} } +func (*QosMarkEnableDisable) GetMessageName() string { return "qos_mark_enable_disable" } +func (*QosMarkEnableDisable) GetCrcString() string { return "1a010f74" } +func (*QosMarkEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *QosMarkEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Enable + size += 4 // m.Mark.SwIfIndex + size += 4 // m.Mark.MapID + size += 1 // m.Mark.OutputSource + return size +} +func (m *QosMarkEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.Enable) + buf.EncodeUint32(uint32(m.Mark.SwIfIndex)) + buf.EncodeUint32(uint32(m.Mark.MapID)) + buf.EncodeUint8(uint8(m.Mark.OutputSource)) + return buf.Bytes(), nil +} +func (m *QosMarkEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Enable = buf.DecodeBool() + m.Mark.SwIfIndex = buf.DecodeUint32() + m.Mark.MapID = buf.DecodeUint32() + m.Mark.OutputSource = QosSource(buf.DecodeUint8()) + return nil +} + +// QosMarkEnableDisableReply defines message 'qos_mark_enable_disable_reply'. +type QosMarkEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *QosMarkEnableDisableReply) Reset() { *m = QosMarkEnableDisableReply{} } +func (*QosMarkEnableDisableReply) GetMessageName() string { return "qos_mark_enable_disable_reply" } +func (*QosMarkEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*QosMarkEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *QosMarkEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *QosMarkEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *QosMarkEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// QosRecordDetails defines message 'qos_record_details'. +type QosRecordDetails struct { + Record QosRecord `binapi:"qos_record,name=record" json:"record,omitempty"` +} + +func (m *QosRecordDetails) Reset() { *m = QosRecordDetails{} } +func (*QosRecordDetails) GetMessageName() string { return "qos_record_details" } +func (*QosRecordDetails) GetCrcString() string { return "4956ccdd" } +func (*QosRecordDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *QosRecordDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Record.SwIfIndex + size += 1 // m.Record.InputSource + return size +} +func (m *QosRecordDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Record.SwIfIndex)) + buf.EncodeUint8(uint8(m.Record.InputSource)) + return buf.Bytes(), nil +} +func (m *QosRecordDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Record.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Record.InputSource = QosSource(buf.DecodeUint8()) + return nil +} + +// QosRecordDump defines message 'qos_record_dump'. +type QosRecordDump struct{} + +func (m *QosRecordDump) Reset() { *m = QosRecordDump{} } +func (*QosRecordDump) GetMessageName() string { return "qos_record_dump" } +func (*QosRecordDump) GetCrcString() string { return "51077d14" } +func (*QosRecordDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *QosRecordDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *QosRecordDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *QosRecordDump) Unmarshal(b []byte) error { + return nil +} + +// QosRecordEnableDisable defines message 'qos_record_enable_disable'. +type QosRecordEnableDisable struct { + Enable bool `binapi:"bool,name=enable,default=true" json:"enable,omitempty"` + Record QosRecord `binapi:"qos_record,name=record" json:"record,omitempty"` +} + +func (m *QosRecordEnableDisable) Reset() { *m = QosRecordEnableDisable{} } +func (*QosRecordEnableDisable) GetMessageName() string { return "qos_record_enable_disable" } +func (*QosRecordEnableDisable) GetCrcString() string { return "25b33f88" } +func (*QosRecordEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *QosRecordEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Enable + size += 4 // m.Record.SwIfIndex + size += 1 // m.Record.InputSource + return size +} +func (m *QosRecordEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.Enable) + buf.EncodeUint32(uint32(m.Record.SwIfIndex)) + buf.EncodeUint8(uint8(m.Record.InputSource)) + return buf.Bytes(), nil +} +func (m *QosRecordEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Enable = buf.DecodeBool() + m.Record.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Record.InputSource = QosSource(buf.DecodeUint8()) + return nil +} + +// QosRecordEnableDisableReply defines message 'qos_record_enable_disable_reply'. +type QosRecordEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *QosRecordEnableDisableReply) Reset() { *m = QosRecordEnableDisableReply{} } +func (*QosRecordEnableDisableReply) GetMessageName() string { return "qos_record_enable_disable_reply" } +func (*QosRecordEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*QosRecordEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *QosRecordEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *QosRecordEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *QosRecordEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// QosStoreDetails defines message 'qos_store_details'. +type QosStoreDetails struct { + Store QosStore `binapi:"qos_store,name=store" json:"store,omitempty"` +} + +func (m *QosStoreDetails) Reset() { *m = QosStoreDetails{} } +func (*QosStoreDetails) GetMessageName() string { return "qos_store_details" } +func (*QosStoreDetails) GetCrcString() string { return "038a6d48" } +func (*QosStoreDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *QosStoreDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Store.SwIfIndex + size += 1 // m.Store.InputSource + size += 1 // m.Store.Value + return size +} +func (m *QosStoreDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Store.SwIfIndex)) + buf.EncodeUint8(uint8(m.Store.InputSource)) + buf.EncodeUint8(uint8(m.Store.Value)) + return buf.Bytes(), nil +} +func (m *QosStoreDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Store.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Store.InputSource = QosSource(buf.DecodeUint8()) + m.Store.Value = buf.DecodeUint8() + return nil +} + +// QosStoreDump defines message 'qos_store_dump'. +type QosStoreDump struct{} + +func (m *QosStoreDump) Reset() { *m = QosStoreDump{} } +func (*QosStoreDump) GetMessageName() string { return "qos_store_dump" } +func (*QosStoreDump) GetCrcString() string { return "51077d14" } +func (*QosStoreDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *QosStoreDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *QosStoreDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *QosStoreDump) Unmarshal(b []byte) error { + return nil +} + +// QosStoreEnableDisable defines message 'qos_store_enable_disable'. +type QosStoreEnableDisable struct { + Enable bool `binapi:"bool,name=enable,default=true" json:"enable,omitempty"` + Store QosStore `binapi:"qos_store,name=store" json:"store,omitempty"` +} + +func (m *QosStoreEnableDisable) Reset() { *m = QosStoreEnableDisable{} } +func (*QosStoreEnableDisable) GetMessageName() string { return "qos_store_enable_disable" } +func (*QosStoreEnableDisable) GetCrcString() string { return "3507235e" } +func (*QosStoreEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *QosStoreEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Enable + size += 4 // m.Store.SwIfIndex + size += 1 // m.Store.InputSource + size += 1 // m.Store.Value + return size +} +func (m *QosStoreEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.Enable) + buf.EncodeUint32(uint32(m.Store.SwIfIndex)) + buf.EncodeUint8(uint8(m.Store.InputSource)) + buf.EncodeUint8(uint8(m.Store.Value)) + return buf.Bytes(), nil +} +func (m *QosStoreEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Enable = buf.DecodeBool() + m.Store.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Store.InputSource = QosSource(buf.DecodeUint8()) + m.Store.Value = buf.DecodeUint8() + return nil +} + +// QosStoreEnableDisableReply defines message 'qos_store_enable_disable_reply'. +type QosStoreEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *QosStoreEnableDisableReply) Reset() { *m = QosStoreEnableDisableReply{} } +func (*QosStoreEnableDisableReply) GetMessageName() string { return "qos_store_enable_disable_reply" } +func (*QosStoreEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*QosStoreEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *QosStoreEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *QosStoreEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *QosStoreEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_qos_binapi_init() } +func file_qos_binapi_init() { + api.RegisterMessage((*QosEgressMapDelete)(nil), "qos_egress_map_delete_3a91bde5") + api.RegisterMessage((*QosEgressMapDeleteReply)(nil), "qos_egress_map_delete_reply_e8d4e804") + api.RegisterMessage((*QosEgressMapDetails)(nil), "qos_egress_map_details_46c5653c") + api.RegisterMessage((*QosEgressMapDump)(nil), "qos_egress_map_dump_51077d14") + api.RegisterMessage((*QosEgressMapUpdate)(nil), "qos_egress_map_update_6d1c065f") + api.RegisterMessage((*QosEgressMapUpdateReply)(nil), "qos_egress_map_update_reply_e8d4e804") + api.RegisterMessage((*QosMarkDetails)(nil), "qos_mark_details_89fe81a9") + api.RegisterMessage((*QosMarkDetailsReply)(nil), "qos_mark_details_reply_e8d4e804") + api.RegisterMessage((*QosMarkDump)(nil), "qos_mark_dump_f9e6675e") + api.RegisterMessage((*QosMarkEnableDisable)(nil), "qos_mark_enable_disable_1a010f74") + api.RegisterMessage((*QosMarkEnableDisableReply)(nil), "qos_mark_enable_disable_reply_e8d4e804") + api.RegisterMessage((*QosRecordDetails)(nil), "qos_record_details_4956ccdd") + api.RegisterMessage((*QosRecordDump)(nil), "qos_record_dump_51077d14") + api.RegisterMessage((*QosRecordEnableDisable)(nil), "qos_record_enable_disable_25b33f88") + api.RegisterMessage((*QosRecordEnableDisableReply)(nil), "qos_record_enable_disable_reply_e8d4e804") + api.RegisterMessage((*QosStoreDetails)(nil), "qos_store_details_038a6d48") + api.RegisterMessage((*QosStoreDump)(nil), "qos_store_dump_51077d14") + api.RegisterMessage((*QosStoreEnableDisable)(nil), "qos_store_enable_disable_3507235e") + api.RegisterMessage((*QosStoreEnableDisableReply)(nil), "qos_store_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*QosEgressMapDelete)(nil), + (*QosEgressMapDeleteReply)(nil), + (*QosEgressMapDetails)(nil), + (*QosEgressMapDump)(nil), + (*QosEgressMapUpdate)(nil), + (*QosEgressMapUpdateReply)(nil), + (*QosMarkDetails)(nil), + (*QosMarkDetailsReply)(nil), + (*QosMarkDump)(nil), + (*QosMarkEnableDisable)(nil), + (*QosMarkEnableDisableReply)(nil), + (*QosRecordDetails)(nil), + (*QosRecordDump)(nil), + (*QosRecordEnableDisable)(nil), + (*QosRecordEnableDisableReply)(nil), + (*QosStoreDetails)(nil), + (*QosStoreDump)(nil), + (*QosStoreEnableDisable)(nil), + (*QosStoreEnableDisableReply)(nil), + } +} diff --git a/binapi/qos/qos_rest.ba.go b/binapi/qos/qos_rest.ba.go new file mode 100644 index 0000000..2e0e546 --- /dev/null +++ b/binapi/qos/qos_rest.ba.go @@ -0,0 +1,129 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package qos + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/qos_egress_map_delete", func(w http.ResponseWriter, req *http.Request) { + var request = new(QosEgressMapDelete) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.QosEgressMapDelete(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/qos_egress_map_update", func(w http.ResponseWriter, req *http.Request) { + var request = new(QosEgressMapUpdate) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.QosEgressMapUpdate(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/qos_mark_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(QosMarkEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.QosMarkEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/qos_record_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(QosRecordEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.QosRecordEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/qos_store_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(QosStoreEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.QosStoreEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/qos/qos_rpc.ba.go b/binapi/qos/qos_rpc.ba.go new file mode 100644 index 0000000..a31f611 --- /dev/null +++ b/binapi/qos/qos_rpc.ba.go @@ -0,0 +1,233 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package qos + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service qos. +type RPCService interface { + QosEgressMapDelete(ctx context.Context, in *QosEgressMapDelete) (*QosEgressMapDeleteReply, error) + QosEgressMapDump(ctx context.Context, in *QosEgressMapDump) (RPCService_QosEgressMapDumpClient, error) + QosEgressMapUpdate(ctx context.Context, in *QosEgressMapUpdate) (*QosEgressMapUpdateReply, error) + QosMarkDump(ctx context.Context, in *QosMarkDump) (RPCService_QosMarkDumpClient, error) + QosMarkEnableDisable(ctx context.Context, in *QosMarkEnableDisable) (*QosMarkEnableDisableReply, error) + QosRecordDump(ctx context.Context, in *QosRecordDump) (RPCService_QosRecordDumpClient, error) + QosRecordEnableDisable(ctx context.Context, in *QosRecordEnableDisable) (*QosRecordEnableDisableReply, error) + QosStoreDump(ctx context.Context, in *QosStoreDump) (RPCService_QosStoreDumpClient, error) + QosStoreEnableDisable(ctx context.Context, in *QosStoreEnableDisable) (*QosStoreEnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) QosEgressMapDelete(ctx context.Context, in *QosEgressMapDelete) (*QosEgressMapDeleteReply, error) { + out := new(QosEgressMapDeleteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) QosEgressMapDump(ctx context.Context, in *QosEgressMapDump) (RPCService_QosEgressMapDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_QosEgressMapDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_QosEgressMapDumpClient interface { + Recv() (*QosEgressMapDetails, error) + api.Stream +} + +type serviceClient_QosEgressMapDumpClient struct { + api.Stream +} + +func (c *serviceClient_QosEgressMapDumpClient) Recv() (*QosEgressMapDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *QosEgressMapDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) QosEgressMapUpdate(ctx context.Context, in *QosEgressMapUpdate) (*QosEgressMapUpdateReply, error) { + out := new(QosEgressMapUpdateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) QosMarkDump(ctx context.Context, in *QosMarkDump) (RPCService_QosMarkDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_QosMarkDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_QosMarkDumpClient interface { + Recv() (*QosMarkDetails, error) + api.Stream +} + +type serviceClient_QosMarkDumpClient struct { + api.Stream +} + +func (c *serviceClient_QosMarkDumpClient) Recv() (*QosMarkDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *QosMarkDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) QosMarkEnableDisable(ctx context.Context, in *QosMarkEnableDisable) (*QosMarkEnableDisableReply, error) { + out := new(QosMarkEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) QosRecordDump(ctx context.Context, in *QosRecordDump) (RPCService_QosRecordDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_QosRecordDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_QosRecordDumpClient interface { + Recv() (*QosRecordDetails, error) + api.Stream +} + +type serviceClient_QosRecordDumpClient struct { + api.Stream +} + +func (c *serviceClient_QosRecordDumpClient) Recv() (*QosRecordDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *QosRecordDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) QosRecordEnableDisable(ctx context.Context, in *QosRecordEnableDisable) (*QosRecordEnableDisableReply, error) { + out := new(QosRecordEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) QosStoreDump(ctx context.Context, in *QosStoreDump) (RPCService_QosStoreDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_QosStoreDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_QosStoreDumpClient interface { + Recv() (*QosStoreDetails, error) + api.Stream +} + +type serviceClient_QosStoreDumpClient struct { + api.Stream +} + +func (c *serviceClient_QosStoreDumpClient) Recv() (*QosStoreDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *QosStoreDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) QosStoreEnableDisable(ctx context.Context, in *QosStoreEnableDisable) (*QosStoreEnableDisableReply, error) { + out := new(QosStoreEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/rd_cp/rd_cp.ba.go b/binapi/rd_cp/rd_cp.ba.go new file mode 100644 index 0000000..7fefd79 --- /dev/null +++ b/binapi/rd_cp/rd_cp.ba.go @@ -0,0 +1,124 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/rd_cp.api.json + +// Package rd_cp contains generated bindings for API file rd_cp.api. +// +// Contents: +// 2 messages +// +package rd_cp + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "rd_cp" + APIVersion = "1.0.1" + VersionCrc = 0x2caa616 +) + +// IP6NdAddressAutoconfig defines message 'ip6_nd_address_autoconfig'. +type IP6NdAddressAutoconfig struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` + InstallDefaultRoutes bool `binapi:"bool,name=install_default_routes" json:"install_default_routes,omitempty"` +} + +func (m *IP6NdAddressAutoconfig) Reset() { *m = IP6NdAddressAutoconfig{} } +func (*IP6NdAddressAutoconfig) GetMessageName() string { return "ip6_nd_address_autoconfig" } +func (*IP6NdAddressAutoconfig) GetCrcString() string { return "9e14a4a7" } +func (*IP6NdAddressAutoconfig) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IP6NdAddressAutoconfig) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Enable + size += 1 // m.InstallDefaultRoutes + return size +} +func (m *IP6NdAddressAutoconfig) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.Enable) + buf.EncodeBool(m.InstallDefaultRoutes) + return buf.Bytes(), nil +} +func (m *IP6NdAddressAutoconfig) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Enable = buf.DecodeBool() + m.InstallDefaultRoutes = buf.DecodeBool() + return nil +} + +// IP6NdAddressAutoconfigReply defines message 'ip6_nd_address_autoconfig_reply'. +type IP6NdAddressAutoconfigReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IP6NdAddressAutoconfigReply) Reset() { *m = IP6NdAddressAutoconfigReply{} } +func (*IP6NdAddressAutoconfigReply) GetMessageName() string { return "ip6_nd_address_autoconfig_reply" } +func (*IP6NdAddressAutoconfigReply) GetCrcString() string { return "e8d4e804" } +func (*IP6NdAddressAutoconfigReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IP6NdAddressAutoconfigReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IP6NdAddressAutoconfigReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IP6NdAddressAutoconfigReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_rd_cp_binapi_init() } +func file_rd_cp_binapi_init() { + api.RegisterMessage((*IP6NdAddressAutoconfig)(nil), "ip6_nd_address_autoconfig_9e14a4a7") + api.RegisterMessage((*IP6NdAddressAutoconfigReply)(nil), "ip6_nd_address_autoconfig_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*IP6NdAddressAutoconfig)(nil), + (*IP6NdAddressAutoconfigReply)(nil), + } +} diff --git a/binapi/rd_cp/rd_cp_rest.ba.go b/binapi/rd_cp/rd_cp_rest.ba.go new file mode 100644 index 0000000..75e75a0 --- /dev/null +++ b/binapi/rd_cp/rd_cp_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package rd_cp + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/ip6_nd_address_autoconfig", func(w http.ResponseWriter, req *http.Request) { + var request = new(IP6NdAddressAutoconfig) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IP6NdAddressAutoconfig(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/rd_cp/rd_cp_rpc.ba.go b/binapi/rd_cp/rd_cp_rpc.ba.go new file mode 100644 index 0000000..af7ba12 --- /dev/null +++ b/binapi/rd_cp/rd_cp_rpc.ba.go @@ -0,0 +1,30 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package rd_cp + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service rd_cp. +type RPCService interface { + IP6NdAddressAutoconfig(ctx context.Context, in *IP6NdAddressAutoconfig) (*IP6NdAddressAutoconfigReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) IP6NdAddressAutoconfig(ctx context.Context, in *IP6NdAddressAutoconfig) (*IP6NdAddressAutoconfigReply, error) { + out := new(IP6NdAddressAutoconfigReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/rdma/rdma.ba.go b/binapi/rdma/rdma.ba.go new file mode 100644 index 0000000..43ab597 --- /dev/null +++ b/binapi/rdma/rdma.ba.go @@ -0,0 +1,248 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/rdma.api.json + +// Package rdma contains generated bindings for API file rdma.api. +// +// Contents: +// 1 enum +// 4 messages +// +package rdma + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "rdma" + APIVersion = "1.0.0" + VersionCrc = 0x8b33158c +) + +// RdmaMode defines enum 'rdma_mode'. +type RdmaMode uint32 + +const ( + RDMA_API_MODE_AUTO RdmaMode = 0 + RDMA_API_MODE_IBV RdmaMode = 1 + RDMA_API_MODE_DV RdmaMode = 2 +) + +var ( + RdmaMode_name = map[uint32]string{ + 0: "RDMA_API_MODE_AUTO", + 1: "RDMA_API_MODE_IBV", + 2: "RDMA_API_MODE_DV", + } + RdmaMode_value = map[string]uint32{ + "RDMA_API_MODE_AUTO": 0, + "RDMA_API_MODE_IBV": 1, + "RDMA_API_MODE_DV": 2, + } +) + +func (x RdmaMode) String() string { + s, ok := RdmaMode_name[uint32(x)] + if ok { + return s + } + return "RdmaMode(" + strconv.Itoa(int(x)) + ")" +} + +// RdmaCreate defines message 'rdma_create'. +type RdmaCreate struct { + HostIf string `binapi:"string[64],name=host_if" json:"host_if,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + RxqNum uint16 `binapi:"u16,name=rxq_num,default=%!s(float64=1)" json:"rxq_num,omitempty"` + RxqSize uint16 `binapi:"u16,name=rxq_size,default=%!s(float64=1024)" json:"rxq_size,omitempty"` + TxqSize uint16 `binapi:"u16,name=txq_size,default=%!s(float64=1024)" json:"txq_size,omitempty"` + Mode RdmaMode `binapi:"rdma_mode,name=mode,default=%!s(float64=0)" json:"mode,omitempty"` +} + +func (m *RdmaCreate) Reset() { *m = RdmaCreate{} } +func (*RdmaCreate) GetMessageName() string { return "rdma_create" } +func (*RdmaCreate) GetCrcString() string { return "076fe418" } +func (*RdmaCreate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *RdmaCreate) Size() int { + if m == nil { + return 0 + } + var size int + size += 64 // m.HostIf + size += 64 // m.Name + size += 2 // m.RxqNum + size += 2 // m.RxqSize + size += 2 // m.TxqSize + size += 4 // m.Mode + return size +} +func (m *RdmaCreate) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.HostIf, 64) + buf.EncodeString(m.Name, 64) + buf.EncodeUint16(uint16(m.RxqNum)) + buf.EncodeUint16(uint16(m.RxqSize)) + buf.EncodeUint16(uint16(m.TxqSize)) + buf.EncodeUint32(uint32(m.Mode)) + return buf.Bytes(), nil +} +func (m *RdmaCreate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.HostIf = buf.DecodeString(64) + m.Name = buf.DecodeString(64) + m.RxqNum = buf.DecodeUint16() + m.RxqSize = buf.DecodeUint16() + m.TxqSize = buf.DecodeUint16() + m.Mode = RdmaMode(buf.DecodeUint32()) + return nil +} + +// RdmaCreateReply defines message 'rdma_create_reply'. +type RdmaCreateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *RdmaCreateReply) Reset() { *m = RdmaCreateReply{} } +func (*RdmaCreateReply) GetMessageName() string { return "rdma_create_reply" } +func (*RdmaCreateReply) GetCrcString() string { return "5383d31f" } +func (*RdmaCreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *RdmaCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *RdmaCreateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *RdmaCreateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// RdmaDelete defines message 'rdma_delete'. +type RdmaDelete struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *RdmaDelete) Reset() { *m = RdmaDelete{} } +func (*RdmaDelete) GetMessageName() string { return "rdma_delete" } +func (*RdmaDelete) GetCrcString() string { return "f9e6675e" } +func (*RdmaDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *RdmaDelete) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *RdmaDelete) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *RdmaDelete) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// RdmaDeleteReply defines message 'rdma_delete_reply'. +type RdmaDeleteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *RdmaDeleteReply) Reset() { *m = RdmaDeleteReply{} } +func (*RdmaDeleteReply) GetMessageName() string { return "rdma_delete_reply" } +func (*RdmaDeleteReply) GetCrcString() string { return "e8d4e804" } +func (*RdmaDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *RdmaDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *RdmaDeleteReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *RdmaDeleteReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_rdma_binapi_init() } +func file_rdma_binapi_init() { + api.RegisterMessage((*RdmaCreate)(nil), "rdma_create_076fe418") + api.RegisterMessage((*RdmaCreateReply)(nil), "rdma_create_reply_5383d31f") + api.RegisterMessage((*RdmaDelete)(nil), "rdma_delete_f9e6675e") + api.RegisterMessage((*RdmaDeleteReply)(nil), "rdma_delete_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*RdmaCreate)(nil), + (*RdmaCreateReply)(nil), + (*RdmaDelete)(nil), + (*RdmaDeleteReply)(nil), + } +} diff --git a/binapi/rdma/rdma_rest.ba.go b/binapi/rdma/rdma_rest.ba.go new file mode 100644 index 0000000..83346d9 --- /dev/null +++ b/binapi/rdma/rdma_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package rdma + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/rdma_create", func(w http.ResponseWriter, req *http.Request) { + var request = new(RdmaCreate) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.RdmaCreate(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/rdma_delete", func(w http.ResponseWriter, req *http.Request) { + var request = new(RdmaDelete) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.RdmaDelete(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/rdma/rdma_rpc.ba.go b/binapi/rdma/rdma_rpc.ba.go new file mode 100644 index 0000000..850f04a --- /dev/null +++ b/binapi/rdma/rdma_rpc.ba.go @@ -0,0 +1,40 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package rdma + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service rdma. +type RPCService interface { + RdmaCreate(ctx context.Context, in *RdmaCreate) (*RdmaCreateReply, error) + RdmaDelete(ctx context.Context, in *RdmaDelete) (*RdmaDeleteReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) RdmaCreate(ctx context.Context, in *RdmaCreate) (*RdmaCreateReply, error) { + out := new(RdmaCreateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) RdmaDelete(ctx context.Context, in *RdmaDelete) (*RdmaDeleteReply, error) { + out := new(RdmaDeleteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/session/session.ba.go b/binapi/session/session.ba.go new file mode 100644 index 0000000..1da2733 --- /dev/null +++ b/binapi/session/session.ba.go @@ -0,0 +1,1158 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/session.api.json + +// Package session contains generated bindings for API file session.api. +// +// Contents: +// 2 enums +// 22 messages +// +package session + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "session" + APIVersion = "3.2.0" + VersionCrc = 0x9aa0ebc0 +) + +// SessionRuleScope defines enum 'session_rule_scope'. +type SessionRuleScope uint32 + +const ( + SESSION_RULE_SCOPE_API_GLOBAL SessionRuleScope = 0 + SESSION_RULE_SCOPE_API_LOCAL SessionRuleScope = 1 + SESSION_RULE_SCOPE_API_BOTH SessionRuleScope = 2 +) + +var ( + SessionRuleScope_name = map[uint32]string{ + 0: "SESSION_RULE_SCOPE_API_GLOBAL", + 1: "SESSION_RULE_SCOPE_API_LOCAL", + 2: "SESSION_RULE_SCOPE_API_BOTH", + } + SessionRuleScope_value = map[string]uint32{ + "SESSION_RULE_SCOPE_API_GLOBAL": 0, + "SESSION_RULE_SCOPE_API_LOCAL": 1, + "SESSION_RULE_SCOPE_API_BOTH": 2, + } +) + +func (x SessionRuleScope) String() string { + s, ok := SessionRuleScope_name[uint32(x)] + if ok { + return s + } + return "SessionRuleScope(" + strconv.Itoa(int(x)) + ")" +} + +// TransportProto defines enum 'transport_proto'. +type TransportProto uint8 + +const ( + TRANSPORT_PROTO_API_TCP TransportProto = 1 + TRANSPORT_PROTO_API_UDP TransportProto = 2 + TRANSPORT_PROTO_API_NONE TransportProto = 3 + TRANSPORT_PROTO_API_TLS TransportProto = 4 + TRANSPORT_PROTO_API_QUIC TransportProto = 5 +) + +var ( + TransportProto_name = map[uint8]string{ + 1: "TRANSPORT_PROTO_API_TCP", + 2: "TRANSPORT_PROTO_API_UDP", + 3: "TRANSPORT_PROTO_API_NONE", + 4: "TRANSPORT_PROTO_API_TLS", + 5: "TRANSPORT_PROTO_API_QUIC", + } + TransportProto_value = map[string]uint8{ + "TRANSPORT_PROTO_API_TCP": 1, + "TRANSPORT_PROTO_API_UDP": 2, + "TRANSPORT_PROTO_API_NONE": 3, + "TRANSPORT_PROTO_API_TLS": 4, + "TRANSPORT_PROTO_API_QUIC": 5, + } +) + +func (x TransportProto) String() string { + s, ok := TransportProto_name[uint8(x)] + if ok { + return s + } + return "TransportProto(" + strconv.Itoa(int(x)) + ")" +} + +// AppAddCertKeyPair defines message 'app_add_cert_key_pair'. +type AppAddCertKeyPair struct { + CertLen uint16 `binapi:"u16,name=cert_len" json:"cert_len,omitempty"` + CertkeyLen uint16 `binapi:"u16,name=certkey_len" json:"-"` + Certkey []byte `binapi:"u8[certkey_len],name=certkey" json:"certkey,omitempty"` +} + +func (m *AppAddCertKeyPair) Reset() { *m = AppAddCertKeyPair{} } +func (*AppAddCertKeyPair) GetMessageName() string { return "app_add_cert_key_pair" } +func (*AppAddCertKeyPair) GetCrcString() string { return "02eb8016" } +func (*AppAddCertKeyPair) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AppAddCertKeyPair) Size() int { + if m == nil { + return 0 + } + var size int + size += 2 // m.CertLen + size += 2 // m.CertkeyLen + size += 1 * len(m.Certkey) // m.Certkey + return size +} +func (m *AppAddCertKeyPair) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint16(uint16(m.CertLen)) + buf.EncodeUint16(uint16(len(m.Certkey))) + buf.EncodeBytes(m.Certkey[:], 0) + return buf.Bytes(), nil +} +func (m *AppAddCertKeyPair) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.CertLen = buf.DecodeUint16() + m.CertkeyLen = buf.DecodeUint16() + copy(m.Certkey[:], buf.DecodeBytes(0)) + return nil +} + +// AppAddCertKeyPairReply defines message 'app_add_cert_key_pair_reply'. +type AppAddCertKeyPairReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` +} + +func (m *AppAddCertKeyPairReply) Reset() { *m = AppAddCertKeyPairReply{} } +func (*AppAddCertKeyPairReply) GetMessageName() string { return "app_add_cert_key_pair_reply" } +func (*AppAddCertKeyPairReply) GetCrcString() string { return "b42958d0" } +func (*AppAddCertKeyPairReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AppAddCertKeyPairReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.Index + return size +} +func (m *AppAddCertKeyPairReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.Index)) + return buf.Bytes(), nil +} +func (m *AppAddCertKeyPairReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Index = buf.DecodeUint32() + return nil +} + +// AppAttach defines message 'app_attach'. +type AppAttach struct { + Options []uint64 `binapi:"u64[18],name=options" json:"options,omitempty"` + NamespaceID string `binapi:"string[],name=namespace_id" json:"namespace_id,omitempty"` +} + +func (m *AppAttach) Reset() { *m = AppAttach{} } +func (*AppAttach) GetMessageName() string { return "app_attach" } +func (*AppAttach) GetCrcString() string { return "5f4a260d" } +func (*AppAttach) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AppAttach) Size() int { + if m == nil { + return 0 + } + var size int + size += 8 * 18 // m.Options + size += 4 + len(m.NamespaceID) // m.NamespaceID + return size +} +func (m *AppAttach) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + for i := 0; i < 18; i++ { + var x uint64 + if i < len(m.Options) { + x = uint64(m.Options[i]) + } + buf.EncodeUint64(uint64(x)) + } + buf.EncodeString(m.NamespaceID, 0) + return buf.Bytes(), nil +} +func (m *AppAttach) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Options = make([]uint64, 18) + for i := 0; i < len(m.Options); i++ { + m.Options[i] = buf.DecodeUint64() + } + m.NamespaceID = buf.DecodeString(0) + return nil +} + +// AppAttachReply defines message 'app_attach_reply'. +type AppAttachReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + AppMq uint64 `binapi:"u64,name=app_mq" json:"app_mq,omitempty"` + VppCtrlMq uint64 `binapi:"u64,name=vpp_ctrl_mq" json:"vpp_ctrl_mq,omitempty"` + VppCtrlMqThread uint8 `binapi:"u8,name=vpp_ctrl_mq_thread" json:"vpp_ctrl_mq_thread,omitempty"` + AppIndex uint32 `binapi:"u32,name=app_index" json:"app_index,omitempty"` + NFds uint8 `binapi:"u8,name=n_fds" json:"n_fds,omitempty"` + FdFlags uint8 `binapi:"u8,name=fd_flags" json:"fd_flags,omitempty"` + SegmentSize uint32 `binapi:"u32,name=segment_size" json:"segment_size,omitempty"` + SegmentHandle uint64 `binapi:"u64,name=segment_handle" json:"segment_handle,omitempty"` + SegmentName string `binapi:"string[],name=segment_name" json:"segment_name,omitempty"` +} + +func (m *AppAttachReply) Reset() { *m = AppAttachReply{} } +func (*AppAttachReply) GetMessageName() string { return "app_attach_reply" } +func (*AppAttachReply) GetCrcString() string { return "5c89c3b0" } +func (*AppAttachReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AppAttachReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 8 // m.AppMq + size += 8 // m.VppCtrlMq + size += 1 // m.VppCtrlMqThread + size += 4 // m.AppIndex + size += 1 // m.NFds + size += 1 // m.FdFlags + size += 4 // m.SegmentSize + size += 8 // m.SegmentHandle + size += 4 + len(m.SegmentName) // m.SegmentName + return size +} +func (m *AppAttachReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint64(uint64(m.AppMq)) + buf.EncodeUint64(uint64(m.VppCtrlMq)) + buf.EncodeUint8(uint8(m.VppCtrlMqThread)) + buf.EncodeUint32(uint32(m.AppIndex)) + buf.EncodeUint8(uint8(m.NFds)) + buf.EncodeUint8(uint8(m.FdFlags)) + buf.EncodeUint32(uint32(m.SegmentSize)) + buf.EncodeUint64(uint64(m.SegmentHandle)) + buf.EncodeString(m.SegmentName, 0) + return buf.Bytes(), nil +} +func (m *AppAttachReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.AppMq = buf.DecodeUint64() + m.VppCtrlMq = buf.DecodeUint64() + m.VppCtrlMqThread = buf.DecodeUint8() + m.AppIndex = buf.DecodeUint32() + m.NFds = buf.DecodeUint8() + m.FdFlags = buf.DecodeUint8() + m.SegmentSize = buf.DecodeUint32() + m.SegmentHandle = buf.DecodeUint64() + m.SegmentName = buf.DecodeString(0) + return nil +} + +// AppDelCertKeyPair defines message 'app_del_cert_key_pair'. +type AppDelCertKeyPair struct { + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` +} + +func (m *AppDelCertKeyPair) Reset() { *m = AppDelCertKeyPair{} } +func (*AppDelCertKeyPair) GetMessageName() string { return "app_del_cert_key_pair" } +func (*AppDelCertKeyPair) GetCrcString() string { return "8ac76db6" } +func (*AppDelCertKeyPair) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AppDelCertKeyPair) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Index + return size +} +func (m *AppDelCertKeyPair) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Index)) + return buf.Bytes(), nil +} +func (m *AppDelCertKeyPair) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Index = buf.DecodeUint32() + return nil +} + +// AppDelCertKeyPairReply defines message 'app_del_cert_key_pair_reply'. +type AppDelCertKeyPairReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *AppDelCertKeyPairReply) Reset() { *m = AppDelCertKeyPairReply{} } +func (*AppDelCertKeyPairReply) GetMessageName() string { return "app_del_cert_key_pair_reply" } +func (*AppDelCertKeyPairReply) GetCrcString() string { return "e8d4e804" } +func (*AppDelCertKeyPairReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AppDelCertKeyPairReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *AppDelCertKeyPairReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *AppDelCertKeyPairReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// AppNamespaceAddDel defines message 'app_namespace_add_del'. +type AppNamespaceAddDel struct { + Secret uint64 `binapi:"u64,name=secret" json:"secret,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"` + IP4FibID uint32 `binapi:"u32,name=ip4_fib_id" json:"ip4_fib_id,omitempty"` + IP6FibID uint32 `binapi:"u32,name=ip6_fib_id" json:"ip6_fib_id,omitempty"` + NamespaceID string `binapi:"string[],name=namespace_id" json:"namespace_id,omitempty"` +} + +func (m *AppNamespaceAddDel) Reset() { *m = AppNamespaceAddDel{} } +func (*AppNamespaceAddDel) GetMessageName() string { return "app_namespace_add_del" } +func (*AppNamespaceAddDel) GetCrcString() string { return "6306aecb" } +func (*AppNamespaceAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AppNamespaceAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 8 // m.Secret + size += 4 // m.SwIfIndex + size += 4 // m.IP4FibID + size += 4 // m.IP6FibID + size += 4 + len(m.NamespaceID) // m.NamespaceID + return size +} +func (m *AppNamespaceAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint64(uint64(m.Secret)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.IP4FibID)) + buf.EncodeUint32(uint32(m.IP6FibID)) + buf.EncodeString(m.NamespaceID, 0) + return buf.Bytes(), nil +} +func (m *AppNamespaceAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Secret = buf.DecodeUint64() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IP4FibID = buf.DecodeUint32() + m.IP6FibID = buf.DecodeUint32() + m.NamespaceID = buf.DecodeString(0) + return nil +} + +// AppNamespaceAddDelReply defines message 'app_namespace_add_del_reply'. +type AppNamespaceAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + AppnsIndex uint32 `binapi:"u32,name=appns_index" json:"appns_index,omitempty"` +} + +func (m *AppNamespaceAddDelReply) Reset() { *m = AppNamespaceAddDelReply{} } +func (*AppNamespaceAddDelReply) GetMessageName() string { return "app_namespace_add_del_reply" } +func (*AppNamespaceAddDelReply) GetCrcString() string { return "85137120" } +func (*AppNamespaceAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AppNamespaceAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.AppnsIndex + return size +} +func (m *AppNamespaceAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.AppnsIndex)) + return buf.Bytes(), nil +} +func (m *AppNamespaceAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.AppnsIndex = buf.DecodeUint32() + return nil +} + +// AppWorkerAddDel defines message 'app_worker_add_del'. +type AppWorkerAddDel struct { + AppIndex uint32 `binapi:"u32,name=app_index" json:"app_index,omitempty"` + WrkIndex uint32 `binapi:"u32,name=wrk_index" json:"wrk_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` +} + +func (m *AppWorkerAddDel) Reset() { *m = AppWorkerAddDel{} } +func (*AppWorkerAddDel) GetMessageName() string { return "app_worker_add_del" } +func (*AppWorkerAddDel) GetCrcString() string { return "753253dc" } +func (*AppWorkerAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AppWorkerAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.AppIndex + size += 4 // m.WrkIndex + size += 1 // m.IsAdd + return size +} +func (m *AppWorkerAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.AppIndex)) + buf.EncodeUint32(uint32(m.WrkIndex)) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *AppWorkerAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.AppIndex = buf.DecodeUint32() + m.WrkIndex = buf.DecodeUint32() + m.IsAdd = buf.DecodeBool() + return nil +} + +// AppWorkerAddDelReply defines message 'app_worker_add_del_reply'. +type AppWorkerAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + WrkIndex uint32 `binapi:"u32,name=wrk_index" json:"wrk_index,omitempty"` + AppEventQueueAddress uint64 `binapi:"u64,name=app_event_queue_address" json:"app_event_queue_address,omitempty"` + NFds uint8 `binapi:"u8,name=n_fds" json:"n_fds,omitempty"` + FdFlags uint8 `binapi:"u8,name=fd_flags" json:"fd_flags,omitempty"` + SegmentHandle uint64 `binapi:"u64,name=segment_handle" json:"segment_handle,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + SegmentName string `binapi:"string[],name=segment_name" json:"segment_name,omitempty"` +} + +func (m *AppWorkerAddDelReply) Reset() { *m = AppWorkerAddDelReply{} } +func (*AppWorkerAddDelReply) GetMessageName() string { return "app_worker_add_del_reply" } +func (*AppWorkerAddDelReply) GetCrcString() string { return "5735ffe7" } +func (*AppWorkerAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AppWorkerAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.WrkIndex + size += 8 // m.AppEventQueueAddress + size += 1 // m.NFds + size += 1 // m.FdFlags + size += 8 // m.SegmentHandle + size += 1 // m.IsAdd + size += 4 + len(m.SegmentName) // m.SegmentName + return size +} +func (m *AppWorkerAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.WrkIndex)) + buf.EncodeUint64(uint64(m.AppEventQueueAddress)) + buf.EncodeUint8(uint8(m.NFds)) + buf.EncodeUint8(uint8(m.FdFlags)) + buf.EncodeUint64(uint64(m.SegmentHandle)) + buf.EncodeBool(m.IsAdd) + buf.EncodeString(m.SegmentName, 0) + return buf.Bytes(), nil +} +func (m *AppWorkerAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.WrkIndex = buf.DecodeUint32() + m.AppEventQueueAddress = buf.DecodeUint64() + m.NFds = buf.DecodeUint8() + m.FdFlags = buf.DecodeUint8() + m.SegmentHandle = buf.DecodeUint64() + m.IsAdd = buf.DecodeBool() + m.SegmentName = buf.DecodeString(0) + return nil +} + +// ApplicationDetach defines message 'application_detach'. +type ApplicationDetach struct{} + +func (m *ApplicationDetach) Reset() { *m = ApplicationDetach{} } +func (*ApplicationDetach) GetMessageName() string { return "application_detach" } +func (*ApplicationDetach) GetCrcString() string { return "51077d14" } +func (*ApplicationDetach) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ApplicationDetach) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ApplicationDetach) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ApplicationDetach) Unmarshal(b []byte) error { + return nil +} + +// ApplicationDetachReply defines message 'application_detach_reply'. +type ApplicationDetachReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ApplicationDetachReply) Reset() { *m = ApplicationDetachReply{} } +func (*ApplicationDetachReply) GetMessageName() string { return "application_detach_reply" } +func (*ApplicationDetachReply) GetCrcString() string { return "e8d4e804" } +func (*ApplicationDetachReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ApplicationDetachReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ApplicationDetachReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ApplicationDetachReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// ApplicationTLSCertAdd defines message 'application_tls_cert_add'. +type ApplicationTLSCertAdd struct { + AppIndex uint32 `binapi:"u32,name=app_index" json:"app_index,omitempty"` + CertLen uint16 `binapi:"u16,name=cert_len" json:"-"` + Cert []byte `binapi:"u8[cert_len],name=cert" json:"cert,omitempty"` +} + +func (m *ApplicationTLSCertAdd) Reset() { *m = ApplicationTLSCertAdd{} } +func (*ApplicationTLSCertAdd) GetMessageName() string { return "application_tls_cert_add" } +func (*ApplicationTLSCertAdd) GetCrcString() string { return "3f5cfe45" } +func (*ApplicationTLSCertAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ApplicationTLSCertAdd) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.AppIndex + size += 2 // m.CertLen + size += 1 * len(m.Cert) // m.Cert + return size +} +func (m *ApplicationTLSCertAdd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.AppIndex)) + buf.EncodeUint16(uint16(len(m.Cert))) + buf.EncodeBytes(m.Cert[:], 0) + return buf.Bytes(), nil +} +func (m *ApplicationTLSCertAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.AppIndex = buf.DecodeUint32() + m.CertLen = buf.DecodeUint16() + copy(m.Cert[:], buf.DecodeBytes(0)) + return nil +} + +// ApplicationTLSCertAddReply defines message 'application_tls_cert_add_reply'. +type ApplicationTLSCertAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ApplicationTLSCertAddReply) Reset() { *m = ApplicationTLSCertAddReply{} } +func (*ApplicationTLSCertAddReply) GetMessageName() string { return "application_tls_cert_add_reply" } +func (*ApplicationTLSCertAddReply) GetCrcString() string { return "e8d4e804" } +func (*ApplicationTLSCertAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ApplicationTLSCertAddReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ApplicationTLSCertAddReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ApplicationTLSCertAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// ApplicationTLSKeyAdd defines message 'application_tls_key_add'. +type ApplicationTLSKeyAdd struct { + AppIndex uint32 `binapi:"u32,name=app_index" json:"app_index,omitempty"` + KeyLen uint16 `binapi:"u16,name=key_len" json:"-"` + Key []byte `binapi:"u8[key_len],name=key" json:"key,omitempty"` +} + +func (m *ApplicationTLSKeyAdd) Reset() { *m = ApplicationTLSKeyAdd{} } +func (*ApplicationTLSKeyAdd) GetMessageName() string { return "application_tls_key_add" } +func (*ApplicationTLSKeyAdd) GetCrcString() string { return "5eaf70cd" } +func (*ApplicationTLSKeyAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ApplicationTLSKeyAdd) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.AppIndex + size += 2 // m.KeyLen + size += 1 * len(m.Key) // m.Key + return size +} +func (m *ApplicationTLSKeyAdd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.AppIndex)) + buf.EncodeUint16(uint16(len(m.Key))) + buf.EncodeBytes(m.Key[:], 0) + return buf.Bytes(), nil +} +func (m *ApplicationTLSKeyAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.AppIndex = buf.DecodeUint32() + m.KeyLen = buf.DecodeUint16() + copy(m.Key[:], buf.DecodeBytes(0)) + return nil +} + +// ApplicationTLSKeyAddReply defines message 'application_tls_key_add_reply'. +type ApplicationTLSKeyAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ApplicationTLSKeyAddReply) Reset() { *m = ApplicationTLSKeyAddReply{} } +func (*ApplicationTLSKeyAddReply) GetMessageName() string { return "application_tls_key_add_reply" } +func (*ApplicationTLSKeyAddReply) GetCrcString() string { return "e8d4e804" } +func (*ApplicationTLSKeyAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ApplicationTLSKeyAddReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ApplicationTLSKeyAddReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ApplicationTLSKeyAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SessionEnableDisable defines message 'session_enable_disable'. +type SessionEnableDisable struct { + IsEnable bool `binapi:"bool,name=is_enable,default=true" json:"is_enable,omitempty"` +} + +func (m *SessionEnableDisable) Reset() { *m = SessionEnableDisable{} } +func (*SessionEnableDisable) GetMessageName() string { return "session_enable_disable" } +func (*SessionEnableDisable) GetCrcString() string { return "c264d7bf" } +func (*SessionEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SessionEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsEnable + return size +} +func (m *SessionEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsEnable) + return buf.Bytes(), nil +} +func (m *SessionEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsEnable = buf.DecodeBool() + return nil +} + +// SessionEnableDisableReply defines message 'session_enable_disable_reply'. +type SessionEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SessionEnableDisableReply) Reset() { *m = SessionEnableDisableReply{} } +func (*SessionEnableDisableReply) GetMessageName() string { return "session_enable_disable_reply" } +func (*SessionEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*SessionEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SessionEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SessionEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SessionEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SessionRuleAddDel defines message 'session_rule_add_del'. +type SessionRuleAddDel struct { + TransportProto TransportProto `binapi:"transport_proto,name=transport_proto" json:"transport_proto,omitempty"` + Lcl ip_types.Prefix `binapi:"prefix,name=lcl" json:"lcl,omitempty"` + Rmt ip_types.Prefix `binapi:"prefix,name=rmt" json:"rmt,omitempty"` + LclPort uint16 `binapi:"u16,name=lcl_port" json:"lcl_port,omitempty"` + RmtPort uint16 `binapi:"u16,name=rmt_port" json:"rmt_port,omitempty"` + ActionIndex uint32 `binapi:"u32,name=action_index" json:"action_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + AppnsIndex uint32 `binapi:"u32,name=appns_index" json:"appns_index,omitempty"` + Scope SessionRuleScope `binapi:"session_rule_scope,name=scope" json:"scope,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` +} + +func (m *SessionRuleAddDel) Reset() { *m = SessionRuleAddDel{} } +func (*SessionRuleAddDel) GetMessageName() string { return "session_rule_add_del" } +func (*SessionRuleAddDel) GetCrcString() string { return "e31f9443" } +func (*SessionRuleAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SessionRuleAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.TransportProto + size += 1 // m.Lcl.Address.Af + size += 1 * 16 // m.Lcl.Address.Un + size += 1 // m.Lcl.Len + size += 1 // m.Rmt.Address.Af + size += 1 * 16 // m.Rmt.Address.Un + size += 1 // m.Rmt.Len + size += 2 // m.LclPort + size += 2 // m.RmtPort + size += 4 // m.ActionIndex + size += 1 // m.IsAdd + size += 4 // m.AppnsIndex + size += 4 // m.Scope + size += 64 // m.Tag + return size +} +func (m *SessionRuleAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.TransportProto)) + buf.EncodeUint8(uint8(m.Lcl.Address.Af)) + buf.EncodeBytes(m.Lcl.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Lcl.Len)) + buf.EncodeUint8(uint8(m.Rmt.Address.Af)) + buf.EncodeBytes(m.Rmt.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Rmt.Len)) + buf.EncodeUint16(uint16(m.LclPort)) + buf.EncodeUint16(uint16(m.RmtPort)) + buf.EncodeUint32(uint32(m.ActionIndex)) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.AppnsIndex)) + buf.EncodeUint32(uint32(m.Scope)) + buf.EncodeString(m.Tag, 64) + return buf.Bytes(), nil +} +func (m *SessionRuleAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.TransportProto = TransportProto(buf.DecodeUint8()) + m.Lcl.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Lcl.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Lcl.Len = buf.DecodeUint8() + m.Rmt.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Rmt.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Rmt.Len = buf.DecodeUint8() + m.LclPort = buf.DecodeUint16() + m.RmtPort = buf.DecodeUint16() + m.ActionIndex = buf.DecodeUint32() + m.IsAdd = buf.DecodeBool() + m.AppnsIndex = buf.DecodeUint32() + m.Scope = SessionRuleScope(buf.DecodeUint32()) + m.Tag = buf.DecodeString(64) + return nil +} + +// SessionRuleAddDelReply defines message 'session_rule_add_del_reply'. +type SessionRuleAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SessionRuleAddDelReply) Reset() { *m = SessionRuleAddDelReply{} } +func (*SessionRuleAddDelReply) GetMessageName() string { return "session_rule_add_del_reply" } +func (*SessionRuleAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*SessionRuleAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SessionRuleAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SessionRuleAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SessionRuleAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SessionRulesDetails defines message 'session_rules_details'. +type SessionRulesDetails struct { + TransportProto TransportProto `binapi:"transport_proto,name=transport_proto" json:"transport_proto,omitempty"` + Lcl ip_types.Prefix `binapi:"prefix,name=lcl" json:"lcl,omitempty"` + Rmt ip_types.Prefix `binapi:"prefix,name=rmt" json:"rmt,omitempty"` + LclPort uint16 `binapi:"u16,name=lcl_port" json:"lcl_port,omitempty"` + RmtPort uint16 `binapi:"u16,name=rmt_port" json:"rmt_port,omitempty"` + ActionIndex uint32 `binapi:"u32,name=action_index" json:"action_index,omitempty"` + AppnsIndex uint32 `binapi:"u32,name=appns_index" json:"appns_index,omitempty"` + Scope SessionRuleScope `binapi:"session_rule_scope,name=scope" json:"scope,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` +} + +func (m *SessionRulesDetails) Reset() { *m = SessionRulesDetails{} } +func (*SessionRulesDetails) GetMessageName() string { return "session_rules_details" } +func (*SessionRulesDetails) GetCrcString() string { return "304b91f0" } +func (*SessionRulesDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SessionRulesDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.TransportProto + size += 1 // m.Lcl.Address.Af + size += 1 * 16 // m.Lcl.Address.Un + size += 1 // m.Lcl.Len + size += 1 // m.Rmt.Address.Af + size += 1 * 16 // m.Rmt.Address.Un + size += 1 // m.Rmt.Len + size += 2 // m.LclPort + size += 2 // m.RmtPort + size += 4 // m.ActionIndex + size += 4 // m.AppnsIndex + size += 4 // m.Scope + size += 64 // m.Tag + return size +} +func (m *SessionRulesDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.TransportProto)) + buf.EncodeUint8(uint8(m.Lcl.Address.Af)) + buf.EncodeBytes(m.Lcl.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Lcl.Len)) + buf.EncodeUint8(uint8(m.Rmt.Address.Af)) + buf.EncodeBytes(m.Rmt.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Rmt.Len)) + buf.EncodeUint16(uint16(m.LclPort)) + buf.EncodeUint16(uint16(m.RmtPort)) + buf.EncodeUint32(uint32(m.ActionIndex)) + buf.EncodeUint32(uint32(m.AppnsIndex)) + buf.EncodeUint32(uint32(m.Scope)) + buf.EncodeString(m.Tag, 64) + return buf.Bytes(), nil +} +func (m *SessionRulesDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.TransportProto = TransportProto(buf.DecodeUint8()) + m.Lcl.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Lcl.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Lcl.Len = buf.DecodeUint8() + m.Rmt.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Rmt.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Rmt.Len = buf.DecodeUint8() + m.LclPort = buf.DecodeUint16() + m.RmtPort = buf.DecodeUint16() + m.ActionIndex = buf.DecodeUint32() + m.AppnsIndex = buf.DecodeUint32() + m.Scope = SessionRuleScope(buf.DecodeUint32()) + m.Tag = buf.DecodeString(64) + return nil +} + +// SessionRulesDump defines message 'session_rules_dump'. +type SessionRulesDump struct{} + +func (m *SessionRulesDump) Reset() { *m = SessionRulesDump{} } +func (*SessionRulesDump) GetMessageName() string { return "session_rules_dump" } +func (*SessionRulesDump) GetCrcString() string { return "51077d14" } +func (*SessionRulesDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SessionRulesDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SessionRulesDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *SessionRulesDump) Unmarshal(b []byte) error { + return nil +} + +func init() { file_session_binapi_init() } +func file_session_binapi_init() { + api.RegisterMessage((*AppAddCertKeyPair)(nil), "app_add_cert_key_pair_02eb8016") + api.RegisterMessage((*AppAddCertKeyPairReply)(nil), "app_add_cert_key_pair_reply_b42958d0") + api.RegisterMessage((*AppAttach)(nil), "app_attach_5f4a260d") + api.RegisterMessage((*AppAttachReply)(nil), "app_attach_reply_5c89c3b0") + api.RegisterMessage((*AppDelCertKeyPair)(nil), "app_del_cert_key_pair_8ac76db6") + api.RegisterMessage((*AppDelCertKeyPairReply)(nil), "app_del_cert_key_pair_reply_e8d4e804") + api.RegisterMessage((*AppNamespaceAddDel)(nil), "app_namespace_add_del_6306aecb") + api.RegisterMessage((*AppNamespaceAddDelReply)(nil), "app_namespace_add_del_reply_85137120") + api.RegisterMessage((*AppWorkerAddDel)(nil), "app_worker_add_del_753253dc") + api.RegisterMessage((*AppWorkerAddDelReply)(nil), "app_worker_add_del_reply_5735ffe7") + api.RegisterMessage((*ApplicationDetach)(nil), "application_detach_51077d14") + api.RegisterMessage((*ApplicationDetachReply)(nil), "application_detach_reply_e8d4e804") + api.RegisterMessage((*ApplicationTLSCertAdd)(nil), "application_tls_cert_add_3f5cfe45") + api.RegisterMessage((*ApplicationTLSCertAddReply)(nil), "application_tls_cert_add_reply_e8d4e804") + api.RegisterMessage((*ApplicationTLSKeyAdd)(nil), "application_tls_key_add_5eaf70cd") + api.RegisterMessage((*ApplicationTLSKeyAddReply)(nil), "application_tls_key_add_reply_e8d4e804") + api.RegisterMessage((*SessionEnableDisable)(nil), "session_enable_disable_c264d7bf") + api.RegisterMessage((*SessionEnableDisableReply)(nil), "session_enable_disable_reply_e8d4e804") + api.RegisterMessage((*SessionRuleAddDel)(nil), "session_rule_add_del_e31f9443") + api.RegisterMessage((*SessionRuleAddDelReply)(nil), "session_rule_add_del_reply_e8d4e804") + api.RegisterMessage((*SessionRulesDetails)(nil), "session_rules_details_304b91f0") + api.RegisterMessage((*SessionRulesDump)(nil), "session_rules_dump_51077d14") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AppAddCertKeyPair)(nil), + (*AppAddCertKeyPairReply)(nil), + (*AppAttach)(nil), + (*AppAttachReply)(nil), + (*AppDelCertKeyPair)(nil), + (*AppDelCertKeyPairReply)(nil), + (*AppNamespaceAddDel)(nil), + (*AppNamespaceAddDelReply)(nil), + (*AppWorkerAddDel)(nil), + (*AppWorkerAddDelReply)(nil), + (*ApplicationDetach)(nil), + (*ApplicationDetachReply)(nil), + (*ApplicationTLSCertAdd)(nil), + (*ApplicationTLSCertAddReply)(nil), + (*ApplicationTLSKeyAdd)(nil), + (*ApplicationTLSKeyAddReply)(nil), + (*SessionEnableDisable)(nil), + (*SessionEnableDisableReply)(nil), + (*SessionRuleAddDel)(nil), + (*SessionRuleAddDelReply)(nil), + (*SessionRulesDetails)(nil), + (*SessionRulesDump)(nil), + } +} diff --git a/binapi/session/session_rest.ba.go b/binapi/session/session_rest.ba.go new file mode 100644 index 0000000..1ef2085 --- /dev/null +++ b/binapi/session/session_rest.ba.go @@ -0,0 +1,235 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package session + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/app_add_cert_key_pair", func(w http.ResponseWriter, req *http.Request) { + var request = new(AppAddCertKeyPair) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.AppAddCertKeyPair(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/app_attach", func(w http.ResponseWriter, req *http.Request) { + var request = new(AppAttach) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.AppAttach(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/app_del_cert_key_pair", func(w http.ResponseWriter, req *http.Request) { + var request = new(AppDelCertKeyPair) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.AppDelCertKeyPair(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/app_namespace_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(AppNamespaceAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.AppNamespaceAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/app_worker_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(AppWorkerAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.AppWorkerAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/application_detach", func(w http.ResponseWriter, req *http.Request) { + var request = new(ApplicationDetach) + reply, err := rpc.ApplicationDetach(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/application_tls_cert_add", func(w http.ResponseWriter, req *http.Request) { + var request = new(ApplicationTLSCertAdd) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ApplicationTLSCertAdd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/application_tls_key_add", func(w http.ResponseWriter, req *http.Request) { + var request = new(ApplicationTLSKeyAdd) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ApplicationTLSKeyAdd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/session_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(SessionEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SessionEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/session_rule_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(SessionRuleAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SessionRuleAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/session/session_rpc.ba.go b/binapi/session/session_rpc.ba.go new file mode 100644 index 0000000..1737ef5 --- /dev/null +++ b/binapi/session/session_rpc.ba.go @@ -0,0 +1,163 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package session + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service session. +type RPCService interface { + AppAddCertKeyPair(ctx context.Context, in *AppAddCertKeyPair) (*AppAddCertKeyPairReply, error) + AppAttach(ctx context.Context, in *AppAttach) (*AppAttachReply, error) + AppDelCertKeyPair(ctx context.Context, in *AppDelCertKeyPair) (*AppDelCertKeyPairReply, error) + AppNamespaceAddDel(ctx context.Context, in *AppNamespaceAddDel) (*AppNamespaceAddDelReply, error) + AppWorkerAddDel(ctx context.Context, in *AppWorkerAddDel) (*AppWorkerAddDelReply, error) + ApplicationDetach(ctx context.Context, in *ApplicationDetach) (*ApplicationDetachReply, error) + ApplicationTLSCertAdd(ctx context.Context, in *ApplicationTLSCertAdd) (*ApplicationTLSCertAddReply, error) + ApplicationTLSKeyAdd(ctx context.Context, in *ApplicationTLSKeyAdd) (*ApplicationTLSKeyAddReply, error) + SessionEnableDisable(ctx context.Context, in *SessionEnableDisable) (*SessionEnableDisableReply, error) + SessionRuleAddDel(ctx context.Context, in *SessionRuleAddDel) (*SessionRuleAddDelReply, error) + SessionRulesDump(ctx context.Context, in *SessionRulesDump) (RPCService_SessionRulesDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) AppAddCertKeyPair(ctx context.Context, in *AppAddCertKeyPair) (*AppAddCertKeyPairReply, error) { + out := new(AppAddCertKeyPairReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AppAttach(ctx context.Context, in *AppAttach) (*AppAttachReply, error) { + out := new(AppAttachReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AppDelCertKeyPair(ctx context.Context, in *AppDelCertKeyPair) (*AppDelCertKeyPairReply, error) { + out := new(AppDelCertKeyPairReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AppNamespaceAddDel(ctx context.Context, in *AppNamespaceAddDel) (*AppNamespaceAddDelReply, error) { + out := new(AppNamespaceAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AppWorkerAddDel(ctx context.Context, in *AppWorkerAddDel) (*AppWorkerAddDelReply, error) { + out := new(AppWorkerAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ApplicationDetach(ctx context.Context, in *ApplicationDetach) (*ApplicationDetachReply, error) { + out := new(ApplicationDetachReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ApplicationTLSCertAdd(ctx context.Context, in *ApplicationTLSCertAdd) (*ApplicationTLSCertAddReply, error) { + out := new(ApplicationTLSCertAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ApplicationTLSKeyAdd(ctx context.Context, in *ApplicationTLSKeyAdd) (*ApplicationTLSKeyAddReply, error) { + out := new(ApplicationTLSKeyAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SessionEnableDisable(ctx context.Context, in *SessionEnableDisable) (*SessionEnableDisableReply, error) { + out := new(SessionEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SessionRuleAddDel(ctx context.Context, in *SessionRuleAddDel) (*SessionRuleAddDelReply, error) { + out := new(SessionRuleAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SessionRulesDump(ctx context.Context, in *SessionRulesDump) (RPCService_SessionRulesDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SessionRulesDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_SessionRulesDumpClient interface { + Recv() (*SessionRulesDetails, error) + api.Stream +} + +type serviceClient_SessionRulesDumpClient struct { + api.Stream +} + +func (c *serviceClient_SessionRulesDumpClient) Recv() (*SessionRulesDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SessionRulesDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/span/span.ba.go b/binapi/span/span.ba.go new file mode 100644 index 0000000..156a1d7 --- /dev/null +++ b/binapi/span/span.ba.go @@ -0,0 +1,255 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/span.api.json + +// Package span contains generated bindings for API file span.api. +// +// Contents: +// 1 enum +// 4 messages +// +package span + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "span" + APIVersion = "2.0.0" + VersionCrc = 0x9f4dec7c +) + +// SpanState defines enum 'span_state'. +type SpanState uint32 + +const ( + SPAN_STATE_API_DISABLED SpanState = 0 + SPAN_STATE_API_RX SpanState = 1 + SPAN_STATE_API_TX SpanState = 2 + SPAN_STATE_API_RX_TX SpanState = 3 +) + +var ( + SpanState_name = map[uint32]string{ + 0: "SPAN_STATE_API_DISABLED", + 1: "SPAN_STATE_API_RX", + 2: "SPAN_STATE_API_TX", + 3: "SPAN_STATE_API_RX_TX", + } + SpanState_value = map[string]uint32{ + "SPAN_STATE_API_DISABLED": 0, + "SPAN_STATE_API_RX": 1, + "SPAN_STATE_API_TX": 2, + "SPAN_STATE_API_RX_TX": 3, + } +) + +func (x SpanState) String() string { + s, ok := SpanState_name[uint32(x)] + if ok { + return s + } + return "SpanState(" + strconv.Itoa(int(x)) + ")" +} + +// SwInterfaceSpanDetails defines message 'sw_interface_span_details'. +type SwInterfaceSpanDetails struct { + SwIfIndexFrom interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index_from" json:"sw_if_index_from,omitempty"` + SwIfIndexTo interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index_to" json:"sw_if_index_to,omitempty"` + State SpanState `binapi:"span_state,name=state" json:"state,omitempty"` + IsL2 bool `binapi:"bool,name=is_l2" json:"is_l2,omitempty"` +} + +func (m *SwInterfaceSpanDetails) Reset() { *m = SwInterfaceSpanDetails{} } +func (*SwInterfaceSpanDetails) GetMessageName() string { return "sw_interface_span_details" } +func (*SwInterfaceSpanDetails) GetCrcString() string { return "055643fc" } +func (*SwInterfaceSpanDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSpanDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndexFrom + size += 4 // m.SwIfIndexTo + size += 4 // m.State + size += 1 // m.IsL2 + return size +} +func (m *SwInterfaceSpanDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndexFrom)) + buf.EncodeUint32(uint32(m.SwIfIndexTo)) + buf.EncodeUint32(uint32(m.State)) + buf.EncodeBool(m.IsL2) + return buf.Bytes(), nil +} +func (m *SwInterfaceSpanDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndexFrom = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.SwIfIndexTo = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.State = SpanState(buf.DecodeUint32()) + m.IsL2 = buf.DecodeBool() + return nil +} + +// SwInterfaceSpanDump defines message 'sw_interface_span_dump'. +type SwInterfaceSpanDump struct { + IsL2 bool `binapi:"bool,name=is_l2" json:"is_l2,omitempty"` +} + +func (m *SwInterfaceSpanDump) Reset() { *m = SwInterfaceSpanDump{} } +func (*SwInterfaceSpanDump) GetMessageName() string { return "sw_interface_span_dump" } +func (*SwInterfaceSpanDump) GetCrcString() string { return "d6cf0c3d" } +func (*SwInterfaceSpanDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSpanDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsL2 + return size +} +func (m *SwInterfaceSpanDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsL2) + return buf.Bytes(), nil +} +func (m *SwInterfaceSpanDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsL2 = buf.DecodeBool() + return nil +} + +// SwInterfaceSpanEnableDisable defines message 'sw_interface_span_enable_disable'. +type SwInterfaceSpanEnableDisable struct { + SwIfIndexFrom interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index_from" json:"sw_if_index_from,omitempty"` + SwIfIndexTo interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index_to" json:"sw_if_index_to,omitempty"` + State SpanState `binapi:"span_state,name=state" json:"state,omitempty"` + IsL2 bool `binapi:"bool,name=is_l2" json:"is_l2,omitempty"` +} + +func (m *SwInterfaceSpanEnableDisable) Reset() { *m = SwInterfaceSpanEnableDisable{} } +func (*SwInterfaceSpanEnableDisable) GetMessageName() string { + return "sw_interface_span_enable_disable" +} +func (*SwInterfaceSpanEnableDisable) GetCrcString() string { return "acc8fea1" } +func (*SwInterfaceSpanEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSpanEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndexFrom + size += 4 // m.SwIfIndexTo + size += 4 // m.State + size += 1 // m.IsL2 + return size +} +func (m *SwInterfaceSpanEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndexFrom)) + buf.EncodeUint32(uint32(m.SwIfIndexTo)) + buf.EncodeUint32(uint32(m.State)) + buf.EncodeBool(m.IsL2) + return buf.Bytes(), nil +} +func (m *SwInterfaceSpanEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndexFrom = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.SwIfIndexTo = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.State = SpanState(buf.DecodeUint32()) + m.IsL2 = buf.DecodeBool() + return nil +} + +// SwInterfaceSpanEnableDisableReply defines message 'sw_interface_span_enable_disable_reply'. +type SwInterfaceSpanEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSpanEnableDisableReply) Reset() { *m = SwInterfaceSpanEnableDisableReply{} } +func (*SwInterfaceSpanEnableDisableReply) GetMessageName() string { + return "sw_interface_span_enable_disable_reply" +} +func (*SwInterfaceSpanEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSpanEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSpanEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSpanEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSpanEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_span_binapi_init() } +func file_span_binapi_init() { + api.RegisterMessage((*SwInterfaceSpanDetails)(nil), "sw_interface_span_details_055643fc") + api.RegisterMessage((*SwInterfaceSpanDump)(nil), "sw_interface_span_dump_d6cf0c3d") + api.RegisterMessage((*SwInterfaceSpanEnableDisable)(nil), "sw_interface_span_enable_disable_acc8fea1") + api.RegisterMessage((*SwInterfaceSpanEnableDisableReply)(nil), "sw_interface_span_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SwInterfaceSpanDetails)(nil), + (*SwInterfaceSpanDump)(nil), + (*SwInterfaceSpanEnableDisable)(nil), + (*SwInterfaceSpanEnableDisableReply)(nil), + } +} diff --git a/binapi/span/span_rest.ba.go b/binapi/span/span_rest.ba.go new file mode 100644 index 0000000..0c2d959 --- /dev/null +++ b/binapi/span/span_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package span + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/sw_interface_span_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceSpanEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceSpanEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/span/span_rpc.ba.go b/binapi/span/span_rpc.ba.go new file mode 100644 index 0000000..3f34859 --- /dev/null +++ b/binapi/span/span_rpc.ba.go @@ -0,0 +1,73 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package span + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service span. +type RPCService interface { + SwInterfaceSpanDump(ctx context.Context, in *SwInterfaceSpanDump) (RPCService_SwInterfaceSpanDumpClient, error) + SwInterfaceSpanEnableDisable(ctx context.Context, in *SwInterfaceSpanEnableDisable) (*SwInterfaceSpanEnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) SwInterfaceSpanDump(ctx context.Context, in *SwInterfaceSpanDump) (RPCService_SwInterfaceSpanDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SwInterfaceSpanDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_SwInterfaceSpanDumpClient interface { + Recv() (*SwInterfaceSpanDetails, error) + api.Stream +} + +type serviceClient_SwInterfaceSpanDumpClient struct { + api.Stream +} + +func (c *serviceClient_SwInterfaceSpanDumpClient) Recv() (*SwInterfaceSpanDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SwInterfaceSpanDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) SwInterfaceSpanEnableDisable(ctx context.Context, in *SwInterfaceSpanEnableDisable) (*SwInterfaceSpanEnableDisableReply, error) { + out := new(SwInterfaceSpanEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/sr/sr.ba.go b/binapi/sr/sr.ba.go new file mode 100644 index 0000000..d26f89b --- /dev/null +++ b/binapi/sr/sr.ba.go @@ -0,0 +1,1049 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/sr.api.json + +// Package sr contains generated bindings for API file sr.api. +// +// Contents: +// 1 struct +// 20 messages +// +package sr + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + sr_types "git.fd.io/govpp.git/binapi/sr_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "sr" + APIVersion = "2.0.0" + VersionCrc = 0xd85c77ca +) + +// Srv6SidList defines type 'srv6_sid_list'. +type Srv6SidList struct { + NumSids uint8 `binapi:"u8,name=num_sids" json:"num_sids,omitempty"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` + Sids [16]ip_types.IP6Address `binapi:"ip6_address[16],name=sids" json:"sids,omitempty"` +} + +// SrLocalsidAddDel defines message 'sr_localsid_add_del'. +type SrLocalsidAddDel struct { + IsDel bool `binapi:"bool,name=is_del,default=%!s(bool=false)" json:"is_del,omitempty"` + Localsid ip_types.IP6Address `binapi:"ip6_address,name=localsid" json:"localsid,omitempty"` + EndPsp bool `binapi:"bool,name=end_psp" json:"end_psp,omitempty"` + Behavior sr_types.SrBehavior `binapi:"sr_behavior,name=behavior" json:"behavior,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"` + VlanIndex uint32 `binapi:"u32,name=vlan_index" json:"vlan_index,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + NhAddr ip_types.Address `binapi:"address,name=nh_addr" json:"nh_addr,omitempty"` +} + +func (m *SrLocalsidAddDel) Reset() { *m = SrLocalsidAddDel{} } +func (*SrLocalsidAddDel) GetMessageName() string { return "sr_localsid_add_del" } +func (*SrLocalsidAddDel) GetCrcString() string { return "26fa3309" } +func (*SrLocalsidAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SrLocalsidAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsDel + size += 1 * 16 // m.Localsid + size += 1 // m.EndPsp + size += 1 // m.Behavior + size += 4 // m.SwIfIndex + size += 4 // m.VlanIndex + size += 4 // m.FibTable + size += 1 // m.NhAddr.Af + size += 1 * 16 // m.NhAddr.Un + return size +} +func (m *SrLocalsidAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsDel) + buf.EncodeBytes(m.Localsid[:], 16) + buf.EncodeBool(m.EndPsp) + buf.EncodeUint8(uint8(m.Behavior)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.VlanIndex)) + buf.EncodeUint32(uint32(m.FibTable)) + buf.EncodeUint8(uint8(m.NhAddr.Af)) + buf.EncodeBytes(m.NhAddr.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *SrLocalsidAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsDel = buf.DecodeBool() + copy(m.Localsid[:], buf.DecodeBytes(16)) + m.EndPsp = buf.DecodeBool() + m.Behavior = sr_types.SrBehavior(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.VlanIndex = buf.DecodeUint32() + m.FibTable = buf.DecodeUint32() + m.NhAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.NhAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// SrLocalsidAddDelReply defines message 'sr_localsid_add_del_reply'. +type SrLocalsidAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrLocalsidAddDelReply) Reset() { *m = SrLocalsidAddDelReply{} } +func (*SrLocalsidAddDelReply) GetMessageName() string { return "sr_localsid_add_del_reply" } +func (*SrLocalsidAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*SrLocalsidAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SrLocalsidAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SrLocalsidAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SrLocalsidAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SrLocalsidsDetails defines message 'sr_localsids_details'. +type SrLocalsidsDetails struct { + Addr ip_types.IP6Address `binapi:"ip6_address,name=addr" json:"addr,omitempty"` + EndPsp bool `binapi:"bool,name=end_psp" json:"end_psp,omitempty"` + Behavior sr_types.SrBehavior `binapi:"sr_behavior,name=behavior" json:"behavior,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + VlanIndex uint32 `binapi:"u32,name=vlan_index" json:"vlan_index,omitempty"` + XconnectNhAddr ip_types.Address `binapi:"address,name=xconnect_nh_addr" json:"xconnect_nh_addr,omitempty"` + XconnectIfaceOrVrfTable uint32 `binapi:"u32,name=xconnect_iface_or_vrf_table" json:"xconnect_iface_or_vrf_table,omitempty"` +} + +func (m *SrLocalsidsDetails) Reset() { *m = SrLocalsidsDetails{} } +func (*SrLocalsidsDetails) GetMessageName() string { return "sr_localsids_details" } +func (*SrLocalsidsDetails) GetCrcString() string { return "6a6c0265" } +func (*SrLocalsidsDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SrLocalsidsDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 16 // m.Addr + size += 1 // m.EndPsp + size += 1 // m.Behavior + size += 4 // m.FibTable + size += 4 // m.VlanIndex + size += 1 // m.XconnectNhAddr.Af + size += 1 * 16 // m.XconnectNhAddr.Un + size += 4 // m.XconnectIfaceOrVrfTable + return size +} +func (m *SrLocalsidsDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.Addr[:], 16) + buf.EncodeBool(m.EndPsp) + buf.EncodeUint8(uint8(m.Behavior)) + buf.EncodeUint32(uint32(m.FibTable)) + buf.EncodeUint32(uint32(m.VlanIndex)) + buf.EncodeUint8(uint8(m.XconnectNhAddr.Af)) + buf.EncodeBytes(m.XconnectNhAddr.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.XconnectIfaceOrVrfTable)) + return buf.Bytes(), nil +} +func (m *SrLocalsidsDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.Addr[:], buf.DecodeBytes(16)) + m.EndPsp = buf.DecodeBool() + m.Behavior = sr_types.SrBehavior(buf.DecodeUint8()) + m.FibTable = buf.DecodeUint32() + m.VlanIndex = buf.DecodeUint32() + m.XconnectNhAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.XconnectNhAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.XconnectIfaceOrVrfTable = buf.DecodeUint32() + return nil +} + +// SrLocalsidsDump defines message 'sr_localsids_dump'. +type SrLocalsidsDump struct{} + +func (m *SrLocalsidsDump) Reset() { *m = SrLocalsidsDump{} } +func (*SrLocalsidsDump) GetMessageName() string { return "sr_localsids_dump" } +func (*SrLocalsidsDump) GetCrcString() string { return "51077d14" } +func (*SrLocalsidsDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SrLocalsidsDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SrLocalsidsDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *SrLocalsidsDump) Unmarshal(b []byte) error { + return nil +} + +// SrPoliciesDetails defines message 'sr_policies_details'. +type SrPoliciesDetails struct { + Bsid ip_types.IP6Address `binapi:"ip6_address,name=bsid" json:"bsid,omitempty"` + IsSpray bool `binapi:"bool,name=is_spray" json:"is_spray,omitempty"` + IsEncap bool `binapi:"bool,name=is_encap" json:"is_encap,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + NumSidLists uint8 `binapi:"u8,name=num_sid_lists" json:"-"` + SidLists []Srv6SidList `binapi:"srv6_sid_list[num_sid_lists],name=sid_lists" json:"sid_lists,omitempty"` +} + +func (m *SrPoliciesDetails) Reset() { *m = SrPoliciesDetails{} } +func (*SrPoliciesDetails) GetMessageName() string { return "sr_policies_details" } +func (*SrPoliciesDetails) GetCrcString() string { return "07ec2d93" } +func (*SrPoliciesDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SrPoliciesDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 16 // m.Bsid + size += 1 // m.IsSpray + size += 1 // m.IsEncap + size += 4 // m.FibTable + size += 1 // m.NumSidLists + for j1 := 0; j1 < len(m.SidLists); j1++ { + var s1 Srv6SidList + _ = s1 + if j1 < len(m.SidLists) { + s1 = m.SidLists[j1] + } + size += 1 // s1.NumSids + size += 4 // s1.Weight + for j2 := 0; j2 < 16; j2++ { + var s2 ip_types.IP6Address + _ = s2 + if j2 < len(s1.Sids) { + s2 = s1.Sids[j2] + } + size += 1 * 16 // s2 + } + } + return size +} +func (m *SrPoliciesDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.Bsid[:], 16) + buf.EncodeBool(m.IsSpray) + buf.EncodeBool(m.IsEncap) + buf.EncodeUint32(uint32(m.FibTable)) + buf.EncodeUint8(uint8(len(m.SidLists))) + for j0 := 0; j0 < len(m.SidLists); j0++ { + var v0 Srv6SidList + if j0 < len(m.SidLists) { + v0 = m.SidLists[j0] + } + buf.EncodeUint8(uint8(v0.NumSids)) + buf.EncodeUint32(uint32(v0.Weight)) + for j1 := 0; j1 < 16; j1++ { + var v1 ip_types.IP6Address + if j1 < len(v0.Sids) { + v1 = v0.Sids[j1] + } + buf.EncodeBytes(v1[:], 16) + } + } + return buf.Bytes(), nil +} +func (m *SrPoliciesDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.Bsid[:], buf.DecodeBytes(16)) + m.IsSpray = buf.DecodeBool() + m.IsEncap = buf.DecodeBool() + m.FibTable = buf.DecodeUint32() + m.NumSidLists = buf.DecodeUint8() + m.SidLists = make([]Srv6SidList, int(m.NumSidLists)) + for j0 := 0; j0 < len(m.SidLists); j0++ { + m.SidLists[j0].NumSids = buf.DecodeUint8() + m.SidLists[j0].Weight = buf.DecodeUint32() + for j1 := 0; j1 < 16; j1++ { + copy(m.SidLists[j0].Sids[j1][:], buf.DecodeBytes(16)) + } + } + return nil +} + +// SrPoliciesDump defines message 'sr_policies_dump'. +type SrPoliciesDump struct{} + +func (m *SrPoliciesDump) Reset() { *m = SrPoliciesDump{} } +func (*SrPoliciesDump) GetMessageName() string { return "sr_policies_dump" } +func (*SrPoliciesDump) GetCrcString() string { return "51077d14" } +func (*SrPoliciesDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SrPoliciesDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SrPoliciesDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *SrPoliciesDump) Unmarshal(b []byte) error { + return nil +} + +// SrPolicyAdd defines message 'sr_policy_add'. +type SrPolicyAdd struct { + BsidAddr ip_types.IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` + IsEncap bool `binapi:"bool,name=is_encap" json:"is_encap,omitempty"` + IsSpray bool `binapi:"bool,name=is_spray" json:"is_spray,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + Sids Srv6SidList `binapi:"srv6_sid_list,name=sids" json:"sids,omitempty"` +} + +func (m *SrPolicyAdd) Reset() { *m = SrPolicyAdd{} } +func (*SrPolicyAdd) GetMessageName() string { return "sr_policy_add" } +func (*SrPolicyAdd) GetCrcString() string { return "ec79ee6a" } +func (*SrPolicyAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SrPolicyAdd) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 16 // m.BsidAddr + size += 4 // m.Weight + size += 1 // m.IsEncap + size += 1 // m.IsSpray + size += 4 // m.FibTable + size += 1 // m.Sids.NumSids + size += 4 // m.Sids.Weight + for j2 := 0; j2 < 16; j2++ { + var s2 ip_types.IP6Address + _ = s2 + if j2 < len(m.Sids.Sids) { + s2 = m.Sids.Sids[j2] + } + size += 1 * 16 // s2 + } + return size +} +func (m *SrPolicyAdd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.BsidAddr[:], 16) + buf.EncodeUint32(uint32(m.Weight)) + buf.EncodeBool(m.IsEncap) + buf.EncodeBool(m.IsSpray) + buf.EncodeUint32(uint32(m.FibTable)) + buf.EncodeUint8(uint8(m.Sids.NumSids)) + buf.EncodeUint32(uint32(m.Sids.Weight)) + for j1 := 0; j1 < 16; j1++ { + var v1 ip_types.IP6Address + if j1 < len(m.Sids.Sids) { + v1 = m.Sids.Sids[j1] + } + buf.EncodeBytes(v1[:], 16) + } + return buf.Bytes(), nil +} +func (m *SrPolicyAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.BsidAddr[:], buf.DecodeBytes(16)) + m.Weight = buf.DecodeUint32() + m.IsEncap = buf.DecodeBool() + m.IsSpray = buf.DecodeBool() + m.FibTable = buf.DecodeUint32() + m.Sids.NumSids = buf.DecodeUint8() + m.Sids.Weight = buf.DecodeUint32() + for j1 := 0; j1 < 16; j1++ { + copy(m.Sids.Sids[j1][:], buf.DecodeBytes(16)) + } + return nil +} + +// SrPolicyAddReply defines message 'sr_policy_add_reply'. +type SrPolicyAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrPolicyAddReply) Reset() { *m = SrPolicyAddReply{} } +func (*SrPolicyAddReply) GetMessageName() string { return "sr_policy_add_reply" } +func (*SrPolicyAddReply) GetCrcString() string { return "e8d4e804" } +func (*SrPolicyAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SrPolicyAddReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SrPolicyAddReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SrPolicyAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SrPolicyDel defines message 'sr_policy_del'. +type SrPolicyDel struct { + BsidAddr ip_types.IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"` + SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` +} + +func (m *SrPolicyDel) Reset() { *m = SrPolicyDel{} } +func (*SrPolicyDel) GetMessageName() string { return "sr_policy_del" } +func (*SrPolicyDel) GetCrcString() string { return "cb4d48d5" } +func (*SrPolicyDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SrPolicyDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 16 // m.BsidAddr + size += 4 // m.SrPolicyIndex + return size +} +func (m *SrPolicyDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.BsidAddr[:], 16) + buf.EncodeUint32(uint32(m.SrPolicyIndex)) + return buf.Bytes(), nil +} +func (m *SrPolicyDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.BsidAddr[:], buf.DecodeBytes(16)) + m.SrPolicyIndex = buf.DecodeUint32() + return nil +} + +// SrPolicyDelReply defines message 'sr_policy_del_reply'. +type SrPolicyDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrPolicyDelReply) Reset() { *m = SrPolicyDelReply{} } +func (*SrPolicyDelReply) GetMessageName() string { return "sr_policy_del_reply" } +func (*SrPolicyDelReply) GetCrcString() string { return "e8d4e804" } +func (*SrPolicyDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SrPolicyDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SrPolicyDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SrPolicyDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SrPolicyMod defines message 'sr_policy_mod'. +type SrPolicyMod struct { + BsidAddr ip_types.IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"` + SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + Operation sr_types.SrPolicyOp `binapi:"sr_policy_op,name=operation" json:"operation,omitempty"` + SlIndex uint32 `binapi:"u32,name=sl_index" json:"sl_index,omitempty"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` + Sids Srv6SidList `binapi:"srv6_sid_list,name=sids" json:"sids,omitempty"` +} + +func (m *SrPolicyMod) Reset() { *m = SrPolicyMod{} } +func (*SrPolicyMod) GetMessageName() string { return "sr_policy_mod" } +func (*SrPolicyMod) GetCrcString() string { return "e531a102" } +func (*SrPolicyMod) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SrPolicyMod) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 16 // m.BsidAddr + size += 4 // m.SrPolicyIndex + size += 4 // m.FibTable + size += 1 // m.Operation + size += 4 // m.SlIndex + size += 4 // m.Weight + size += 1 // m.Sids.NumSids + size += 4 // m.Sids.Weight + for j2 := 0; j2 < 16; j2++ { + var s2 ip_types.IP6Address + _ = s2 + if j2 < len(m.Sids.Sids) { + s2 = m.Sids.Sids[j2] + } + size += 1 * 16 // s2 + } + return size +} +func (m *SrPolicyMod) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.BsidAddr[:], 16) + buf.EncodeUint32(uint32(m.SrPolicyIndex)) + buf.EncodeUint32(uint32(m.FibTable)) + buf.EncodeUint8(uint8(m.Operation)) + buf.EncodeUint32(uint32(m.SlIndex)) + buf.EncodeUint32(uint32(m.Weight)) + buf.EncodeUint8(uint8(m.Sids.NumSids)) + buf.EncodeUint32(uint32(m.Sids.Weight)) + for j1 := 0; j1 < 16; j1++ { + var v1 ip_types.IP6Address + if j1 < len(m.Sids.Sids) { + v1 = m.Sids.Sids[j1] + } + buf.EncodeBytes(v1[:], 16) + } + return buf.Bytes(), nil +} +func (m *SrPolicyMod) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.BsidAddr[:], buf.DecodeBytes(16)) + m.SrPolicyIndex = buf.DecodeUint32() + m.FibTable = buf.DecodeUint32() + m.Operation = sr_types.SrPolicyOp(buf.DecodeUint8()) + m.SlIndex = buf.DecodeUint32() + m.Weight = buf.DecodeUint32() + m.Sids.NumSids = buf.DecodeUint8() + m.Sids.Weight = buf.DecodeUint32() + for j1 := 0; j1 < 16; j1++ { + copy(m.Sids.Sids[j1][:], buf.DecodeBytes(16)) + } + return nil +} + +// SrPolicyModReply defines message 'sr_policy_mod_reply'. +type SrPolicyModReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrPolicyModReply) Reset() { *m = SrPolicyModReply{} } +func (*SrPolicyModReply) GetMessageName() string { return "sr_policy_mod_reply" } +func (*SrPolicyModReply) GetCrcString() string { return "e8d4e804" } +func (*SrPolicyModReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SrPolicyModReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SrPolicyModReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SrPolicyModReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SrSetEncapHopLimit defines message 'sr_set_encap_hop_limit'. +type SrSetEncapHopLimit struct { + HopLimit uint8 `binapi:"u8,name=hop_limit" json:"hop_limit,omitempty"` +} + +func (m *SrSetEncapHopLimit) Reset() { *m = SrSetEncapHopLimit{} } +func (*SrSetEncapHopLimit) GetMessageName() string { return "sr_set_encap_hop_limit" } +func (*SrSetEncapHopLimit) GetCrcString() string { return "aa75d7d0" } +func (*SrSetEncapHopLimit) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SrSetEncapHopLimit) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.HopLimit + return size +} +func (m *SrSetEncapHopLimit) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.HopLimit)) + return buf.Bytes(), nil +} +func (m *SrSetEncapHopLimit) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.HopLimit = buf.DecodeUint8() + return nil +} + +// SrSetEncapHopLimitReply defines message 'sr_set_encap_hop_limit_reply'. +type SrSetEncapHopLimitReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrSetEncapHopLimitReply) Reset() { *m = SrSetEncapHopLimitReply{} } +func (*SrSetEncapHopLimitReply) GetMessageName() string { return "sr_set_encap_hop_limit_reply" } +func (*SrSetEncapHopLimitReply) GetCrcString() string { return "e8d4e804" } +func (*SrSetEncapHopLimitReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SrSetEncapHopLimitReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SrSetEncapHopLimitReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SrSetEncapHopLimitReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SrSetEncapSource defines message 'sr_set_encap_source'. +type SrSetEncapSource struct { + EncapsSource ip_types.IP6Address `binapi:"ip6_address,name=encaps_source" json:"encaps_source,omitempty"` +} + +func (m *SrSetEncapSource) Reset() { *m = SrSetEncapSource{} } +func (*SrSetEncapSource) GetMessageName() string { return "sr_set_encap_source" } +func (*SrSetEncapSource) GetCrcString() string { return "d3bad5e1" } +func (*SrSetEncapSource) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SrSetEncapSource) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 16 // m.EncapsSource + return size +} +func (m *SrSetEncapSource) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.EncapsSource[:], 16) + return buf.Bytes(), nil +} +func (m *SrSetEncapSource) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.EncapsSource[:], buf.DecodeBytes(16)) + return nil +} + +// SrSetEncapSourceReply defines message 'sr_set_encap_source_reply'. +type SrSetEncapSourceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrSetEncapSourceReply) Reset() { *m = SrSetEncapSourceReply{} } +func (*SrSetEncapSourceReply) GetMessageName() string { return "sr_set_encap_source_reply" } +func (*SrSetEncapSourceReply) GetCrcString() string { return "e8d4e804" } +func (*SrSetEncapSourceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SrSetEncapSourceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SrSetEncapSourceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SrSetEncapSourceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SrSteeringAddDel defines message 'sr_steering_add_del'. +type SrSteeringAddDel struct { + IsDel bool `binapi:"bool,name=is_del,default=%!s(bool=false)" json:"is_del,omitempty"` + BsidAddr ip_types.IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"` + SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + Prefix ip_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + TrafficType sr_types.SrSteer `binapi:"sr_steer,name=traffic_type" json:"traffic_type,omitempty"` +} + +func (m *SrSteeringAddDel) Reset() { *m = SrSteeringAddDel{} } +func (*SrSteeringAddDel) GetMessageName() string { return "sr_steering_add_del" } +func (*SrSteeringAddDel) GetCrcString() string { return "3711dace" } +func (*SrSteeringAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SrSteeringAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsDel + size += 1 * 16 // m.BsidAddr + size += 4 // m.SrPolicyIndex + size += 4 // m.TableID + size += 1 // m.Prefix.Address.Af + size += 1 * 16 // m.Prefix.Address.Un + size += 1 // m.Prefix.Len + size += 4 // m.SwIfIndex + size += 1 // m.TrafficType + return size +} +func (m *SrSteeringAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsDel) + buf.EncodeBytes(m.BsidAddr[:], 16) + buf.EncodeUint32(uint32(m.SrPolicyIndex)) + buf.EncodeUint32(uint32(m.TableID)) + buf.EncodeUint8(uint8(m.Prefix.Address.Af)) + buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Prefix.Len)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.TrafficType)) + return buf.Bytes(), nil +} +func (m *SrSteeringAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsDel = buf.DecodeBool() + copy(m.BsidAddr[:], buf.DecodeBytes(16)) + m.SrPolicyIndex = buf.DecodeUint32() + m.TableID = buf.DecodeUint32() + m.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Prefix.Len = buf.DecodeUint8() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.TrafficType = sr_types.SrSteer(buf.DecodeUint8()) + return nil +} + +// SrSteeringAddDelReply defines message 'sr_steering_add_del_reply'. +type SrSteeringAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrSteeringAddDelReply) Reset() { *m = SrSteeringAddDelReply{} } +func (*SrSteeringAddDelReply) GetMessageName() string { return "sr_steering_add_del_reply" } +func (*SrSteeringAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*SrSteeringAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SrSteeringAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SrSteeringAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SrSteeringAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SrSteeringPolDetails defines message 'sr_steering_pol_details'. +type SrSteeringPolDetails struct { + TrafficType sr_types.SrSteer `binapi:"sr_steer,name=traffic_type" json:"traffic_type,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + Prefix ip_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Bsid ip_types.IP6Address `binapi:"ip6_address,name=bsid" json:"bsid,omitempty"` +} + +func (m *SrSteeringPolDetails) Reset() { *m = SrSteeringPolDetails{} } +func (*SrSteeringPolDetails) GetMessageName() string { return "sr_steering_pol_details" } +func (*SrSteeringPolDetails) GetCrcString() string { return "1c1ee786" } +func (*SrSteeringPolDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SrSteeringPolDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.TrafficType + size += 4 // m.FibTable + size += 1 // m.Prefix.Address.Af + size += 1 * 16 // m.Prefix.Address.Un + size += 1 // m.Prefix.Len + size += 4 // m.SwIfIndex + size += 1 * 16 // m.Bsid + return size +} +func (m *SrSteeringPolDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.TrafficType)) + buf.EncodeUint32(uint32(m.FibTable)) + buf.EncodeUint8(uint8(m.Prefix.Address.Af)) + buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Prefix.Len)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBytes(m.Bsid[:], 16) + return buf.Bytes(), nil +} +func (m *SrSteeringPolDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.TrafficType = sr_types.SrSteer(buf.DecodeUint8()) + m.FibTable = buf.DecodeUint32() + m.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Prefix.Len = buf.DecodeUint8() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + copy(m.Bsid[:], buf.DecodeBytes(16)) + return nil +} + +// SrSteeringPolDump defines message 'sr_steering_pol_dump'. +type SrSteeringPolDump struct{} + +func (m *SrSteeringPolDump) Reset() { *m = SrSteeringPolDump{} } +func (*SrSteeringPolDump) GetMessageName() string { return "sr_steering_pol_dump" } +func (*SrSteeringPolDump) GetCrcString() string { return "51077d14" } +func (*SrSteeringPolDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SrSteeringPolDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SrSteeringPolDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *SrSteeringPolDump) Unmarshal(b []byte) error { + return nil +} + +func init() { file_sr_binapi_init() } +func file_sr_binapi_init() { + api.RegisterMessage((*SrLocalsidAddDel)(nil), "sr_localsid_add_del_26fa3309") + api.RegisterMessage((*SrLocalsidAddDelReply)(nil), "sr_localsid_add_del_reply_e8d4e804") + api.RegisterMessage((*SrLocalsidsDetails)(nil), "sr_localsids_details_6a6c0265") + api.RegisterMessage((*SrLocalsidsDump)(nil), "sr_localsids_dump_51077d14") + api.RegisterMessage((*SrPoliciesDetails)(nil), "sr_policies_details_07ec2d93") + api.RegisterMessage((*SrPoliciesDump)(nil), "sr_policies_dump_51077d14") + api.RegisterMessage((*SrPolicyAdd)(nil), "sr_policy_add_ec79ee6a") + api.RegisterMessage((*SrPolicyAddReply)(nil), "sr_policy_add_reply_e8d4e804") + api.RegisterMessage((*SrPolicyDel)(nil), "sr_policy_del_cb4d48d5") + api.RegisterMessage((*SrPolicyDelReply)(nil), "sr_policy_del_reply_e8d4e804") + api.RegisterMessage((*SrPolicyMod)(nil), "sr_policy_mod_e531a102") + api.RegisterMessage((*SrPolicyModReply)(nil), "sr_policy_mod_reply_e8d4e804") + api.RegisterMessage((*SrSetEncapHopLimit)(nil), "sr_set_encap_hop_limit_aa75d7d0") + api.RegisterMessage((*SrSetEncapHopLimitReply)(nil), "sr_set_encap_hop_limit_reply_e8d4e804") + api.RegisterMessage((*SrSetEncapSource)(nil), "sr_set_encap_source_d3bad5e1") + api.RegisterMessage((*SrSetEncapSourceReply)(nil), "sr_set_encap_source_reply_e8d4e804") + api.RegisterMessage((*SrSteeringAddDel)(nil), "sr_steering_add_del_3711dace") + api.RegisterMessage((*SrSteeringAddDelReply)(nil), "sr_steering_add_del_reply_e8d4e804") + api.RegisterMessage((*SrSteeringPolDetails)(nil), "sr_steering_pol_details_1c1ee786") + api.RegisterMessage((*SrSteeringPolDump)(nil), "sr_steering_pol_dump_51077d14") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SrLocalsidAddDel)(nil), + (*SrLocalsidAddDelReply)(nil), + (*SrLocalsidsDetails)(nil), + (*SrLocalsidsDump)(nil), + (*SrPoliciesDetails)(nil), + (*SrPoliciesDump)(nil), + (*SrPolicyAdd)(nil), + (*SrPolicyAddReply)(nil), + (*SrPolicyDel)(nil), + (*SrPolicyDelReply)(nil), + (*SrPolicyMod)(nil), + (*SrPolicyModReply)(nil), + (*SrSetEncapHopLimit)(nil), + (*SrSetEncapHopLimitReply)(nil), + (*SrSetEncapSource)(nil), + (*SrSetEncapSourceReply)(nil), + (*SrSteeringAddDel)(nil), + (*SrSteeringAddDelReply)(nil), + (*SrSteeringPolDetails)(nil), + (*SrSteeringPolDump)(nil), + } +} diff --git a/binapi/sr/sr_rest.ba.go b/binapi/sr/sr_rest.ba.go new file mode 100644 index 0000000..0d3acfc --- /dev/null +++ b/binapi/sr/sr_rest.ba.go @@ -0,0 +1,175 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package sr + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/sr_localsid_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(SrLocalsidAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SrLocalsidAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sr_policy_add", func(w http.ResponseWriter, req *http.Request) { + var request = new(SrPolicyAdd) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SrPolicyAdd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sr_policy_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(SrPolicyDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SrPolicyDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sr_policy_mod", func(w http.ResponseWriter, req *http.Request) { + var request = new(SrPolicyMod) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SrPolicyMod(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sr_set_encap_hop_limit", func(w http.ResponseWriter, req *http.Request) { + var request = new(SrSetEncapHopLimit) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SrSetEncapHopLimit(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sr_set_encap_source", func(w http.ResponseWriter, req *http.Request) { + var request = new(SrSetEncapSource) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SrSetEncapSource(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sr_steering_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(SrSteeringAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SrSteeringAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/sr/sr_rpc.ba.go b/binapi/sr/sr_rpc.ba.go new file mode 100644 index 0000000..59a2909 --- /dev/null +++ b/binapi/sr/sr_rpc.ba.go @@ -0,0 +1,213 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package sr + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service sr. +type RPCService interface { + SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddDel) (*SrLocalsidAddDelReply, error) + SrLocalsidsDump(ctx context.Context, in *SrLocalsidsDump) (RPCService_SrLocalsidsDumpClient, error) + SrPoliciesDump(ctx context.Context, in *SrPoliciesDump) (RPCService_SrPoliciesDumpClient, error) + SrPolicyAdd(ctx context.Context, in *SrPolicyAdd) (*SrPolicyAddReply, error) + SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPolicyDelReply, error) + SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPolicyModReply, error) + SrSetEncapHopLimit(ctx context.Context, in *SrSetEncapHopLimit) (*SrSetEncapHopLimitReply, error) + SrSetEncapSource(ctx context.Context, in *SrSetEncapSource) (*SrSetEncapSourceReply, error) + SrSteeringAddDel(ctx context.Context, in *SrSteeringAddDel) (*SrSteeringAddDelReply, error) + SrSteeringPolDump(ctx context.Context, in *SrSteeringPolDump) (RPCService_SrSteeringPolDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddDel) (*SrLocalsidAddDelReply, error) { + out := new(SrLocalsidAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrLocalsidsDump(ctx context.Context, in *SrLocalsidsDump) (RPCService_SrLocalsidsDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SrLocalsidsDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_SrLocalsidsDumpClient interface { + Recv() (*SrLocalsidsDetails, error) + api.Stream +} + +type serviceClient_SrLocalsidsDumpClient struct { + api.Stream +} + +func (c *serviceClient_SrLocalsidsDumpClient) Recv() (*SrLocalsidsDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SrLocalsidsDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) SrPoliciesDump(ctx context.Context, in *SrPoliciesDump) (RPCService_SrPoliciesDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SrPoliciesDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_SrPoliciesDumpClient interface { + Recv() (*SrPoliciesDetails, error) + api.Stream +} + +type serviceClient_SrPoliciesDumpClient struct { + api.Stream +} + +func (c *serviceClient_SrPoliciesDumpClient) Recv() (*SrPoliciesDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SrPoliciesDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) SrPolicyAdd(ctx context.Context, in *SrPolicyAdd) (*SrPolicyAddReply, error) { + out := new(SrPolicyAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPolicyDelReply, error) { + out := new(SrPolicyDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPolicyModReply, error) { + out := new(SrPolicyModReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrSetEncapHopLimit(ctx context.Context, in *SrSetEncapHopLimit) (*SrSetEncapHopLimitReply, error) { + out := new(SrSetEncapHopLimitReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrSetEncapSource(ctx context.Context, in *SrSetEncapSource) (*SrSetEncapSourceReply, error) { + out := new(SrSetEncapSourceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrSteeringAddDel(ctx context.Context, in *SrSteeringAddDel) (*SrSteeringAddDelReply, error) { + out := new(SrSteeringAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrSteeringPolDump(ctx context.Context, in *SrSteeringPolDump) (RPCService_SrSteeringPolDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SrSteeringPolDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_SrSteeringPolDumpClient interface { + Recv() (*SrSteeringPolDetails, error) + api.Stream +} + +type serviceClient_SrSteeringPolDumpClient struct { + api.Stream +} + +func (c *serviceClient_SrSteeringPolDumpClient) Recv() (*SrSteeringPolDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SrSteeringPolDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/sr_mpls/sr_mpls.ba.go b/binapi/sr_mpls/sr_mpls.ba.go new file mode 100644 index 0000000..c34522d --- /dev/null +++ b/binapi/sr_mpls/sr_mpls.ba.go @@ -0,0 +1,532 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/sr_mpls.api.json + +// Package sr_mpls contains generated bindings for API file sr_mpls.api. +// +// Contents: +// 10 messages +// +package sr_mpls + +import ( + api "git.fd.io/govpp.git/api" + _ "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + sr_types "git.fd.io/govpp.git/binapi/sr_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "sr_mpls" + APIVersion = "3.0.0" + VersionCrc = 0xaf471151 +) + +// SrMplsPolicyAdd defines message 'sr_mpls_policy_add'. +type SrMplsPolicyAdd struct { + Bsid uint32 `binapi:"u32,name=bsid" json:"bsid,omitempty"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` + IsSpray bool `binapi:"bool,name=is_spray" json:"is_spray,omitempty"` + NSegments uint8 `binapi:"u8,name=n_segments" json:"-"` + Segments []uint32 `binapi:"u32[n_segments],name=segments" json:"segments,omitempty"` +} + +func (m *SrMplsPolicyAdd) Reset() { *m = SrMplsPolicyAdd{} } +func (*SrMplsPolicyAdd) GetMessageName() string { return "sr_mpls_policy_add" } +func (*SrMplsPolicyAdd) GetCrcString() string { return "a1a70c70" } +func (*SrMplsPolicyAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SrMplsPolicyAdd) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Bsid + size += 4 // m.Weight + size += 1 // m.IsSpray + size += 1 // m.NSegments + size += 4 * len(m.Segments) // m.Segments + return size +} +func (m *SrMplsPolicyAdd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Bsid)) + buf.EncodeUint32(uint32(m.Weight)) + buf.EncodeBool(m.IsSpray) + buf.EncodeUint8(uint8(len(m.Segments))) + for i := 0; i < len(m.Segments); i++ { + var x uint32 + if i < len(m.Segments) { + x = uint32(m.Segments[i]) + } + buf.EncodeUint32(uint32(x)) + } + return buf.Bytes(), nil +} +func (m *SrMplsPolicyAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Bsid = buf.DecodeUint32() + m.Weight = buf.DecodeUint32() + m.IsSpray = buf.DecodeBool() + m.NSegments = buf.DecodeUint8() + m.Segments = make([]uint32, m.NSegments) + for i := 0; i < len(m.Segments); i++ { + m.Segments[i] = buf.DecodeUint32() + } + return nil +} + +// SrMplsPolicyAddReply defines message 'sr_mpls_policy_add_reply'. +type SrMplsPolicyAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrMplsPolicyAddReply) Reset() { *m = SrMplsPolicyAddReply{} } +func (*SrMplsPolicyAddReply) GetMessageName() string { return "sr_mpls_policy_add_reply" } +func (*SrMplsPolicyAddReply) GetCrcString() string { return "e8d4e804" } +func (*SrMplsPolicyAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SrMplsPolicyAddReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SrMplsPolicyAddReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SrMplsPolicyAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SrMplsPolicyAssignEndpointColor defines message 'sr_mpls_policy_assign_endpoint_color'. +type SrMplsPolicyAssignEndpointColor struct { + Bsid uint32 `binapi:"u32,name=bsid" json:"bsid,omitempty"` + Endpoint ip_types.Address `binapi:"address,name=endpoint" json:"endpoint,omitempty"` + Color uint32 `binapi:"u32,name=color" json:"color,omitempty"` +} + +func (m *SrMplsPolicyAssignEndpointColor) Reset() { *m = SrMplsPolicyAssignEndpointColor{} } +func (*SrMplsPolicyAssignEndpointColor) GetMessageName() string { + return "sr_mpls_policy_assign_endpoint_color" +} +func (*SrMplsPolicyAssignEndpointColor) GetCrcString() string { return "5e1c5c13" } +func (*SrMplsPolicyAssignEndpointColor) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SrMplsPolicyAssignEndpointColor) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Bsid + size += 1 // m.Endpoint.Af + size += 1 * 16 // m.Endpoint.Un + size += 4 // m.Color + return size +} +func (m *SrMplsPolicyAssignEndpointColor) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Bsid)) + buf.EncodeUint8(uint8(m.Endpoint.Af)) + buf.EncodeBytes(m.Endpoint.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.Color)) + return buf.Bytes(), nil +} +func (m *SrMplsPolicyAssignEndpointColor) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Bsid = buf.DecodeUint32() + m.Endpoint.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Endpoint.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Color = buf.DecodeUint32() + return nil +} + +// SrMplsPolicyAssignEndpointColorReply defines message 'sr_mpls_policy_assign_endpoint_color_reply'. +type SrMplsPolicyAssignEndpointColorReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrMplsPolicyAssignEndpointColorReply) Reset() { *m = SrMplsPolicyAssignEndpointColorReply{} } +func (*SrMplsPolicyAssignEndpointColorReply) GetMessageName() string { + return "sr_mpls_policy_assign_endpoint_color_reply" +} +func (*SrMplsPolicyAssignEndpointColorReply) GetCrcString() string { return "e8d4e804" } +func (*SrMplsPolicyAssignEndpointColorReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SrMplsPolicyAssignEndpointColorReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SrMplsPolicyAssignEndpointColorReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SrMplsPolicyAssignEndpointColorReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SrMplsPolicyDel defines message 'sr_mpls_policy_del'. +type SrMplsPolicyDel struct { + Bsid uint32 `binapi:"u32,name=bsid" json:"bsid,omitempty"` +} + +func (m *SrMplsPolicyDel) Reset() { *m = SrMplsPolicyDel{} } +func (*SrMplsPolicyDel) GetMessageName() string { return "sr_mpls_policy_del" } +func (*SrMplsPolicyDel) GetCrcString() string { return "e29d34fa" } +func (*SrMplsPolicyDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SrMplsPolicyDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Bsid + return size +} +func (m *SrMplsPolicyDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Bsid)) + return buf.Bytes(), nil +} +func (m *SrMplsPolicyDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Bsid = buf.DecodeUint32() + return nil +} + +// SrMplsPolicyDelReply defines message 'sr_mpls_policy_del_reply'. +type SrMplsPolicyDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrMplsPolicyDelReply) Reset() { *m = SrMplsPolicyDelReply{} } +func (*SrMplsPolicyDelReply) GetMessageName() string { return "sr_mpls_policy_del_reply" } +func (*SrMplsPolicyDelReply) GetCrcString() string { return "e8d4e804" } +func (*SrMplsPolicyDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SrMplsPolicyDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SrMplsPolicyDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SrMplsPolicyDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SrMplsPolicyMod defines message 'sr_mpls_policy_mod'. +type SrMplsPolicyMod struct { + Bsid uint32 `binapi:"u32,name=bsid" json:"bsid,omitempty"` + Operation sr_types.SrPolicyOp `binapi:"sr_policy_op,name=operation" json:"operation,omitempty"` + SlIndex uint32 `binapi:"u32,name=sl_index" json:"sl_index,omitempty"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` + NSegments uint8 `binapi:"u8,name=n_segments" json:"-"` + Segments []uint32 `binapi:"u32[n_segments],name=segments" json:"segments,omitempty"` +} + +func (m *SrMplsPolicyMod) Reset() { *m = SrMplsPolicyMod{} } +func (*SrMplsPolicyMod) GetMessageName() string { return "sr_mpls_policy_mod" } +func (*SrMplsPolicyMod) GetCrcString() string { return "88482c17" } +func (*SrMplsPolicyMod) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SrMplsPolicyMod) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Bsid + size += 1 // m.Operation + size += 4 // m.SlIndex + size += 4 // m.Weight + size += 1 // m.NSegments + size += 4 * len(m.Segments) // m.Segments + return size +} +func (m *SrMplsPolicyMod) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Bsid)) + buf.EncodeUint8(uint8(m.Operation)) + buf.EncodeUint32(uint32(m.SlIndex)) + buf.EncodeUint32(uint32(m.Weight)) + buf.EncodeUint8(uint8(len(m.Segments))) + for i := 0; i < len(m.Segments); i++ { + var x uint32 + if i < len(m.Segments) { + x = uint32(m.Segments[i]) + } + buf.EncodeUint32(uint32(x)) + } + return buf.Bytes(), nil +} +func (m *SrMplsPolicyMod) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Bsid = buf.DecodeUint32() + m.Operation = sr_types.SrPolicyOp(buf.DecodeUint8()) + m.SlIndex = buf.DecodeUint32() + m.Weight = buf.DecodeUint32() + m.NSegments = buf.DecodeUint8() + m.Segments = make([]uint32, m.NSegments) + for i := 0; i < len(m.Segments); i++ { + m.Segments[i] = buf.DecodeUint32() + } + return nil +} + +// SrMplsPolicyModReply defines message 'sr_mpls_policy_mod_reply'. +type SrMplsPolicyModReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrMplsPolicyModReply) Reset() { *m = SrMplsPolicyModReply{} } +func (*SrMplsPolicyModReply) GetMessageName() string { return "sr_mpls_policy_mod_reply" } +func (*SrMplsPolicyModReply) GetCrcString() string { return "e8d4e804" } +func (*SrMplsPolicyModReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SrMplsPolicyModReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SrMplsPolicyModReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SrMplsPolicyModReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SrMplsSteeringAddDel defines message 'sr_mpls_steering_add_del'. +type SrMplsSteeringAddDel struct { + IsDel bool `binapi:"bool,name=is_del,default=%!s(bool=false)" json:"is_del,omitempty"` + Bsid uint32 `binapi:"u32,name=bsid" json:"bsid,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + Prefix ip_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + MaskWidth uint32 `binapi:"u32,name=mask_width" json:"mask_width,omitempty"` + NextHop ip_types.Address `binapi:"address,name=next_hop" json:"next_hop,omitempty"` + Color uint32 `binapi:"u32,name=color" json:"color,omitempty"` + CoBits uint8 `binapi:"u8,name=co_bits" json:"co_bits,omitempty"` + VPNLabel uint32 `binapi:"u32,name=vpn_label" json:"vpn_label,omitempty"` +} + +func (m *SrMplsSteeringAddDel) Reset() { *m = SrMplsSteeringAddDel{} } +func (*SrMplsSteeringAddDel) GetMessageName() string { return "sr_mpls_steering_add_del" } +func (*SrMplsSteeringAddDel) GetCrcString() string { return "7d1b0a0b" } +func (*SrMplsSteeringAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SrMplsSteeringAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsDel + size += 4 // m.Bsid + size += 4 // m.TableID + size += 1 // m.Prefix.Address.Af + size += 1 * 16 // m.Prefix.Address.Un + size += 1 // m.Prefix.Len + size += 4 // m.MaskWidth + size += 1 // m.NextHop.Af + size += 1 * 16 // m.NextHop.Un + size += 4 // m.Color + size += 1 // m.CoBits + size += 4 // m.VPNLabel + return size +} +func (m *SrMplsSteeringAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsDel) + buf.EncodeUint32(uint32(m.Bsid)) + buf.EncodeUint32(uint32(m.TableID)) + buf.EncodeUint8(uint8(m.Prefix.Address.Af)) + buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Prefix.Len)) + buf.EncodeUint32(uint32(m.MaskWidth)) + buf.EncodeUint8(uint8(m.NextHop.Af)) + buf.EncodeBytes(m.NextHop.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.Color)) + buf.EncodeUint8(uint8(m.CoBits)) + buf.EncodeUint32(uint32(m.VPNLabel)) + return buf.Bytes(), nil +} +func (m *SrMplsSteeringAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsDel = buf.DecodeBool() + m.Bsid = buf.DecodeUint32() + m.TableID = buf.DecodeUint32() + m.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Prefix.Len = buf.DecodeUint8() + m.MaskWidth = buf.DecodeUint32() + m.NextHop.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.NextHop.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Color = buf.DecodeUint32() + m.CoBits = buf.DecodeUint8() + m.VPNLabel = buf.DecodeUint32() + return nil +} + +// SrMplsSteeringAddDelReply defines message 'sr_mpls_steering_add_del_reply'. +type SrMplsSteeringAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrMplsSteeringAddDelReply) Reset() { *m = SrMplsSteeringAddDelReply{} } +func (*SrMplsSteeringAddDelReply) GetMessageName() string { return "sr_mpls_steering_add_del_reply" } +func (*SrMplsSteeringAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*SrMplsSteeringAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SrMplsSteeringAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SrMplsSteeringAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SrMplsSteeringAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_sr_mpls_binapi_init() } +func file_sr_mpls_binapi_init() { + api.RegisterMessage((*SrMplsPolicyAdd)(nil), "sr_mpls_policy_add_a1a70c70") + api.RegisterMessage((*SrMplsPolicyAddReply)(nil), "sr_mpls_policy_add_reply_e8d4e804") + api.RegisterMessage((*SrMplsPolicyAssignEndpointColor)(nil), "sr_mpls_policy_assign_endpoint_color_5e1c5c13") + api.RegisterMessage((*SrMplsPolicyAssignEndpointColorReply)(nil), "sr_mpls_policy_assign_endpoint_color_reply_e8d4e804") + api.RegisterMessage((*SrMplsPolicyDel)(nil), "sr_mpls_policy_del_e29d34fa") + api.RegisterMessage((*SrMplsPolicyDelReply)(nil), "sr_mpls_policy_del_reply_e8d4e804") + api.RegisterMessage((*SrMplsPolicyMod)(nil), "sr_mpls_policy_mod_88482c17") + api.RegisterMessage((*SrMplsPolicyModReply)(nil), "sr_mpls_policy_mod_reply_e8d4e804") + api.RegisterMessage((*SrMplsSteeringAddDel)(nil), "sr_mpls_steering_add_del_7d1b0a0b") + api.RegisterMessage((*SrMplsSteeringAddDelReply)(nil), "sr_mpls_steering_add_del_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SrMplsPolicyAdd)(nil), + (*SrMplsPolicyAddReply)(nil), + (*SrMplsPolicyAssignEndpointColor)(nil), + (*SrMplsPolicyAssignEndpointColorReply)(nil), + (*SrMplsPolicyDel)(nil), + (*SrMplsPolicyDelReply)(nil), + (*SrMplsPolicyMod)(nil), + (*SrMplsPolicyModReply)(nil), + (*SrMplsSteeringAddDel)(nil), + (*SrMplsSteeringAddDelReply)(nil), + } +} diff --git a/binapi/sr_mpls/sr_mpls_rest.ba.go b/binapi/sr_mpls/sr_mpls_rest.ba.go new file mode 100644 index 0000000..85edbf0 --- /dev/null +++ b/binapi/sr_mpls/sr_mpls_rest.ba.go @@ -0,0 +1,129 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package sr_mpls + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/sr_mpls_policy_add", func(w http.ResponseWriter, req *http.Request) { + var request = new(SrMplsPolicyAdd) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SrMplsPolicyAdd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sr_mpls_policy_assign_endpoint_color", func(w http.ResponseWriter, req *http.Request) { + var request = new(SrMplsPolicyAssignEndpointColor) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SrMplsPolicyAssignEndpointColor(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sr_mpls_policy_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(SrMplsPolicyDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SrMplsPolicyDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sr_mpls_policy_mod", func(w http.ResponseWriter, req *http.Request) { + var request = new(SrMplsPolicyMod) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SrMplsPolicyMod(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sr_mpls_steering_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(SrMplsSteeringAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SrMplsSteeringAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/sr_mpls/sr_mpls_rpc.ba.go b/binapi/sr_mpls/sr_mpls_rpc.ba.go new file mode 100644 index 0000000..8669e70 --- /dev/null +++ b/binapi/sr_mpls/sr_mpls_rpc.ba.go @@ -0,0 +1,70 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package sr_mpls + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service sr_mpls. +type RPCService interface { + SrMplsPolicyAdd(ctx context.Context, in *SrMplsPolicyAdd) (*SrMplsPolicyAddReply, error) + SrMplsPolicyAssignEndpointColor(ctx context.Context, in *SrMplsPolicyAssignEndpointColor) (*SrMplsPolicyAssignEndpointColorReply, error) + SrMplsPolicyDel(ctx context.Context, in *SrMplsPolicyDel) (*SrMplsPolicyDelReply, error) + SrMplsPolicyMod(ctx context.Context, in *SrMplsPolicyMod) (*SrMplsPolicyModReply, error) + SrMplsSteeringAddDel(ctx context.Context, in *SrMplsSteeringAddDel) (*SrMplsSteeringAddDelReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) SrMplsPolicyAdd(ctx context.Context, in *SrMplsPolicyAdd) (*SrMplsPolicyAddReply, error) { + out := new(SrMplsPolicyAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrMplsPolicyAssignEndpointColor(ctx context.Context, in *SrMplsPolicyAssignEndpointColor) (*SrMplsPolicyAssignEndpointColorReply, error) { + out := new(SrMplsPolicyAssignEndpointColorReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrMplsPolicyDel(ctx context.Context, in *SrMplsPolicyDel) (*SrMplsPolicyDelReply, error) { + out := new(SrMplsPolicyDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrMplsPolicyMod(ctx context.Context, in *SrMplsPolicyMod) (*SrMplsPolicyModReply, error) { + out := new(SrMplsPolicyModReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrMplsSteeringAddDel(ctx context.Context, in *SrMplsSteeringAddDel) (*SrMplsSteeringAddDelReply, error) { + out := new(SrMplsSteeringAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/sr_types/sr_types.ba.go b/binapi/sr_types/sr_types.ba.go new file mode 100644 index 0000000..df9f0f6 --- /dev/null +++ b/binapi/sr_types/sr_types.ba.go @@ -0,0 +1,137 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/sr_types.api.json + +// Package sr_types contains generated bindings for API file sr_types.api. +// +// Contents: +// 3 enums +// +package sr_types + +import ( + api "git.fd.io/govpp.git/api" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +// SrBehavior defines enum 'sr_behavior'. +type SrBehavior uint8 + +const ( + SR_BEHAVIOR_API_END SrBehavior = 1 + SR_BEHAVIOR_API_X SrBehavior = 2 + SR_BEHAVIOR_API_T SrBehavior = 3 + SR_BEHAVIOR_API_D_FIRST SrBehavior = 4 + SR_BEHAVIOR_API_DX2 SrBehavior = 5 + SR_BEHAVIOR_API_DX6 SrBehavior = 6 + SR_BEHAVIOR_API_DX4 SrBehavior = 7 + SR_BEHAVIOR_API_DT6 SrBehavior = 8 + SR_BEHAVIOR_API_DT4 SrBehavior = 9 + SR_BEHAVIOR_API_LAST SrBehavior = 10 +) + +var ( + SrBehavior_name = map[uint8]string{ + 1: "SR_BEHAVIOR_API_END", + 2: "SR_BEHAVIOR_API_X", + 3: "SR_BEHAVIOR_API_T", + 4: "SR_BEHAVIOR_API_D_FIRST", + 5: "SR_BEHAVIOR_API_DX2", + 6: "SR_BEHAVIOR_API_DX6", + 7: "SR_BEHAVIOR_API_DX4", + 8: "SR_BEHAVIOR_API_DT6", + 9: "SR_BEHAVIOR_API_DT4", + 10: "SR_BEHAVIOR_API_LAST", + } + SrBehavior_value = map[string]uint8{ + "SR_BEHAVIOR_API_END": 1, + "SR_BEHAVIOR_API_X": 2, + "SR_BEHAVIOR_API_T": 3, + "SR_BEHAVIOR_API_D_FIRST": 4, + "SR_BEHAVIOR_API_DX2": 5, + "SR_BEHAVIOR_API_DX6": 6, + "SR_BEHAVIOR_API_DX4": 7, + "SR_BEHAVIOR_API_DT6": 8, + "SR_BEHAVIOR_API_DT4": 9, + "SR_BEHAVIOR_API_LAST": 10, + } +) + +func (x SrBehavior) String() string { + s, ok := SrBehavior_name[uint8(x)] + if ok { + return s + } + return "SrBehavior(" + strconv.Itoa(int(x)) + ")" +} + +// SrPolicyOp defines enum 'sr_policy_op'. +type SrPolicyOp uint8 + +const ( + SR_POLICY_OP_API_NONE SrPolicyOp = 0 + SR_POLICY_OP_API_ADD SrPolicyOp = 1 + SR_POLICY_OP_API_DEL SrPolicyOp = 2 + SR_POLICY_OP_API_MOD SrPolicyOp = 3 +) + +var ( + SrPolicyOp_name = map[uint8]string{ + 0: "SR_POLICY_OP_API_NONE", + 1: "SR_POLICY_OP_API_ADD", + 2: "SR_POLICY_OP_API_DEL", + 3: "SR_POLICY_OP_API_MOD", + } + SrPolicyOp_value = map[string]uint8{ + "SR_POLICY_OP_API_NONE": 0, + "SR_POLICY_OP_API_ADD": 1, + "SR_POLICY_OP_API_DEL": 2, + "SR_POLICY_OP_API_MOD": 3, + } +) + +func (x SrPolicyOp) String() string { + s, ok := SrPolicyOp_name[uint8(x)] + if ok { + return s + } + return "SrPolicyOp(" + strconv.Itoa(int(x)) + ")" +} + +// SrSteer defines enum 'sr_steer'. +type SrSteer uint8 + +const ( + SR_STEER_API_L2 SrSteer = 2 + SR_STEER_API_IPV4 SrSteer = 4 + SR_STEER_API_IPV6 SrSteer = 6 +) + +var ( + SrSteer_name = map[uint8]string{ + 2: "SR_STEER_API_L2", + 4: "SR_STEER_API_IPV4", + 6: "SR_STEER_API_IPV6", + } + SrSteer_value = map[string]uint8{ + "SR_STEER_API_L2": 2, + "SR_STEER_API_IPV4": 4, + "SR_STEER_API_IPV6": 6, + } +) + +func (x SrSteer) String() string { + s, ok := SrSteer_name[uint8(x)] + if ok { + return s + } + return "SrSteer(" + strconv.Itoa(int(x)) + ")" +} diff --git a/binapi/stn/stn.ba.go b/binapi/stn/stn.ba.go new file mode 100644 index 0000000..34cb419 --- /dev/null +++ b/binapi/stn/stn.ba.go @@ -0,0 +1,205 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/stn.api.json + +// Package stn contains generated bindings for API file stn.api. +// +// Contents: +// 4 messages +// +package stn + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "stn" + APIVersion = "2.0.0" + VersionCrc = 0x5a5079cd +) + +// StnAddDelRule defines message 'stn_add_del_rule'. +type StnAddDelRule struct { + IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *StnAddDelRule) Reset() { *m = StnAddDelRule{} } +func (*StnAddDelRule) GetMessageName() string { return "stn_add_del_rule" } +func (*StnAddDelRule) GetCrcString() string { return "53f751e6" } +func (*StnAddDelRule) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *StnAddDelRule) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IPAddress.Af + size += 1 * 16 // m.IPAddress.Un + size += 4 // m.SwIfIndex + size += 1 // m.IsAdd + return size +} +func (m *StnAddDelRule) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.IPAddress.Af)) + buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *StnAddDelRule) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsAdd = buf.DecodeBool() + return nil +} + +// StnAddDelRuleReply defines message 'stn_add_del_rule_reply'. +type StnAddDelRuleReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *StnAddDelRuleReply) Reset() { *m = StnAddDelRuleReply{} } +func (*StnAddDelRuleReply) GetMessageName() string { return "stn_add_del_rule_reply" } +func (*StnAddDelRuleReply) GetCrcString() string { return "e8d4e804" } +func (*StnAddDelRuleReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *StnAddDelRuleReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *StnAddDelRuleReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *StnAddDelRuleReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// StnRulesDetails defines message 'stn_rules_details'. +type StnRulesDetails struct { + IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *StnRulesDetails) Reset() { *m = StnRulesDetails{} } +func (*StnRulesDetails) GetMessageName() string { return "stn_rules_details" } +func (*StnRulesDetails) GetCrcString() string { return "b0f6606c" } +func (*StnRulesDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *StnRulesDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IPAddress.Af + size += 1 * 16 // m.IPAddress.Un + size += 4 // m.SwIfIndex + return size +} +func (m *StnRulesDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.IPAddress.Af)) + buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *StnRulesDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// StnRulesDump defines message 'stn_rules_dump'. +type StnRulesDump struct{} + +func (m *StnRulesDump) Reset() { *m = StnRulesDump{} } +func (*StnRulesDump) GetMessageName() string { return "stn_rules_dump" } +func (*StnRulesDump) GetCrcString() string { return "51077d14" } +func (*StnRulesDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *StnRulesDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *StnRulesDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *StnRulesDump) Unmarshal(b []byte) error { + return nil +} + +func init() { file_stn_binapi_init() } +func file_stn_binapi_init() { + api.RegisterMessage((*StnAddDelRule)(nil), "stn_add_del_rule_53f751e6") + api.RegisterMessage((*StnAddDelRuleReply)(nil), "stn_add_del_rule_reply_e8d4e804") + api.RegisterMessage((*StnRulesDetails)(nil), "stn_rules_details_b0f6606c") + api.RegisterMessage((*StnRulesDump)(nil), "stn_rules_dump_51077d14") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*StnAddDelRule)(nil), + (*StnAddDelRuleReply)(nil), + (*StnRulesDetails)(nil), + (*StnRulesDump)(nil), + } +} diff --git a/binapi/stn/stn_rest.ba.go b/binapi/stn/stn_rest.ba.go new file mode 100644 index 0000000..826aee9 --- /dev/null +++ b/binapi/stn/stn_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package stn + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/stn_add_del_rule", func(w http.ResponseWriter, req *http.Request) { + var request = new(StnAddDelRule) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.StnAddDelRule(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/stn/stn_rpc.ba.go b/binapi/stn/stn_rpc.ba.go new file mode 100644 index 0000000..932074c --- /dev/null +++ b/binapi/stn/stn_rpc.ba.go @@ -0,0 +1,73 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package stn + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service stn. +type RPCService interface { + StnAddDelRule(ctx context.Context, in *StnAddDelRule) (*StnAddDelRuleReply, error) + StnRulesDump(ctx context.Context, in *StnRulesDump) (RPCService_StnRulesDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) StnAddDelRule(ctx context.Context, in *StnAddDelRule) (*StnAddDelRuleReply, error) { + out := new(StnAddDelRuleReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) StnRulesDump(ctx context.Context, in *StnRulesDump) (RPCService_StnRulesDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_StnRulesDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_StnRulesDumpClient interface { + Recv() (*StnRulesDetails, error) + api.Stream +} + +type serviceClient_StnRulesDumpClient struct { + api.Stream +} + +func (c *serviceClient_StnRulesDumpClient) Recv() (*StnRulesDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *StnRulesDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/svs/svs.ba.go b/binapi/svs/svs.ba.go new file mode 100644 index 0000000..06573cc --- /dev/null +++ b/binapi/svs/svs.ba.go @@ -0,0 +1,459 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/svs.api.json + +// Package svs contains generated bindings for API file svs.api. +// +// Contents: +// 10 messages +// +package svs + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "svs" + APIVersion = "1.0.0" + VersionCrc = 0x1644b2d6 +) + +// SvsDetails defines message 'svs_details'. +type SvsDetails struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Af ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` +} + +func (m *SvsDetails) Reset() { *m = SvsDetails{} } +func (*SvsDetails) GetMessageName() string { return "svs_details" } +func (*SvsDetails) GetCrcString() string { return "b8523d64" } +func (*SvsDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SvsDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.TableID + size += 4 // m.SwIfIndex + size += 1 // m.Af + return size +} +func (m *SvsDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.TableID)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.Af)) + return buf.Bytes(), nil +} +func (m *SvsDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.TableID = buf.DecodeUint32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Af = ip_types.AddressFamily(buf.DecodeUint8()) + return nil +} + +// SvsDump defines message 'svs_dump'. +type SvsDump struct{} + +func (m *SvsDump) Reset() { *m = SvsDump{} } +func (*SvsDump) GetMessageName() string { return "svs_dump" } +func (*SvsDump) GetCrcString() string { return "51077d14" } +func (*SvsDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SvsDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SvsDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *SvsDump) Unmarshal(b []byte) error { + return nil +} + +// SvsEnableDisable defines message 'svs_enable_disable'. +type SvsEnableDisable struct { + IsEnable bool `binapi:"bool,name=is_enable" json:"is_enable,omitempty"` + Af ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *SvsEnableDisable) Reset() { *m = SvsEnableDisable{} } +func (*SvsEnableDisable) GetMessageName() string { return "svs_enable_disable" } +func (*SvsEnableDisable) GetCrcString() string { return "634b89d2" } +func (*SvsEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SvsEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsEnable + size += 1 // m.Af + size += 4 // m.TableID + size += 4 // m.SwIfIndex + return size +} +func (m *SvsEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsEnable) + buf.EncodeUint8(uint8(m.Af)) + buf.EncodeUint32(uint32(m.TableID)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *SvsEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsEnable = buf.DecodeBool() + m.Af = ip_types.AddressFamily(buf.DecodeUint8()) + m.TableID = buf.DecodeUint32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// SvsEnableDisableReply defines message 'svs_enable_disable_reply'. +type SvsEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SvsEnableDisableReply) Reset() { *m = SvsEnableDisableReply{} } +func (*SvsEnableDisableReply) GetMessageName() string { return "svs_enable_disable_reply" } +func (*SvsEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*SvsEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SvsEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SvsEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SvsEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SvsPluginGetVersion defines message 'svs_plugin_get_version'. +type SvsPluginGetVersion struct{} + +func (m *SvsPluginGetVersion) Reset() { *m = SvsPluginGetVersion{} } +func (*SvsPluginGetVersion) GetMessageName() string { return "svs_plugin_get_version" } +func (*SvsPluginGetVersion) GetCrcString() string { return "51077d14" } +func (*SvsPluginGetVersion) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SvsPluginGetVersion) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SvsPluginGetVersion) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *SvsPluginGetVersion) Unmarshal(b []byte) error { + return nil +} + +// SvsPluginGetVersionReply defines message 'svs_plugin_get_version_reply'. +type SvsPluginGetVersionReply struct { + Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` + Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` +} + +func (m *SvsPluginGetVersionReply) Reset() { *m = SvsPluginGetVersionReply{} } +func (*SvsPluginGetVersionReply) GetMessageName() string { return "svs_plugin_get_version_reply" } +func (*SvsPluginGetVersionReply) GetCrcString() string { return "9b32cf86" } +func (*SvsPluginGetVersionReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SvsPluginGetVersionReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Major + size += 4 // m.Minor + return size +} +func (m *SvsPluginGetVersionReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Major)) + buf.EncodeUint32(uint32(m.Minor)) + return buf.Bytes(), nil +} +func (m *SvsPluginGetVersionReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Major = buf.DecodeUint32() + m.Minor = buf.DecodeUint32() + return nil +} + +// SvsRouteAddDel defines message 'svs_route_add_del'. +type SvsRouteAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Prefix ip_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + SourceTableID uint32 `binapi:"u32,name=source_table_id" json:"source_table_id,omitempty"` +} + +func (m *SvsRouteAddDel) Reset() { *m = SvsRouteAddDel{} } +func (*SvsRouteAddDel) GetMessageName() string { return "svs_route_add_del" } +func (*SvsRouteAddDel) GetCrcString() string { return "d39e31fc" } +func (*SvsRouteAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SvsRouteAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.Prefix.Address.Af + size += 1 * 16 // m.Prefix.Address.Un + size += 1 // m.Prefix.Len + size += 4 // m.TableID + size += 4 // m.SourceTableID + return size +} +func (m *SvsRouteAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.Prefix.Address.Af)) + buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Prefix.Len)) + buf.EncodeUint32(uint32(m.TableID)) + buf.EncodeUint32(uint32(m.SourceTableID)) + return buf.Bytes(), nil +} +func (m *SvsRouteAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Prefix.Len = buf.DecodeUint8() + m.TableID = buf.DecodeUint32() + m.SourceTableID = buf.DecodeUint32() + return nil +} + +// SvsRouteAddDelReply defines message 'svs_route_add_del_reply'. +type SvsRouteAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SvsRouteAddDelReply) Reset() { *m = SvsRouteAddDelReply{} } +func (*SvsRouteAddDelReply) GetMessageName() string { return "svs_route_add_del_reply" } +func (*SvsRouteAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*SvsRouteAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SvsRouteAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SvsRouteAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SvsRouteAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SvsTableAddDel defines message 'svs_table_add_del'. +type SvsTableAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Af ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` +} + +func (m *SvsTableAddDel) Reset() { *m = SvsTableAddDel{} } +func (*SvsTableAddDel) GetMessageName() string { return "svs_table_add_del" } +func (*SvsTableAddDel) GetCrcString() string { return "7d21cb2a" } +func (*SvsTableAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SvsTableAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.Af + size += 4 // m.TableID + return size +} +func (m *SvsTableAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.Af)) + buf.EncodeUint32(uint32(m.TableID)) + return buf.Bytes(), nil +} +func (m *SvsTableAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Af = ip_types.AddressFamily(buf.DecodeUint8()) + m.TableID = buf.DecodeUint32() + return nil +} + +// SvsTableAddDelReply defines message 'svs_table_add_del_reply'. +type SvsTableAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SvsTableAddDelReply) Reset() { *m = SvsTableAddDelReply{} } +func (*SvsTableAddDelReply) GetMessageName() string { return "svs_table_add_del_reply" } +func (*SvsTableAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*SvsTableAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SvsTableAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SvsTableAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SvsTableAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_svs_binapi_init() } +func file_svs_binapi_init() { + api.RegisterMessage((*SvsDetails)(nil), "svs_details_b8523d64") + api.RegisterMessage((*SvsDump)(nil), "svs_dump_51077d14") + api.RegisterMessage((*SvsEnableDisable)(nil), "svs_enable_disable_634b89d2") + api.RegisterMessage((*SvsEnableDisableReply)(nil), "svs_enable_disable_reply_e8d4e804") + api.RegisterMessage((*SvsPluginGetVersion)(nil), "svs_plugin_get_version_51077d14") + api.RegisterMessage((*SvsPluginGetVersionReply)(nil), "svs_plugin_get_version_reply_9b32cf86") + api.RegisterMessage((*SvsRouteAddDel)(nil), "svs_route_add_del_d39e31fc") + api.RegisterMessage((*SvsRouteAddDelReply)(nil), "svs_route_add_del_reply_e8d4e804") + api.RegisterMessage((*SvsTableAddDel)(nil), "svs_table_add_del_7d21cb2a") + api.RegisterMessage((*SvsTableAddDelReply)(nil), "svs_table_add_del_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SvsDetails)(nil), + (*SvsDump)(nil), + (*SvsEnableDisable)(nil), + (*SvsEnableDisableReply)(nil), + (*SvsPluginGetVersion)(nil), + (*SvsPluginGetVersionReply)(nil), + (*SvsRouteAddDel)(nil), + (*SvsRouteAddDelReply)(nil), + (*SvsTableAddDel)(nil), + (*SvsTableAddDelReply)(nil), + } +} diff --git a/binapi/svs/svs_rest.ba.go b/binapi/svs/svs_rest.ba.go new file mode 100644 index 0000000..4293223 --- /dev/null +++ b/binapi/svs/svs_rest.ba.go @@ -0,0 +1,97 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package svs + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/svs_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(SvsEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SvsEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/svs_plugin_get_version", func(w http.ResponseWriter, req *http.Request) { + var request = new(SvsPluginGetVersion) + reply, err := rpc.SvsPluginGetVersion(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/svs_route_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(SvsRouteAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SvsRouteAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/svs_table_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(SvsTableAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SvsTableAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/svs/svs_rpc.ba.go b/binapi/svs/svs_rpc.ba.go new file mode 100644 index 0000000..d934f9e --- /dev/null +++ b/binapi/svs/svs_rpc.ba.go @@ -0,0 +1,103 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package svs + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service svs. +type RPCService interface { + SvsDump(ctx context.Context, in *SvsDump) (RPCService_SvsDumpClient, error) + SvsEnableDisable(ctx context.Context, in *SvsEnableDisable) (*SvsEnableDisableReply, error) + SvsPluginGetVersion(ctx context.Context, in *SvsPluginGetVersion) (*SvsPluginGetVersionReply, error) + SvsRouteAddDel(ctx context.Context, in *SvsRouteAddDel) (*SvsRouteAddDelReply, error) + SvsTableAddDel(ctx context.Context, in *SvsTableAddDel) (*SvsTableAddDelReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) SvsDump(ctx context.Context, in *SvsDump) (RPCService_SvsDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SvsDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_SvsDumpClient interface { + Recv() (*SvsDetails, error) + api.Stream +} + +type serviceClient_SvsDumpClient struct { + api.Stream +} + +func (c *serviceClient_SvsDumpClient) Recv() (*SvsDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SvsDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) SvsEnableDisable(ctx context.Context, in *SvsEnableDisable) (*SvsEnableDisableReply, error) { + out := new(SvsEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SvsPluginGetVersion(ctx context.Context, in *SvsPluginGetVersion) (*SvsPluginGetVersionReply, error) { + out := new(SvsPluginGetVersionReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SvsRouteAddDel(ctx context.Context, in *SvsRouteAddDel) (*SvsRouteAddDelReply, error) { + out := new(SvsRouteAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SvsTableAddDel(ctx context.Context, in *SvsTableAddDel) (*SvsTableAddDelReply, error) { + out := new(SvsTableAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/syslog/syslog.ba.go b/binapi/syslog/syslog.ba.go new file mode 100644 index 0000000..c6d78dc --- /dev/null +++ b/binapi/syslog/syslog.ba.go @@ -0,0 +1,419 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/syslog.api.json + +// Package syslog contains generated bindings for API file syslog.api. +// +// Contents: +// 1 enum +// 8 messages +// +package syslog + +import ( + api "git.fd.io/govpp.git/api" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "syslog" + APIVersion = "1.0.0" + VersionCrc = 0x95b7380f +) + +// SyslogSeverity defines enum 'syslog_severity'. +type SyslogSeverity uint32 + +const ( + SYSLOG_API_SEVERITY_EMERG SyslogSeverity = 0 + SYSLOG_API_SEVERITY_ALERT SyslogSeverity = 1 + SYSLOG_API_SEVERITY_CRIT SyslogSeverity = 2 + SYSLOG_API_SEVERITY_ERR SyslogSeverity = 3 + SYSLOG_API_SEVERITY_WARN SyslogSeverity = 4 + SYSLOG_API_SEVERITY_NOTICE SyslogSeverity = 5 + SYSLOG_API_SEVERITY_INFO SyslogSeverity = 6 + SYSLOG_API_SEVERITY_DBG SyslogSeverity = 7 +) + +var ( + SyslogSeverity_name = map[uint32]string{ + 0: "SYSLOG_API_SEVERITY_EMERG", + 1: "SYSLOG_API_SEVERITY_ALERT", + 2: "SYSLOG_API_SEVERITY_CRIT", + 3: "SYSLOG_API_SEVERITY_ERR", + 4: "SYSLOG_API_SEVERITY_WARN", + 5: "SYSLOG_API_SEVERITY_NOTICE", + 6: "SYSLOG_API_SEVERITY_INFO", + 7: "SYSLOG_API_SEVERITY_DBG", + } + SyslogSeverity_value = map[string]uint32{ + "SYSLOG_API_SEVERITY_EMERG": 0, + "SYSLOG_API_SEVERITY_ALERT": 1, + "SYSLOG_API_SEVERITY_CRIT": 2, + "SYSLOG_API_SEVERITY_ERR": 3, + "SYSLOG_API_SEVERITY_WARN": 4, + "SYSLOG_API_SEVERITY_NOTICE": 5, + "SYSLOG_API_SEVERITY_INFO": 6, + "SYSLOG_API_SEVERITY_DBG": 7, + } +) + +func (x SyslogSeverity) String() string { + s, ok := SyslogSeverity_name[uint32(x)] + if ok { + return s + } + return "SyslogSeverity(" + strconv.Itoa(int(x)) + ")" +} + +// SyslogGetFilter defines message 'syslog_get_filter'. +type SyslogGetFilter struct{} + +func (m *SyslogGetFilter) Reset() { *m = SyslogGetFilter{} } +func (*SyslogGetFilter) GetMessageName() string { return "syslog_get_filter" } +func (*SyslogGetFilter) GetCrcString() string { return "51077d14" } +func (*SyslogGetFilter) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SyslogGetFilter) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SyslogGetFilter) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *SyslogGetFilter) Unmarshal(b []byte) error { + return nil +} + +// SyslogGetFilterReply defines message 'syslog_get_filter_reply'. +type SyslogGetFilterReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Severity SyslogSeverity `binapi:"syslog_severity,name=severity" json:"severity,omitempty"` +} + +func (m *SyslogGetFilterReply) Reset() { *m = SyslogGetFilterReply{} } +func (*SyslogGetFilterReply) GetMessageName() string { return "syslog_get_filter_reply" } +func (*SyslogGetFilterReply) GetCrcString() string { return "eb1833f8" } +func (*SyslogGetFilterReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SyslogGetFilterReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.Severity + return size +} +func (m *SyslogGetFilterReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.Severity)) + return buf.Bytes(), nil +} +func (m *SyslogGetFilterReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Severity = SyslogSeverity(buf.DecodeUint32()) + return nil +} + +// SyslogGetSender defines message 'syslog_get_sender'. +type SyslogGetSender struct{} + +func (m *SyslogGetSender) Reset() { *m = SyslogGetSender{} } +func (*SyslogGetSender) GetMessageName() string { return "syslog_get_sender" } +func (*SyslogGetSender) GetCrcString() string { return "51077d14" } +func (*SyslogGetSender) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SyslogGetSender) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SyslogGetSender) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *SyslogGetSender) Unmarshal(b []byte) error { + return nil +} + +// SyslogGetSenderReply defines message 'syslog_get_sender_reply'. +type SyslogGetSenderReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SrcAddress ip_types.IP4Address `binapi:"ip4_address,name=src_address" json:"src_address,omitempty"` + CollectorAddress ip_types.IP4Address `binapi:"ip4_address,name=collector_address" json:"collector_address,omitempty"` + CollectorPort uint16 `binapi:"u16,name=collector_port" json:"collector_port,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + MaxMsgSize uint32 `binapi:"u32,name=max_msg_size" json:"max_msg_size,omitempty"` +} + +func (m *SyslogGetSenderReply) Reset() { *m = SyslogGetSenderReply{} } +func (*SyslogGetSenderReply) GetMessageName() string { return "syslog_get_sender_reply" } +func (*SyslogGetSenderReply) GetCrcString() string { return "d3da60ac" } +func (*SyslogGetSenderReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SyslogGetSenderReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 * 4 // m.SrcAddress + size += 1 * 4 // m.CollectorAddress + size += 2 // m.CollectorPort + size += 4 // m.VrfID + size += 4 // m.MaxMsgSize + return size +} +func (m *SyslogGetSenderReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBytes(m.SrcAddress[:], 4) + buf.EncodeBytes(m.CollectorAddress[:], 4) + buf.EncodeUint16(uint16(m.CollectorPort)) + buf.EncodeUint32(uint32(m.VrfID)) + buf.EncodeUint32(uint32(m.MaxMsgSize)) + return buf.Bytes(), nil +} +func (m *SyslogGetSenderReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + copy(m.SrcAddress[:], buf.DecodeBytes(4)) + copy(m.CollectorAddress[:], buf.DecodeBytes(4)) + m.CollectorPort = buf.DecodeUint16() + m.VrfID = buf.DecodeUint32() + m.MaxMsgSize = buf.DecodeUint32() + return nil +} + +// SyslogSetFilter defines message 'syslog_set_filter'. +type SyslogSetFilter struct { + Severity SyslogSeverity `binapi:"syslog_severity,name=severity" json:"severity,omitempty"` +} + +func (m *SyslogSetFilter) Reset() { *m = SyslogSetFilter{} } +func (*SyslogSetFilter) GetMessageName() string { return "syslog_set_filter" } +func (*SyslogSetFilter) GetCrcString() string { return "571348c3" } +func (*SyslogSetFilter) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SyslogSetFilter) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Severity + return size +} +func (m *SyslogSetFilter) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Severity)) + return buf.Bytes(), nil +} +func (m *SyslogSetFilter) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Severity = SyslogSeverity(buf.DecodeUint32()) + return nil +} + +// SyslogSetFilterReply defines message 'syslog_set_filter_reply'. +type SyslogSetFilterReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SyslogSetFilterReply) Reset() { *m = SyslogSetFilterReply{} } +func (*SyslogSetFilterReply) GetMessageName() string { return "syslog_set_filter_reply" } +func (*SyslogSetFilterReply) GetCrcString() string { return "e8d4e804" } +func (*SyslogSetFilterReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SyslogSetFilterReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SyslogSetFilterReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SyslogSetFilterReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SyslogSetSender defines message 'syslog_set_sender'. +type SyslogSetSender struct { + SrcAddress ip_types.IP4Address `binapi:"ip4_address,name=src_address" json:"src_address,omitempty"` + CollectorAddress ip_types.IP4Address `binapi:"ip4_address,name=collector_address" json:"collector_address,omitempty"` + CollectorPort uint16 `binapi:"u16,name=collector_port,default=%!s(float64=514)" json:"collector_port,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + MaxMsgSize uint32 `binapi:"u32,name=max_msg_size,default=%!s(float64=480)" json:"max_msg_size,omitempty"` +} + +func (m *SyslogSetSender) Reset() { *m = SyslogSetSender{} } +func (*SyslogSetSender) GetMessageName() string { return "syslog_set_sender" } +func (*SyslogSetSender) GetCrcString() string { return "bb641285" } +func (*SyslogSetSender) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SyslogSetSender) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.SrcAddress + size += 1 * 4 // m.CollectorAddress + size += 2 // m.CollectorPort + size += 4 // m.VrfID + size += 4 // m.MaxMsgSize + return size +} +func (m *SyslogSetSender) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.SrcAddress[:], 4) + buf.EncodeBytes(m.CollectorAddress[:], 4) + buf.EncodeUint16(uint16(m.CollectorPort)) + buf.EncodeUint32(uint32(m.VrfID)) + buf.EncodeUint32(uint32(m.MaxMsgSize)) + return buf.Bytes(), nil +} +func (m *SyslogSetSender) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.SrcAddress[:], buf.DecodeBytes(4)) + copy(m.CollectorAddress[:], buf.DecodeBytes(4)) + m.CollectorPort = buf.DecodeUint16() + m.VrfID = buf.DecodeUint32() + m.MaxMsgSize = buf.DecodeUint32() + return nil +} + +// SyslogSetSenderReply defines message 'syslog_set_sender_reply'. +type SyslogSetSenderReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SyslogSetSenderReply) Reset() { *m = SyslogSetSenderReply{} } +func (*SyslogSetSenderReply) GetMessageName() string { return "syslog_set_sender_reply" } +func (*SyslogSetSenderReply) GetCrcString() string { return "e8d4e804" } +func (*SyslogSetSenderReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SyslogSetSenderReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SyslogSetSenderReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SyslogSetSenderReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_syslog_binapi_init() } +func file_syslog_binapi_init() { + api.RegisterMessage((*SyslogGetFilter)(nil), "syslog_get_filter_51077d14") + api.RegisterMessage((*SyslogGetFilterReply)(nil), "syslog_get_filter_reply_eb1833f8") + api.RegisterMessage((*SyslogGetSender)(nil), "syslog_get_sender_51077d14") + api.RegisterMessage((*SyslogGetSenderReply)(nil), "syslog_get_sender_reply_d3da60ac") + api.RegisterMessage((*SyslogSetFilter)(nil), "syslog_set_filter_571348c3") + api.RegisterMessage((*SyslogSetFilterReply)(nil), "syslog_set_filter_reply_e8d4e804") + api.RegisterMessage((*SyslogSetSender)(nil), "syslog_set_sender_bb641285") + api.RegisterMessage((*SyslogSetSenderReply)(nil), "syslog_set_sender_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SyslogGetFilter)(nil), + (*SyslogGetFilterReply)(nil), + (*SyslogGetSender)(nil), + (*SyslogGetSenderReply)(nil), + (*SyslogSetFilter)(nil), + (*SyslogSetFilterReply)(nil), + (*SyslogSetSender)(nil), + (*SyslogSetSenderReply)(nil), + } +} diff --git a/binapi/syslog/syslog_rest.ba.go b/binapi/syslog/syslog_rest.ba.go new file mode 100644 index 0000000..e9098e8 --- /dev/null +++ b/binapi/syslog/syslog_rest.ba.go @@ -0,0 +1,88 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package syslog + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/syslog_get_filter", func(w http.ResponseWriter, req *http.Request) { + var request = new(SyslogGetFilter) + reply, err := rpc.SyslogGetFilter(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/syslog_get_sender", func(w http.ResponseWriter, req *http.Request) { + var request = new(SyslogGetSender) + reply, err := rpc.SyslogGetSender(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/syslog_set_filter", func(w http.ResponseWriter, req *http.Request) { + var request = new(SyslogSetFilter) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SyslogSetFilter(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/syslog_set_sender", func(w http.ResponseWriter, req *http.Request) { + var request = new(SyslogSetSender) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SyslogSetSender(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/syslog/syslog_rpc.ba.go b/binapi/syslog/syslog_rpc.ba.go new file mode 100644 index 0000000..a1f4a27 --- /dev/null +++ b/binapi/syslog/syslog_rpc.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package syslog + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service syslog. +type RPCService interface { + SyslogGetFilter(ctx context.Context, in *SyslogGetFilter) (*SyslogGetFilterReply, error) + SyslogGetSender(ctx context.Context, in *SyslogGetSender) (*SyslogGetSenderReply, error) + SyslogSetFilter(ctx context.Context, in *SyslogSetFilter) (*SyslogSetFilterReply, error) + SyslogSetSender(ctx context.Context, in *SyslogSetSender) (*SyslogSetSenderReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) SyslogGetFilter(ctx context.Context, in *SyslogGetFilter) (*SyslogGetFilterReply, error) { + out := new(SyslogGetFilterReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SyslogGetSender(ctx context.Context, in *SyslogGetSender) (*SyslogGetSenderReply, error) { + out := new(SyslogGetSenderReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SyslogSetFilter(ctx context.Context, in *SyslogSetFilter) (*SyslogSetFilterReply, error) { + out := new(SyslogSetFilterReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SyslogSetSender(ctx context.Context, in *SyslogSetSender) (*SyslogSetSenderReply, error) { + out := new(SyslogSetSenderReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/tapv2/tapv2.ba.go b/binapi/tapv2/tapv2.ba.go new file mode 100644 index 0000000..e19b556 --- /dev/null +++ b/binapi/tapv2/tapv2.ba.go @@ -0,0 +1,494 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/tapv2.api.json + +// Package tapv2 contains generated bindings for API file tapv2.api. +// +// Contents: +// 1 enum +// 6 messages +// +package tapv2 + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "tapv2" + APIVersion = "4.0.0" + VersionCrc = 0x3ed7c42d +) + +// TapFlags defines enum 'tap_flags'. +type TapFlags uint32 + +const ( + TAP_API_FLAG_GSO TapFlags = 1 + TAP_API_FLAG_CSUM_OFFLOAD TapFlags = 2 + TAP_API_FLAG_PERSIST TapFlags = 4 + TAP_API_FLAG_ATTACH TapFlags = 8 + TAP_API_FLAG_TUN TapFlags = 16 + TAP_API_FLAG_GRO_COALESCE TapFlags = 32 +) + +var ( + TapFlags_name = map[uint32]string{ + 1: "TAP_API_FLAG_GSO", + 2: "TAP_API_FLAG_CSUM_OFFLOAD", + 4: "TAP_API_FLAG_PERSIST", + 8: "TAP_API_FLAG_ATTACH", + 16: "TAP_API_FLAG_TUN", + 32: "TAP_API_FLAG_GRO_COALESCE", + } + TapFlags_value = map[string]uint32{ + "TAP_API_FLAG_GSO": 1, + "TAP_API_FLAG_CSUM_OFFLOAD": 2, + "TAP_API_FLAG_PERSIST": 4, + "TAP_API_FLAG_ATTACH": 8, + "TAP_API_FLAG_TUN": 16, + "TAP_API_FLAG_GRO_COALESCE": 32, + } +) + +func (x TapFlags) String() string { + s, ok := TapFlags_name[uint32(x)] + if ok { + return s + } + str := func(n uint32) string { + s, ok := TapFlags_name[uint32(n)] + if ok { + return s + } + return "TapFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint32(0); i <= 32; i++ { + val := uint32(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint32(x)) + } + return s +} + +// SwInterfaceTapV2Details defines message 'sw_interface_tap_v2_details'. +type SwInterfaceTapV2Details struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` + TxRingSz uint16 `binapi:"u16,name=tx_ring_sz" json:"tx_ring_sz,omitempty"` + RxRingSz uint16 `binapi:"u16,name=rx_ring_sz" json:"rx_ring_sz,omitempty"` + HostMtuSize uint32 `binapi:"u32,name=host_mtu_size" json:"host_mtu_size,omitempty"` + HostMacAddr ethernet_types.MacAddress `binapi:"mac_address,name=host_mac_addr" json:"host_mac_addr,omitempty"` + HostIP4Prefix ip_types.IP4AddressWithPrefix `binapi:"ip4_address_with_prefix,name=host_ip4_prefix" json:"host_ip4_prefix,omitempty"` + HostIP6Prefix ip_types.IP6AddressWithPrefix `binapi:"ip6_address_with_prefix,name=host_ip6_prefix" json:"host_ip6_prefix,omitempty"` + TapFlags TapFlags `binapi:"tap_flags,name=tap_flags" json:"tap_flags,omitempty"` + DevName string `binapi:"string[64],name=dev_name" json:"dev_name,omitempty"` + HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"` + HostNamespace string `binapi:"string[64],name=host_namespace" json:"host_namespace,omitempty"` + HostBridge string `binapi:"string[64],name=host_bridge" json:"host_bridge,omitempty"` +} + +func (m *SwInterfaceTapV2Details) Reset() { *m = SwInterfaceTapV2Details{} } +func (*SwInterfaceTapV2Details) GetMessageName() string { return "sw_interface_tap_v2_details" } +func (*SwInterfaceTapV2Details) GetCrcString() string { return "e53c16de" } +func (*SwInterfaceTapV2Details) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceTapV2Details) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.ID + size += 2 // m.TxRingSz + size += 2 // m.RxRingSz + size += 4 // m.HostMtuSize + size += 1 * 6 // m.HostMacAddr + size += 1 * 4 // m.HostIP4Prefix.Address + size += 1 // m.HostIP4Prefix.Len + size += 1 * 16 // m.HostIP6Prefix.Address + size += 1 // m.HostIP6Prefix.Len + size += 4 // m.TapFlags + size += 64 // m.DevName + size += 64 // m.HostIfName + size += 64 // m.HostNamespace + size += 64 // m.HostBridge + return size +} +func (m *SwInterfaceTapV2Details) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.ID)) + buf.EncodeUint16(uint16(m.TxRingSz)) + buf.EncodeUint16(uint16(m.RxRingSz)) + buf.EncodeUint32(uint32(m.HostMtuSize)) + buf.EncodeBytes(m.HostMacAddr[:], 6) + buf.EncodeBytes(m.HostIP4Prefix.Address[:], 4) + buf.EncodeUint8(uint8(m.HostIP4Prefix.Len)) + buf.EncodeBytes(m.HostIP6Prefix.Address[:], 16) + buf.EncodeUint8(uint8(m.HostIP6Prefix.Len)) + buf.EncodeUint32(uint32(m.TapFlags)) + buf.EncodeString(m.DevName, 64) + buf.EncodeString(m.HostIfName, 64) + buf.EncodeString(m.HostNamespace, 64) + buf.EncodeString(m.HostBridge, 64) + return buf.Bytes(), nil +} +func (m *SwInterfaceTapV2Details) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = buf.DecodeUint32() + m.ID = buf.DecodeUint32() + m.TxRingSz = buf.DecodeUint16() + m.RxRingSz = buf.DecodeUint16() + m.HostMtuSize = buf.DecodeUint32() + copy(m.HostMacAddr[:], buf.DecodeBytes(6)) + copy(m.HostIP4Prefix.Address[:], buf.DecodeBytes(4)) + m.HostIP4Prefix.Len = buf.DecodeUint8() + copy(m.HostIP6Prefix.Address[:], buf.DecodeBytes(16)) + m.HostIP6Prefix.Len = buf.DecodeUint8() + m.TapFlags = TapFlags(buf.DecodeUint32()) + m.DevName = buf.DecodeString(64) + m.HostIfName = buf.DecodeString(64) + m.HostNamespace = buf.DecodeString(64) + m.HostBridge = buf.DecodeString(64) + return nil +} + +// SwInterfaceTapV2Dump defines message 'sw_interface_tap_v2_dump'. +type SwInterfaceTapV2Dump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"` +} + +func (m *SwInterfaceTapV2Dump) Reset() { *m = SwInterfaceTapV2Dump{} } +func (*SwInterfaceTapV2Dump) GetMessageName() string { return "sw_interface_tap_v2_dump" } +func (*SwInterfaceTapV2Dump) GetCrcString() string { return "f9e6675e" } +func (*SwInterfaceTapV2Dump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceTapV2Dump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *SwInterfaceTapV2Dump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *SwInterfaceTapV2Dump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// TapCreateV2 defines message 'tap_create_v2'. +type TapCreateV2 struct { + ID uint32 `binapi:"u32,name=id,default=%!s(float64=4.294967295e+09)" json:"id,omitempty"` + UseRandomMac bool `binapi:"bool,name=use_random_mac,default=true" json:"use_random_mac,omitempty"` + MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` + NumRxQueues uint8 `binapi:"u8,name=num_rx_queues,default=%!s(float64=1)" json:"num_rx_queues,omitempty"` + TxRingSz uint16 `binapi:"u16,name=tx_ring_sz,default=%!s(float64=256)" json:"tx_ring_sz,omitempty"` + RxRingSz uint16 `binapi:"u16,name=rx_ring_sz,default=%!s(float64=256)" json:"rx_ring_sz,omitempty"` + HostMtuSet bool `binapi:"bool,name=host_mtu_set" json:"host_mtu_set,omitempty"` + HostMtuSize uint32 `binapi:"u32,name=host_mtu_size" json:"host_mtu_size,omitempty"` + HostMacAddrSet bool `binapi:"bool,name=host_mac_addr_set" json:"host_mac_addr_set,omitempty"` + HostMacAddr ethernet_types.MacAddress `binapi:"mac_address,name=host_mac_addr" json:"host_mac_addr,omitempty"` + HostIP4PrefixSet bool `binapi:"bool,name=host_ip4_prefix_set" json:"host_ip4_prefix_set,omitempty"` + HostIP4Prefix ip_types.IP4AddressWithPrefix `binapi:"ip4_address_with_prefix,name=host_ip4_prefix" json:"host_ip4_prefix,omitempty"` + HostIP6PrefixSet bool `binapi:"bool,name=host_ip6_prefix_set" json:"host_ip6_prefix_set,omitempty"` + HostIP6Prefix ip_types.IP6AddressWithPrefix `binapi:"ip6_address_with_prefix,name=host_ip6_prefix" json:"host_ip6_prefix,omitempty"` + HostIP4GwSet bool `binapi:"bool,name=host_ip4_gw_set" json:"host_ip4_gw_set,omitempty"` + HostIP4Gw ip_types.IP4Address `binapi:"ip4_address,name=host_ip4_gw" json:"host_ip4_gw,omitempty"` + HostIP6GwSet bool `binapi:"bool,name=host_ip6_gw_set" json:"host_ip6_gw_set,omitempty"` + HostIP6Gw ip_types.IP6Address `binapi:"ip6_address,name=host_ip6_gw" json:"host_ip6_gw,omitempty"` + TapFlags TapFlags `binapi:"tap_flags,name=tap_flags" json:"tap_flags,omitempty"` + HostNamespaceSet bool `binapi:"bool,name=host_namespace_set" json:"host_namespace_set,omitempty"` + HostNamespace string `binapi:"string[64],name=host_namespace" json:"host_namespace,omitempty"` + HostIfNameSet bool `binapi:"bool,name=host_if_name_set" json:"host_if_name_set,omitempty"` + HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"` + HostBridgeSet bool `binapi:"bool,name=host_bridge_set" json:"host_bridge_set,omitempty"` + HostBridge string `binapi:"string[64],name=host_bridge" json:"host_bridge,omitempty"` + Tag string `binapi:"string[],name=tag" json:"tag,omitempty"` +} + +func (m *TapCreateV2) Reset() { *m = TapCreateV2{} } +func (*TapCreateV2) GetMessageName() string { return "tap_create_v2" } +func (*TapCreateV2) GetCrcString() string { return "445835fd" } +func (*TapCreateV2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *TapCreateV2) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ID + size += 1 // m.UseRandomMac + size += 1 * 6 // m.MacAddress + size += 1 // m.NumRxQueues + size += 2 // m.TxRingSz + size += 2 // m.RxRingSz + size += 1 // m.HostMtuSet + size += 4 // m.HostMtuSize + size += 1 // m.HostMacAddrSet + size += 1 * 6 // m.HostMacAddr + size += 1 // m.HostIP4PrefixSet + size += 1 * 4 // m.HostIP4Prefix.Address + size += 1 // m.HostIP4Prefix.Len + size += 1 // m.HostIP6PrefixSet + size += 1 * 16 // m.HostIP6Prefix.Address + size += 1 // m.HostIP6Prefix.Len + size += 1 // m.HostIP4GwSet + size += 1 * 4 // m.HostIP4Gw + size += 1 // m.HostIP6GwSet + size += 1 * 16 // m.HostIP6Gw + size += 4 // m.TapFlags + size += 1 // m.HostNamespaceSet + size += 64 // m.HostNamespace + size += 1 // m.HostIfNameSet + size += 64 // m.HostIfName + size += 1 // m.HostBridgeSet + size += 64 // m.HostBridge + size += 4 + len(m.Tag) // m.Tag + return size +} +func (m *TapCreateV2) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ID)) + buf.EncodeBool(m.UseRandomMac) + buf.EncodeBytes(m.MacAddress[:], 6) + buf.EncodeUint8(uint8(m.NumRxQueues)) + buf.EncodeUint16(uint16(m.TxRingSz)) + buf.EncodeUint16(uint16(m.RxRingSz)) + buf.EncodeBool(m.HostMtuSet) + buf.EncodeUint32(uint32(m.HostMtuSize)) + buf.EncodeBool(m.HostMacAddrSet) + buf.EncodeBytes(m.HostMacAddr[:], 6) + buf.EncodeBool(m.HostIP4PrefixSet) + buf.EncodeBytes(m.HostIP4Prefix.Address[:], 4) + buf.EncodeUint8(uint8(m.HostIP4Prefix.Len)) + buf.EncodeBool(m.HostIP6PrefixSet) + buf.EncodeBytes(m.HostIP6Prefix.Address[:], 16) + buf.EncodeUint8(uint8(m.HostIP6Prefix.Len)) + buf.EncodeBool(m.HostIP4GwSet) + buf.EncodeBytes(m.HostIP4Gw[:], 4) + buf.EncodeBool(m.HostIP6GwSet) + buf.EncodeBytes(m.HostIP6Gw[:], 16) + buf.EncodeUint32(uint32(m.TapFlags)) + buf.EncodeBool(m.HostNamespaceSet) + buf.EncodeString(m.HostNamespace, 64) + buf.EncodeBool(m.HostIfNameSet) + buf.EncodeString(m.HostIfName, 64) + buf.EncodeBool(m.HostBridgeSet) + buf.EncodeString(m.HostBridge, 64) + buf.EncodeString(m.Tag, 0) + return buf.Bytes(), nil +} +func (m *TapCreateV2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ID = buf.DecodeUint32() + m.UseRandomMac = buf.DecodeBool() + copy(m.MacAddress[:], buf.DecodeBytes(6)) + m.NumRxQueues = buf.DecodeUint8() + m.TxRingSz = buf.DecodeUint16() + m.RxRingSz = buf.DecodeUint16() + m.HostMtuSet = buf.DecodeBool() + m.HostMtuSize = buf.DecodeUint32() + m.HostMacAddrSet = buf.DecodeBool() + copy(m.HostMacAddr[:], buf.DecodeBytes(6)) + m.HostIP4PrefixSet = buf.DecodeBool() + copy(m.HostIP4Prefix.Address[:], buf.DecodeBytes(4)) + m.HostIP4Prefix.Len = buf.DecodeUint8() + m.HostIP6PrefixSet = buf.DecodeBool() + copy(m.HostIP6Prefix.Address[:], buf.DecodeBytes(16)) + m.HostIP6Prefix.Len = buf.DecodeUint8() + m.HostIP4GwSet = buf.DecodeBool() + copy(m.HostIP4Gw[:], buf.DecodeBytes(4)) + m.HostIP6GwSet = buf.DecodeBool() + copy(m.HostIP6Gw[:], buf.DecodeBytes(16)) + m.TapFlags = TapFlags(buf.DecodeUint32()) + m.HostNamespaceSet = buf.DecodeBool() + m.HostNamespace = buf.DecodeString(64) + m.HostIfNameSet = buf.DecodeBool() + m.HostIfName = buf.DecodeString(64) + m.HostBridgeSet = buf.DecodeBool() + m.HostBridge = buf.DecodeString(64) + m.Tag = buf.DecodeString(0) + return nil +} + +// TapCreateV2Reply defines message 'tap_create_v2_reply'. +type TapCreateV2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *TapCreateV2Reply) Reset() { *m = TapCreateV2Reply{} } +func (*TapCreateV2Reply) GetMessageName() string { return "tap_create_v2_reply" } +func (*TapCreateV2Reply) GetCrcString() string { return "5383d31f" } +func (*TapCreateV2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *TapCreateV2Reply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *TapCreateV2Reply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *TapCreateV2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// TapDeleteV2 defines message 'tap_delete_v2'. +type TapDeleteV2 struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *TapDeleteV2) Reset() { *m = TapDeleteV2{} } +func (*TapDeleteV2) GetMessageName() string { return "tap_delete_v2" } +func (*TapDeleteV2) GetCrcString() string { return "f9e6675e" } +func (*TapDeleteV2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *TapDeleteV2) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *TapDeleteV2) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *TapDeleteV2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// TapDeleteV2Reply defines message 'tap_delete_v2_reply'. +type TapDeleteV2Reply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *TapDeleteV2Reply) Reset() { *m = TapDeleteV2Reply{} } +func (*TapDeleteV2Reply) GetMessageName() string { return "tap_delete_v2_reply" } +func (*TapDeleteV2Reply) GetCrcString() string { return "e8d4e804" } +func (*TapDeleteV2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *TapDeleteV2Reply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *TapDeleteV2Reply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *TapDeleteV2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_tapv2_binapi_init() } +func file_tapv2_binapi_init() { + api.RegisterMessage((*SwInterfaceTapV2Details)(nil), "sw_interface_tap_v2_details_e53c16de") + api.RegisterMessage((*SwInterfaceTapV2Dump)(nil), "sw_interface_tap_v2_dump_f9e6675e") + api.RegisterMessage((*TapCreateV2)(nil), "tap_create_v2_445835fd") + api.RegisterMessage((*TapCreateV2Reply)(nil), "tap_create_v2_reply_5383d31f") + api.RegisterMessage((*TapDeleteV2)(nil), "tap_delete_v2_f9e6675e") + api.RegisterMessage((*TapDeleteV2Reply)(nil), "tap_delete_v2_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SwInterfaceTapV2Details)(nil), + (*SwInterfaceTapV2Dump)(nil), + (*TapCreateV2)(nil), + (*TapCreateV2Reply)(nil), + (*TapDeleteV2)(nil), + (*TapDeleteV2Reply)(nil), + } +} diff --git a/binapi/tapv2/tapv2_rest.ba.go b/binapi/tapv2/tapv2_rest.ba.go new file mode 100644 index 0000000..b1d1111 --- /dev/null +++ b/binapi/tapv2/tapv2_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package tapv2 + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/tap_create_v2", func(w http.ResponseWriter, req *http.Request) { + var request = new(TapCreateV2) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.TapCreateV2(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/tap_delete_v2", func(w http.ResponseWriter, req *http.Request) { + var request = new(TapDeleteV2) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.TapDeleteV2(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/tapv2/tapv2_rpc.ba.go b/binapi/tapv2/tapv2_rpc.ba.go new file mode 100644 index 0000000..ab530eb --- /dev/null +++ b/binapi/tapv2/tapv2_rpc.ba.go @@ -0,0 +1,83 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package tapv2 + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service tapv2. +type RPCService interface { + SwInterfaceTapV2Dump(ctx context.Context, in *SwInterfaceTapV2Dump) (RPCService_SwInterfaceTapV2DumpClient, error) + TapCreateV2(ctx context.Context, in *TapCreateV2) (*TapCreateV2Reply, error) + TapDeleteV2(ctx context.Context, in *TapDeleteV2) (*TapDeleteV2Reply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) SwInterfaceTapV2Dump(ctx context.Context, in *SwInterfaceTapV2Dump) (RPCService_SwInterfaceTapV2DumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SwInterfaceTapV2DumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_SwInterfaceTapV2DumpClient interface { + Recv() (*SwInterfaceTapV2Details, error) + api.Stream +} + +type serviceClient_SwInterfaceTapV2DumpClient struct { + api.Stream +} + +func (c *serviceClient_SwInterfaceTapV2DumpClient) Recv() (*SwInterfaceTapV2Details, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SwInterfaceTapV2Details: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) TapCreateV2(ctx context.Context, in *TapCreateV2) (*TapCreateV2Reply, error) { + out := new(TapCreateV2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) TapDeleteV2(ctx context.Context, in *TapDeleteV2) (*TapDeleteV2Reply, error) { + out := new(TapDeleteV2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/tcp/tcp.ba.go b/binapi/tcp/tcp.ba.go new file mode 100644 index 0000000..89571c4 --- /dev/null +++ b/binapi/tcp/tcp.ba.go @@ -0,0 +1,132 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/tcp.api.json + +// Package tcp contains generated bindings for API file tcp.api. +// +// Contents: +// 2 messages +// +package tcp + +import ( + api "git.fd.io/govpp.git/api" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "tcp" + APIVersion = "2.0.0" + VersionCrc = 0xf586c9ba +) + +// TCPConfigureSrcAddresses defines message 'tcp_configure_src_addresses'. +type TCPConfigureSrcAddresses struct { + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + FirstAddress ip_types.Address `binapi:"address,name=first_address" json:"first_address,omitempty"` + LastAddress ip_types.Address `binapi:"address,name=last_address" json:"last_address,omitempty"` +} + +func (m *TCPConfigureSrcAddresses) Reset() { *m = TCPConfigureSrcAddresses{} } +func (*TCPConfigureSrcAddresses) GetMessageName() string { return "tcp_configure_src_addresses" } +func (*TCPConfigureSrcAddresses) GetCrcString() string { return "4b02b946" } +func (*TCPConfigureSrcAddresses) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *TCPConfigureSrcAddresses) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.VrfID + size += 1 // m.FirstAddress.Af + size += 1 * 16 // m.FirstAddress.Un + size += 1 // m.LastAddress.Af + size += 1 * 16 // m.LastAddress.Un + return size +} +func (m *TCPConfigureSrcAddresses) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.VrfID)) + buf.EncodeUint8(uint8(m.FirstAddress.Af)) + buf.EncodeBytes(m.FirstAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.LastAddress.Af)) + buf.EncodeBytes(m.LastAddress.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *TCPConfigureSrcAddresses) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.VrfID = buf.DecodeUint32() + m.FirstAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.FirstAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.LastAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.LastAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// TCPConfigureSrcAddressesReply defines message 'tcp_configure_src_addresses_reply'. +type TCPConfigureSrcAddressesReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *TCPConfigureSrcAddressesReply) Reset() { *m = TCPConfigureSrcAddressesReply{} } +func (*TCPConfigureSrcAddressesReply) GetMessageName() string { + return "tcp_configure_src_addresses_reply" +} +func (*TCPConfigureSrcAddressesReply) GetCrcString() string { return "e8d4e804" } +func (*TCPConfigureSrcAddressesReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *TCPConfigureSrcAddressesReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *TCPConfigureSrcAddressesReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *TCPConfigureSrcAddressesReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_tcp_binapi_init() } +func file_tcp_binapi_init() { + api.RegisterMessage((*TCPConfigureSrcAddresses)(nil), "tcp_configure_src_addresses_4b02b946") + api.RegisterMessage((*TCPConfigureSrcAddressesReply)(nil), "tcp_configure_src_addresses_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*TCPConfigureSrcAddresses)(nil), + (*TCPConfigureSrcAddressesReply)(nil), + } +} diff --git a/binapi/tcp/tcp_rest.ba.go b/binapi/tcp/tcp_rest.ba.go new file mode 100644 index 0000000..8fa0b79 --- /dev/null +++ b/binapi/tcp/tcp_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package tcp + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/tcp_configure_src_addresses", func(w http.ResponseWriter, req *http.Request) { + var request = new(TCPConfigureSrcAddresses) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.TCPConfigureSrcAddresses(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/tcp/tcp_rpc.ba.go b/binapi/tcp/tcp_rpc.ba.go new file mode 100644 index 0000000..8be3619 --- /dev/null +++ b/binapi/tcp/tcp_rpc.ba.go @@ -0,0 +1,30 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package tcp + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service tcp. +type RPCService interface { + TCPConfigureSrcAddresses(ctx context.Context, in *TCPConfigureSrcAddresses) (*TCPConfigureSrcAddressesReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) TCPConfigureSrcAddresses(ctx context.Context, in *TCPConfigureSrcAddresses) (*TCPConfigureSrcAddressesReply, error) { + out := new(TCPConfigureSrcAddressesReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/teib/teib.ba.go b/binapi/teib/teib.ba.go new file mode 100644 index 0000000..9c216bf --- /dev/null +++ b/binapi/teib/teib.ba.go @@ -0,0 +1,230 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/teib.api.json + +// Package teib contains generated bindings for API file teib.api. +// +// Contents: +// 1 struct +// 4 messages +// +package teib + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "teib" + APIVersion = "1.0.0" + VersionCrc = 0xaac93c17 +) + +// TeibEntry defines type 'teib_entry'. +type TeibEntry struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Peer ip_types.Address `binapi:"address,name=peer" json:"peer,omitempty"` + Nh ip_types.Address `binapi:"address,name=nh" json:"nh,omitempty"` + NhTableID uint32 `binapi:"u32,name=nh_table_id" json:"nh_table_id,omitempty"` +} + +// TeibDetails defines message 'teib_details'. +type TeibDetails struct { + Entry TeibEntry `binapi:"teib_entry,name=entry" json:"entry,omitempty"` +} + +func (m *TeibDetails) Reset() { *m = TeibDetails{} } +func (*TeibDetails) GetMessageName() string { return "teib_details" } +func (*TeibDetails) GetCrcString() string { return "e3b6a503" } +func (*TeibDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *TeibDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Entry.SwIfIndex + size += 1 // m.Entry.Peer.Af + size += 1 * 16 // m.Entry.Peer.Un + size += 1 // m.Entry.Nh.Af + size += 1 * 16 // m.Entry.Nh.Un + size += 4 // m.Entry.NhTableID + return size +} +func (m *TeibDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Entry.SwIfIndex)) + buf.EncodeUint8(uint8(m.Entry.Peer.Af)) + buf.EncodeBytes(m.Entry.Peer.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Entry.Nh.Af)) + buf.EncodeBytes(m.Entry.Nh.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.Entry.NhTableID)) + return buf.Bytes(), nil +} +func (m *TeibDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Entry.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Entry.Peer.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.Peer.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.Nh.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.Nh.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.NhTableID = buf.DecodeUint32() + return nil +} + +// TeibDump defines message 'teib_dump'. +type TeibDump struct{} + +func (m *TeibDump) Reset() { *m = TeibDump{} } +func (*TeibDump) GetMessageName() string { return "teib_dump" } +func (*TeibDump) GetCrcString() string { return "51077d14" } +func (*TeibDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *TeibDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *TeibDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *TeibDump) Unmarshal(b []byte) error { + return nil +} + +// TeibEntryAddDel defines message 'teib_entry_add_del'. +type TeibEntryAddDel struct { + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` + Entry TeibEntry `binapi:"teib_entry,name=entry" json:"entry,omitempty"` +} + +func (m *TeibEntryAddDel) Reset() { *m = TeibEntryAddDel{} } +func (*TeibEntryAddDel) GetMessageName() string { return "teib_entry_add_del" } +func (*TeibEntryAddDel) GetCrcString() string { return "5aa0a538" } +func (*TeibEntryAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *TeibEntryAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Entry.SwIfIndex + size += 1 // m.Entry.Peer.Af + size += 1 * 16 // m.Entry.Peer.Un + size += 1 // m.Entry.Nh.Af + size += 1 * 16 // m.Entry.Nh.Un + size += 4 // m.Entry.NhTableID + return size +} +func (m *TeibEntryAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.IsAdd)) + buf.EncodeUint32(uint32(m.Entry.SwIfIndex)) + buf.EncodeUint8(uint8(m.Entry.Peer.Af)) + buf.EncodeBytes(m.Entry.Peer.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Entry.Nh.Af)) + buf.EncodeBytes(m.Entry.Nh.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.Entry.NhTableID)) + return buf.Bytes(), nil +} +func (m *TeibEntryAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeUint8() + m.Entry.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Entry.Peer.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.Peer.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.Nh.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Entry.Nh.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.NhTableID = buf.DecodeUint32() + return nil +} + +// TeibEntryAddDelReply defines message 'teib_entry_add_del_reply'. +type TeibEntryAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *TeibEntryAddDelReply) Reset() { *m = TeibEntryAddDelReply{} } +func (*TeibEntryAddDelReply) GetMessageName() string { return "teib_entry_add_del_reply" } +func (*TeibEntryAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*TeibEntryAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *TeibEntryAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *TeibEntryAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *TeibEntryAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_teib_binapi_init() } +func file_teib_binapi_init() { + api.RegisterMessage((*TeibDetails)(nil), "teib_details_e3b6a503") + api.RegisterMessage((*TeibDump)(nil), "teib_dump_51077d14") + api.RegisterMessage((*TeibEntryAddDel)(nil), "teib_entry_add_del_5aa0a538") + api.RegisterMessage((*TeibEntryAddDelReply)(nil), "teib_entry_add_del_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*TeibDetails)(nil), + (*TeibDump)(nil), + (*TeibEntryAddDel)(nil), + (*TeibEntryAddDelReply)(nil), + } +} diff --git a/binapi/teib/teib_rest.ba.go b/binapi/teib/teib_rest.ba.go new file mode 100644 index 0000000..fb8bc17 --- /dev/null +++ b/binapi/teib/teib_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package teib + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/teib_entry_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(TeibEntryAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.TeibEntryAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/teib/teib_rpc.ba.go b/binapi/teib/teib_rpc.ba.go new file mode 100644 index 0000000..4803c2d --- /dev/null +++ b/binapi/teib/teib_rpc.ba.go @@ -0,0 +1,73 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package teib + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service teib. +type RPCService interface { + TeibDump(ctx context.Context, in *TeibDump) (RPCService_TeibDumpClient, error) + TeibEntryAddDel(ctx context.Context, in *TeibEntryAddDel) (*TeibEntryAddDelReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) TeibDump(ctx context.Context, in *TeibDump) (RPCService_TeibDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_TeibDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_TeibDumpClient interface { + Recv() (*TeibDetails, error) + api.Stream +} + +type serviceClient_TeibDumpClient struct { + api.Stream +} + +func (c *serviceClient_TeibDumpClient) Recv() (*TeibDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *TeibDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) TeibEntryAddDel(ctx context.Context, in *TeibEntryAddDel) (*TeibEntryAddDelReply, error) { + out := new(TeibEntryAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/tls_openssl/tls_openssl.ba.go b/binapi/tls_openssl/tls_openssl.ba.go new file mode 100644 index 0000000..b4293fd --- /dev/null +++ b/binapi/tls_openssl/tls_openssl.ba.go @@ -0,0 +1,127 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/tls_openssl.api.json + +// Package tls_openssl contains generated bindings for API file tls_openssl.api. +// +// Contents: +// 2 messages +// +package tls_openssl + +import ( + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "tls_openssl" + APIVersion = "2.0.0" + VersionCrc = 0x7386fbcd +) + +// TLSOpensslSetEngine defines message 'tls_openssl_set_engine'. +type TLSOpensslSetEngine struct { + AsyncEnable uint32 `binapi:"u32,name=async_enable" json:"async_enable,omitempty"` + Engine []byte `binapi:"u8[64],name=engine" json:"engine,omitempty"` + Algorithm []byte `binapi:"u8[64],name=algorithm" json:"algorithm,omitempty"` + Ciphers []byte `binapi:"u8[64],name=ciphers" json:"ciphers,omitempty"` +} + +func (m *TLSOpensslSetEngine) Reset() { *m = TLSOpensslSetEngine{} } +func (*TLSOpensslSetEngine) GetMessageName() string { return "tls_openssl_set_engine" } +func (*TLSOpensslSetEngine) GetCrcString() string { return "e34d95c1" } +func (*TLSOpensslSetEngine) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *TLSOpensslSetEngine) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.AsyncEnable + size += 1 * 64 // m.Engine + size += 1 * 64 // m.Algorithm + size += 1 * 64 // m.Ciphers + return size +} +func (m *TLSOpensslSetEngine) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.AsyncEnable)) + buf.EncodeBytes(m.Engine[:], 64) + buf.EncodeBytes(m.Algorithm[:], 64) + buf.EncodeBytes(m.Ciphers[:], 64) + return buf.Bytes(), nil +} +func (m *TLSOpensslSetEngine) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.AsyncEnable = buf.DecodeUint32() + copy(m.Engine[:], buf.DecodeBytes(64)) + copy(m.Algorithm[:], buf.DecodeBytes(64)) + copy(m.Ciphers[:], buf.DecodeBytes(64)) + return nil +} + +// TLSOpensslSetEngineReply defines message 'tls_openssl_set_engine_reply'. +type TLSOpensslSetEngineReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *TLSOpensslSetEngineReply) Reset() { *m = TLSOpensslSetEngineReply{} } +func (*TLSOpensslSetEngineReply) GetMessageName() string { return "tls_openssl_set_engine_reply" } +func (*TLSOpensslSetEngineReply) GetCrcString() string { return "e8d4e804" } +func (*TLSOpensslSetEngineReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *TLSOpensslSetEngineReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *TLSOpensslSetEngineReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *TLSOpensslSetEngineReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_tls_openssl_binapi_init() } +func file_tls_openssl_binapi_init() { + api.RegisterMessage((*TLSOpensslSetEngine)(nil), "tls_openssl_set_engine_e34d95c1") + api.RegisterMessage((*TLSOpensslSetEngineReply)(nil), "tls_openssl_set_engine_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*TLSOpensslSetEngine)(nil), + (*TLSOpensslSetEngineReply)(nil), + } +} diff --git a/binapi/tls_openssl/tls_openssl_rest.ba.go b/binapi/tls_openssl/tls_openssl_rest.ba.go new file mode 100644 index 0000000..bfabb43 --- /dev/null +++ b/binapi/tls_openssl/tls_openssl_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package tls_openssl + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/tls_openssl_set_engine", func(w http.ResponseWriter, req *http.Request) { + var request = new(TLSOpensslSetEngine) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.TLSOpensslSetEngine(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/tls_openssl/tls_openssl_rpc.ba.go b/binapi/tls_openssl/tls_openssl_rpc.ba.go new file mode 100644 index 0000000..2575bf2 --- /dev/null +++ b/binapi/tls_openssl/tls_openssl_rpc.ba.go @@ -0,0 +1,30 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package tls_openssl + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service tls_openssl. +type RPCService interface { + TLSOpensslSetEngine(ctx context.Context, in *TLSOpensslSetEngine) (*TLSOpensslSetEngineReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) TLSOpensslSetEngine(ctx context.Context, in *TLSOpensslSetEngine) (*TLSOpensslSetEngineReply, error) { + out := new(TLSOpensslSetEngineReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/trace/trace.ba.go b/binapi/trace/trace.ba.go new file mode 100644 index 0000000..25db789 --- /dev/null +++ b/binapi/trace/trace.ba.go @@ -0,0 +1,291 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/trace.api.json + +// Package trace contains generated bindings for API file trace.api. +// +// Contents: +// 6 messages +// +package trace + +import ( + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "trace" + APIVersion = "1.0.0" + VersionCrc = 0x397cbf90 +) + +// TraceProfileAdd defines message 'trace_profile_add'. +type TraceProfileAdd struct { + TraceType uint8 `binapi:"u8,name=trace_type" json:"trace_type,omitempty"` + NumElts uint8 `binapi:"u8,name=num_elts" json:"num_elts,omitempty"` + TraceTsp uint8 `binapi:"u8,name=trace_tsp" json:"trace_tsp,omitempty"` + NodeID uint32 `binapi:"u32,name=node_id" json:"node_id,omitempty"` + AppData uint32 `binapi:"u32,name=app_data" json:"app_data,omitempty"` +} + +func (m *TraceProfileAdd) Reset() { *m = TraceProfileAdd{} } +func (*TraceProfileAdd) GetMessageName() string { return "trace_profile_add" } +func (*TraceProfileAdd) GetCrcString() string { return "de08aa6d" } +func (*TraceProfileAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *TraceProfileAdd) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.TraceType + size += 1 // m.NumElts + size += 1 // m.TraceTsp + size += 4 // m.NodeID + size += 4 // m.AppData + return size +} +func (m *TraceProfileAdd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.TraceType)) + buf.EncodeUint8(uint8(m.NumElts)) + buf.EncodeUint8(uint8(m.TraceTsp)) + buf.EncodeUint32(uint32(m.NodeID)) + buf.EncodeUint32(uint32(m.AppData)) + return buf.Bytes(), nil +} +func (m *TraceProfileAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.TraceType = buf.DecodeUint8() + m.NumElts = buf.DecodeUint8() + m.TraceTsp = buf.DecodeUint8() + m.NodeID = buf.DecodeUint32() + m.AppData = buf.DecodeUint32() + return nil +} + +// TraceProfileAddReply defines message 'trace_profile_add_reply'. +type TraceProfileAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *TraceProfileAddReply) Reset() { *m = TraceProfileAddReply{} } +func (*TraceProfileAddReply) GetMessageName() string { return "trace_profile_add_reply" } +func (*TraceProfileAddReply) GetCrcString() string { return "e8d4e804" } +func (*TraceProfileAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *TraceProfileAddReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *TraceProfileAddReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *TraceProfileAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// TraceProfileDel defines message 'trace_profile_del'. +type TraceProfileDel struct{} + +func (m *TraceProfileDel) Reset() { *m = TraceProfileDel{} } +func (*TraceProfileDel) GetMessageName() string { return "trace_profile_del" } +func (*TraceProfileDel) GetCrcString() string { return "51077d14" } +func (*TraceProfileDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *TraceProfileDel) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *TraceProfileDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *TraceProfileDel) Unmarshal(b []byte) error { + return nil +} + +// TraceProfileDelReply defines message 'trace_profile_del_reply'. +type TraceProfileDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *TraceProfileDelReply) Reset() { *m = TraceProfileDelReply{} } +func (*TraceProfileDelReply) GetMessageName() string { return "trace_profile_del_reply" } +func (*TraceProfileDelReply) GetCrcString() string { return "e8d4e804" } +func (*TraceProfileDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *TraceProfileDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *TraceProfileDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *TraceProfileDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// TraceProfileShowConfig defines message 'trace_profile_show_config'. +type TraceProfileShowConfig struct{} + +func (m *TraceProfileShowConfig) Reset() { *m = TraceProfileShowConfig{} } +func (*TraceProfileShowConfig) GetMessageName() string { return "trace_profile_show_config" } +func (*TraceProfileShowConfig) GetCrcString() string { return "51077d14" } +func (*TraceProfileShowConfig) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *TraceProfileShowConfig) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *TraceProfileShowConfig) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *TraceProfileShowConfig) Unmarshal(b []byte) error { + return nil +} + +// TraceProfileShowConfigReply defines message 'trace_profile_show_config_reply'. +type TraceProfileShowConfigReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + TraceType uint8 `binapi:"u8,name=trace_type" json:"trace_type,omitempty"` + NumElts uint8 `binapi:"u8,name=num_elts" json:"num_elts,omitempty"` + TraceTsp uint8 `binapi:"u8,name=trace_tsp" json:"trace_tsp,omitempty"` + NodeID uint32 `binapi:"u32,name=node_id" json:"node_id,omitempty"` + AppData uint32 `binapi:"u32,name=app_data" json:"app_data,omitempty"` +} + +func (m *TraceProfileShowConfigReply) Reset() { *m = TraceProfileShowConfigReply{} } +func (*TraceProfileShowConfigReply) GetMessageName() string { return "trace_profile_show_config_reply" } +func (*TraceProfileShowConfigReply) GetCrcString() string { return "0f1d374c" } +func (*TraceProfileShowConfigReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *TraceProfileShowConfigReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.TraceType + size += 1 // m.NumElts + size += 1 // m.TraceTsp + size += 4 // m.NodeID + size += 4 // m.AppData + return size +} +func (m *TraceProfileShowConfigReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint8(uint8(m.TraceType)) + buf.EncodeUint8(uint8(m.NumElts)) + buf.EncodeUint8(uint8(m.TraceTsp)) + buf.EncodeUint32(uint32(m.NodeID)) + buf.EncodeUint32(uint32(m.AppData)) + return buf.Bytes(), nil +} +func (m *TraceProfileShowConfigReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.TraceType = buf.DecodeUint8() + m.NumElts = buf.DecodeUint8() + m.TraceTsp = buf.DecodeUint8() + m.NodeID = buf.DecodeUint32() + m.AppData = buf.DecodeUint32() + return nil +} + +func init() { file_trace_binapi_init() } +func file_trace_binapi_init() { + api.RegisterMessage((*TraceProfileAdd)(nil), "trace_profile_add_de08aa6d") + api.RegisterMessage((*TraceProfileAddReply)(nil), "trace_profile_add_reply_e8d4e804") + api.RegisterMessage((*TraceProfileDel)(nil), "trace_profile_del_51077d14") + api.RegisterMessage((*TraceProfileDelReply)(nil), "trace_profile_del_reply_e8d4e804") + api.RegisterMessage((*TraceProfileShowConfig)(nil), "trace_profile_show_config_51077d14") + api.RegisterMessage((*TraceProfileShowConfigReply)(nil), "trace_profile_show_config_reply_0f1d374c") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*TraceProfileAdd)(nil), + (*TraceProfileAddReply)(nil), + (*TraceProfileDel)(nil), + (*TraceProfileDelReply)(nil), + (*TraceProfileShowConfig)(nil), + (*TraceProfileShowConfigReply)(nil), + } +} diff --git a/binapi/trace/trace_rest.ba.go b/binapi/trace/trace_rest.ba.go new file mode 100644 index 0000000..d7d2244 --- /dev/null +++ b/binapi/trace/trace_rest.ba.go @@ -0,0 +1,65 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package trace + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/trace_profile_add", func(w http.ResponseWriter, req *http.Request) { + var request = new(TraceProfileAdd) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.TraceProfileAdd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/trace_profile_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(TraceProfileDel) + reply, err := rpc.TraceProfileDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/trace_profile_show_config", func(w http.ResponseWriter, req *http.Request) { + var request = new(TraceProfileShowConfig) + reply, err := rpc.TraceProfileShowConfig(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/trace/trace_rpc.ba.go b/binapi/trace/trace_rpc.ba.go new file mode 100644 index 0000000..f0f2ca7 --- /dev/null +++ b/binapi/trace/trace_rpc.ba.go @@ -0,0 +1,50 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package trace + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service trace. +type RPCService interface { + TraceProfileAdd(ctx context.Context, in *TraceProfileAdd) (*TraceProfileAddReply, error) + TraceProfileDel(ctx context.Context, in *TraceProfileDel) (*TraceProfileDelReply, error) + TraceProfileShowConfig(ctx context.Context, in *TraceProfileShowConfig) (*TraceProfileShowConfigReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) TraceProfileAdd(ctx context.Context, in *TraceProfileAdd) (*TraceProfileAddReply, error) { + out := new(TraceProfileAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) TraceProfileDel(ctx context.Context, in *TraceProfileDel) (*TraceProfileDelReply, error) { + out := new(TraceProfileDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) TraceProfileShowConfig(ctx context.Context, in *TraceProfileShowConfig) (*TraceProfileShowConfigReply, error) { + out := new(TraceProfileShowConfigReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/tunnel_types/tunnel_types.ba.go b/binapi/tunnel_types/tunnel_types.ba.go new file mode 100644 index 0000000..30cdba8 --- /dev/null +++ b/binapi/tunnel_types/tunnel_types.ba.go @@ -0,0 +1,108 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/tunnel_types.api.json + +// Package tunnel_types contains generated bindings for API file tunnel_types.api. +// +// Contents: +// 2 enums +// +package tunnel_types + +import ( + api "git.fd.io/govpp.git/api" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +// TunnelEncapDecapFlags defines enum 'tunnel_encap_decap_flags'. +type TunnelEncapDecapFlags uint8 + +const ( + TUNNEL_API_ENCAP_DECAP_FLAG_NONE TunnelEncapDecapFlags = 0 + TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DF TunnelEncapDecapFlags = 1 + TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_SET_DF TunnelEncapDecapFlags = 2 + TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP TunnelEncapDecapFlags = 4 + TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN TunnelEncapDecapFlags = 8 + TUNNEL_API_ENCAP_DECAP_FLAG_DECAP_COPY_ECN TunnelEncapDecapFlags = 16 +) + +var ( + TunnelEncapDecapFlags_name = map[uint8]string{ + 0: "TUNNEL_API_ENCAP_DECAP_FLAG_NONE", + 1: "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DF", + 2: "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_SET_DF", + 4: "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP", + 8: "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN", + 16: "TUNNEL_API_ENCAP_DECAP_FLAG_DECAP_COPY_ECN", + } + TunnelEncapDecapFlags_value = map[string]uint8{ + "TUNNEL_API_ENCAP_DECAP_FLAG_NONE": 0, + "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DF": 1, + "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_SET_DF": 2, + "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP": 4, + "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN": 8, + "TUNNEL_API_ENCAP_DECAP_FLAG_DECAP_COPY_ECN": 16, + } +) + +func (x TunnelEncapDecapFlags) String() string { + s, ok := TunnelEncapDecapFlags_name[uint8(x)] + if ok { + return s + } + str := func(n uint8) string { + s, ok := TunnelEncapDecapFlags_name[uint8(n)] + if ok { + return s + } + return "TunnelEncapDecapFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint8(0); i <= 8; i++ { + val := uint8(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint8(x)) + } + return s +} + +// TunnelMode defines enum 'tunnel_mode'. +type TunnelMode uint8 + +const ( + TUNNEL_API_MODE_P2P TunnelMode = 0 + TUNNEL_API_MODE_MP TunnelMode = 1 +) + +var ( + TunnelMode_name = map[uint8]string{ + 0: "TUNNEL_API_MODE_P2P", + 1: "TUNNEL_API_MODE_MP", + } + TunnelMode_value = map[string]uint8{ + "TUNNEL_API_MODE_P2P": 0, + "TUNNEL_API_MODE_MP": 1, + } +) + +func (x TunnelMode) String() string { + s, ok := TunnelMode_name[uint8(x)] + if ok { + return s + } + return "TunnelMode(" + strconv.Itoa(int(x)) + ")" +} diff --git a/binapi/udp/udp.ba.go b/binapi/udp/udp.ba.go new file mode 100644 index 0000000..2582afb --- /dev/null +++ b/binapi/udp/udp.ba.go @@ -0,0 +1,319 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/udp.api.json + +// Package udp contains generated bindings for API file udp.api. +// +// Contents: +// 1 struct +// 6 messages +// +package udp + +import ( + api "git.fd.io/govpp.git/api" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "udp" + APIVersion = "1.1.0" + VersionCrc = 0xb827bf4f +) + +// UDPEncap defines type 'udp_encap'. +type UDPEncap struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + SrcPort uint16 `binapi:"u16,name=src_port" json:"src_port,omitempty"` + DstPort uint16 `binapi:"u16,name=dst_port" json:"dst_port,omitempty"` + SrcIP ip_types.Address `binapi:"address,name=src_ip" json:"src_ip,omitempty"` + DstIP ip_types.Address `binapi:"address,name=dst_ip" json:"dst_ip,omitempty"` + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` +} + +// UDPEncapAdd defines message 'udp_encap_add'. +type UDPEncapAdd struct { + UDPEncap UDPEncap `binapi:"udp_encap,name=udp_encap" json:"udp_encap,omitempty"` +} + +func (m *UDPEncapAdd) Reset() { *m = UDPEncapAdd{} } +func (*UDPEncapAdd) GetMessageName() string { return "udp_encap_add" } +func (*UDPEncapAdd) GetCrcString() string { return "61d5fc48" } +func (*UDPEncapAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *UDPEncapAdd) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.UDPEncap.TableID + size += 2 // m.UDPEncap.SrcPort + size += 2 // m.UDPEncap.DstPort + size += 1 // m.UDPEncap.SrcIP.Af + size += 1 * 16 // m.UDPEncap.SrcIP.Un + size += 1 // m.UDPEncap.DstIP.Af + size += 1 * 16 // m.UDPEncap.DstIP.Un + size += 4 // m.UDPEncap.ID + return size +} +func (m *UDPEncapAdd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.UDPEncap.TableID)) + buf.EncodeUint16(uint16(m.UDPEncap.SrcPort)) + buf.EncodeUint16(uint16(m.UDPEncap.DstPort)) + buf.EncodeUint8(uint8(m.UDPEncap.SrcIP.Af)) + buf.EncodeBytes(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.UDPEncap.DstIP.Af)) + buf.EncodeBytes(m.UDPEncap.DstIP.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.UDPEncap.ID)) + return buf.Bytes(), nil +} +func (m *UDPEncapAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.UDPEncap.TableID = buf.DecodeUint32() + m.UDPEncap.SrcPort = buf.DecodeUint16() + m.UDPEncap.DstPort = buf.DecodeUint16() + m.UDPEncap.SrcIP.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.UDPEncap.DstIP.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.UDPEncap.DstIP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.UDPEncap.ID = buf.DecodeUint32() + return nil +} + +// UDPEncapAddReply defines message 'udp_encap_add_reply'. +type UDPEncapAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` +} + +func (m *UDPEncapAddReply) Reset() { *m = UDPEncapAddReply{} } +func (*UDPEncapAddReply) GetMessageName() string { return "udp_encap_add_reply" } +func (*UDPEncapAddReply) GetCrcString() string { return "e2fc8294" } +func (*UDPEncapAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *UDPEncapAddReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.ID + return size +} +func (m *UDPEncapAddReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.ID)) + return buf.Bytes(), nil +} +func (m *UDPEncapAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.ID = buf.DecodeUint32() + return nil +} + +// UDPEncapDel defines message 'udp_encap_del'. +type UDPEncapDel struct { + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` +} + +func (m *UDPEncapDel) Reset() { *m = UDPEncapDel{} } +func (*UDPEncapDel) GetMessageName() string { return "udp_encap_del" } +func (*UDPEncapDel) GetCrcString() string { return "3a91bde5" } +func (*UDPEncapDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *UDPEncapDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ID + return size +} +func (m *UDPEncapDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ID)) + return buf.Bytes(), nil +} +func (m *UDPEncapDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ID = buf.DecodeUint32() + return nil +} + +// UDPEncapDelReply defines message 'udp_encap_del_reply'. +type UDPEncapDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *UDPEncapDelReply) Reset() { *m = UDPEncapDelReply{} } +func (*UDPEncapDelReply) GetMessageName() string { return "udp_encap_del_reply" } +func (*UDPEncapDelReply) GetCrcString() string { return "e8d4e804" } +func (*UDPEncapDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *UDPEncapDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *UDPEncapDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *UDPEncapDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// UDPEncapDetails defines message 'udp_encap_details'. +type UDPEncapDetails struct { + UDPEncap UDPEncap `binapi:"udp_encap,name=udp_encap" json:"udp_encap,omitempty"` +} + +func (m *UDPEncapDetails) Reset() { *m = UDPEncapDetails{} } +func (*UDPEncapDetails) GetMessageName() string { return "udp_encap_details" } +func (*UDPEncapDetails) GetCrcString() string { return "87c82821" } +func (*UDPEncapDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *UDPEncapDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.UDPEncap.TableID + size += 2 // m.UDPEncap.SrcPort + size += 2 // m.UDPEncap.DstPort + size += 1 // m.UDPEncap.SrcIP.Af + size += 1 * 16 // m.UDPEncap.SrcIP.Un + size += 1 // m.UDPEncap.DstIP.Af + size += 1 * 16 // m.UDPEncap.DstIP.Un + size += 4 // m.UDPEncap.ID + return size +} +func (m *UDPEncapDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.UDPEncap.TableID)) + buf.EncodeUint16(uint16(m.UDPEncap.SrcPort)) + buf.EncodeUint16(uint16(m.UDPEncap.DstPort)) + buf.EncodeUint8(uint8(m.UDPEncap.SrcIP.Af)) + buf.EncodeBytes(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.UDPEncap.DstIP.Af)) + buf.EncodeBytes(m.UDPEncap.DstIP.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.UDPEncap.ID)) + return buf.Bytes(), nil +} +func (m *UDPEncapDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.UDPEncap.TableID = buf.DecodeUint32() + m.UDPEncap.SrcPort = buf.DecodeUint16() + m.UDPEncap.DstPort = buf.DecodeUint16() + m.UDPEncap.SrcIP.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.UDPEncap.DstIP.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.UDPEncap.DstIP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.UDPEncap.ID = buf.DecodeUint32() + return nil +} + +// UDPEncapDump defines message 'udp_encap_dump'. +type UDPEncapDump struct{} + +func (m *UDPEncapDump) Reset() { *m = UDPEncapDump{} } +func (*UDPEncapDump) GetMessageName() string { return "udp_encap_dump" } +func (*UDPEncapDump) GetCrcString() string { return "51077d14" } +func (*UDPEncapDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *UDPEncapDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *UDPEncapDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *UDPEncapDump) Unmarshal(b []byte) error { + return nil +} + +func init() { file_udp_binapi_init() } +func file_udp_binapi_init() { + api.RegisterMessage((*UDPEncapAdd)(nil), "udp_encap_add_61d5fc48") + api.RegisterMessage((*UDPEncapAddReply)(nil), "udp_encap_add_reply_e2fc8294") + api.RegisterMessage((*UDPEncapDel)(nil), "udp_encap_del_3a91bde5") + api.RegisterMessage((*UDPEncapDelReply)(nil), "udp_encap_del_reply_e8d4e804") + api.RegisterMessage((*UDPEncapDetails)(nil), "udp_encap_details_87c82821") + api.RegisterMessage((*UDPEncapDump)(nil), "udp_encap_dump_51077d14") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*UDPEncapAdd)(nil), + (*UDPEncapAddReply)(nil), + (*UDPEncapDel)(nil), + (*UDPEncapDelReply)(nil), + (*UDPEncapDetails)(nil), + (*UDPEncapDump)(nil), + } +} diff --git a/binapi/udp/udp_rest.ba.go b/binapi/udp/udp_rest.ba.go new file mode 100644 index 0000000..fc584bb --- /dev/null +++ b/binapi/udp/udp_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package udp + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/udp_encap_add", func(w http.ResponseWriter, req *http.Request) { + var request = new(UDPEncapAdd) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.UDPEncapAdd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/udp_encap_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(UDPEncapDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.UDPEncapDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/udp/udp_rpc.ba.go b/binapi/udp/udp_rpc.ba.go new file mode 100644 index 0000000..adb495c --- /dev/null +++ b/binapi/udp/udp_rpc.ba.go @@ -0,0 +1,83 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package udp + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service udp. +type RPCService interface { + UDPEncapAdd(ctx context.Context, in *UDPEncapAdd) (*UDPEncapAddReply, error) + UDPEncapDel(ctx context.Context, in *UDPEncapDel) (*UDPEncapDelReply, error) + UDPEncapDump(ctx context.Context, in *UDPEncapDump) (RPCService_UDPEncapDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) UDPEncapAdd(ctx context.Context, in *UDPEncapAdd) (*UDPEncapAddReply, error) { + out := new(UDPEncapAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) UDPEncapDel(ctx context.Context, in *UDPEncapDel) (*UDPEncapDelReply, error) { + out := new(UDPEncapDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) UDPEncapDump(ctx context.Context, in *UDPEncapDump) (RPCService_UDPEncapDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_UDPEncapDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_UDPEncapDumpClient interface { + Recv() (*UDPEncapDetails, error) + api.Stream +} + +type serviceClient_UDPEncapDumpClient struct { + api.Stream +} + +func (c *serviceClient_UDPEncapDumpClient) Recv() (*UDPEncapDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *UDPEncapDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/udp_ping/udp_ping.ba.go b/binapi/udp_ping/udp_ping.ba.go new file mode 100644 index 0000000..98d0c9f --- /dev/null +++ b/binapi/udp_ping/udp_ping.ba.go @@ -0,0 +1,234 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/udp_ping.api.json + +// Package udp_ping contains generated bindings for API file udp_ping.api. +// +// Contents: +// 4 messages +// +package udp_ping + +import ( + api "git.fd.io/govpp.git/api" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "udp_ping" + APIVersion = "3.0.0" + VersionCrc = 0x3b2c67de +) + +// UDPPingAddDel defines message 'udp_ping_add_del'. +type UDPPingAddDel struct { + SrcIPAddress ip_types.Address `binapi:"address,name=src_ip_address" json:"src_ip_address,omitempty"` + DstIPAddress ip_types.Address `binapi:"address,name=dst_ip_address" json:"dst_ip_address,omitempty"` + StartSrcPort uint16 `binapi:"u16,name=start_src_port" json:"start_src_port,omitempty"` + EndSrcPort uint16 `binapi:"u16,name=end_src_port" json:"end_src_port,omitempty"` + StartDstPort uint16 `binapi:"u16,name=start_dst_port" json:"start_dst_port,omitempty"` + EndDstPort uint16 `binapi:"u16,name=end_dst_port" json:"end_dst_port,omitempty"` + Interval uint16 `binapi:"u16,name=interval" json:"interval,omitempty"` + Dis uint8 `binapi:"u8,name=dis" json:"dis,omitempty"` + FaultDet uint8 `binapi:"u8,name=fault_det" json:"fault_det,omitempty"` + Reserve []byte `binapi:"u8[3],name=reserve" json:"reserve,omitempty"` +} + +func (m *UDPPingAddDel) Reset() { *m = UDPPingAddDel{} } +func (*UDPPingAddDel) GetMessageName() string { return "udp_ping_add_del" } +func (*UDPPingAddDel) GetCrcString() string { return "c692b188" } +func (*UDPPingAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *UDPPingAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.SrcIPAddress.Af + size += 1 * 16 // m.SrcIPAddress.Un + size += 1 // m.DstIPAddress.Af + size += 1 * 16 // m.DstIPAddress.Un + size += 2 // m.StartSrcPort + size += 2 // m.EndSrcPort + size += 2 // m.StartDstPort + size += 2 // m.EndDstPort + size += 2 // m.Interval + size += 1 // m.Dis + size += 1 // m.FaultDet + size += 1 * 3 // m.Reserve + return size +} +func (m *UDPPingAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.SrcIPAddress.Af)) + buf.EncodeBytes(m.SrcIPAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.DstIPAddress.Af)) + buf.EncodeBytes(m.DstIPAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint16(uint16(m.StartSrcPort)) + buf.EncodeUint16(uint16(m.EndSrcPort)) + buf.EncodeUint16(uint16(m.StartDstPort)) + buf.EncodeUint16(uint16(m.EndDstPort)) + buf.EncodeUint16(uint16(m.Interval)) + buf.EncodeUint8(uint8(m.Dis)) + buf.EncodeUint8(uint8(m.FaultDet)) + buf.EncodeBytes(m.Reserve[:], 3) + return buf.Bytes(), nil +} +func (m *UDPPingAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SrcIPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.SrcIPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.DstIPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.DstIPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.StartSrcPort = buf.DecodeUint16() + m.EndSrcPort = buf.DecodeUint16() + m.StartDstPort = buf.DecodeUint16() + m.EndDstPort = buf.DecodeUint16() + m.Interval = buf.DecodeUint16() + m.Dis = buf.DecodeUint8() + m.FaultDet = buf.DecodeUint8() + copy(m.Reserve[:], buf.DecodeBytes(3)) + return nil +} + +// UDPPingAddDelReply defines message 'udp_ping_add_del_reply'. +type UDPPingAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *UDPPingAddDelReply) Reset() { *m = UDPPingAddDelReply{} } +func (*UDPPingAddDelReply) GetMessageName() string { return "udp_ping_add_del_reply" } +func (*UDPPingAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*UDPPingAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *UDPPingAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *UDPPingAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *UDPPingAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// UDPPingExport defines message 'udp_ping_export'. +type UDPPingExport struct { + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *UDPPingExport) Reset() { *m = UDPPingExport{} } +func (*UDPPingExport) GetMessageName() string { return "udp_ping_export" } +func (*UDPPingExport) GetCrcString() string { return "b3e225d2" } +func (*UDPPingExport) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *UDPPingExport) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Enable + return size +} +func (m *UDPPingExport) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *UDPPingExport) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Enable = buf.DecodeBool() + return nil +} + +// UDPPingExportReply defines message 'udp_ping_export_reply'. +type UDPPingExportReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *UDPPingExportReply) Reset() { *m = UDPPingExportReply{} } +func (*UDPPingExportReply) GetMessageName() string { return "udp_ping_export_reply" } +func (*UDPPingExportReply) GetCrcString() string { return "e8d4e804" } +func (*UDPPingExportReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *UDPPingExportReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *UDPPingExportReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *UDPPingExportReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_udp_ping_binapi_init() } +func file_udp_ping_binapi_init() { + api.RegisterMessage((*UDPPingAddDel)(nil), "udp_ping_add_del_c692b188") + api.RegisterMessage((*UDPPingAddDelReply)(nil), "udp_ping_add_del_reply_e8d4e804") + api.RegisterMessage((*UDPPingExport)(nil), "udp_ping_export_b3e225d2") + api.RegisterMessage((*UDPPingExportReply)(nil), "udp_ping_export_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*UDPPingAddDel)(nil), + (*UDPPingAddDelReply)(nil), + (*UDPPingExport)(nil), + (*UDPPingExportReply)(nil), + } +} diff --git a/binapi/udp_ping/udp_ping_rest.ba.go b/binapi/udp_ping/udp_ping_rest.ba.go new file mode 100644 index 0000000..41317c4 --- /dev/null +++ b/binapi/udp_ping/udp_ping_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package udp_ping + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/udp_ping_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(UDPPingAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.UDPPingAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/udp_ping_export", func(w http.ResponseWriter, req *http.Request) { + var request = new(UDPPingExport) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.UDPPingExport(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/udp_ping/udp_ping_rpc.ba.go b/binapi/udp_ping/udp_ping_rpc.ba.go new file mode 100644 index 0000000..eae0ab4 --- /dev/null +++ b/binapi/udp_ping/udp_ping_rpc.ba.go @@ -0,0 +1,40 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package udp_ping + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service udp_ping. +type RPCService interface { + UDPPingAddDel(ctx context.Context, in *UDPPingAddDel) (*UDPPingAddDelReply, error) + UDPPingExport(ctx context.Context, in *UDPPingExport) (*UDPPingExportReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) UDPPingAddDel(ctx context.Context, in *UDPPingAddDel) (*UDPPingAddDelReply, error) { + out := new(UDPPingAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) UDPPingExport(ctx context.Context, in *UDPPingExport) (*UDPPingExportReply, error) { + out := new(UDPPingExportReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/urpf/urpf.ba.go b/binapi/urpf/urpf.ba.go new file mode 100644 index 0000000..d324bdb --- /dev/null +++ b/binapi/urpf/urpf.ba.go @@ -0,0 +1,162 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/urpf.api.json + +// Package urpf contains generated bindings for API file urpf.api. +// +// Contents: +// 1 enum +// 2 messages +// +package urpf + +import ( + api "git.fd.io/govpp.git/api" + _ "git.fd.io/govpp.git/binapi/fib_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "urpf" + APIVersion = "1.0.0" + VersionCrc = 0x3e2ebd8a +) + +// UrpfMode defines enum 'urpf_mode'. +type UrpfMode uint8 + +const ( + URPF_API_MODE_OFF UrpfMode = 1 + URPF_API_MODE_LOOSE UrpfMode = 2 + URPF_API_MODE_STRICT UrpfMode = 3 +) + +var ( + UrpfMode_name = map[uint8]string{ + 1: "URPF_API_MODE_OFF", + 2: "URPF_API_MODE_LOOSE", + 3: "URPF_API_MODE_STRICT", + } + UrpfMode_value = map[string]uint8{ + "URPF_API_MODE_OFF": 1, + "URPF_API_MODE_LOOSE": 2, + "URPF_API_MODE_STRICT": 3, + } +) + +func (x UrpfMode) String() string { + s, ok := UrpfMode_name[uint8(x)] + if ok { + return s + } + return "UrpfMode(" + strconv.Itoa(int(x)) + ")" +} + +// UrpfUpdate defines message 'urpf_update'. +type UrpfUpdate struct { + IsInput bool `binapi:"bool,name=is_input,default=true" json:"is_input,omitempty"` + Mode UrpfMode `binapi:"urpf_mode,name=mode" json:"mode,omitempty"` + Af ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *UrpfUpdate) Reset() { *m = UrpfUpdate{} } +func (*UrpfUpdate) GetMessageName() string { return "urpf_update" } +func (*UrpfUpdate) GetCrcString() string { return "2bf8a77c" } +func (*UrpfUpdate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *UrpfUpdate) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsInput + size += 1 // m.Mode + size += 1 // m.Af + size += 4 // m.SwIfIndex + return size +} +func (m *UrpfUpdate) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsInput) + buf.EncodeUint8(uint8(m.Mode)) + buf.EncodeUint8(uint8(m.Af)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *UrpfUpdate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsInput = buf.DecodeBool() + m.Mode = UrpfMode(buf.DecodeUint8()) + m.Af = ip_types.AddressFamily(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// UrpfUpdateReply defines message 'urpf_update_reply'. +type UrpfUpdateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *UrpfUpdateReply) Reset() { *m = UrpfUpdateReply{} } +func (*UrpfUpdateReply) GetMessageName() string { return "urpf_update_reply" } +func (*UrpfUpdateReply) GetCrcString() string { return "e8d4e804" } +func (*UrpfUpdateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *UrpfUpdateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *UrpfUpdateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *UrpfUpdateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_urpf_binapi_init() } +func file_urpf_binapi_init() { + api.RegisterMessage((*UrpfUpdate)(nil), "urpf_update_2bf8a77c") + api.RegisterMessage((*UrpfUpdateReply)(nil), "urpf_update_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*UrpfUpdate)(nil), + (*UrpfUpdateReply)(nil), + } +} diff --git a/binapi/urpf/urpf_rest.ba.go b/binapi/urpf/urpf_rest.ba.go new file mode 100644 index 0000000..cbe7875 --- /dev/null +++ b/binapi/urpf/urpf_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package urpf + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/urpf_update", func(w http.ResponseWriter, req *http.Request) { + var request = new(UrpfUpdate) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.UrpfUpdate(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/urpf/urpf_rpc.ba.go b/binapi/urpf/urpf_rpc.ba.go new file mode 100644 index 0000000..92441b1 --- /dev/null +++ b/binapi/urpf/urpf_rpc.ba.go @@ -0,0 +1,30 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package urpf + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service urpf. +type RPCService interface { + UrpfUpdate(ctx context.Context, in *UrpfUpdate) (*UrpfUpdateReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) UrpfUpdate(ctx context.Context, in *UrpfUpdate) (*UrpfUpdateReply, error) { + out := new(UrpfUpdateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/vhost_user/vhost_user.ba.go b/binapi/vhost_user/vhost_user.ba.go new file mode 100644 index 0000000..ea3d32b --- /dev/null +++ b/binapi/vhost_user/vhost_user.ba.go @@ -0,0 +1,446 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/vhost_user.api.json + +// Package vhost_user contains generated bindings for API file vhost_user.api. +// +// Contents: +// 8 messages +// +package vhost_user + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + virtio_types "git.fd.io/govpp.git/binapi/virtio_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "vhost_user" + APIVersion = "4.0.1" + VersionCrc = 0x3df14dfe +) + +// CreateVhostUserIf defines message 'create_vhost_user_if'. +type CreateVhostUserIf struct { + IsServer bool `binapi:"bool,name=is_server" json:"is_server,omitempty"` + SockFilename string `binapi:"string[256],name=sock_filename" json:"sock_filename,omitempty"` + Renumber bool `binapi:"bool,name=renumber" json:"renumber,omitempty"` + DisableMrgRxbuf bool `binapi:"bool,name=disable_mrg_rxbuf" json:"disable_mrg_rxbuf,omitempty"` + DisableIndirectDesc bool `binapi:"bool,name=disable_indirect_desc" json:"disable_indirect_desc,omitempty"` + EnableGso bool `binapi:"bool,name=enable_gso" json:"enable_gso,omitempty"` + EnablePacked bool `binapi:"bool,name=enable_packed" json:"enable_packed,omitempty"` + CustomDevInstance uint32 `binapi:"u32,name=custom_dev_instance" json:"custom_dev_instance,omitempty"` + UseCustomMac bool `binapi:"bool,name=use_custom_mac" json:"use_custom_mac,omitempty"` + MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` +} + +func (m *CreateVhostUserIf) Reset() { *m = CreateVhostUserIf{} } +func (*CreateVhostUserIf) GetMessageName() string { return "create_vhost_user_if" } +func (*CreateVhostUserIf) GetCrcString() string { return "c785c6fc" } +func (*CreateVhostUserIf) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CreateVhostUserIf) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsServer + size += 256 // m.SockFilename + size += 1 // m.Renumber + size += 1 // m.DisableMrgRxbuf + size += 1 // m.DisableIndirectDesc + size += 1 // m.EnableGso + size += 1 // m.EnablePacked + size += 4 // m.CustomDevInstance + size += 1 // m.UseCustomMac + size += 1 * 6 // m.MacAddress + size += 64 // m.Tag + return size +} +func (m *CreateVhostUserIf) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsServer) + buf.EncodeString(m.SockFilename, 256) + buf.EncodeBool(m.Renumber) + buf.EncodeBool(m.DisableMrgRxbuf) + buf.EncodeBool(m.DisableIndirectDesc) + buf.EncodeBool(m.EnableGso) + buf.EncodeBool(m.EnablePacked) + buf.EncodeUint32(uint32(m.CustomDevInstance)) + buf.EncodeBool(m.UseCustomMac) + buf.EncodeBytes(m.MacAddress[:], 6) + buf.EncodeString(m.Tag, 64) + return buf.Bytes(), nil +} +func (m *CreateVhostUserIf) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsServer = buf.DecodeBool() + m.SockFilename = buf.DecodeString(256) + m.Renumber = buf.DecodeBool() + m.DisableMrgRxbuf = buf.DecodeBool() + m.DisableIndirectDesc = buf.DecodeBool() + m.EnableGso = buf.DecodeBool() + m.EnablePacked = buf.DecodeBool() + m.CustomDevInstance = buf.DecodeUint32() + m.UseCustomMac = buf.DecodeBool() + copy(m.MacAddress[:], buf.DecodeBytes(6)) + m.Tag = buf.DecodeString(64) + return nil +} + +// CreateVhostUserIfReply defines message 'create_vhost_user_if_reply'. +type CreateVhostUserIfReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *CreateVhostUserIfReply) Reset() { *m = CreateVhostUserIfReply{} } +func (*CreateVhostUserIfReply) GetMessageName() string { return "create_vhost_user_if_reply" } +func (*CreateVhostUserIfReply) GetCrcString() string { return "5383d31f" } +func (*CreateVhostUserIfReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CreateVhostUserIfReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *CreateVhostUserIfReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *CreateVhostUserIfReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// DeleteVhostUserIf defines message 'delete_vhost_user_if'. +type DeleteVhostUserIf struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *DeleteVhostUserIf) Reset() { *m = DeleteVhostUserIf{} } +func (*DeleteVhostUserIf) GetMessageName() string { return "delete_vhost_user_if" } +func (*DeleteVhostUserIf) GetCrcString() string { return "f9e6675e" } +func (*DeleteVhostUserIf) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DeleteVhostUserIf) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *DeleteVhostUserIf) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *DeleteVhostUserIf) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// DeleteVhostUserIfReply defines message 'delete_vhost_user_if_reply'. +type DeleteVhostUserIfReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DeleteVhostUserIfReply) Reset() { *m = DeleteVhostUserIfReply{} } +func (*DeleteVhostUserIfReply) GetMessageName() string { return "delete_vhost_user_if_reply" } +func (*DeleteVhostUserIfReply) GetCrcString() string { return "e8d4e804" } +func (*DeleteVhostUserIfReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DeleteVhostUserIfReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DeleteVhostUserIfReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DeleteVhostUserIfReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// ModifyVhostUserIf defines message 'modify_vhost_user_if'. +type ModifyVhostUserIf struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsServer bool `binapi:"bool,name=is_server" json:"is_server,omitempty"` + SockFilename string `binapi:"string[256],name=sock_filename" json:"sock_filename,omitempty"` + Renumber bool `binapi:"bool,name=renumber" json:"renumber,omitempty"` + EnableGso bool `binapi:"bool,name=enable_gso" json:"enable_gso,omitempty"` + EnablePacked bool `binapi:"bool,name=enable_packed" json:"enable_packed,omitempty"` + CustomDevInstance uint32 `binapi:"u32,name=custom_dev_instance" json:"custom_dev_instance,omitempty"` +} + +func (m *ModifyVhostUserIf) Reset() { *m = ModifyVhostUserIf{} } +func (*ModifyVhostUserIf) GetMessageName() string { return "modify_vhost_user_if" } +func (*ModifyVhostUserIf) GetCrcString() string { return "0e71d40b" } +func (*ModifyVhostUserIf) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ModifyVhostUserIf) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.IsServer + size += 256 // m.SockFilename + size += 1 // m.Renumber + size += 1 // m.EnableGso + size += 1 // m.EnablePacked + size += 4 // m.CustomDevInstance + return size +} +func (m *ModifyVhostUserIf) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsServer) + buf.EncodeString(m.SockFilename, 256) + buf.EncodeBool(m.Renumber) + buf.EncodeBool(m.EnableGso) + buf.EncodeBool(m.EnablePacked) + buf.EncodeUint32(uint32(m.CustomDevInstance)) + return buf.Bytes(), nil +} +func (m *ModifyVhostUserIf) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsServer = buf.DecodeBool() + m.SockFilename = buf.DecodeString(256) + m.Renumber = buf.DecodeBool() + m.EnableGso = buf.DecodeBool() + m.EnablePacked = buf.DecodeBool() + m.CustomDevInstance = buf.DecodeUint32() + return nil +} + +// ModifyVhostUserIfReply defines message 'modify_vhost_user_if_reply'. +type ModifyVhostUserIfReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ModifyVhostUserIfReply) Reset() { *m = ModifyVhostUserIfReply{} } +func (*ModifyVhostUserIfReply) GetMessageName() string { return "modify_vhost_user_if_reply" } +func (*ModifyVhostUserIfReply) GetCrcString() string { return "e8d4e804" } +func (*ModifyVhostUserIfReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ModifyVhostUserIfReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ModifyVhostUserIfReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ModifyVhostUserIfReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceVhostUserDetails defines message 'sw_interface_vhost_user_details'. +type SwInterfaceVhostUserDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + InterfaceName string `binapi:"string[64],name=interface_name" json:"interface_name,omitempty"` + VirtioNetHdrSz uint32 `binapi:"u32,name=virtio_net_hdr_sz" json:"virtio_net_hdr_sz,omitempty"` + FeaturesFirst32 virtio_types.VirtioNetFeaturesFirst32 `binapi:"virtio_net_features_first_32,name=features_first_32" json:"features_first_32,omitempty"` + FeaturesLast32 virtio_types.VirtioNetFeaturesLast32 `binapi:"virtio_net_features_last_32,name=features_last_32" json:"features_last_32,omitempty"` + IsServer bool `binapi:"bool,name=is_server" json:"is_server,omitempty"` + SockFilename string `binapi:"string[256],name=sock_filename" json:"sock_filename,omitempty"` + NumRegions uint32 `binapi:"u32,name=num_regions" json:"num_regions,omitempty"` + SockErrno int32 `binapi:"i32,name=sock_errno" json:"sock_errno,omitempty"` +} + +func (m *SwInterfaceVhostUserDetails) Reset() { *m = SwInterfaceVhostUserDetails{} } +func (*SwInterfaceVhostUserDetails) GetMessageName() string { return "sw_interface_vhost_user_details" } +func (*SwInterfaceVhostUserDetails) GetCrcString() string { return "98530df1" } +func (*SwInterfaceVhostUserDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceVhostUserDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 64 // m.InterfaceName + size += 4 // m.VirtioNetHdrSz + size += 4 // m.FeaturesFirst32 + size += 4 // m.FeaturesLast32 + size += 1 // m.IsServer + size += 256 // m.SockFilename + size += 4 // m.NumRegions + size += 4 // m.SockErrno + return size +} +func (m *SwInterfaceVhostUserDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeString(m.InterfaceName, 64) + buf.EncodeUint32(uint32(m.VirtioNetHdrSz)) + buf.EncodeUint32(uint32(m.FeaturesFirst32)) + buf.EncodeUint32(uint32(m.FeaturesLast32)) + buf.EncodeBool(m.IsServer) + buf.EncodeString(m.SockFilename, 256) + buf.EncodeUint32(uint32(m.NumRegions)) + buf.EncodeUint32(uint32(m.SockErrno)) + return buf.Bytes(), nil +} +func (m *SwInterfaceVhostUserDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.InterfaceName = buf.DecodeString(64) + m.VirtioNetHdrSz = buf.DecodeUint32() + m.FeaturesFirst32 = virtio_types.VirtioNetFeaturesFirst32(buf.DecodeUint32()) + m.FeaturesLast32 = virtio_types.VirtioNetFeaturesLast32(buf.DecodeUint32()) + m.IsServer = buf.DecodeBool() + m.SockFilename = buf.DecodeString(256) + m.NumRegions = buf.DecodeUint32() + m.SockErrno = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceVhostUserDump defines message 'sw_interface_vhost_user_dump'. +type SwInterfaceVhostUserDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"` +} + +func (m *SwInterfaceVhostUserDump) Reset() { *m = SwInterfaceVhostUserDump{} } +func (*SwInterfaceVhostUserDump) GetMessageName() string { return "sw_interface_vhost_user_dump" } +func (*SwInterfaceVhostUserDump) GetCrcString() string { return "f9e6675e" } +func (*SwInterfaceVhostUserDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceVhostUserDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *SwInterfaceVhostUserDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *SwInterfaceVhostUserDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +func init() { file_vhost_user_binapi_init() } +func file_vhost_user_binapi_init() { + api.RegisterMessage((*CreateVhostUserIf)(nil), "create_vhost_user_if_c785c6fc") + api.RegisterMessage((*CreateVhostUserIfReply)(nil), "create_vhost_user_if_reply_5383d31f") + api.RegisterMessage((*DeleteVhostUserIf)(nil), "delete_vhost_user_if_f9e6675e") + api.RegisterMessage((*DeleteVhostUserIfReply)(nil), "delete_vhost_user_if_reply_e8d4e804") + api.RegisterMessage((*ModifyVhostUserIf)(nil), "modify_vhost_user_if_0e71d40b") + api.RegisterMessage((*ModifyVhostUserIfReply)(nil), "modify_vhost_user_if_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceVhostUserDetails)(nil), "sw_interface_vhost_user_details_98530df1") + api.RegisterMessage((*SwInterfaceVhostUserDump)(nil), "sw_interface_vhost_user_dump_f9e6675e") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*CreateVhostUserIf)(nil), + (*CreateVhostUserIfReply)(nil), + (*DeleteVhostUserIf)(nil), + (*DeleteVhostUserIfReply)(nil), + (*ModifyVhostUserIf)(nil), + (*ModifyVhostUserIfReply)(nil), + (*SwInterfaceVhostUserDetails)(nil), + (*SwInterfaceVhostUserDump)(nil), + } +} diff --git a/binapi/vhost_user/vhost_user_rest.ba.go b/binapi/vhost_user/vhost_user_rest.ba.go new file mode 100644 index 0000000..c2f687b --- /dev/null +++ b/binapi/vhost_user/vhost_user_rest.ba.go @@ -0,0 +1,83 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package vhost_user + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/create_vhost_user_if", func(w http.ResponseWriter, req *http.Request) { + var request = new(CreateVhostUserIf) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.CreateVhostUserIf(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/delete_vhost_user_if", func(w http.ResponseWriter, req *http.Request) { + var request = new(DeleteVhostUserIf) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DeleteVhostUserIf(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/modify_vhost_user_if", func(w http.ResponseWriter, req *http.Request) { + var request = new(ModifyVhostUserIf) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ModifyVhostUserIf(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/vhost_user/vhost_user_rpc.ba.go b/binapi/vhost_user/vhost_user_rpc.ba.go new file mode 100644 index 0000000..091ed53 --- /dev/null +++ b/binapi/vhost_user/vhost_user_rpc.ba.go @@ -0,0 +1,93 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package vhost_user + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service vhost_user. +type RPCService interface { + CreateVhostUserIf(ctx context.Context, in *CreateVhostUserIf) (*CreateVhostUserIfReply, error) + DeleteVhostUserIf(ctx context.Context, in *DeleteVhostUserIf) (*DeleteVhostUserIfReply, error) + ModifyVhostUserIf(ctx context.Context, in *ModifyVhostUserIf) (*ModifyVhostUserIfReply, error) + SwInterfaceVhostUserDump(ctx context.Context, in *SwInterfaceVhostUserDump) (RPCService_SwInterfaceVhostUserDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) CreateVhostUserIf(ctx context.Context, in *CreateVhostUserIf) (*CreateVhostUserIfReply, error) { + out := new(CreateVhostUserIfReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DeleteVhostUserIf(ctx context.Context, in *DeleteVhostUserIf) (*DeleteVhostUserIfReply, error) { + out := new(DeleteVhostUserIfReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ModifyVhostUserIf(ctx context.Context, in *ModifyVhostUserIf) (*ModifyVhostUserIfReply, error) { + out := new(ModifyVhostUserIfReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceVhostUserDump(ctx context.Context, in *SwInterfaceVhostUserDump) (RPCService_SwInterfaceVhostUserDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SwInterfaceVhostUserDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_SwInterfaceVhostUserDumpClient interface { + Recv() (*SwInterfaceVhostUserDetails, error) + api.Stream +} + +type serviceClient_SwInterfaceVhostUserDumpClient struct { + api.Stream +} + +func (c *serviceClient_SwInterfaceVhostUserDumpClient) Recv() (*SwInterfaceVhostUserDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SwInterfaceVhostUserDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/virtio/virtio.ba.go b/binapi/virtio/virtio.ba.go new file mode 100644 index 0000000..467cc0f --- /dev/null +++ b/binapi/virtio/virtio.ba.go @@ -0,0 +1,326 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/virtio.api.json + +// Package virtio contains generated bindings for API file virtio.api. +// +// Contents: +// 6 messages +// +package virtio + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + pci_types "git.fd.io/govpp.git/binapi/pci_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "virtio" + APIVersion = "2.0.0" + VersionCrc = 0x601b1fdc +) + +// SwInterfaceVirtioPciDetails defines message 'sw_interface_virtio_pci_details'. +type SwInterfaceVirtioPciDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + PciAddr pci_types.PciAddress `binapi:"pci_address,name=pci_addr" json:"pci_addr,omitempty"` + MacAddr ethernet_types.MacAddress `binapi:"mac_address,name=mac_addr" json:"mac_addr,omitempty"` + TxRingSz uint16 `binapi:"u16,name=tx_ring_sz" json:"tx_ring_sz,omitempty"` + RxRingSz uint16 `binapi:"u16,name=rx_ring_sz" json:"rx_ring_sz,omitempty"` + Features uint64 `binapi:"u64,name=features" json:"features,omitempty"` +} + +func (m *SwInterfaceVirtioPciDetails) Reset() { *m = SwInterfaceVirtioPciDetails{} } +func (*SwInterfaceVirtioPciDetails) GetMessageName() string { return "sw_interface_virtio_pci_details" } +func (*SwInterfaceVirtioPciDetails) GetCrcString() string { return "16187f3a" } +func (*SwInterfaceVirtioPciDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceVirtioPciDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 2 // m.PciAddr.Domain + size += 1 // m.PciAddr.Bus + size += 1 // m.PciAddr.Slot + size += 1 // m.PciAddr.Function + size += 1 * 6 // m.MacAddr + size += 2 // m.TxRingSz + size += 2 // m.RxRingSz + size += 8 // m.Features + return size +} +func (m *SwInterfaceVirtioPciDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint16(uint16(m.PciAddr.Domain)) + buf.EncodeUint8(uint8(m.PciAddr.Bus)) + buf.EncodeUint8(uint8(m.PciAddr.Slot)) + buf.EncodeUint8(uint8(m.PciAddr.Function)) + buf.EncodeBytes(m.MacAddr[:], 6) + buf.EncodeUint16(uint16(m.TxRingSz)) + buf.EncodeUint16(uint16(m.RxRingSz)) + buf.EncodeUint64(uint64(m.Features)) + return buf.Bytes(), nil +} +func (m *SwInterfaceVirtioPciDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.PciAddr.Domain = buf.DecodeUint16() + m.PciAddr.Bus = buf.DecodeUint8() + m.PciAddr.Slot = buf.DecodeUint8() + m.PciAddr.Function = buf.DecodeUint8() + copy(m.MacAddr[:], buf.DecodeBytes(6)) + m.TxRingSz = buf.DecodeUint16() + m.RxRingSz = buf.DecodeUint16() + m.Features = buf.DecodeUint64() + return nil +} + +// SwInterfaceVirtioPciDump defines message 'sw_interface_virtio_pci_dump'. +type SwInterfaceVirtioPciDump struct{} + +func (m *SwInterfaceVirtioPciDump) Reset() { *m = SwInterfaceVirtioPciDump{} } +func (*SwInterfaceVirtioPciDump) GetMessageName() string { return "sw_interface_virtio_pci_dump" } +func (*SwInterfaceVirtioPciDump) GetCrcString() string { return "51077d14" } +func (*SwInterfaceVirtioPciDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceVirtioPciDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SwInterfaceVirtioPciDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *SwInterfaceVirtioPciDump) Unmarshal(b []byte) error { + return nil +} + +// VirtioPciCreate defines message 'virtio_pci_create'. +type VirtioPciCreate struct { + PciAddr pci_types.PciAddress `binapi:"pci_address,name=pci_addr" json:"pci_addr,omitempty"` + UseRandomMac bool `binapi:"bool,name=use_random_mac" json:"use_random_mac,omitempty"` + MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` + GsoEnabled bool `binapi:"bool,name=gso_enabled" json:"gso_enabled,omitempty"` + ChecksumOffloadEnabled bool `binapi:"bool,name=checksum_offload_enabled" json:"checksum_offload_enabled,omitempty"` + Features uint64 `binapi:"u64,name=features" json:"features,omitempty"` +} + +func (m *VirtioPciCreate) Reset() { *m = VirtioPciCreate{} } +func (*VirtioPciCreate) GetMessageName() string { return "virtio_pci_create" } +func (*VirtioPciCreate) GetCrcString() string { return "a9f1370c" } +func (*VirtioPciCreate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VirtioPciCreate) Size() int { + if m == nil { + return 0 + } + var size int + size += 2 // m.PciAddr.Domain + size += 1 // m.PciAddr.Bus + size += 1 // m.PciAddr.Slot + size += 1 // m.PciAddr.Function + size += 1 // m.UseRandomMac + size += 1 * 6 // m.MacAddress + size += 1 // m.GsoEnabled + size += 1 // m.ChecksumOffloadEnabled + size += 8 // m.Features + return size +} +func (m *VirtioPciCreate) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint16(uint16(m.PciAddr.Domain)) + buf.EncodeUint8(uint8(m.PciAddr.Bus)) + buf.EncodeUint8(uint8(m.PciAddr.Slot)) + buf.EncodeUint8(uint8(m.PciAddr.Function)) + buf.EncodeBool(m.UseRandomMac) + buf.EncodeBytes(m.MacAddress[:], 6) + buf.EncodeBool(m.GsoEnabled) + buf.EncodeBool(m.ChecksumOffloadEnabled) + buf.EncodeUint64(uint64(m.Features)) + return buf.Bytes(), nil +} +func (m *VirtioPciCreate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PciAddr.Domain = buf.DecodeUint16() + m.PciAddr.Bus = buf.DecodeUint8() + m.PciAddr.Slot = buf.DecodeUint8() + m.PciAddr.Function = buf.DecodeUint8() + m.UseRandomMac = buf.DecodeBool() + copy(m.MacAddress[:], buf.DecodeBytes(6)) + m.GsoEnabled = buf.DecodeBool() + m.ChecksumOffloadEnabled = buf.DecodeBool() + m.Features = buf.DecodeUint64() + return nil +} + +// VirtioPciCreateReply defines message 'virtio_pci_create_reply'. +type VirtioPciCreateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *VirtioPciCreateReply) Reset() { *m = VirtioPciCreateReply{} } +func (*VirtioPciCreateReply) GetMessageName() string { return "virtio_pci_create_reply" } +func (*VirtioPciCreateReply) GetCrcString() string { return "5383d31f" } +func (*VirtioPciCreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VirtioPciCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *VirtioPciCreateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *VirtioPciCreateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// VirtioPciDelete defines message 'virtio_pci_delete'. +type VirtioPciDelete struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *VirtioPciDelete) Reset() { *m = VirtioPciDelete{} } +func (*VirtioPciDelete) GetMessageName() string { return "virtio_pci_delete" } +func (*VirtioPciDelete) GetCrcString() string { return "f9e6675e" } +func (*VirtioPciDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VirtioPciDelete) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *VirtioPciDelete) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *VirtioPciDelete) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// VirtioPciDeleteReply defines message 'virtio_pci_delete_reply'. +type VirtioPciDeleteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *VirtioPciDeleteReply) Reset() { *m = VirtioPciDeleteReply{} } +func (*VirtioPciDeleteReply) GetMessageName() string { return "virtio_pci_delete_reply" } +func (*VirtioPciDeleteReply) GetCrcString() string { return "e8d4e804" } +func (*VirtioPciDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VirtioPciDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *VirtioPciDeleteReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *VirtioPciDeleteReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_virtio_binapi_init() } +func file_virtio_binapi_init() { + api.RegisterMessage((*SwInterfaceVirtioPciDetails)(nil), "sw_interface_virtio_pci_details_16187f3a") + api.RegisterMessage((*SwInterfaceVirtioPciDump)(nil), "sw_interface_virtio_pci_dump_51077d14") + api.RegisterMessage((*VirtioPciCreate)(nil), "virtio_pci_create_a9f1370c") + api.RegisterMessage((*VirtioPciCreateReply)(nil), "virtio_pci_create_reply_5383d31f") + api.RegisterMessage((*VirtioPciDelete)(nil), "virtio_pci_delete_f9e6675e") + api.RegisterMessage((*VirtioPciDeleteReply)(nil), "virtio_pci_delete_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SwInterfaceVirtioPciDetails)(nil), + (*SwInterfaceVirtioPciDump)(nil), + (*VirtioPciCreate)(nil), + (*VirtioPciCreateReply)(nil), + (*VirtioPciDelete)(nil), + (*VirtioPciDeleteReply)(nil), + } +} diff --git a/binapi/virtio/virtio_rest.ba.go b/binapi/virtio/virtio_rest.ba.go new file mode 100644 index 0000000..bd97059 --- /dev/null +++ b/binapi/virtio/virtio_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package virtio + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/virtio_pci_create", func(w http.ResponseWriter, req *http.Request) { + var request = new(VirtioPciCreate) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.VirtioPciCreate(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/virtio_pci_delete", func(w http.ResponseWriter, req *http.Request) { + var request = new(VirtioPciDelete) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.VirtioPciDelete(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/virtio/virtio_rpc.ba.go b/binapi/virtio/virtio_rpc.ba.go new file mode 100644 index 0000000..785a460 --- /dev/null +++ b/binapi/virtio/virtio_rpc.ba.go @@ -0,0 +1,83 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package virtio + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service virtio. +type RPCService interface { + SwInterfaceVirtioPciDump(ctx context.Context, in *SwInterfaceVirtioPciDump) (RPCService_SwInterfaceVirtioPciDumpClient, error) + VirtioPciCreate(ctx context.Context, in *VirtioPciCreate) (*VirtioPciCreateReply, error) + VirtioPciDelete(ctx context.Context, in *VirtioPciDelete) (*VirtioPciDeleteReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) SwInterfaceVirtioPciDump(ctx context.Context, in *SwInterfaceVirtioPciDump) (RPCService_SwInterfaceVirtioPciDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SwInterfaceVirtioPciDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_SwInterfaceVirtioPciDumpClient interface { + Recv() (*SwInterfaceVirtioPciDetails, error) + api.Stream +} + +type serviceClient_SwInterfaceVirtioPciDumpClient struct { + api.Stream +} + +func (c *serviceClient_SwInterfaceVirtioPciDumpClient) Recv() (*SwInterfaceVirtioPciDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SwInterfaceVirtioPciDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) VirtioPciCreate(ctx context.Context, in *VirtioPciCreate) (*VirtioPciCreateReply, error) { + out := new(VirtioPciCreateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VirtioPciDelete(ctx context.Context, in *VirtioPciDelete) (*VirtioPciDeleteReply, error) { + out := new(VirtioPciDeleteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/virtio_types/virtio_types.ba.go b/binapi/virtio_types/virtio_types.ba.go new file mode 100644 index 0000000..2b8fa5d --- /dev/null +++ b/binapi/virtio_types/virtio_types.ba.go @@ -0,0 +1,116 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/virtio_types.api.json + +// Package virtio_types contains generated bindings for API file virtio_types.api. +// +// Contents: +// 2 enums +// +package virtio_types + +import ( + api "git.fd.io/govpp.git/api" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +// VirtioNetFeaturesFirst32 defines enum 'virtio_net_features_first_32'. +type VirtioNetFeaturesFirst32 uint32 + +const ( + VIRTIO_NET_F_API_CSUM VirtioNetFeaturesFirst32 = 1 + VIRTIO_NET_F_API_GUEST_CSUM VirtioNetFeaturesFirst32 = 2 + VIRTIO_NET_F_API_GUEST_TSO4 VirtioNetFeaturesFirst32 = 128 + VIRTIO_NET_F_API_GUEST_TSO6 VirtioNetFeaturesFirst32 = 256 + VIRTIO_NET_F_API_GUEST_UFO VirtioNetFeaturesFirst32 = 1024 + VIRTIO_NET_F_API_HOST_TSO4 VirtioNetFeaturesFirst32 = 2048 + VIRTIO_NET_F_API_HOST_TSO6 VirtioNetFeaturesFirst32 = 4096 + VIRTIO_NET_F_API_HOST_UFO VirtioNetFeaturesFirst32 = 16384 + VIRTIO_NET_F_API_MRG_RXBUF VirtioNetFeaturesFirst32 = 32768 + VIRTIO_NET_F_API_CTRL_VQ VirtioNetFeaturesFirst32 = 131072 + VIRTIO_NET_F_API_GUEST_ANNOUNCE VirtioNetFeaturesFirst32 = 2097152 + VIRTIO_NET_F_API_MQ VirtioNetFeaturesFirst32 = 4194304 + VHOST_F_API_LOG_ALL VirtioNetFeaturesFirst32 = 67108864 + VIRTIO_F_API_ANY_LAYOUT VirtioNetFeaturesFirst32 = 134217728 + VIRTIO_F_API_INDIRECT_DESC VirtioNetFeaturesFirst32 = 268435456 + VHOST_USER_F_API_PROTOCOL_FEATURES VirtioNetFeaturesFirst32 = 1073741824 +) + +var ( + VirtioNetFeaturesFirst32_name = map[uint32]string{ + 1: "VIRTIO_NET_F_API_CSUM", + 2: "VIRTIO_NET_F_API_GUEST_CSUM", + 128: "VIRTIO_NET_F_API_GUEST_TSO4", + 256: "VIRTIO_NET_F_API_GUEST_TSO6", + 1024: "VIRTIO_NET_F_API_GUEST_UFO", + 2048: "VIRTIO_NET_F_API_HOST_TSO4", + 4096: "VIRTIO_NET_F_API_HOST_TSO6", + 16384: "VIRTIO_NET_F_API_HOST_UFO", + 32768: "VIRTIO_NET_F_API_MRG_RXBUF", + 131072: "VIRTIO_NET_F_API_CTRL_VQ", + 2097152: "VIRTIO_NET_F_API_GUEST_ANNOUNCE", + 4194304: "VIRTIO_NET_F_API_MQ", + 67108864: "VHOST_F_API_LOG_ALL", + 134217728: "VIRTIO_F_API_ANY_LAYOUT", + 268435456: "VIRTIO_F_API_INDIRECT_DESC", + 1073741824: "VHOST_USER_F_API_PROTOCOL_FEATURES", + } + VirtioNetFeaturesFirst32_value = map[string]uint32{ + "VIRTIO_NET_F_API_CSUM": 1, + "VIRTIO_NET_F_API_GUEST_CSUM": 2, + "VIRTIO_NET_F_API_GUEST_TSO4": 128, + "VIRTIO_NET_F_API_GUEST_TSO6": 256, + "VIRTIO_NET_F_API_GUEST_UFO": 1024, + "VIRTIO_NET_F_API_HOST_TSO4": 2048, + "VIRTIO_NET_F_API_HOST_TSO6": 4096, + "VIRTIO_NET_F_API_HOST_UFO": 16384, + "VIRTIO_NET_F_API_MRG_RXBUF": 32768, + "VIRTIO_NET_F_API_CTRL_VQ": 131072, + "VIRTIO_NET_F_API_GUEST_ANNOUNCE": 2097152, + "VIRTIO_NET_F_API_MQ": 4194304, + "VHOST_F_API_LOG_ALL": 67108864, + "VIRTIO_F_API_ANY_LAYOUT": 134217728, + "VIRTIO_F_API_INDIRECT_DESC": 268435456, + "VHOST_USER_F_API_PROTOCOL_FEATURES": 1073741824, + } +) + +func (x VirtioNetFeaturesFirst32) String() string { + s, ok := VirtioNetFeaturesFirst32_name[uint32(x)] + if ok { + return s + } + return "VirtioNetFeaturesFirst32(" + strconv.Itoa(int(x)) + ")" +} + +// VirtioNetFeaturesLast32 defines enum 'virtio_net_features_last_32'. +type VirtioNetFeaturesLast32 uint32 + +const ( + VIRTIO_F_API_VERSION_1 VirtioNetFeaturesLast32 = 1 +) + +var ( + VirtioNetFeaturesLast32_name = map[uint32]string{ + 1: "VIRTIO_F_API_VERSION_1", + } + VirtioNetFeaturesLast32_value = map[string]uint32{ + "VIRTIO_F_API_VERSION_1": 1, + } +) + +func (x VirtioNetFeaturesLast32) String() string { + s, ok := VirtioNetFeaturesLast32_name[uint32(x)] + if ok { + return s + } + return "VirtioNetFeaturesLast32(" + strconv.Itoa(int(x)) + ")" +} diff --git a/binapi/vmxnet3/vmxnet3.ba.go b/binapi/vmxnet3/vmxnet3.ba.go new file mode 100644 index 0000000..b975448 --- /dev/null +++ b/binapi/vmxnet3/vmxnet3.ba.go @@ -0,0 +1,427 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/vmxnet3.api.json + +// Package vmxnet3 contains generated bindings for API file vmxnet3.api. +// +// Contents: +// 2 structs +// 6 messages +// +package vmxnet3 + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "vmxnet3" + APIVersion = "1.1.0" + VersionCrc = 0x38928311 +) + +// Vmxnet3RxList defines type 'vmxnet3_rx_list'. +type Vmxnet3RxList struct { + RxQsize uint16 `binapi:"u16,name=rx_qsize" json:"rx_qsize,omitempty"` + RxFill []uint16 `binapi:"u16[2],name=rx_fill" json:"rx_fill,omitempty"` + RxNext uint16 `binapi:"u16,name=rx_next" json:"rx_next,omitempty"` + RxProduce []uint16 `binapi:"u16[2],name=rx_produce" json:"rx_produce,omitempty"` + RxConsume []uint16 `binapi:"u16[2],name=rx_consume" json:"rx_consume,omitempty"` +} + +// Vmxnet3TxList defines type 'vmxnet3_tx_list'. +type Vmxnet3TxList struct { + TxQsize uint16 `binapi:"u16,name=tx_qsize" json:"tx_qsize,omitempty"` + TxNext uint16 `binapi:"u16,name=tx_next" json:"tx_next,omitempty"` + TxProduce uint16 `binapi:"u16,name=tx_produce" json:"tx_produce,omitempty"` + TxConsume uint16 `binapi:"u16,name=tx_consume" json:"tx_consume,omitempty"` +} + +// Vmxnet3Create defines message 'vmxnet3_create'. +type Vmxnet3Create struct { + PciAddr uint32 `binapi:"u32,name=pci_addr" json:"pci_addr,omitempty"` + EnableElog int32 `binapi:"i32,name=enable_elog" json:"enable_elog,omitempty"` + RxqSize uint16 `binapi:"u16,name=rxq_size" json:"rxq_size,omitempty"` + RxqNum uint16 `binapi:"u16,name=rxq_num" json:"rxq_num,omitempty"` + TxqSize uint16 `binapi:"u16,name=txq_size" json:"txq_size,omitempty"` + TxqNum uint16 `binapi:"u16,name=txq_num" json:"txq_num,omitempty"` + Bind uint8 `binapi:"u8,name=bind" json:"bind,omitempty"` + EnableGso bool `binapi:"bool,name=enable_gso" json:"enable_gso,omitempty"` +} + +func (m *Vmxnet3Create) Reset() { *m = Vmxnet3Create{} } +func (*Vmxnet3Create) GetMessageName() string { return "vmxnet3_create" } +func (*Vmxnet3Create) GetCrcString() string { return "71a07314" } +func (*Vmxnet3Create) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Vmxnet3Create) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.PciAddr + size += 4 // m.EnableElog + size += 2 // m.RxqSize + size += 2 // m.RxqNum + size += 2 // m.TxqSize + size += 2 // m.TxqNum + size += 1 // m.Bind + size += 1 // m.EnableGso + return size +} +func (m *Vmxnet3Create) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.PciAddr)) + buf.EncodeUint32(uint32(m.EnableElog)) + buf.EncodeUint16(uint16(m.RxqSize)) + buf.EncodeUint16(uint16(m.RxqNum)) + buf.EncodeUint16(uint16(m.TxqSize)) + buf.EncodeUint16(uint16(m.TxqNum)) + buf.EncodeUint8(uint8(m.Bind)) + buf.EncodeBool(m.EnableGso) + return buf.Bytes(), nil +} +func (m *Vmxnet3Create) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PciAddr = buf.DecodeUint32() + m.EnableElog = int32(buf.DecodeUint32()) + m.RxqSize = buf.DecodeUint16() + m.RxqNum = buf.DecodeUint16() + m.TxqSize = buf.DecodeUint16() + m.TxqNum = buf.DecodeUint16() + m.Bind = buf.DecodeUint8() + m.EnableGso = buf.DecodeBool() + return nil +} + +// Vmxnet3CreateReply defines message 'vmxnet3_create_reply'. +type Vmxnet3CreateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Vmxnet3CreateReply) Reset() { *m = Vmxnet3CreateReply{} } +func (*Vmxnet3CreateReply) GetMessageName() string { return "vmxnet3_create_reply" } +func (*Vmxnet3CreateReply) GetCrcString() string { return "5383d31f" } +func (*Vmxnet3CreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Vmxnet3CreateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *Vmxnet3CreateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Vmxnet3CreateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Vmxnet3Delete defines message 'vmxnet3_delete'. +type Vmxnet3Delete struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Vmxnet3Delete) Reset() { *m = Vmxnet3Delete{} } +func (*Vmxnet3Delete) GetMessageName() string { return "vmxnet3_delete" } +func (*Vmxnet3Delete) GetCrcString() string { return "f9e6675e" } +func (*Vmxnet3Delete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Vmxnet3Delete) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *Vmxnet3Delete) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Vmxnet3Delete) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Vmxnet3DeleteReply defines message 'vmxnet3_delete_reply'. +type Vmxnet3DeleteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Vmxnet3DeleteReply) Reset() { *m = Vmxnet3DeleteReply{} } +func (*Vmxnet3DeleteReply) GetMessageName() string { return "vmxnet3_delete_reply" } +func (*Vmxnet3DeleteReply) GetCrcString() string { return "e8d4e804" } +func (*Vmxnet3DeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Vmxnet3DeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Vmxnet3DeleteReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Vmxnet3DeleteReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// Vmxnet3Details defines message 'vmxnet3_details'. +type Vmxnet3Details struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IfName string `binapi:"string[64],name=if_name" json:"if_name,omitempty"` + HwAddr ethernet_types.MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` + PciAddr uint32 `binapi:"u32,name=pci_addr" json:"pci_addr,omitempty"` + Version uint8 `binapi:"u8,name=version" json:"version,omitempty"` + AdminUpDown bool `binapi:"bool,name=admin_up_down" json:"admin_up_down,omitempty"` + RxCount uint8 `binapi:"u8,name=rx_count" json:"rx_count,omitempty"` + RxList [16]Vmxnet3RxList `binapi:"vmxnet3_rx_list[16],name=rx_list" json:"rx_list,omitempty"` + TxCount uint8 `binapi:"u8,name=tx_count" json:"tx_count,omitempty"` + TxList [8]Vmxnet3TxList `binapi:"vmxnet3_tx_list[8],name=tx_list" json:"tx_list,omitempty"` +} + +func (m *Vmxnet3Details) Reset() { *m = Vmxnet3Details{} } +func (*Vmxnet3Details) GetMessageName() string { return "vmxnet3_details" } +func (*Vmxnet3Details) GetCrcString() string { return "829ba055" } +func (*Vmxnet3Details) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Vmxnet3Details) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 64 // m.IfName + size += 1 * 6 // m.HwAddr + size += 4 // m.PciAddr + size += 1 // m.Version + size += 1 // m.AdminUpDown + size += 1 // m.RxCount + for j1 := 0; j1 < 16; j1++ { + var s1 Vmxnet3RxList + _ = s1 + if j1 < len(m.RxList) { + s1 = m.RxList[j1] + } + size += 2 // s1.RxQsize + size += 2 * 2 // s1.RxFill + size += 2 // s1.RxNext + size += 2 * 2 // s1.RxProduce + size += 2 * 2 // s1.RxConsume + } + size += 1 // m.TxCount + for j1 := 0; j1 < 8; j1++ { + var s1 Vmxnet3TxList + _ = s1 + if j1 < len(m.TxList) { + s1 = m.TxList[j1] + } + size += 2 // s1.TxQsize + size += 2 // s1.TxNext + size += 2 // s1.TxProduce + size += 2 // s1.TxConsume + } + return size +} +func (m *Vmxnet3Details) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeString(m.IfName, 64) + buf.EncodeBytes(m.HwAddr[:], 6) + buf.EncodeUint32(uint32(m.PciAddr)) + buf.EncodeUint8(uint8(m.Version)) + buf.EncodeBool(m.AdminUpDown) + buf.EncodeUint8(uint8(m.RxCount)) + for j0 := 0; j0 < 16; j0++ { + var v0 Vmxnet3RxList + if j0 < len(m.RxList) { + v0 = m.RxList[j0] + } + buf.EncodeUint16(uint16(v0.RxQsize)) + for i := 0; i < 2; i++ { + var x uint16 + if i < len(v0.RxFill) { + x = uint16(v0.RxFill[i]) + } + buf.EncodeUint16(uint16(x)) + } + buf.EncodeUint16(uint16(v0.RxNext)) + for i := 0; i < 2; i++ { + var x uint16 + if i < len(v0.RxProduce) { + x = uint16(v0.RxProduce[i]) + } + buf.EncodeUint16(uint16(x)) + } + for i := 0; i < 2; i++ { + var x uint16 + if i < len(v0.RxConsume) { + x = uint16(v0.RxConsume[i]) + } + buf.EncodeUint16(uint16(x)) + } + } + buf.EncodeUint8(uint8(m.TxCount)) + for j0 := 0; j0 < 8; j0++ { + var v0 Vmxnet3TxList + if j0 < len(m.TxList) { + v0 = m.TxList[j0] + } + buf.EncodeUint16(uint16(v0.TxQsize)) + buf.EncodeUint16(uint16(v0.TxNext)) + buf.EncodeUint16(uint16(v0.TxProduce)) + buf.EncodeUint16(uint16(v0.TxConsume)) + } + return buf.Bytes(), nil +} +func (m *Vmxnet3Details) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IfName = buf.DecodeString(64) + copy(m.HwAddr[:], buf.DecodeBytes(6)) + m.PciAddr = buf.DecodeUint32() + m.Version = buf.DecodeUint8() + m.AdminUpDown = buf.DecodeBool() + m.RxCount = buf.DecodeUint8() + for j0 := 0; j0 < 16; j0++ { + m.RxList[j0].RxQsize = buf.DecodeUint16() + m.RxList[j0].RxFill = make([]uint16, 2) + for i := 0; i < len(m.RxList[j0].RxFill); i++ { + m.RxList[j0].RxFill[i] = buf.DecodeUint16() + } + m.RxList[j0].RxNext = buf.DecodeUint16() + m.RxList[j0].RxProduce = make([]uint16, 2) + for i := 0; i < len(m.RxList[j0].RxProduce); i++ { + m.RxList[j0].RxProduce[i] = buf.DecodeUint16() + } + m.RxList[j0].RxConsume = make([]uint16, 2) + for i := 0; i < len(m.RxList[j0].RxConsume); i++ { + m.RxList[j0].RxConsume[i] = buf.DecodeUint16() + } + } + m.TxCount = buf.DecodeUint8() + for j0 := 0; j0 < 8; j0++ { + m.TxList[j0].TxQsize = buf.DecodeUint16() + m.TxList[j0].TxNext = buf.DecodeUint16() + m.TxList[j0].TxProduce = buf.DecodeUint16() + m.TxList[j0].TxConsume = buf.DecodeUint16() + } + return nil +} + +// Vmxnet3Dump defines message 'vmxnet3_dump'. +type Vmxnet3Dump struct{} + +func (m *Vmxnet3Dump) Reset() { *m = Vmxnet3Dump{} } +func (*Vmxnet3Dump) GetMessageName() string { return "vmxnet3_dump" } +func (*Vmxnet3Dump) GetCrcString() string { return "51077d14" } +func (*Vmxnet3Dump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Vmxnet3Dump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *Vmxnet3Dump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *Vmxnet3Dump) Unmarshal(b []byte) error { + return nil +} + +func init() { file_vmxnet3_binapi_init() } +func file_vmxnet3_binapi_init() { + api.RegisterMessage((*Vmxnet3Create)(nil), "vmxnet3_create_71a07314") + api.RegisterMessage((*Vmxnet3CreateReply)(nil), "vmxnet3_create_reply_5383d31f") + api.RegisterMessage((*Vmxnet3Delete)(nil), "vmxnet3_delete_f9e6675e") + api.RegisterMessage((*Vmxnet3DeleteReply)(nil), "vmxnet3_delete_reply_e8d4e804") + api.RegisterMessage((*Vmxnet3Details)(nil), "vmxnet3_details_829ba055") + api.RegisterMessage((*Vmxnet3Dump)(nil), "vmxnet3_dump_51077d14") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*Vmxnet3Create)(nil), + (*Vmxnet3CreateReply)(nil), + (*Vmxnet3Delete)(nil), + (*Vmxnet3DeleteReply)(nil), + (*Vmxnet3Details)(nil), + (*Vmxnet3Dump)(nil), + } +} diff --git a/binapi/vmxnet3/vmxnet3_rest.ba.go b/binapi/vmxnet3/vmxnet3_rest.ba.go new file mode 100644 index 0000000..3280f8c --- /dev/null +++ b/binapi/vmxnet3/vmxnet3_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package vmxnet3 + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/vmxnet3_create", func(w http.ResponseWriter, req *http.Request) { + var request = new(Vmxnet3Create) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Vmxnet3Create(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/vmxnet3_delete", func(w http.ResponseWriter, req *http.Request) { + var request = new(Vmxnet3Delete) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Vmxnet3Delete(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/vmxnet3/vmxnet3_rpc.ba.go b/binapi/vmxnet3/vmxnet3_rpc.ba.go new file mode 100644 index 0000000..cb4020d --- /dev/null +++ b/binapi/vmxnet3/vmxnet3_rpc.ba.go @@ -0,0 +1,83 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package vmxnet3 + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service vmxnet3. +type RPCService interface { + Vmxnet3Create(ctx context.Context, in *Vmxnet3Create) (*Vmxnet3CreateReply, error) + Vmxnet3Delete(ctx context.Context, in *Vmxnet3Delete) (*Vmxnet3DeleteReply, error) + Vmxnet3Dump(ctx context.Context, in *Vmxnet3Dump) (RPCService_Vmxnet3DumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) Vmxnet3Create(ctx context.Context, in *Vmxnet3Create) (*Vmxnet3CreateReply, error) { + out := new(Vmxnet3CreateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Vmxnet3Delete(ctx context.Context, in *Vmxnet3Delete) (*Vmxnet3DeleteReply, error) { + out := new(Vmxnet3DeleteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Vmxnet3Dump(ctx context.Context, in *Vmxnet3Dump) (RPCService_Vmxnet3DumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_Vmxnet3DumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_Vmxnet3DumpClient interface { + Recv() (*Vmxnet3Details, error) + api.Stream +} + +type serviceClient_Vmxnet3DumpClient struct { + api.Stream +} + +func (c *serviceClient_Vmxnet3DumpClient) Recv() (*Vmxnet3Details, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *Vmxnet3Details: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/vpe/vpe.ba.go b/binapi/vpe/vpe.ba.go new file mode 100644 index 0000000..59cdcad --- /dev/null +++ b/binapi/vpe/vpe.ba.go @@ -0,0 +1,1132 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/vpe.api.json + +// Package vpe contains generated bindings for API file vpe.api. +// +// Contents: +// 1 struct +// 26 messages +// +package vpe + +import ( + api "git.fd.io/govpp.git/api" + vpe_types "git.fd.io/govpp.git/binapi/vpe_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "vpe" + APIVersion = "1.6.1" + VersionCrc = 0xbd2c94f4 +) + +// ThreadData defines type 'thread_data'. +type ThreadData struct { + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty"` + Type string `binapi:"string[64],name=type" json:"type,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + CPUID uint32 `binapi:"u32,name=cpu_id" json:"cpu_id,omitempty"` + Core uint32 `binapi:"u32,name=core" json:"core,omitempty"` + CPUSocket uint32 `binapi:"u32,name=cpu_socket" json:"cpu_socket,omitempty"` +} + +// AddNodeNext defines message 'add_node_next'. +type AddNodeNext struct { + NodeName string `binapi:"string[64],name=node_name" json:"node_name,omitempty"` + NextName string `binapi:"string[64],name=next_name" json:"next_name,omitempty"` +} + +func (m *AddNodeNext) Reset() { *m = AddNodeNext{} } +func (*AddNodeNext) GetMessageName() string { return "add_node_next" } +func (*AddNodeNext) GetCrcString() string { return "2457116d" } +func (*AddNodeNext) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AddNodeNext) Size() int { + if m == nil { + return 0 + } + var size int + size += 64 // m.NodeName + size += 64 // m.NextName + return size +} +func (m *AddNodeNext) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.NodeName, 64) + buf.EncodeString(m.NextName, 64) + return buf.Bytes(), nil +} +func (m *AddNodeNext) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.NodeName = buf.DecodeString(64) + m.NextName = buf.DecodeString(64) + return nil +} + +// AddNodeNextReply defines message 'add_node_next_reply'. +type AddNodeNextReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + NextIndex uint32 `binapi:"u32,name=next_index" json:"next_index,omitempty"` +} + +func (m *AddNodeNextReply) Reset() { *m = AddNodeNextReply{} } +func (*AddNodeNextReply) GetMessageName() string { return "add_node_next_reply" } +func (*AddNodeNextReply) GetCrcString() string { return "2ed75f32" } +func (*AddNodeNextReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AddNodeNextReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.NextIndex + return size +} +func (m *AddNodeNextReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.NextIndex)) + return buf.Bytes(), nil +} +func (m *AddNodeNextReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.NextIndex = buf.DecodeUint32() + return nil +} + +// Cli defines message 'cli'. +type Cli struct { + CmdInShmem uint64 `binapi:"u64,name=cmd_in_shmem" json:"cmd_in_shmem,omitempty"` +} + +func (m *Cli) Reset() { *m = Cli{} } +func (*Cli) GetMessageName() string { return "cli" } +func (*Cli) GetCrcString() string { return "23bfbfff" } +func (*Cli) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Cli) Size() int { + if m == nil { + return 0 + } + var size int + size += 8 // m.CmdInShmem + return size +} +func (m *Cli) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint64(uint64(m.CmdInShmem)) + return buf.Bytes(), nil +} +func (m *Cli) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.CmdInShmem = buf.DecodeUint64() + return nil +} + +// CliInband defines message 'cli_inband'. +type CliInband struct { + Cmd string `binapi:"string[],name=cmd" json:"cmd,omitempty"` +} + +func (m *CliInband) Reset() { *m = CliInband{} } +func (*CliInband) GetMessageName() string { return "cli_inband" } +func (*CliInband) GetCrcString() string { return "f8377302" } +func (*CliInband) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CliInband) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 + len(m.Cmd) // m.Cmd + return size +} +func (m *CliInband) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.Cmd, 0) + return buf.Bytes(), nil +} +func (m *CliInband) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Cmd = buf.DecodeString(0) + return nil +} + +// CliInbandReply defines message 'cli_inband_reply'. +type CliInbandReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Reply string `binapi:"string[],name=reply" json:"reply,omitempty"` +} + +func (m *CliInbandReply) Reset() { *m = CliInbandReply{} } +func (*CliInbandReply) GetMessageName() string { return "cli_inband_reply" } +func (*CliInbandReply) GetCrcString() string { return "05879051" } +func (*CliInbandReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CliInbandReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 + len(m.Reply) // m.Reply + return size +} +func (m *CliInbandReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeString(m.Reply, 0) + return buf.Bytes(), nil +} +func (m *CliInbandReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Reply = buf.DecodeString(0) + return nil +} + +// CliReply defines message 'cli_reply'. +type CliReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ReplyInShmem uint64 `binapi:"u64,name=reply_in_shmem" json:"reply_in_shmem,omitempty"` +} + +func (m *CliReply) Reset() { *m = CliReply{} } +func (*CliReply) GetMessageName() string { return "cli_reply" } +func (*CliReply) GetCrcString() string { return "06d68297" } +func (*CliReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CliReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 8 // m.ReplyInShmem + return size +} +func (m *CliReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint64(uint64(m.ReplyInShmem)) + return buf.Bytes(), nil +} +func (m *CliReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.ReplyInShmem = buf.DecodeUint64() + return nil +} + +// ControlPing defines message 'control_ping'. +type ControlPing struct{} + +func (m *ControlPing) Reset() { *m = ControlPing{} } +func (*ControlPing) GetMessageName() string { return "control_ping" } +func (*ControlPing) GetCrcString() string { return "51077d14" } +func (*ControlPing) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ControlPing) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ControlPing) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ControlPing) Unmarshal(b []byte) error { + return nil +} + +// ControlPingReply defines message 'control_ping_reply'. +type ControlPingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ClientIndex uint32 `binapi:"u32,name=client_index" json:"client_index,omitempty"` + VpePID uint32 `binapi:"u32,name=vpe_pid" json:"vpe_pid,omitempty"` +} + +func (m *ControlPingReply) Reset() { *m = ControlPingReply{} } +func (*ControlPingReply) GetMessageName() string { return "control_ping_reply" } +func (*ControlPingReply) GetCrcString() string { return "f6b0b8ca" } +func (*ControlPingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ControlPingReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.ClientIndex + size += 4 // m.VpePID + return size +} +func (m *ControlPingReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.ClientIndex)) + buf.EncodeUint32(uint32(m.VpePID)) + return buf.Bytes(), nil +} +func (m *ControlPingReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.ClientIndex = buf.DecodeUint32() + m.VpePID = buf.DecodeUint32() + return nil +} + +// GetF64EndianValue defines message 'get_f64_endian_value'. +type GetF64EndianValue struct { + F64One float64 `binapi:"f64,name=f64_one,default=%!s(float64=1)" json:"f64_one,omitempty"` +} + +func (m *GetF64EndianValue) Reset() { *m = GetF64EndianValue{} } +func (*GetF64EndianValue) GetMessageName() string { return "get_f64_endian_value" } +func (*GetF64EndianValue) GetCrcString() string { return "809fcd44" } +func (*GetF64EndianValue) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GetF64EndianValue) Size() int { + if m == nil { + return 0 + } + var size int + size += 8 // m.F64One + return size +} +func (m *GetF64EndianValue) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeFloat64(float64(m.F64One)) + return buf.Bytes(), nil +} +func (m *GetF64EndianValue) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.F64One = float64(buf.DecodeFloat64()) + return nil +} + +// GetF64EndianValueReply defines message 'get_f64_endian_value_reply'. +type GetF64EndianValueReply struct { + Retval uint32 `binapi:"u32,name=retval" json:"retval,omitempty"` + F64OneResult float64 `binapi:"f64,name=f64_one_result" json:"f64_one_result,omitempty"` +} + +func (m *GetF64EndianValueReply) Reset() { *m = GetF64EndianValueReply{} } +func (*GetF64EndianValueReply) GetMessageName() string { return "get_f64_endian_value_reply" } +func (*GetF64EndianValueReply) GetCrcString() string { return "7e02e404" } +func (*GetF64EndianValueReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GetF64EndianValueReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 8 // m.F64OneResult + return size +} +func (m *GetF64EndianValueReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeFloat64(float64(m.F64OneResult)) + return buf.Bytes(), nil +} +func (m *GetF64EndianValueReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeUint32() + m.F64OneResult = float64(buf.DecodeFloat64()) + return nil +} + +// GetF64IncrementByOne defines message 'get_f64_increment_by_one'. +type GetF64IncrementByOne struct { + F64Value float64 `binapi:"f64,name=f64_value,default=%!s(float64=1)" json:"f64_value,omitempty"` +} + +func (m *GetF64IncrementByOne) Reset() { *m = GetF64IncrementByOne{} } +func (*GetF64IncrementByOne) GetMessageName() string { return "get_f64_increment_by_one" } +func (*GetF64IncrementByOne) GetCrcString() string { return "b64f027e" } +func (*GetF64IncrementByOne) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GetF64IncrementByOne) Size() int { + if m == nil { + return 0 + } + var size int + size += 8 // m.F64Value + return size +} +func (m *GetF64IncrementByOne) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeFloat64(float64(m.F64Value)) + return buf.Bytes(), nil +} +func (m *GetF64IncrementByOne) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.F64Value = float64(buf.DecodeFloat64()) + return nil +} + +// GetF64IncrementByOneReply defines message 'get_f64_increment_by_one_reply'. +type GetF64IncrementByOneReply struct { + Retval uint32 `binapi:"u32,name=retval" json:"retval,omitempty"` + F64Value float64 `binapi:"f64,name=f64_value" json:"f64_value,omitempty"` +} + +func (m *GetF64IncrementByOneReply) Reset() { *m = GetF64IncrementByOneReply{} } +func (*GetF64IncrementByOneReply) GetMessageName() string { return "get_f64_increment_by_one_reply" } +func (*GetF64IncrementByOneReply) GetCrcString() string { return "d25dbaa3" } +func (*GetF64IncrementByOneReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GetF64IncrementByOneReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 8 // m.F64Value + return size +} +func (m *GetF64IncrementByOneReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeFloat64(float64(m.F64Value)) + return buf.Bytes(), nil +} +func (m *GetF64IncrementByOneReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeUint32() + m.F64Value = float64(buf.DecodeFloat64()) + return nil +} + +// GetNextIndex defines message 'get_next_index'. +type GetNextIndex struct { + NodeName string `binapi:"string[64],name=node_name" json:"node_name,omitempty"` + NextName string `binapi:"string[64],name=next_name" json:"next_name,omitempty"` +} + +func (m *GetNextIndex) Reset() { *m = GetNextIndex{} } +func (*GetNextIndex) GetMessageName() string { return "get_next_index" } +func (*GetNextIndex) GetCrcString() string { return "2457116d" } +func (*GetNextIndex) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GetNextIndex) Size() int { + if m == nil { + return 0 + } + var size int + size += 64 // m.NodeName + size += 64 // m.NextName + return size +} +func (m *GetNextIndex) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.NodeName, 64) + buf.EncodeString(m.NextName, 64) + return buf.Bytes(), nil +} +func (m *GetNextIndex) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.NodeName = buf.DecodeString(64) + m.NextName = buf.DecodeString(64) + return nil +} + +// GetNextIndexReply defines message 'get_next_index_reply'. +type GetNextIndexReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + NextIndex uint32 `binapi:"u32,name=next_index" json:"next_index,omitempty"` +} + +func (m *GetNextIndexReply) Reset() { *m = GetNextIndexReply{} } +func (*GetNextIndexReply) GetMessageName() string { return "get_next_index_reply" } +func (*GetNextIndexReply) GetCrcString() string { return "2ed75f32" } +func (*GetNextIndexReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GetNextIndexReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.NextIndex + return size +} +func (m *GetNextIndexReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.NextIndex)) + return buf.Bytes(), nil +} +func (m *GetNextIndexReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.NextIndex = buf.DecodeUint32() + return nil +} + +// GetNodeGraph defines message 'get_node_graph'. +type GetNodeGraph struct{} + +func (m *GetNodeGraph) Reset() { *m = GetNodeGraph{} } +func (*GetNodeGraph) GetMessageName() string { return "get_node_graph" } +func (*GetNodeGraph) GetCrcString() string { return "51077d14" } +func (*GetNodeGraph) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GetNodeGraph) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *GetNodeGraph) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *GetNodeGraph) Unmarshal(b []byte) error { + return nil +} + +// GetNodeGraphReply defines message 'get_node_graph_reply'. +type GetNodeGraphReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ReplyInShmem uint64 `binapi:"u64,name=reply_in_shmem" json:"reply_in_shmem,omitempty"` +} + +func (m *GetNodeGraphReply) Reset() { *m = GetNodeGraphReply{} } +func (*GetNodeGraphReply) GetMessageName() string { return "get_node_graph_reply" } +func (*GetNodeGraphReply) GetCrcString() string { return "06d68297" } +func (*GetNodeGraphReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GetNodeGraphReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 8 // m.ReplyInShmem + return size +} +func (m *GetNodeGraphReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint64(uint64(m.ReplyInShmem)) + return buf.Bytes(), nil +} +func (m *GetNodeGraphReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.ReplyInShmem = buf.DecodeUint64() + return nil +} + +// GetNodeIndex defines message 'get_node_index'. +type GetNodeIndex struct { + NodeName string `binapi:"string[64],name=node_name" json:"node_name,omitempty"` +} + +func (m *GetNodeIndex) Reset() { *m = GetNodeIndex{} } +func (*GetNodeIndex) GetMessageName() string { return "get_node_index" } +func (*GetNodeIndex) GetCrcString() string { return "f1984c64" } +func (*GetNodeIndex) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GetNodeIndex) Size() int { + if m == nil { + return 0 + } + var size int + size += 64 // m.NodeName + return size +} +func (m *GetNodeIndex) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.NodeName, 64) + return buf.Bytes(), nil +} +func (m *GetNodeIndex) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.NodeName = buf.DecodeString(64) + return nil +} + +// GetNodeIndexReply defines message 'get_node_index_reply'. +type GetNodeIndexReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + NodeIndex uint32 `binapi:"u32,name=node_index" json:"node_index,omitempty"` +} + +func (m *GetNodeIndexReply) Reset() { *m = GetNodeIndexReply{} } +func (*GetNodeIndexReply) GetMessageName() string { return "get_node_index_reply" } +func (*GetNodeIndexReply) GetCrcString() string { return "a8600b89" } +func (*GetNodeIndexReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GetNodeIndexReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.NodeIndex + return size +} +func (m *GetNodeIndexReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.NodeIndex)) + return buf.Bytes(), nil +} +func (m *GetNodeIndexReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.NodeIndex = buf.DecodeUint32() + return nil +} + +// LogDetails defines message 'log_details'. +type LogDetails struct { + Timestamp vpe_types.Timestamp `binapi:"timestamp,name=timestamp" json:"timestamp,omitempty"` + Level vpe_types.LogLevel `binapi:"log_level,name=level" json:"level,omitempty"` + MsgClass string `binapi:"string[32],name=msg_class" json:"msg_class,omitempty"` + Message string `binapi:"string[256],name=message" json:"message,omitempty"` +} + +func (m *LogDetails) Reset() { *m = LogDetails{} } +func (*LogDetails) GetMessageName() string { return "log_details" } +func (*LogDetails) GetCrcString() string { return "255827a1" } +func (*LogDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *LogDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 8 // m.Timestamp + size += 4 // m.Level + size += 32 // m.MsgClass + size += 256 // m.Message + return size +} +func (m *LogDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeFloat64(float64(m.Timestamp)) + buf.EncodeUint32(uint32(m.Level)) + buf.EncodeString(m.MsgClass, 32) + buf.EncodeString(m.Message, 256) + return buf.Bytes(), nil +} +func (m *LogDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Timestamp = vpe_types.Timestamp(buf.DecodeFloat64()) + m.Level = vpe_types.LogLevel(buf.DecodeUint32()) + m.MsgClass = buf.DecodeString(32) + m.Message = buf.DecodeString(256) + return nil +} + +// LogDump defines message 'log_dump'. +type LogDump struct { + StartTimestamp vpe_types.Timestamp `binapi:"timestamp,name=start_timestamp" json:"start_timestamp,omitempty"` +} + +func (m *LogDump) Reset() { *m = LogDump{} } +func (*LogDump) GetMessageName() string { return "log_dump" } +func (*LogDump) GetCrcString() string { return "6ab31753" } +func (*LogDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *LogDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 8 // m.StartTimestamp + return size +} +func (m *LogDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeFloat64(float64(m.StartTimestamp)) + return buf.Bytes(), nil +} +func (m *LogDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.StartTimestamp = vpe_types.Timestamp(buf.DecodeFloat64()) + return nil +} + +// ShowThreads defines message 'show_threads'. +type ShowThreads struct{} + +func (m *ShowThreads) Reset() { *m = ShowThreads{} } +func (*ShowThreads) GetMessageName() string { return "show_threads" } +func (*ShowThreads) GetCrcString() string { return "51077d14" } +func (*ShowThreads) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ShowThreads) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowThreads) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ShowThreads) Unmarshal(b []byte) error { + return nil +} + +// ShowThreadsReply defines message 'show_threads_reply'. +type ShowThreadsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + ThreadData []ThreadData `binapi:"thread_data[count],name=thread_data" json:"thread_data,omitempty"` +} + +func (m *ShowThreadsReply) Reset() { *m = ShowThreadsReply{} } +func (*ShowThreadsReply) GetMessageName() string { return "show_threads_reply" } +func (*ShowThreadsReply) GetCrcString() string { return "efd78e83" } +func (*ShowThreadsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ShowThreadsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.Count + for j1 := 0; j1 < len(m.ThreadData); j1++ { + var s1 ThreadData + _ = s1 + if j1 < len(m.ThreadData) { + s1 = m.ThreadData[j1] + } + size += 4 // s1.ID + size += 64 // s1.Name + size += 64 // s1.Type + size += 4 // s1.PID + size += 4 // s1.CPUID + size += 4 // s1.Core + size += 4 // s1.CPUSocket + } + return size +} +func (m *ShowThreadsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(len(m.ThreadData))) + for j0 := 0; j0 < len(m.ThreadData); j0++ { + var v0 ThreadData + if j0 < len(m.ThreadData) { + v0 = m.ThreadData[j0] + } + buf.EncodeUint32(uint32(v0.ID)) + buf.EncodeString(v0.Name, 64) + buf.EncodeString(v0.Type, 64) + buf.EncodeUint32(uint32(v0.PID)) + buf.EncodeUint32(uint32(v0.CPUID)) + buf.EncodeUint32(uint32(v0.Core)) + buf.EncodeUint32(uint32(v0.CPUSocket)) + } + return buf.Bytes(), nil +} +func (m *ShowThreadsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Count = buf.DecodeUint32() + m.ThreadData = make([]ThreadData, int(m.Count)) + for j0 := 0; j0 < len(m.ThreadData); j0++ { + m.ThreadData[j0].ID = buf.DecodeUint32() + m.ThreadData[j0].Name = buf.DecodeString(64) + m.ThreadData[j0].Type = buf.DecodeString(64) + m.ThreadData[j0].PID = buf.DecodeUint32() + m.ThreadData[j0].CPUID = buf.DecodeUint32() + m.ThreadData[j0].Core = buf.DecodeUint32() + m.ThreadData[j0].CPUSocket = buf.DecodeUint32() + } + return nil +} + +// ShowVersion defines message 'show_version'. +type ShowVersion struct{} + +func (m *ShowVersion) Reset() { *m = ShowVersion{} } +func (*ShowVersion) GetMessageName() string { return "show_version" } +func (*ShowVersion) GetCrcString() string { return "51077d14" } +func (*ShowVersion) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ShowVersion) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowVersion) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ShowVersion) Unmarshal(b []byte) error { + return nil +} + +// ShowVersionReply defines message 'show_version_reply'. +type ShowVersionReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Program string `binapi:"string[32],name=program" json:"program,omitempty"` + Version string `binapi:"string[32],name=version" json:"version,omitempty"` + BuildDate string `binapi:"string[32],name=build_date" json:"build_date,omitempty"` + BuildDirectory string `binapi:"string[256],name=build_directory" json:"build_directory,omitempty"` +} + +func (m *ShowVersionReply) Reset() { *m = ShowVersionReply{} } +func (*ShowVersionReply) GetMessageName() string { return "show_version_reply" } +func (*ShowVersionReply) GetCrcString() string { return "c919bde1" } +func (*ShowVersionReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ShowVersionReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 32 // m.Program + size += 32 // m.Version + size += 32 // m.BuildDate + size += 256 // m.BuildDirectory + return size +} +func (m *ShowVersionReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeString(m.Program, 32) + buf.EncodeString(m.Version, 32) + buf.EncodeString(m.BuildDate, 32) + buf.EncodeString(m.BuildDirectory, 256) + return buf.Bytes(), nil +} +func (m *ShowVersionReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Program = buf.DecodeString(32) + m.Version = buf.DecodeString(32) + m.BuildDate = buf.DecodeString(32) + m.BuildDirectory = buf.DecodeString(256) + return nil +} + +// ShowVpeSystemTime defines message 'show_vpe_system_time'. +type ShowVpeSystemTime struct{} + +func (m *ShowVpeSystemTime) Reset() { *m = ShowVpeSystemTime{} } +func (*ShowVpeSystemTime) GetMessageName() string { return "show_vpe_system_time" } +func (*ShowVpeSystemTime) GetCrcString() string { return "51077d14" } +func (*ShowVpeSystemTime) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ShowVpeSystemTime) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowVpeSystemTime) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ShowVpeSystemTime) Unmarshal(b []byte) error { + return nil +} + +// ShowVpeSystemTimeReply defines message 'show_vpe_system_time_reply'. +type ShowVpeSystemTimeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + VpeSystemTime vpe_types.Timestamp `binapi:"timestamp,name=vpe_system_time" json:"vpe_system_time,omitempty"` +} + +func (m *ShowVpeSystemTimeReply) Reset() { *m = ShowVpeSystemTimeReply{} } +func (*ShowVpeSystemTimeReply) GetMessageName() string { return "show_vpe_system_time_reply" } +func (*ShowVpeSystemTimeReply) GetCrcString() string { return "7ffd8193" } +func (*ShowVpeSystemTimeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ShowVpeSystemTimeReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 8 // m.VpeSystemTime + return size +} +func (m *ShowVpeSystemTimeReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeFloat64(float64(m.VpeSystemTime)) + return buf.Bytes(), nil +} +func (m *ShowVpeSystemTimeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.VpeSystemTime = vpe_types.Timestamp(buf.DecodeFloat64()) + return nil +} + +func init() { file_vpe_binapi_init() } +func file_vpe_binapi_init() { + api.RegisterMessage((*AddNodeNext)(nil), "add_node_next_2457116d") + api.RegisterMessage((*AddNodeNextReply)(nil), "add_node_next_reply_2ed75f32") + api.RegisterMessage((*Cli)(nil), "cli_23bfbfff") + api.RegisterMessage((*CliInband)(nil), "cli_inband_f8377302") + api.RegisterMessage((*CliInbandReply)(nil), "cli_inband_reply_05879051") + api.RegisterMessage((*CliReply)(nil), "cli_reply_06d68297") + api.RegisterMessage((*ControlPing)(nil), "control_ping_51077d14") + api.RegisterMessage((*ControlPingReply)(nil), "control_ping_reply_f6b0b8ca") + api.RegisterMessage((*GetF64EndianValue)(nil), "get_f64_endian_value_809fcd44") + api.RegisterMessage((*GetF64EndianValueReply)(nil), "get_f64_endian_value_reply_7e02e404") + api.RegisterMessage((*GetF64IncrementByOne)(nil), "get_f64_increment_by_one_b64f027e") + api.RegisterMessage((*GetF64IncrementByOneReply)(nil), "get_f64_increment_by_one_reply_d25dbaa3") + api.RegisterMessage((*GetNextIndex)(nil), "get_next_index_2457116d") + api.RegisterMessage((*GetNextIndexReply)(nil), "get_next_index_reply_2ed75f32") + api.RegisterMessage((*GetNodeGraph)(nil), "get_node_graph_51077d14") + api.RegisterMessage((*GetNodeGraphReply)(nil), "get_node_graph_reply_06d68297") + api.RegisterMessage((*GetNodeIndex)(nil), "get_node_index_f1984c64") + api.RegisterMessage((*GetNodeIndexReply)(nil), "get_node_index_reply_a8600b89") + api.RegisterMessage((*LogDetails)(nil), "log_details_255827a1") + api.RegisterMessage((*LogDump)(nil), "log_dump_6ab31753") + api.RegisterMessage((*ShowThreads)(nil), "show_threads_51077d14") + api.RegisterMessage((*ShowThreadsReply)(nil), "show_threads_reply_efd78e83") + api.RegisterMessage((*ShowVersion)(nil), "show_version_51077d14") + api.RegisterMessage((*ShowVersionReply)(nil), "show_version_reply_c919bde1") + api.RegisterMessage((*ShowVpeSystemTime)(nil), "show_vpe_system_time_51077d14") + api.RegisterMessage((*ShowVpeSystemTimeReply)(nil), "show_vpe_system_time_reply_7ffd8193") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AddNodeNext)(nil), + (*AddNodeNextReply)(nil), + (*Cli)(nil), + (*CliInband)(nil), + (*CliInbandReply)(nil), + (*CliReply)(nil), + (*ControlPing)(nil), + (*ControlPingReply)(nil), + (*GetF64EndianValue)(nil), + (*GetF64EndianValueReply)(nil), + (*GetF64IncrementByOne)(nil), + (*GetF64IncrementByOneReply)(nil), + (*GetNextIndex)(nil), + (*GetNextIndexReply)(nil), + (*GetNodeGraph)(nil), + (*GetNodeGraphReply)(nil), + (*GetNodeIndex)(nil), + (*GetNodeIndexReply)(nil), + (*LogDetails)(nil), + (*LogDump)(nil), + (*ShowThreads)(nil), + (*ShowThreadsReply)(nil), + (*ShowVersion)(nil), + (*ShowVersionReply)(nil), + (*ShowVpeSystemTime)(nil), + (*ShowVpeSystemTimeReply)(nil), + } +} diff --git a/binapi/vpe/vpe_rest.ba.go b/binapi/vpe/vpe_rest.ba.go new file mode 100644 index 0000000..2f92a62 --- /dev/null +++ b/binapi/vpe/vpe_rest.ba.go @@ -0,0 +1,245 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package vpe + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/add_node_next", func(w http.ResponseWriter, req *http.Request) { + var request = new(AddNodeNext) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.AddNodeNext(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/cli", func(w http.ResponseWriter, req *http.Request) { + var request = new(Cli) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Cli(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/cli_inband", func(w http.ResponseWriter, req *http.Request) { + var request = new(CliInband) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.CliInband(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/control_ping", func(w http.ResponseWriter, req *http.Request) { + var request = new(ControlPing) + reply, err := rpc.ControlPing(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/get_f64_endian_value", func(w http.ResponseWriter, req *http.Request) { + var request = new(GetF64EndianValue) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GetF64EndianValue(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/get_f64_increment_by_one", func(w http.ResponseWriter, req *http.Request) { + var request = new(GetF64IncrementByOne) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GetF64IncrementByOne(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/get_next_index", func(w http.ResponseWriter, req *http.Request) { + var request = new(GetNextIndex) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GetNextIndex(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/get_node_graph", func(w http.ResponseWriter, req *http.Request) { + var request = new(GetNodeGraph) + reply, err := rpc.GetNodeGraph(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/get_node_index", func(w http.ResponseWriter, req *http.Request) { + var request = new(GetNodeIndex) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.GetNodeIndex(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/show_threads", func(w http.ResponseWriter, req *http.Request) { + var request = new(ShowThreads) + reply, err := rpc.ShowThreads(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/show_version", func(w http.ResponseWriter, req *http.Request) { + var request = new(ShowVersion) + reply, err := rpc.ShowVersion(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/show_vpe_system_time", func(w http.ResponseWriter, req *http.Request) { + var request = new(ShowVpeSystemTime) + reply, err := rpc.ShowVpeSystemTime(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/vpe/vpe_rpc.ba.go b/binapi/vpe/vpe_rpc.ba.go new file mode 100644 index 0000000..dfa669f --- /dev/null +++ b/binapi/vpe/vpe_rpc.ba.go @@ -0,0 +1,182 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package vpe + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + "io" +) + +// RPCService defines RPC service vpe. +type RPCService interface { + AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) + Cli(ctx context.Context, in *Cli) (*CliReply, error) + CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) + ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) + GetF64EndianValue(ctx context.Context, in *GetF64EndianValue) (*GetF64EndianValueReply, error) + GetF64IncrementByOne(ctx context.Context, in *GetF64IncrementByOne) (*GetF64IncrementByOneReply, error) + GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) + GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) + GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) + LogDump(ctx context.Context, in *LogDump) (RPCService_LogDumpClient, error) + ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) + ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) + ShowVpeSystemTime(ctx context.Context, in *ShowVpeSystemTime) (*ShowVpeSystemTimeReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) { + out := new(AddNodeNextReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Cli(ctx context.Context, in *Cli) (*CliReply, error) { + out := new(CliReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) { + out := new(CliInbandReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) { + out := new(ControlPingReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetF64EndianValue(ctx context.Context, in *GetF64EndianValue) (*GetF64EndianValueReply, error) { + out := new(GetF64EndianValueReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetF64IncrementByOne(ctx context.Context, in *GetF64IncrementByOne) (*GetF64IncrementByOneReply, error) { + out := new(GetF64IncrementByOneReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) { + out := new(GetNextIndexReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) { + out := new(GetNodeGraphReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) { + out := new(GetNodeIndexReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LogDump(ctx context.Context, in *LogDump) (RPCService_LogDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_LogDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_LogDumpClient interface { + Recv() (*LogDetails, error) + api.Stream +} + +type serviceClient_LogDumpClient struct { + api.Stream +} + +func (c *serviceClient_LogDumpClient) Recv() (*LogDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *LogDetails: + return m, nil + case *ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) { + out := new(ShowThreadsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) { + out := new(ShowVersionReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowVpeSystemTime(ctx context.Context, in *ShowVpeSystemTime) (*ShowVpeSystemTimeReply, error) { + out := new(ShowVpeSystemTimeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/vpe_types/vpe_types.ba.go b/binapi/vpe_types/vpe_types.ba.go new file mode 100644 index 0000000..538b497 --- /dev/null +++ b/binapi/vpe_types/vpe_types.ba.go @@ -0,0 +1,88 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/vpe_types.api.json + +// Package vpe_types contains generated bindings for API file vpe_types.api. +// +// Contents: +// 2 aliases +// 1 enum +// 1 struct +// +package vpe_types + +import ( + api "git.fd.io/govpp.git/api" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +// LogLevel defines enum 'log_level'. +type LogLevel uint32 + +const ( + VPE_API_LOG_LEVEL_EMERG LogLevel = 0 + VPE_API_LOG_LEVEL_ALERT LogLevel = 1 + VPE_API_LOG_LEVEL_CRIT LogLevel = 2 + VPE_API_LOG_LEVEL_ERR LogLevel = 3 + VPE_API_LOG_LEVEL_WARNING LogLevel = 4 + VPE_API_LOG_LEVEL_NOTICE LogLevel = 5 + VPE_API_LOG_LEVEL_INFO LogLevel = 6 + VPE_API_LOG_LEVEL_DEBUG LogLevel = 7 + VPE_API_LOG_LEVEL_DISABLED LogLevel = 8 +) + +var ( + LogLevel_name = map[uint32]string{ + 0: "VPE_API_LOG_LEVEL_EMERG", + 1: "VPE_API_LOG_LEVEL_ALERT", + 2: "VPE_API_LOG_LEVEL_CRIT", + 3: "VPE_API_LOG_LEVEL_ERR", + 4: "VPE_API_LOG_LEVEL_WARNING", + 5: "VPE_API_LOG_LEVEL_NOTICE", + 6: "VPE_API_LOG_LEVEL_INFO", + 7: "VPE_API_LOG_LEVEL_DEBUG", + 8: "VPE_API_LOG_LEVEL_DISABLED", + } + LogLevel_value = map[string]uint32{ + "VPE_API_LOG_LEVEL_EMERG": 0, + "VPE_API_LOG_LEVEL_ALERT": 1, + "VPE_API_LOG_LEVEL_CRIT": 2, + "VPE_API_LOG_LEVEL_ERR": 3, + "VPE_API_LOG_LEVEL_WARNING": 4, + "VPE_API_LOG_LEVEL_NOTICE": 5, + "VPE_API_LOG_LEVEL_INFO": 6, + "VPE_API_LOG_LEVEL_DEBUG": 7, + "VPE_API_LOG_LEVEL_DISABLED": 8, + } +) + +func (x LogLevel) String() string { + s, ok := LogLevel_name[uint32(x)] + if ok { + return s + } + return "LogLevel(" + strconv.Itoa(int(x)) + ")" +} + +// Timedelta defines alias 'timedelta'. +type Timedelta float64 + +// Timestamp defines alias 'timestamp'. +type Timestamp float64 + +// Version defines type 'version'. +type Version struct { + Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` + Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` + Patch uint32 `binapi:"u32,name=patch" json:"patch,omitempty"` + PreRelease []byte `binapi:"u8[17],name=pre_release" json:"pre_release,omitempty"` + BuildMetadata []byte `binapi:"u8[17],name=build_metadata" json:"build_metadata,omitempty"` +} diff --git a/binapi/vrrp/vrrp.ba.go b/binapi/vrrp/vrrp.ba.go new file mode 100644 index 0000000..297fbd8 --- /dev/null +++ b/binapi/vrrp/vrrp.ba.go @@ -0,0 +1,984 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/vrrp.api.json + +// Package vrrp contains generated bindings for API file vrrp.api. +// +// Contents: +// 2 enums +// 5 structs +// 14 messages +// +package vrrp + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "vrrp" + APIVersion = "1.0.1" + VersionCrc = 0x1903f1f1 +) + +// VrrpVrFlags defines enum 'vrrp_vr_flags'. +type VrrpVrFlags uint32 + +const ( + VRRP_API_VR_PREEMPT VrrpVrFlags = 1 + VRRP_API_VR_ACCEPT VrrpVrFlags = 2 + VRRP_API_VR_UNICAST VrrpVrFlags = 4 + VRRP_API_VR_IPV6 VrrpVrFlags = 8 +) + +var ( + VrrpVrFlags_name = map[uint32]string{ + 1: "VRRP_API_VR_PREEMPT", + 2: "VRRP_API_VR_ACCEPT", + 4: "VRRP_API_VR_UNICAST", + 8: "VRRP_API_VR_IPV6", + } + VrrpVrFlags_value = map[string]uint32{ + "VRRP_API_VR_PREEMPT": 1, + "VRRP_API_VR_ACCEPT": 2, + "VRRP_API_VR_UNICAST": 4, + "VRRP_API_VR_IPV6": 8, + } +) + +func (x VrrpVrFlags) String() string { + s, ok := VrrpVrFlags_name[uint32(x)] + if ok { + return s + } + str := func(n uint32) string { + s, ok := VrrpVrFlags_name[uint32(n)] + if ok { + return s + } + return "VrrpVrFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint32(0); i <= 32; i++ { + val := uint32(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint32(x)) + } + return s +} + +// VrrpVrState defines enum 'vrrp_vr_state'. +type VrrpVrState uint32 + +const ( + VRRP_API_VR_STATE_INIT VrrpVrState = 0 + VRRP_API_VR_STATE_BACKUP VrrpVrState = 1 + VRRP_API_VR_STATE_MASTER VrrpVrState = 2 + VRRP_API_VR_STATE_INTF_DOWN VrrpVrState = 3 +) + +var ( + VrrpVrState_name = map[uint32]string{ + 0: "VRRP_API_VR_STATE_INIT", + 1: "VRRP_API_VR_STATE_BACKUP", + 2: "VRRP_API_VR_STATE_MASTER", + 3: "VRRP_API_VR_STATE_INTF_DOWN", + } + VrrpVrState_value = map[string]uint32{ + "VRRP_API_VR_STATE_INIT": 0, + "VRRP_API_VR_STATE_BACKUP": 1, + "VRRP_API_VR_STATE_MASTER": 2, + "VRRP_API_VR_STATE_INTF_DOWN": 3, + } +) + +func (x VrrpVrState) String() string { + s, ok := VrrpVrState_name[uint32(x)] + if ok { + return s + } + return "VrrpVrState(" + strconv.Itoa(int(x)) + ")" +} + +// VrrpVrConf defines type 'vrrp_vr_conf'. +type VrrpVrConf struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + VrID uint8 `binapi:"u8,name=vr_id" json:"vr_id,omitempty"` + Priority uint8 `binapi:"u8,name=priority" json:"priority,omitempty"` + Interval uint16 `binapi:"u16,name=interval" json:"interval,omitempty"` + Flags VrrpVrFlags `binapi:"vrrp_vr_flags,name=flags" json:"flags,omitempty"` +} + +// VrrpVrKey defines type 'vrrp_vr_key'. +type VrrpVrKey struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + VrID uint8 `binapi:"u8,name=vr_id" json:"vr_id,omitempty"` + IsIPv6 uint8 `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"` +} + +// VrrpVrRuntime defines type 'vrrp_vr_runtime'. +type VrrpVrRuntime struct { + State VrrpVrState `binapi:"vrrp_vr_state,name=state" json:"state,omitempty"` + MasterAdvInt uint16 `binapi:"u16,name=master_adv_int" json:"master_adv_int,omitempty"` + Skew uint16 `binapi:"u16,name=skew" json:"skew,omitempty"` + MasterDownInt uint16 `binapi:"u16,name=master_down_int" json:"master_down_int,omitempty"` + Mac ethernet_types.MacAddress `binapi:"mac_address,name=mac" json:"mac,omitempty"` + Tracking VrrpVrTracking `binapi:"vrrp_vr_tracking,name=tracking" json:"tracking,omitempty"` +} + +// VrrpVrTrackIf defines type 'vrrp_vr_track_if'. +type VrrpVrTrackIf struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Priority uint8 `binapi:"u8,name=priority" json:"priority,omitempty"` +} + +// VrrpVrTracking defines type 'vrrp_vr_tracking'. +type VrrpVrTracking struct { + InterfacesDec uint32 `binapi:"u32,name=interfaces_dec" json:"interfaces_dec,omitempty"` + Priority uint8 `binapi:"u8,name=priority" json:"priority,omitempty"` +} + +// VrrpVrAddDel defines message 'vrrp_vr_add_del'. +type VrrpVrAddDel struct { + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + VrID uint8 `binapi:"u8,name=vr_id" json:"vr_id,omitempty"` + Priority uint8 `binapi:"u8,name=priority" json:"priority,omitempty"` + Interval uint16 `binapi:"u16,name=interval" json:"interval,omitempty"` + Flags VrrpVrFlags `binapi:"vrrp_vr_flags,name=flags" json:"flags,omitempty"` + NAddrs uint8 `binapi:"u8,name=n_addrs" json:"-"` + Addrs []ip_types.Address `binapi:"address[n_addrs],name=addrs" json:"addrs,omitempty"` +} + +func (m *VrrpVrAddDel) Reset() { *m = VrrpVrAddDel{} } +func (*VrrpVrAddDel) GetMessageName() string { return "vrrp_vr_add_del" } +func (*VrrpVrAddDel) GetCrcString() string { return "6dc4b881" } +func (*VrrpVrAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VrrpVrAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.SwIfIndex + size += 1 // m.VrID + size += 1 // m.Priority + size += 2 // m.Interval + size += 4 // m.Flags + size += 1 // m.NAddrs + for j1 := 0; j1 < len(m.Addrs); j1++ { + var s1 ip_types.Address + _ = s1 + if j1 < len(m.Addrs) { + s1 = m.Addrs[j1] + } + size += 1 // s1.Af + size += 1 * 16 // s1.Un + } + return size +} +func (m *VrrpVrAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.IsAdd)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.VrID)) + buf.EncodeUint8(uint8(m.Priority)) + buf.EncodeUint16(uint16(m.Interval)) + buf.EncodeUint32(uint32(m.Flags)) + buf.EncodeUint8(uint8(len(m.Addrs))) + for j0 := 0; j0 < len(m.Addrs); j0++ { + var v0 ip_types.Address + if j0 < len(m.Addrs) { + v0 = m.Addrs[j0] + } + buf.EncodeUint8(uint8(v0.Af)) + buf.EncodeBytes(v0.Un.XXX_UnionData[:], 0) + } + return buf.Bytes(), nil +} +func (m *VrrpVrAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeUint8() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.VrID = buf.DecodeUint8() + m.Priority = buf.DecodeUint8() + m.Interval = buf.DecodeUint16() + m.Flags = VrrpVrFlags(buf.DecodeUint32()) + m.NAddrs = buf.DecodeUint8() + m.Addrs = make([]ip_types.Address, int(m.NAddrs)) + for j0 := 0; j0 < len(m.Addrs); j0++ { + m.Addrs[j0].Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Addrs[j0].Un.XXX_UnionData[:], buf.DecodeBytes(16)) + } + return nil +} + +// VrrpVrAddDelReply defines message 'vrrp_vr_add_del_reply'. +type VrrpVrAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *VrrpVrAddDelReply) Reset() { *m = VrrpVrAddDelReply{} } +func (*VrrpVrAddDelReply) GetMessageName() string { return "vrrp_vr_add_del_reply" } +func (*VrrpVrAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*VrrpVrAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VrrpVrAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *VrrpVrAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *VrrpVrAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// VrrpVrDetails defines message 'vrrp_vr_details'. +type VrrpVrDetails struct { + Config VrrpVrConf `binapi:"vrrp_vr_conf,name=config" json:"config,omitempty"` + Runtime VrrpVrRuntime `binapi:"vrrp_vr_runtime,name=runtime" json:"runtime,omitempty"` + NAddrs uint8 `binapi:"u8,name=n_addrs" json:"-"` + Addrs []ip_types.Address `binapi:"address[n_addrs],name=addrs" json:"addrs,omitempty"` +} + +func (m *VrrpVrDetails) Reset() { *m = VrrpVrDetails{} } +func (*VrrpVrDetails) GetMessageName() string { return "vrrp_vr_details" } +func (*VrrpVrDetails) GetCrcString() string { return "0412fa71" } +func (*VrrpVrDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VrrpVrDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Config.SwIfIndex + size += 1 // m.Config.VrID + size += 1 // m.Config.Priority + size += 2 // m.Config.Interval + size += 4 // m.Config.Flags + size += 4 // m.Runtime.State + size += 2 // m.Runtime.MasterAdvInt + size += 2 // m.Runtime.Skew + size += 2 // m.Runtime.MasterDownInt + size += 1 * 6 // m.Runtime.Mac + size += 4 // m.Runtime.Tracking.InterfacesDec + size += 1 // m.Runtime.Tracking.Priority + size += 1 // m.NAddrs + for j1 := 0; j1 < len(m.Addrs); j1++ { + var s1 ip_types.Address + _ = s1 + if j1 < len(m.Addrs) { + s1 = m.Addrs[j1] + } + size += 1 // s1.Af + size += 1 * 16 // s1.Un + } + return size +} +func (m *VrrpVrDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Config.SwIfIndex)) + buf.EncodeUint8(uint8(m.Config.VrID)) + buf.EncodeUint8(uint8(m.Config.Priority)) + buf.EncodeUint16(uint16(m.Config.Interval)) + buf.EncodeUint32(uint32(m.Config.Flags)) + buf.EncodeUint32(uint32(m.Runtime.State)) + buf.EncodeUint16(uint16(m.Runtime.MasterAdvInt)) + buf.EncodeUint16(uint16(m.Runtime.Skew)) + buf.EncodeUint16(uint16(m.Runtime.MasterDownInt)) + buf.EncodeBytes(m.Runtime.Mac[:], 6) + buf.EncodeUint32(uint32(m.Runtime.Tracking.InterfacesDec)) + buf.EncodeUint8(uint8(m.Runtime.Tracking.Priority)) + buf.EncodeUint8(uint8(len(m.Addrs))) + for j0 := 0; j0 < len(m.Addrs); j0++ { + var v0 ip_types.Address + if j0 < len(m.Addrs) { + v0 = m.Addrs[j0] + } + buf.EncodeUint8(uint8(v0.Af)) + buf.EncodeBytes(v0.Un.XXX_UnionData[:], 0) + } + return buf.Bytes(), nil +} +func (m *VrrpVrDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Config.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Config.VrID = buf.DecodeUint8() + m.Config.Priority = buf.DecodeUint8() + m.Config.Interval = buf.DecodeUint16() + m.Config.Flags = VrrpVrFlags(buf.DecodeUint32()) + m.Runtime.State = VrrpVrState(buf.DecodeUint32()) + m.Runtime.MasterAdvInt = buf.DecodeUint16() + m.Runtime.Skew = buf.DecodeUint16() + m.Runtime.MasterDownInt = buf.DecodeUint16() + copy(m.Runtime.Mac[:], buf.DecodeBytes(6)) + m.Runtime.Tracking.InterfacesDec = buf.DecodeUint32() + m.Runtime.Tracking.Priority = buf.DecodeUint8() + m.NAddrs = buf.DecodeUint8() + m.Addrs = make([]ip_types.Address, int(m.NAddrs)) + for j0 := 0; j0 < len(m.Addrs); j0++ { + m.Addrs[j0].Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Addrs[j0].Un.XXX_UnionData[:], buf.DecodeBytes(16)) + } + return nil +} + +// VrrpVrDump defines message 'vrrp_vr_dump'. +type VrrpVrDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *VrrpVrDump) Reset() { *m = VrrpVrDump{} } +func (*VrrpVrDump) GetMessageName() string { return "vrrp_vr_dump" } +func (*VrrpVrDump) GetCrcString() string { return "f9e6675e" } +func (*VrrpVrDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VrrpVrDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *VrrpVrDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *VrrpVrDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// VrrpVrPeerDetails defines message 'vrrp_vr_peer_details'. +type VrrpVrPeerDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + VrID uint8 `binapi:"u8,name=vr_id" json:"vr_id,omitempty"` + IsIPv6 uint8 `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"` + NPeerAddrs uint8 `binapi:"u8,name=n_peer_addrs" json:"-"` + PeerAddrs []ip_types.Address `binapi:"address[n_peer_addrs],name=peer_addrs" json:"peer_addrs,omitempty"` +} + +func (m *VrrpVrPeerDetails) Reset() { *m = VrrpVrPeerDetails{} } +func (*VrrpVrPeerDetails) GetMessageName() string { return "vrrp_vr_peer_details" } +func (*VrrpVrPeerDetails) GetCrcString() string { return "abd9145e" } +func (*VrrpVrPeerDetails) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VrrpVrPeerDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.VrID + size += 1 // m.IsIPv6 + size += 1 // m.NPeerAddrs + for j1 := 0; j1 < len(m.PeerAddrs); j1++ { + var s1 ip_types.Address + _ = s1 + if j1 < len(m.PeerAddrs) { + s1 = m.PeerAddrs[j1] + } + size += 1 // s1.Af + size += 1 * 16 // s1.Un + } + return size +} +func (m *VrrpVrPeerDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.VrID)) + buf.EncodeUint8(uint8(m.IsIPv6)) + buf.EncodeUint8(uint8(len(m.PeerAddrs))) + for j0 := 0; j0 < len(m.PeerAddrs); j0++ { + var v0 ip_types.Address + if j0 < len(m.PeerAddrs) { + v0 = m.PeerAddrs[j0] + } + buf.EncodeUint8(uint8(v0.Af)) + buf.EncodeBytes(v0.Un.XXX_UnionData[:], 0) + } + return buf.Bytes(), nil +} +func (m *VrrpVrPeerDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.VrID = buf.DecodeUint8() + m.IsIPv6 = buf.DecodeUint8() + m.NPeerAddrs = buf.DecodeUint8() + m.PeerAddrs = make([]ip_types.Address, int(m.NPeerAddrs)) + for j0 := 0; j0 < len(m.PeerAddrs); j0++ { + m.PeerAddrs[j0].Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.PeerAddrs[j0].Un.XXX_UnionData[:], buf.DecodeBytes(16)) + } + return nil +} + +// VrrpVrPeerDump defines message 'vrrp_vr_peer_dump'. +type VrrpVrPeerDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 uint8 `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"` + VrID uint8 `binapi:"u8,name=vr_id" json:"vr_id,omitempty"` +} + +func (m *VrrpVrPeerDump) Reset() { *m = VrrpVrPeerDump{} } +func (*VrrpVrPeerDump) GetMessageName() string { return "vrrp_vr_peer_dump" } +func (*VrrpVrPeerDump) GetCrcString() string { return "6fa3f7c4" } +func (*VrrpVrPeerDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VrrpVrPeerDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.IsIPv6 + size += 1 // m.VrID + return size +} +func (m *VrrpVrPeerDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.IsIPv6)) + buf.EncodeUint8(uint8(m.VrID)) + return buf.Bytes(), nil +} +func (m *VrrpVrPeerDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsIPv6 = buf.DecodeUint8() + m.VrID = buf.DecodeUint8() + return nil +} + +// VrrpVrSetPeers defines message 'vrrp_vr_set_peers'. +type VrrpVrSetPeers struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + VrID uint8 `binapi:"u8,name=vr_id" json:"vr_id,omitempty"` + IsIPv6 uint8 `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"` + NAddrs uint8 `binapi:"u8,name=n_addrs" json:"-"` + Addrs []ip_types.Address `binapi:"address[n_addrs],name=addrs" json:"addrs,omitempty"` +} + +func (m *VrrpVrSetPeers) Reset() { *m = VrrpVrSetPeers{} } +func (*VrrpVrSetPeers) GetMessageName() string { return "vrrp_vr_set_peers" } +func (*VrrpVrSetPeers) GetCrcString() string { return "baa2e52b" } +func (*VrrpVrSetPeers) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VrrpVrSetPeers) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.VrID + size += 1 // m.IsIPv6 + size += 1 // m.NAddrs + for j1 := 0; j1 < len(m.Addrs); j1++ { + var s1 ip_types.Address + _ = s1 + if j1 < len(m.Addrs) { + s1 = m.Addrs[j1] + } + size += 1 // s1.Af + size += 1 * 16 // s1.Un + } + return size +} +func (m *VrrpVrSetPeers) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.VrID)) + buf.EncodeUint8(uint8(m.IsIPv6)) + buf.EncodeUint8(uint8(len(m.Addrs))) + for j0 := 0; j0 < len(m.Addrs); j0++ { + var v0 ip_types.Address + if j0 < len(m.Addrs) { + v0 = m.Addrs[j0] + } + buf.EncodeUint8(uint8(v0.Af)) + buf.EncodeBytes(v0.Un.XXX_UnionData[:], 0) + } + return buf.Bytes(), nil +} +func (m *VrrpVrSetPeers) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.VrID = buf.DecodeUint8() + m.IsIPv6 = buf.DecodeUint8() + m.NAddrs = buf.DecodeUint8() + m.Addrs = make([]ip_types.Address, int(m.NAddrs)) + for j0 := 0; j0 < len(m.Addrs); j0++ { + m.Addrs[j0].Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Addrs[j0].Un.XXX_UnionData[:], buf.DecodeBytes(16)) + } + return nil +} + +// VrrpVrSetPeersReply defines message 'vrrp_vr_set_peers_reply'. +type VrrpVrSetPeersReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *VrrpVrSetPeersReply) Reset() { *m = VrrpVrSetPeersReply{} } +func (*VrrpVrSetPeersReply) GetMessageName() string { return "vrrp_vr_set_peers_reply" } +func (*VrrpVrSetPeersReply) GetCrcString() string { return "e8d4e804" } +func (*VrrpVrSetPeersReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VrrpVrSetPeersReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *VrrpVrSetPeersReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *VrrpVrSetPeersReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// VrrpVrStartStop defines message 'vrrp_vr_start_stop'. +type VrrpVrStartStop struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + VrID uint8 `binapi:"u8,name=vr_id" json:"vr_id,omitempty"` + IsIPv6 uint8 `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"` + IsStart uint8 `binapi:"u8,name=is_start" json:"is_start,omitempty"` +} + +func (m *VrrpVrStartStop) Reset() { *m = VrrpVrStartStop{} } +func (*VrrpVrStartStop) GetMessageName() string { return "vrrp_vr_start_stop" } +func (*VrrpVrStartStop) GetCrcString() string { return "0662a3b7" } +func (*VrrpVrStartStop) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VrrpVrStartStop) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.VrID + size += 1 // m.IsIPv6 + size += 1 // m.IsStart + return size +} +func (m *VrrpVrStartStop) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.VrID)) + buf.EncodeUint8(uint8(m.IsIPv6)) + buf.EncodeUint8(uint8(m.IsStart)) + return buf.Bytes(), nil +} +func (m *VrrpVrStartStop) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.VrID = buf.DecodeUint8() + m.IsIPv6 = buf.DecodeUint8() + m.IsStart = buf.DecodeUint8() + return nil +} + +// VrrpVrStartStopReply defines message 'vrrp_vr_start_stop_reply'. +type VrrpVrStartStopReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *VrrpVrStartStopReply) Reset() { *m = VrrpVrStartStopReply{} } +func (*VrrpVrStartStopReply) GetMessageName() string { return "vrrp_vr_start_stop_reply" } +func (*VrrpVrStartStopReply) GetCrcString() string { return "e8d4e804" } +func (*VrrpVrStartStopReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VrrpVrStartStopReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *VrrpVrStartStopReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *VrrpVrStartStopReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// VrrpVrTrackIfAddDel defines message 'vrrp_vr_track_if_add_del'. +type VrrpVrTrackIfAddDel struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 uint8 `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"` + VrID uint8 `binapi:"u8,name=vr_id" json:"vr_id,omitempty"` + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` + NIfs uint8 `binapi:"u8,name=n_ifs" json:"-"` + Ifs []VrrpVrTrackIf `binapi:"vrrp_vr_track_if[n_ifs],name=ifs" json:"ifs,omitempty"` +} + +func (m *VrrpVrTrackIfAddDel) Reset() { *m = VrrpVrTrackIfAddDel{} } +func (*VrrpVrTrackIfAddDel) GetMessageName() string { return "vrrp_vr_track_if_add_del" } +func (*VrrpVrTrackIfAddDel) GetCrcString() string { return "337f4ba4" } +func (*VrrpVrTrackIfAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VrrpVrTrackIfAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.IsIPv6 + size += 1 // m.VrID + size += 1 // m.IsAdd + size += 1 // m.NIfs + for j1 := 0; j1 < len(m.Ifs); j1++ { + var s1 VrrpVrTrackIf + _ = s1 + if j1 < len(m.Ifs) { + s1 = m.Ifs[j1] + } + size += 4 // s1.SwIfIndex + size += 1 // s1.Priority + } + return size +} +func (m *VrrpVrTrackIfAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.IsIPv6)) + buf.EncodeUint8(uint8(m.VrID)) + buf.EncodeUint8(uint8(m.IsAdd)) + buf.EncodeUint8(uint8(len(m.Ifs))) + for j0 := 0; j0 < len(m.Ifs); j0++ { + var v0 VrrpVrTrackIf + if j0 < len(m.Ifs) { + v0 = m.Ifs[j0] + } + buf.EncodeUint32(uint32(v0.SwIfIndex)) + buf.EncodeUint8(uint8(v0.Priority)) + } + return buf.Bytes(), nil +} +func (m *VrrpVrTrackIfAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsIPv6 = buf.DecodeUint8() + m.VrID = buf.DecodeUint8() + m.IsAdd = buf.DecodeUint8() + m.NIfs = buf.DecodeUint8() + m.Ifs = make([]VrrpVrTrackIf, int(m.NIfs)) + for j0 := 0; j0 < len(m.Ifs); j0++ { + m.Ifs[j0].SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Ifs[j0].Priority = buf.DecodeUint8() + } + return nil +} + +// VrrpVrTrackIfAddDelReply defines message 'vrrp_vr_track_if_add_del_reply'. +type VrrpVrTrackIfAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *VrrpVrTrackIfAddDelReply) Reset() { *m = VrrpVrTrackIfAddDelReply{} } +func (*VrrpVrTrackIfAddDelReply) GetMessageName() string { return "vrrp_vr_track_if_add_del_reply" } +func (*VrrpVrTrackIfAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*VrrpVrTrackIfAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VrrpVrTrackIfAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *VrrpVrTrackIfAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *VrrpVrTrackIfAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// VrrpVrTrackIfDetails defines message 'vrrp_vr_track_if_details'. +type VrrpVrTrackIfDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + VrID uint8 `binapi:"u8,name=vr_id" json:"vr_id,omitempty"` + IsIPv6 uint8 `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"` + NIfs uint8 `binapi:"u8,name=n_ifs" json:"-"` + Ifs []VrrpVrTrackIf `binapi:"vrrp_vr_track_if[n_ifs],name=ifs" json:"ifs,omitempty"` +} + +func (m *VrrpVrTrackIfDetails) Reset() { *m = VrrpVrTrackIfDetails{} } +func (*VrrpVrTrackIfDetails) GetMessageName() string { return "vrrp_vr_track_if_details" } +func (*VrrpVrTrackIfDetails) GetCrcString() string { return "99bcca9c" } +func (*VrrpVrTrackIfDetails) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VrrpVrTrackIfDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.VrID + size += 1 // m.IsIPv6 + size += 1 // m.NIfs + for j1 := 0; j1 < len(m.Ifs); j1++ { + var s1 VrrpVrTrackIf + _ = s1 + if j1 < len(m.Ifs) { + s1 = m.Ifs[j1] + } + size += 4 // s1.SwIfIndex + size += 1 // s1.Priority + } + return size +} +func (m *VrrpVrTrackIfDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.VrID)) + buf.EncodeUint8(uint8(m.IsIPv6)) + buf.EncodeUint8(uint8(len(m.Ifs))) + for j0 := 0; j0 < len(m.Ifs); j0++ { + var v0 VrrpVrTrackIf + if j0 < len(m.Ifs) { + v0 = m.Ifs[j0] + } + buf.EncodeUint32(uint32(v0.SwIfIndex)) + buf.EncodeUint8(uint8(v0.Priority)) + } + return buf.Bytes(), nil +} +func (m *VrrpVrTrackIfDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.VrID = buf.DecodeUint8() + m.IsIPv6 = buf.DecodeUint8() + m.NIfs = buf.DecodeUint8() + m.Ifs = make([]VrrpVrTrackIf, int(m.NIfs)) + for j0 := 0; j0 < len(m.Ifs); j0++ { + m.Ifs[j0].SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Ifs[j0].Priority = buf.DecodeUint8() + } + return nil +} + +// VrrpVrTrackIfDump defines message 'vrrp_vr_track_if_dump'. +type VrrpVrTrackIfDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 uint8 `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"` + VrID uint8 `binapi:"u8,name=vr_id" json:"vr_id,omitempty"` + DumpAll uint8 `binapi:"u8,name=dump_all" json:"dump_all,omitempty"` +} + +func (m *VrrpVrTrackIfDump) Reset() { *m = VrrpVrTrackIfDump{} } +func (*VrrpVrTrackIfDump) GetMessageName() string { return "vrrp_vr_track_if_dump" } +func (*VrrpVrTrackIfDump) GetCrcString() string { return "a34dfc6d" } +func (*VrrpVrTrackIfDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VrrpVrTrackIfDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.IsIPv6 + size += 1 // m.VrID + size += 1 // m.DumpAll + return size +} +func (m *VrrpVrTrackIfDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.IsIPv6)) + buf.EncodeUint8(uint8(m.VrID)) + buf.EncodeUint8(uint8(m.DumpAll)) + return buf.Bytes(), nil +} +func (m *VrrpVrTrackIfDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsIPv6 = buf.DecodeUint8() + m.VrID = buf.DecodeUint8() + m.DumpAll = buf.DecodeUint8() + return nil +} + +func init() { file_vrrp_binapi_init() } +func file_vrrp_binapi_init() { + api.RegisterMessage((*VrrpVrAddDel)(nil), "vrrp_vr_add_del_6dc4b881") + api.RegisterMessage((*VrrpVrAddDelReply)(nil), "vrrp_vr_add_del_reply_e8d4e804") + api.RegisterMessage((*VrrpVrDetails)(nil), "vrrp_vr_details_0412fa71") + api.RegisterMessage((*VrrpVrDump)(nil), "vrrp_vr_dump_f9e6675e") + api.RegisterMessage((*VrrpVrPeerDetails)(nil), "vrrp_vr_peer_details_abd9145e") + api.RegisterMessage((*VrrpVrPeerDump)(nil), "vrrp_vr_peer_dump_6fa3f7c4") + api.RegisterMessage((*VrrpVrSetPeers)(nil), "vrrp_vr_set_peers_baa2e52b") + api.RegisterMessage((*VrrpVrSetPeersReply)(nil), "vrrp_vr_set_peers_reply_e8d4e804") + api.RegisterMessage((*VrrpVrStartStop)(nil), "vrrp_vr_start_stop_0662a3b7") + api.RegisterMessage((*VrrpVrStartStopReply)(nil), "vrrp_vr_start_stop_reply_e8d4e804") + api.RegisterMessage((*VrrpVrTrackIfAddDel)(nil), "vrrp_vr_track_if_add_del_337f4ba4") + api.RegisterMessage((*VrrpVrTrackIfAddDelReply)(nil), "vrrp_vr_track_if_add_del_reply_e8d4e804") + api.RegisterMessage((*VrrpVrTrackIfDetails)(nil), "vrrp_vr_track_if_details_99bcca9c") + api.RegisterMessage((*VrrpVrTrackIfDump)(nil), "vrrp_vr_track_if_dump_a34dfc6d") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*VrrpVrAddDel)(nil), + (*VrrpVrAddDelReply)(nil), + (*VrrpVrDetails)(nil), + (*VrrpVrDump)(nil), + (*VrrpVrPeerDetails)(nil), + (*VrrpVrPeerDump)(nil), + (*VrrpVrSetPeers)(nil), + (*VrrpVrSetPeersReply)(nil), + (*VrrpVrStartStop)(nil), + (*VrrpVrStartStopReply)(nil), + (*VrrpVrTrackIfAddDel)(nil), + (*VrrpVrTrackIfAddDelReply)(nil), + (*VrrpVrTrackIfDetails)(nil), + (*VrrpVrTrackIfDump)(nil), + } +} diff --git a/binapi/vrrp/vrrp_rest.ba.go b/binapi/vrrp/vrrp_rest.ba.go new file mode 100644 index 0000000..35cedfe --- /dev/null +++ b/binapi/vrrp/vrrp_rest.ba.go @@ -0,0 +1,106 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package vrrp + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/vrrp_vr_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(VrrpVrAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.VrrpVrAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/vrrp_vr_set_peers", func(w http.ResponseWriter, req *http.Request) { + var request = new(VrrpVrSetPeers) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.VrrpVrSetPeers(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/vrrp_vr_start_stop", func(w http.ResponseWriter, req *http.Request) { + var request = new(VrrpVrStartStop) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.VrrpVrStartStop(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/vrrp_vr_track_if_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(VrrpVrTrackIfAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.VrrpVrTrackIfAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/vrrp/vrrp_rpc.ba.go b/binapi/vrrp/vrrp_rpc.ba.go new file mode 100644 index 0000000..c001082 --- /dev/null +++ b/binapi/vrrp/vrrp_rpc.ba.go @@ -0,0 +1,183 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package vrrp + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service vrrp. +type RPCService interface { + VrrpVrAddDel(ctx context.Context, in *VrrpVrAddDel) (*VrrpVrAddDelReply, error) + VrrpVrDump(ctx context.Context, in *VrrpVrDump) (RPCService_VrrpVrDumpClient, error) + VrrpVrPeerDump(ctx context.Context, in *VrrpVrPeerDump) (RPCService_VrrpVrPeerDumpClient, error) + VrrpVrSetPeers(ctx context.Context, in *VrrpVrSetPeers) (*VrrpVrSetPeersReply, error) + VrrpVrStartStop(ctx context.Context, in *VrrpVrStartStop) (*VrrpVrStartStopReply, error) + VrrpVrTrackIfAddDel(ctx context.Context, in *VrrpVrTrackIfAddDel) (*VrrpVrTrackIfAddDelReply, error) + VrrpVrTrackIfDump(ctx context.Context, in *VrrpVrTrackIfDump) (RPCService_VrrpVrTrackIfDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) VrrpVrAddDel(ctx context.Context, in *VrrpVrAddDel) (*VrrpVrAddDelReply, error) { + out := new(VrrpVrAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VrrpVrDump(ctx context.Context, in *VrrpVrDump) (RPCService_VrrpVrDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_VrrpVrDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_VrrpVrDumpClient interface { + Recv() (*VrrpVrDetails, error) + api.Stream +} + +type serviceClient_VrrpVrDumpClient struct { + api.Stream +} + +func (c *serviceClient_VrrpVrDumpClient) Recv() (*VrrpVrDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *VrrpVrDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) VrrpVrPeerDump(ctx context.Context, in *VrrpVrPeerDump) (RPCService_VrrpVrPeerDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_VrrpVrPeerDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_VrrpVrPeerDumpClient interface { + Recv() (*VrrpVrPeerDetails, error) + api.Stream +} + +type serviceClient_VrrpVrPeerDumpClient struct { + api.Stream +} + +func (c *serviceClient_VrrpVrPeerDumpClient) Recv() (*VrrpVrPeerDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *VrrpVrPeerDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) VrrpVrSetPeers(ctx context.Context, in *VrrpVrSetPeers) (*VrrpVrSetPeersReply, error) { + out := new(VrrpVrSetPeersReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VrrpVrStartStop(ctx context.Context, in *VrrpVrStartStop) (*VrrpVrStartStopReply, error) { + out := new(VrrpVrStartStopReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VrrpVrTrackIfAddDel(ctx context.Context, in *VrrpVrTrackIfAddDel) (*VrrpVrTrackIfAddDelReply, error) { + out := new(VrrpVrTrackIfAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VrrpVrTrackIfDump(ctx context.Context, in *VrrpVrTrackIfDump) (RPCService_VrrpVrTrackIfDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_VrrpVrTrackIfDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_VrrpVrTrackIfDumpClient interface { + Recv() (*VrrpVrTrackIfDetails, error) + api.Stream +} + +type serviceClient_VrrpVrTrackIfDumpClient struct { + api.Stream +} + +func (c *serviceClient_VrrpVrTrackIfDumpClient) Recv() (*VrrpVrTrackIfDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *VrrpVrTrackIfDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/vxlan/vxlan.ba.go b/binapi/vxlan/vxlan.ba.go new file mode 100644 index 0000000..bec763f --- /dev/null +++ b/binapi/vxlan/vxlan.ba.go @@ -0,0 +1,435 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/vxlan.api.json + +// Package vxlan contains generated bindings for API file vxlan.api. +// +// Contents: +// 8 messages +// +package vxlan + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "vxlan" + APIVersion = "2.0.0" + VersionCrc = 0xf11ad29f +) + +// SwInterfaceSetVxlanBypass defines message 'sw_interface_set_vxlan_bypass'. +type SwInterfaceSetVxlanBypass struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + Enable bool `binapi:"bool,name=enable,default=true" json:"enable,omitempty"` +} + +func (m *SwInterfaceSetVxlanBypass) Reset() { *m = SwInterfaceSetVxlanBypass{} } +func (*SwInterfaceSetVxlanBypass) GetMessageName() string { return "sw_interface_set_vxlan_bypass" } +func (*SwInterfaceSetVxlanBypass) GetCrcString() string { return "65247409" } +func (*SwInterfaceSetVxlanBypass) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetVxlanBypass) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.IsIPv6 + size += 1 // m.Enable + return size +} +func (m *SwInterfaceSetVxlanBypass) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsIPv6) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetVxlanBypass) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsIPv6 = buf.DecodeBool() + m.Enable = buf.DecodeBool() + return nil +} + +// SwInterfaceSetVxlanBypassReply defines message 'sw_interface_set_vxlan_bypass_reply'. +type SwInterfaceSetVxlanBypassReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetVxlanBypassReply) Reset() { *m = SwInterfaceSetVxlanBypassReply{} } +func (*SwInterfaceSetVxlanBypassReply) GetMessageName() string { + return "sw_interface_set_vxlan_bypass_reply" +} +func (*SwInterfaceSetVxlanBypassReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetVxlanBypassReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetVxlanBypassReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetVxlanBypassReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetVxlanBypassReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// VxlanAddDelTunnel defines message 'vxlan_add_del_tunnel'. +type VxlanAddDelTunnel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Instance uint32 `binapi:"u32,name=instance" json:"instance,omitempty"` + SrcAddress ip_types.Address `binapi:"address,name=src_address" json:"src_address,omitempty"` + DstAddress ip_types.Address `binapi:"address,name=dst_address" json:"dst_address,omitempty"` + McastSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mcast_sw_if_index" json:"mcast_sw_if_index,omitempty"` + EncapVrfID uint32 `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"` + DecapNextIndex uint32 `binapi:"u32,name=decap_next_index" json:"decap_next_index,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` +} + +func (m *VxlanAddDelTunnel) Reset() { *m = VxlanAddDelTunnel{} } +func (*VxlanAddDelTunnel) GetMessageName() string { return "vxlan_add_del_tunnel" } +func (*VxlanAddDelTunnel) GetCrcString() string { return "a35dc8f5" } +func (*VxlanAddDelTunnel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VxlanAddDelTunnel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Instance + size += 1 // m.SrcAddress.Af + size += 1 * 16 // m.SrcAddress.Un + size += 1 // m.DstAddress.Af + size += 1 * 16 // m.DstAddress.Un + size += 4 // m.McastSwIfIndex + size += 4 // m.EncapVrfID + size += 4 // m.DecapNextIndex + size += 4 // m.Vni + return size +} +func (m *VxlanAddDelTunnel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Instance)) + buf.EncodeUint8(uint8(m.SrcAddress.Af)) + buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.DstAddress.Af)) + buf.EncodeBytes(m.DstAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.McastSwIfIndex)) + buf.EncodeUint32(uint32(m.EncapVrfID)) + buf.EncodeUint32(uint32(m.DecapNextIndex)) + buf.EncodeUint32(uint32(m.Vni)) + return buf.Bytes(), nil +} +func (m *VxlanAddDelTunnel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Instance = buf.DecodeUint32() + m.SrcAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.SrcAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.DstAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.DstAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.EncapVrfID = buf.DecodeUint32() + m.DecapNextIndex = buf.DecodeUint32() + m.Vni = buf.DecodeUint32() + return nil +} + +// VxlanAddDelTunnelReply defines message 'vxlan_add_del_tunnel_reply'. +type VxlanAddDelTunnelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *VxlanAddDelTunnelReply) Reset() { *m = VxlanAddDelTunnelReply{} } +func (*VxlanAddDelTunnelReply) GetMessageName() string { return "vxlan_add_del_tunnel_reply" } +func (*VxlanAddDelTunnelReply) GetCrcString() string { return "5383d31f" } +func (*VxlanAddDelTunnelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VxlanAddDelTunnelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *VxlanAddDelTunnelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *VxlanAddDelTunnelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// VxlanOffloadRx defines message 'vxlan_offload_rx'. +type VxlanOffloadRx struct { + HwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=hw_if_index" json:"hw_if_index,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Enable bool `binapi:"bool,name=enable,default=true" json:"enable,omitempty"` +} + +func (m *VxlanOffloadRx) Reset() { *m = VxlanOffloadRx{} } +func (*VxlanOffloadRx) GetMessageName() string { return "vxlan_offload_rx" } +func (*VxlanOffloadRx) GetCrcString() string { return "89a1564b" } +func (*VxlanOffloadRx) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VxlanOffloadRx) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.HwIfIndex + size += 4 // m.SwIfIndex + size += 1 // m.Enable + return size +} +func (m *VxlanOffloadRx) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.HwIfIndex)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *VxlanOffloadRx) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.HwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Enable = buf.DecodeBool() + return nil +} + +// VxlanOffloadRxReply defines message 'vxlan_offload_rx_reply'. +type VxlanOffloadRxReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *VxlanOffloadRxReply) Reset() { *m = VxlanOffloadRxReply{} } +func (*VxlanOffloadRxReply) GetMessageName() string { return "vxlan_offload_rx_reply" } +func (*VxlanOffloadRxReply) GetCrcString() string { return "e8d4e804" } +func (*VxlanOffloadRxReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VxlanOffloadRxReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *VxlanOffloadRxReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *VxlanOffloadRxReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// VxlanTunnelDetails defines message 'vxlan_tunnel_details'. +type VxlanTunnelDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Instance uint32 `binapi:"u32,name=instance" json:"instance,omitempty"` + SrcAddress ip_types.Address `binapi:"address,name=src_address" json:"src_address,omitempty"` + DstAddress ip_types.Address `binapi:"address,name=dst_address" json:"dst_address,omitempty"` + McastSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mcast_sw_if_index" json:"mcast_sw_if_index,omitempty"` + EncapVrfID uint32 `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"` + DecapNextIndex uint32 `binapi:"u32,name=decap_next_index" json:"decap_next_index,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` +} + +func (m *VxlanTunnelDetails) Reset() { *m = VxlanTunnelDetails{} } +func (*VxlanTunnelDetails) GetMessageName() string { return "vxlan_tunnel_details" } +func (*VxlanTunnelDetails) GetCrcString() string { return "e782f70f" } +func (*VxlanTunnelDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VxlanTunnelDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.Instance + size += 1 // m.SrcAddress.Af + size += 1 * 16 // m.SrcAddress.Un + size += 1 // m.DstAddress.Af + size += 1 * 16 // m.DstAddress.Un + size += 4 // m.McastSwIfIndex + size += 4 // m.EncapVrfID + size += 4 // m.DecapNextIndex + size += 4 // m.Vni + return size +} +func (m *VxlanTunnelDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.Instance)) + buf.EncodeUint8(uint8(m.SrcAddress.Af)) + buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.DstAddress.Af)) + buf.EncodeBytes(m.DstAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.McastSwIfIndex)) + buf.EncodeUint32(uint32(m.EncapVrfID)) + buf.EncodeUint32(uint32(m.DecapNextIndex)) + buf.EncodeUint32(uint32(m.Vni)) + return buf.Bytes(), nil +} +func (m *VxlanTunnelDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Instance = buf.DecodeUint32() + m.SrcAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.SrcAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.DstAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.DstAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.EncapVrfID = buf.DecodeUint32() + m.DecapNextIndex = buf.DecodeUint32() + m.Vni = buf.DecodeUint32() + return nil +} + +// VxlanTunnelDump defines message 'vxlan_tunnel_dump'. +type VxlanTunnelDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *VxlanTunnelDump) Reset() { *m = VxlanTunnelDump{} } +func (*VxlanTunnelDump) GetMessageName() string { return "vxlan_tunnel_dump" } +func (*VxlanTunnelDump) GetCrcString() string { return "f9e6675e" } +func (*VxlanTunnelDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VxlanTunnelDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *VxlanTunnelDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *VxlanTunnelDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +func init() { file_vxlan_binapi_init() } +func file_vxlan_binapi_init() { + api.RegisterMessage((*SwInterfaceSetVxlanBypass)(nil), "sw_interface_set_vxlan_bypass_65247409") + api.RegisterMessage((*SwInterfaceSetVxlanBypassReply)(nil), "sw_interface_set_vxlan_bypass_reply_e8d4e804") + api.RegisterMessage((*VxlanAddDelTunnel)(nil), "vxlan_add_del_tunnel_a35dc8f5") + api.RegisterMessage((*VxlanAddDelTunnelReply)(nil), "vxlan_add_del_tunnel_reply_5383d31f") + api.RegisterMessage((*VxlanOffloadRx)(nil), "vxlan_offload_rx_89a1564b") + api.RegisterMessage((*VxlanOffloadRxReply)(nil), "vxlan_offload_rx_reply_e8d4e804") + api.RegisterMessage((*VxlanTunnelDetails)(nil), "vxlan_tunnel_details_e782f70f") + api.RegisterMessage((*VxlanTunnelDump)(nil), "vxlan_tunnel_dump_f9e6675e") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SwInterfaceSetVxlanBypass)(nil), + (*SwInterfaceSetVxlanBypassReply)(nil), + (*VxlanAddDelTunnel)(nil), + (*VxlanAddDelTunnelReply)(nil), + (*VxlanOffloadRx)(nil), + (*VxlanOffloadRxReply)(nil), + (*VxlanTunnelDetails)(nil), + (*VxlanTunnelDump)(nil), + } +} diff --git a/binapi/vxlan/vxlan_rest.ba.go b/binapi/vxlan/vxlan_rest.ba.go new file mode 100644 index 0000000..ee35144 --- /dev/null +++ b/binapi/vxlan/vxlan_rest.ba.go @@ -0,0 +1,83 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package vxlan + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/sw_interface_set_vxlan_bypass", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceSetVxlanBypass) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceSetVxlanBypass(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/vxlan_add_del_tunnel", func(w http.ResponseWriter, req *http.Request) { + var request = new(VxlanAddDelTunnel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.VxlanAddDelTunnel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/vxlan_offload_rx", func(w http.ResponseWriter, req *http.Request) { + var request = new(VxlanOffloadRx) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.VxlanOffloadRx(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/vxlan/vxlan_rpc.ba.go b/binapi/vxlan/vxlan_rpc.ba.go new file mode 100644 index 0000000..5284fab --- /dev/null +++ b/binapi/vxlan/vxlan_rpc.ba.go @@ -0,0 +1,93 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package vxlan + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service vxlan. +type RPCService interface { + SwInterfaceSetVxlanBypass(ctx context.Context, in *SwInterfaceSetVxlanBypass) (*SwInterfaceSetVxlanBypassReply, error) + VxlanAddDelTunnel(ctx context.Context, in *VxlanAddDelTunnel) (*VxlanAddDelTunnelReply, error) + VxlanOffloadRx(ctx context.Context, in *VxlanOffloadRx) (*VxlanOffloadRxReply, error) + VxlanTunnelDump(ctx context.Context, in *VxlanTunnelDump) (RPCService_VxlanTunnelDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) SwInterfaceSetVxlanBypass(ctx context.Context, in *SwInterfaceSetVxlanBypass) (*SwInterfaceSetVxlanBypassReply, error) { + out := new(SwInterfaceSetVxlanBypassReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VxlanAddDelTunnel(ctx context.Context, in *VxlanAddDelTunnel) (*VxlanAddDelTunnelReply, error) { + out := new(VxlanAddDelTunnelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VxlanOffloadRx(ctx context.Context, in *VxlanOffloadRx) (*VxlanOffloadRxReply, error) { + out := new(VxlanOffloadRxReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VxlanTunnelDump(ctx context.Context, in *VxlanTunnelDump) (RPCService_VxlanTunnelDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_VxlanTunnelDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_VxlanTunnelDumpClient interface { + Recv() (*VxlanTunnelDetails, error) + api.Stream +} + +type serviceClient_VxlanTunnelDumpClient struct { + api.Stream +} + +func (c *serviceClient_VxlanTunnelDumpClient) Recv() (*VxlanTunnelDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *VxlanTunnelDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/vxlan_gbp/vxlan_gbp.ba.go b/binapi/vxlan_gbp/vxlan_gbp.ba.go new file mode 100644 index 0000000..d5c3f32 --- /dev/null +++ b/binapi/vxlan_gbp/vxlan_gbp.ba.go @@ -0,0 +1,385 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/vxlan_gbp.api.json + +// Package vxlan_gbp contains generated bindings for API file vxlan_gbp.api. +// +// Contents: +// 1 enum +// 1 struct +// 6 messages +// +package vxlan_gbp + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "vxlan_gbp" + APIVersion = "1.1.1" + VersionCrc = 0xfa8aff54 +) + +// VxlanGbpAPITunnelMode defines enum 'vxlan_gbp_api_tunnel_mode'. +type VxlanGbpAPITunnelMode uint32 + +const ( + VXLAN_GBP_API_TUNNEL_MODE_L2 VxlanGbpAPITunnelMode = 1 + VXLAN_GBP_API_TUNNEL_MODE_L3 VxlanGbpAPITunnelMode = 2 +) + +var ( + VxlanGbpAPITunnelMode_name = map[uint32]string{ + 1: "VXLAN_GBP_API_TUNNEL_MODE_L2", + 2: "VXLAN_GBP_API_TUNNEL_MODE_L3", + } + VxlanGbpAPITunnelMode_value = map[string]uint32{ + "VXLAN_GBP_API_TUNNEL_MODE_L2": 1, + "VXLAN_GBP_API_TUNNEL_MODE_L3": 2, + } +) + +func (x VxlanGbpAPITunnelMode) String() string { + s, ok := VxlanGbpAPITunnelMode_name[uint32(x)] + if ok { + return s + } + return "VxlanGbpAPITunnelMode(" + strconv.Itoa(int(x)) + ")" +} + +// VxlanGbpTunnel defines type 'vxlan_gbp_tunnel'. +type VxlanGbpTunnel struct { + Instance uint32 `binapi:"u32,name=instance" json:"instance,omitempty"` + Src ip_types.Address `binapi:"address,name=src" json:"src,omitempty"` + Dst ip_types.Address `binapi:"address,name=dst" json:"dst,omitempty"` + McastSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mcast_sw_if_index" json:"mcast_sw_if_index,omitempty"` + EncapTableID uint32 `binapi:"u32,name=encap_table_id" json:"encap_table_id,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Mode VxlanGbpAPITunnelMode `binapi:"vxlan_gbp_api_tunnel_mode,name=mode" json:"mode,omitempty"` +} + +// SwInterfaceSetVxlanGbpBypass defines message 'sw_interface_set_vxlan_gbp_bypass'. +type SwInterfaceSetVxlanGbpBypass struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + Enable bool `binapi:"bool,name=enable,default=true" json:"enable,omitempty"` +} + +func (m *SwInterfaceSetVxlanGbpBypass) Reset() { *m = SwInterfaceSetVxlanGbpBypass{} } +func (*SwInterfaceSetVxlanGbpBypass) GetMessageName() string { + return "sw_interface_set_vxlan_gbp_bypass" +} +func (*SwInterfaceSetVxlanGbpBypass) GetCrcString() string { return "65247409" } +func (*SwInterfaceSetVxlanGbpBypass) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetVxlanGbpBypass) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.IsIPv6 + size += 1 // m.Enable + return size +} +func (m *SwInterfaceSetVxlanGbpBypass) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsIPv6) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetVxlanGbpBypass) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsIPv6 = buf.DecodeBool() + m.Enable = buf.DecodeBool() + return nil +} + +// SwInterfaceSetVxlanGbpBypassReply defines message 'sw_interface_set_vxlan_gbp_bypass_reply'. +type SwInterfaceSetVxlanGbpBypassReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetVxlanGbpBypassReply) Reset() { *m = SwInterfaceSetVxlanGbpBypassReply{} } +func (*SwInterfaceSetVxlanGbpBypassReply) GetMessageName() string { + return "sw_interface_set_vxlan_gbp_bypass_reply" +} +func (*SwInterfaceSetVxlanGbpBypassReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetVxlanGbpBypassReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetVxlanGbpBypassReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetVxlanGbpBypassReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetVxlanGbpBypassReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// VxlanGbpTunnelAddDel defines message 'vxlan_gbp_tunnel_add_del'. +type VxlanGbpTunnelAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Tunnel VxlanGbpTunnel `binapi:"vxlan_gbp_tunnel,name=tunnel" json:"tunnel,omitempty"` +} + +func (m *VxlanGbpTunnelAddDel) Reset() { *m = VxlanGbpTunnelAddDel{} } +func (*VxlanGbpTunnelAddDel) GetMessageName() string { return "vxlan_gbp_tunnel_add_del" } +func (*VxlanGbpTunnelAddDel) GetCrcString() string { return "8c819166" } +func (*VxlanGbpTunnelAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VxlanGbpTunnelAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Tunnel.Instance + size += 1 // m.Tunnel.Src.Af + size += 1 * 16 // m.Tunnel.Src.Un + size += 1 // m.Tunnel.Dst.Af + size += 1 * 16 // m.Tunnel.Dst.Un + size += 4 // m.Tunnel.McastSwIfIndex + size += 4 // m.Tunnel.EncapTableID + size += 4 // m.Tunnel.Vni + size += 4 // m.Tunnel.SwIfIndex + size += 4 // m.Tunnel.Mode + return size +} +func (m *VxlanGbpTunnelAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Tunnel.Instance)) + buf.EncodeUint8(uint8(m.Tunnel.Src.Af)) + buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Tunnel.Dst.Af)) + buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.Tunnel.McastSwIfIndex)) + buf.EncodeUint32(uint32(m.Tunnel.EncapTableID)) + buf.EncodeUint32(uint32(m.Tunnel.Vni)) + buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex)) + buf.EncodeUint32(uint32(m.Tunnel.Mode)) + return buf.Bytes(), nil +} +func (m *VxlanGbpTunnelAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Tunnel.Instance = buf.DecodeUint32() + m.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Tunnel.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Tunnel.EncapTableID = buf.DecodeUint32() + m.Tunnel.Vni = buf.DecodeUint32() + m.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Tunnel.Mode = VxlanGbpAPITunnelMode(buf.DecodeUint32()) + return nil +} + +// VxlanGbpTunnelAddDelReply defines message 'vxlan_gbp_tunnel_add_del_reply'. +type VxlanGbpTunnelAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *VxlanGbpTunnelAddDelReply) Reset() { *m = VxlanGbpTunnelAddDelReply{} } +func (*VxlanGbpTunnelAddDelReply) GetMessageName() string { return "vxlan_gbp_tunnel_add_del_reply" } +func (*VxlanGbpTunnelAddDelReply) GetCrcString() string { return "5383d31f" } +func (*VxlanGbpTunnelAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VxlanGbpTunnelAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *VxlanGbpTunnelAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *VxlanGbpTunnelAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// VxlanGbpTunnelDetails defines message 'vxlan_gbp_tunnel_details'. +type VxlanGbpTunnelDetails struct { + Tunnel VxlanGbpTunnel `binapi:"vxlan_gbp_tunnel,name=tunnel" json:"tunnel,omitempty"` +} + +func (m *VxlanGbpTunnelDetails) Reset() { *m = VxlanGbpTunnelDetails{} } +func (*VxlanGbpTunnelDetails) GetMessageName() string { return "vxlan_gbp_tunnel_details" } +func (*VxlanGbpTunnelDetails) GetCrcString() string { return "1da24016" } +func (*VxlanGbpTunnelDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VxlanGbpTunnelDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Tunnel.Instance + size += 1 // m.Tunnel.Src.Af + size += 1 * 16 // m.Tunnel.Src.Un + size += 1 // m.Tunnel.Dst.Af + size += 1 * 16 // m.Tunnel.Dst.Un + size += 4 // m.Tunnel.McastSwIfIndex + size += 4 // m.Tunnel.EncapTableID + size += 4 // m.Tunnel.Vni + size += 4 // m.Tunnel.SwIfIndex + size += 4 // m.Tunnel.Mode + return size +} +func (m *VxlanGbpTunnelDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Tunnel.Instance)) + buf.EncodeUint8(uint8(m.Tunnel.Src.Af)) + buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Tunnel.Dst.Af)) + buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.Tunnel.McastSwIfIndex)) + buf.EncodeUint32(uint32(m.Tunnel.EncapTableID)) + buf.EncodeUint32(uint32(m.Tunnel.Vni)) + buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex)) + buf.EncodeUint32(uint32(m.Tunnel.Mode)) + return buf.Bytes(), nil +} +func (m *VxlanGbpTunnelDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Tunnel.Instance = buf.DecodeUint32() + m.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Tunnel.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Tunnel.EncapTableID = buf.DecodeUint32() + m.Tunnel.Vni = buf.DecodeUint32() + m.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Tunnel.Mode = VxlanGbpAPITunnelMode(buf.DecodeUint32()) + return nil +} + +// VxlanGbpTunnelDump defines message 'vxlan_gbp_tunnel_dump'. +type VxlanGbpTunnelDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"` +} + +func (m *VxlanGbpTunnelDump) Reset() { *m = VxlanGbpTunnelDump{} } +func (*VxlanGbpTunnelDump) GetMessageName() string { return "vxlan_gbp_tunnel_dump" } +func (*VxlanGbpTunnelDump) GetCrcString() string { return "f9e6675e" } +func (*VxlanGbpTunnelDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VxlanGbpTunnelDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *VxlanGbpTunnelDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *VxlanGbpTunnelDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +func init() { file_vxlan_gbp_binapi_init() } +func file_vxlan_gbp_binapi_init() { + api.RegisterMessage((*SwInterfaceSetVxlanGbpBypass)(nil), "sw_interface_set_vxlan_gbp_bypass_65247409") + api.RegisterMessage((*SwInterfaceSetVxlanGbpBypassReply)(nil), "sw_interface_set_vxlan_gbp_bypass_reply_e8d4e804") + api.RegisterMessage((*VxlanGbpTunnelAddDel)(nil), "vxlan_gbp_tunnel_add_del_8c819166") + api.RegisterMessage((*VxlanGbpTunnelAddDelReply)(nil), "vxlan_gbp_tunnel_add_del_reply_5383d31f") + api.RegisterMessage((*VxlanGbpTunnelDetails)(nil), "vxlan_gbp_tunnel_details_1da24016") + api.RegisterMessage((*VxlanGbpTunnelDump)(nil), "vxlan_gbp_tunnel_dump_f9e6675e") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SwInterfaceSetVxlanGbpBypass)(nil), + (*SwInterfaceSetVxlanGbpBypassReply)(nil), + (*VxlanGbpTunnelAddDel)(nil), + (*VxlanGbpTunnelAddDelReply)(nil), + (*VxlanGbpTunnelDetails)(nil), + (*VxlanGbpTunnelDump)(nil), + } +} diff --git a/binapi/vxlan_gbp/vxlan_gbp_rest.ba.go b/binapi/vxlan_gbp/vxlan_gbp_rest.ba.go new file mode 100644 index 0000000..5d94785 --- /dev/null +++ b/binapi/vxlan_gbp/vxlan_gbp_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package vxlan_gbp + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/sw_interface_set_vxlan_gbp_bypass", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceSetVxlanGbpBypass) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceSetVxlanGbpBypass(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/vxlan_gbp_tunnel_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(VxlanGbpTunnelAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.VxlanGbpTunnelAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/vxlan_gbp/vxlan_gbp_rpc.ba.go b/binapi/vxlan_gbp/vxlan_gbp_rpc.ba.go new file mode 100644 index 0000000..7d23984 --- /dev/null +++ b/binapi/vxlan_gbp/vxlan_gbp_rpc.ba.go @@ -0,0 +1,83 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package vxlan_gbp + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service vxlan_gbp. +type RPCService interface { + SwInterfaceSetVxlanGbpBypass(ctx context.Context, in *SwInterfaceSetVxlanGbpBypass) (*SwInterfaceSetVxlanGbpBypassReply, error) + VxlanGbpTunnelAddDel(ctx context.Context, in *VxlanGbpTunnelAddDel) (*VxlanGbpTunnelAddDelReply, error) + VxlanGbpTunnelDump(ctx context.Context, in *VxlanGbpTunnelDump) (RPCService_VxlanGbpTunnelDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) SwInterfaceSetVxlanGbpBypass(ctx context.Context, in *SwInterfaceSetVxlanGbpBypass) (*SwInterfaceSetVxlanGbpBypassReply, error) { + out := new(SwInterfaceSetVxlanGbpBypassReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VxlanGbpTunnelAddDel(ctx context.Context, in *VxlanGbpTunnelAddDel) (*VxlanGbpTunnelAddDelReply, error) { + out := new(VxlanGbpTunnelAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VxlanGbpTunnelDump(ctx context.Context, in *VxlanGbpTunnelDump) (RPCService_VxlanGbpTunnelDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_VxlanGbpTunnelDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_VxlanGbpTunnelDumpClient interface { + Recv() (*VxlanGbpTunnelDetails, error) + api.Stream +} + +type serviceClient_VxlanGbpTunnelDumpClient struct { + api.Stream +} + +func (c *serviceClient_VxlanGbpTunnelDumpClient) Recv() (*VxlanGbpTunnelDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *VxlanGbpTunnelDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/vxlan_gpe/vxlan_gpe.ba.go b/binapi/vxlan_gpe/vxlan_gpe.ba.go new file mode 100644 index 0000000..9da919d --- /dev/null +++ b/binapi/vxlan_gpe/vxlan_gpe.ba.go @@ -0,0 +1,357 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/vxlan_gpe.api.json + +// Package vxlan_gpe contains generated bindings for API file vxlan_gpe.api. +// +// Contents: +// 6 messages +// +package vxlan_gpe + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "vxlan_gpe" + APIVersion = "2.0.0" + VersionCrc = 0x8295f28f +) + +// SwInterfaceSetVxlanGpeBypass defines message 'sw_interface_set_vxlan_gpe_bypass'. +type SwInterfaceSetVxlanGpeBypass struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + Enable bool `binapi:"bool,name=enable,default=true" json:"enable,omitempty"` +} + +func (m *SwInterfaceSetVxlanGpeBypass) Reset() { *m = SwInterfaceSetVxlanGpeBypass{} } +func (*SwInterfaceSetVxlanGpeBypass) GetMessageName() string { + return "sw_interface_set_vxlan_gpe_bypass" +} +func (*SwInterfaceSetVxlanGpeBypass) GetCrcString() string { return "65247409" } +func (*SwInterfaceSetVxlanGpeBypass) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetVxlanGpeBypass) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.IsIPv6 + size += 1 // m.Enable + return size +} +func (m *SwInterfaceSetVxlanGpeBypass) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsIPv6) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetVxlanGpeBypass) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsIPv6 = buf.DecodeBool() + m.Enable = buf.DecodeBool() + return nil +} + +// SwInterfaceSetVxlanGpeBypassReply defines message 'sw_interface_set_vxlan_gpe_bypass_reply'. +type SwInterfaceSetVxlanGpeBypassReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetVxlanGpeBypassReply) Reset() { *m = SwInterfaceSetVxlanGpeBypassReply{} } +func (*SwInterfaceSetVxlanGpeBypassReply) GetMessageName() string { + return "sw_interface_set_vxlan_gpe_bypass_reply" +} +func (*SwInterfaceSetVxlanGpeBypassReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetVxlanGpeBypassReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetVxlanGpeBypassReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetVxlanGpeBypassReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetVxlanGpeBypassReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// VxlanGpeAddDelTunnel defines message 'vxlan_gpe_add_del_tunnel'. +type VxlanGpeAddDelTunnel struct { + Local ip_types.Address `binapi:"address,name=local" json:"local,omitempty"` + Remote ip_types.Address `binapi:"address,name=remote" json:"remote,omitempty"` + McastSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mcast_sw_if_index" json:"mcast_sw_if_index,omitempty"` + EncapVrfID uint32 `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"` + DecapVrfID uint32 `binapi:"u32,name=decap_vrf_id" json:"decap_vrf_id,omitempty"` + Protocol ip_types.IPProto `binapi:"ip_proto,name=protocol" json:"protocol,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` +} + +func (m *VxlanGpeAddDelTunnel) Reset() { *m = VxlanGpeAddDelTunnel{} } +func (*VxlanGpeAddDelTunnel) GetMessageName() string { return "vxlan_gpe_add_del_tunnel" } +func (*VxlanGpeAddDelTunnel) GetCrcString() string { return "7c6da6ae" } +func (*VxlanGpeAddDelTunnel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VxlanGpeAddDelTunnel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Local.Af + size += 1 * 16 // m.Local.Un + size += 1 // m.Remote.Af + size += 1 * 16 // m.Remote.Un + size += 4 // m.McastSwIfIndex + size += 4 // m.EncapVrfID + size += 4 // m.DecapVrfID + size += 1 // m.Protocol + size += 4 // m.Vni + size += 1 // m.IsAdd + return size +} +func (m *VxlanGpeAddDelTunnel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Local.Af)) + buf.EncodeBytes(m.Local.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Remote.Af)) + buf.EncodeBytes(m.Remote.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.McastSwIfIndex)) + buf.EncodeUint32(uint32(m.EncapVrfID)) + buf.EncodeUint32(uint32(m.DecapVrfID)) + buf.EncodeUint8(uint8(m.Protocol)) + buf.EncodeUint32(uint32(m.Vni)) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *VxlanGpeAddDelTunnel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Local.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Local.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Remote.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Remote.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.EncapVrfID = buf.DecodeUint32() + m.DecapVrfID = buf.DecodeUint32() + m.Protocol = ip_types.IPProto(buf.DecodeUint8()) + m.Vni = buf.DecodeUint32() + m.IsAdd = buf.DecodeBool() + return nil +} + +// VxlanGpeAddDelTunnelReply defines message 'vxlan_gpe_add_del_tunnel_reply'. +type VxlanGpeAddDelTunnelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *VxlanGpeAddDelTunnelReply) Reset() { *m = VxlanGpeAddDelTunnelReply{} } +func (*VxlanGpeAddDelTunnelReply) GetMessageName() string { return "vxlan_gpe_add_del_tunnel_reply" } +func (*VxlanGpeAddDelTunnelReply) GetCrcString() string { return "5383d31f" } +func (*VxlanGpeAddDelTunnelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VxlanGpeAddDelTunnelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *VxlanGpeAddDelTunnelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *VxlanGpeAddDelTunnelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// VxlanGpeTunnelDetails defines message 'vxlan_gpe_tunnel_details'. +type VxlanGpeTunnelDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Local ip_types.Address `binapi:"address,name=local" json:"local,omitempty"` + Remote ip_types.Address `binapi:"address,name=remote" json:"remote,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + Protocol ip_types.IPProto `binapi:"ip_proto,name=protocol" json:"protocol,omitempty"` + McastSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mcast_sw_if_index" json:"mcast_sw_if_index,omitempty"` + EncapVrfID uint32 `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"` + DecapVrfID uint32 `binapi:"u32,name=decap_vrf_id" json:"decap_vrf_id,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` +} + +func (m *VxlanGpeTunnelDetails) Reset() { *m = VxlanGpeTunnelDetails{} } +func (*VxlanGpeTunnelDetails) GetMessageName() string { return "vxlan_gpe_tunnel_details" } +func (*VxlanGpeTunnelDetails) GetCrcString() string { return "57712346" } +func (*VxlanGpeTunnelDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VxlanGpeTunnelDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Local.Af + size += 1 * 16 // m.Local.Un + size += 1 // m.Remote.Af + size += 1 * 16 // m.Remote.Un + size += 4 // m.Vni + size += 1 // m.Protocol + size += 4 // m.McastSwIfIndex + size += 4 // m.EncapVrfID + size += 4 // m.DecapVrfID + size += 1 // m.IsIPv6 + return size +} +func (m *VxlanGpeTunnelDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.Local.Af)) + buf.EncodeBytes(m.Local.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Remote.Af)) + buf.EncodeBytes(m.Remote.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.Vni)) + buf.EncodeUint8(uint8(m.Protocol)) + buf.EncodeUint32(uint32(m.McastSwIfIndex)) + buf.EncodeUint32(uint32(m.EncapVrfID)) + buf.EncodeUint32(uint32(m.DecapVrfID)) + buf.EncodeBool(m.IsIPv6) + return buf.Bytes(), nil +} +func (m *VxlanGpeTunnelDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Local.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Local.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Remote.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Remote.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Vni = buf.DecodeUint32() + m.Protocol = ip_types.IPProto(buf.DecodeUint8()) + m.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.EncapVrfID = buf.DecodeUint32() + m.DecapVrfID = buf.DecodeUint32() + m.IsIPv6 = buf.DecodeBool() + return nil +} + +// VxlanGpeTunnelDump defines message 'vxlan_gpe_tunnel_dump'. +type VxlanGpeTunnelDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *VxlanGpeTunnelDump) Reset() { *m = VxlanGpeTunnelDump{} } +func (*VxlanGpeTunnelDump) GetMessageName() string { return "vxlan_gpe_tunnel_dump" } +func (*VxlanGpeTunnelDump) GetCrcString() string { return "f9e6675e" } +func (*VxlanGpeTunnelDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VxlanGpeTunnelDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *VxlanGpeTunnelDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *VxlanGpeTunnelDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +func init() { file_vxlan_gpe_binapi_init() } +func file_vxlan_gpe_binapi_init() { + api.RegisterMessage((*SwInterfaceSetVxlanGpeBypass)(nil), "sw_interface_set_vxlan_gpe_bypass_65247409") + api.RegisterMessage((*SwInterfaceSetVxlanGpeBypassReply)(nil), "sw_interface_set_vxlan_gpe_bypass_reply_e8d4e804") + api.RegisterMessage((*VxlanGpeAddDelTunnel)(nil), "vxlan_gpe_add_del_tunnel_7c6da6ae") + api.RegisterMessage((*VxlanGpeAddDelTunnelReply)(nil), "vxlan_gpe_add_del_tunnel_reply_5383d31f") + api.RegisterMessage((*VxlanGpeTunnelDetails)(nil), "vxlan_gpe_tunnel_details_57712346") + api.RegisterMessage((*VxlanGpeTunnelDump)(nil), "vxlan_gpe_tunnel_dump_f9e6675e") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SwInterfaceSetVxlanGpeBypass)(nil), + (*SwInterfaceSetVxlanGpeBypassReply)(nil), + (*VxlanGpeAddDelTunnel)(nil), + (*VxlanGpeAddDelTunnelReply)(nil), + (*VxlanGpeTunnelDetails)(nil), + (*VxlanGpeTunnelDump)(nil), + } +} diff --git a/binapi/vxlan_gpe/vxlan_gpe_rest.ba.go b/binapi/vxlan_gpe/vxlan_gpe_rest.ba.go new file mode 100644 index 0000000..0761ca3 --- /dev/null +++ b/binapi/vxlan_gpe/vxlan_gpe_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package vxlan_gpe + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/sw_interface_set_vxlan_gpe_bypass", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceSetVxlanGpeBypass) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceSetVxlanGpeBypass(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/vxlan_gpe_add_del_tunnel", func(w http.ResponseWriter, req *http.Request) { + var request = new(VxlanGpeAddDelTunnel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.VxlanGpeAddDelTunnel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/vxlan_gpe/vxlan_gpe_rpc.ba.go b/binapi/vxlan_gpe/vxlan_gpe_rpc.ba.go new file mode 100644 index 0000000..f36262e --- /dev/null +++ b/binapi/vxlan_gpe/vxlan_gpe_rpc.ba.go @@ -0,0 +1,83 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package vxlan_gpe + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service vxlan_gpe. +type RPCService interface { + SwInterfaceSetVxlanGpeBypass(ctx context.Context, in *SwInterfaceSetVxlanGpeBypass) (*SwInterfaceSetVxlanGpeBypassReply, error) + VxlanGpeAddDelTunnel(ctx context.Context, in *VxlanGpeAddDelTunnel) (*VxlanGpeAddDelTunnelReply, error) + VxlanGpeTunnelDump(ctx context.Context, in *VxlanGpeTunnelDump) (RPCService_VxlanGpeTunnelDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) SwInterfaceSetVxlanGpeBypass(ctx context.Context, in *SwInterfaceSetVxlanGpeBypass) (*SwInterfaceSetVxlanGpeBypassReply, error) { + out := new(SwInterfaceSetVxlanGpeBypassReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VxlanGpeAddDelTunnel(ctx context.Context, in *VxlanGpeAddDelTunnel) (*VxlanGpeAddDelTunnelReply, error) { + out := new(VxlanGpeAddDelTunnelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VxlanGpeTunnelDump(ctx context.Context, in *VxlanGpeTunnelDump) (RPCService_VxlanGpeTunnelDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_VxlanGpeTunnelDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_VxlanGpeTunnelDumpClient interface { + Recv() (*VxlanGpeTunnelDetails, error) + api.Stream +} + +type serviceClient_VxlanGpeTunnelDumpClient struct { + api.Stream +} + +func (c *serviceClient_VxlanGpeTunnelDumpClient) Recv() (*VxlanGpeTunnelDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *VxlanGpeTunnelDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export.ba.go b/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export.ba.go new file mode 100644 index 0000000..5a25905 --- /dev/null +++ b/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export.ba.go @@ -0,0 +1,128 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/vxlan_gpe_ioam_export.api.json + +// Package vxlan_gpe_ioam_export contains generated bindings for API file vxlan_gpe_ioam_export.api. +// +// Contents: +// 2 messages +// +package vxlan_gpe_ioam_export + +import ( + api "git.fd.io/govpp.git/api" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "vxlan_gpe_ioam_export" + APIVersion = "1.0.0" + VersionCrc = 0x56bd3b73 +) + +// VxlanGpeIoamExportEnableDisable defines message 'vxlan_gpe_ioam_export_enable_disable'. +type VxlanGpeIoamExportEnableDisable struct { + IsDisable bool `binapi:"bool,name=is_disable" json:"is_disable,omitempty"` + CollectorAddress ip_types.IP4Address `binapi:"ip4_address,name=collector_address" json:"collector_address,omitempty"` + SrcAddress ip_types.IP4Address `binapi:"ip4_address,name=src_address" json:"src_address,omitempty"` +} + +func (m *VxlanGpeIoamExportEnableDisable) Reset() { *m = VxlanGpeIoamExportEnableDisable{} } +func (*VxlanGpeIoamExportEnableDisable) GetMessageName() string { + return "vxlan_gpe_ioam_export_enable_disable" +} +func (*VxlanGpeIoamExportEnableDisable) GetCrcString() string { return "e4d4ebfa" } +func (*VxlanGpeIoamExportEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VxlanGpeIoamExportEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsDisable + size += 1 * 4 // m.CollectorAddress + size += 1 * 4 // m.SrcAddress + return size +} +func (m *VxlanGpeIoamExportEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsDisable) + buf.EncodeBytes(m.CollectorAddress[:], 4) + buf.EncodeBytes(m.SrcAddress[:], 4) + return buf.Bytes(), nil +} +func (m *VxlanGpeIoamExportEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsDisable = buf.DecodeBool() + copy(m.CollectorAddress[:], buf.DecodeBytes(4)) + copy(m.SrcAddress[:], buf.DecodeBytes(4)) + return nil +} + +// VxlanGpeIoamExportEnableDisableReply defines message 'vxlan_gpe_ioam_export_enable_disable_reply'. +type VxlanGpeIoamExportEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *VxlanGpeIoamExportEnableDisableReply) Reset() { *m = VxlanGpeIoamExportEnableDisableReply{} } +func (*VxlanGpeIoamExportEnableDisableReply) GetMessageName() string { + return "vxlan_gpe_ioam_export_enable_disable_reply" +} +func (*VxlanGpeIoamExportEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*VxlanGpeIoamExportEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VxlanGpeIoamExportEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *VxlanGpeIoamExportEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *VxlanGpeIoamExportEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_vxlan_gpe_ioam_export_binapi_init() } +func file_vxlan_gpe_ioam_export_binapi_init() { + api.RegisterMessage((*VxlanGpeIoamExportEnableDisable)(nil), "vxlan_gpe_ioam_export_enable_disable_e4d4ebfa") + api.RegisterMessage((*VxlanGpeIoamExportEnableDisableReply)(nil), "vxlan_gpe_ioam_export_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*VxlanGpeIoamExportEnableDisable)(nil), + (*VxlanGpeIoamExportEnableDisableReply)(nil), + } +} diff --git a/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rest.ba.go b/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rest.ba.go new file mode 100644 index 0000000..b2cf182 --- /dev/null +++ b/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package vxlan_gpe_ioam_export + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/vxlan_gpe_ioam_export_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(VxlanGpeIoamExportEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.VxlanGpeIoamExportEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rpc.ba.go b/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rpc.ba.go new file mode 100644 index 0000000..ce35b62 --- /dev/null +++ b/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rpc.ba.go @@ -0,0 +1,30 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package vxlan_gpe_ioam_export + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service vxlan_gpe_ioam_export. +type RPCService interface { + VxlanGpeIoamExportEnableDisable(ctx context.Context, in *VxlanGpeIoamExportEnableDisable) (*VxlanGpeIoamExportEnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) VxlanGpeIoamExportEnableDisable(ctx context.Context, in *VxlanGpeIoamExportEnableDisable) (*VxlanGpeIoamExportEnableDisableReply, error) { + out := new(VxlanGpeIoamExportEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} |