From a101d966133a70b8a76526be25070436d14fcf9f Mon Sep 17 00:00:00 2001 From: Rastislav Szabo Date: Thu, 4 May 2017 11:09:03 +0200 Subject: initial commit Signed-off-by: Rastislav Szabo --- examples/bin_api/acl.api.json | 212 +++++++ examples/bin_api/acl/acl.go | 788 ++++++++++++++++++++++++ examples/bin_api/af_packet.api.json | 37 ++ examples/bin_api/af_packet/af_packet.go | 124 ++++ examples/bin_api/interface.api.json | 195 ++++++ examples/bin_api/interfaces/interfaces.go | 688 +++++++++++++++++++++ examples/bin_api/ip.api.json | 292 +++++++++ examples/bin_api/ip/ip.go | 993 ++++++++++++++++++++++++++++++ examples/bin_api/memif.api.json | 61 ++ examples/bin_api/memif/memif.go | 201 ++++++ examples/bin_api/tap.api.json | 78 +++ examples/bin_api/tap/tap.go | 264 ++++++++ examples/bin_api/uflow.api.json | 78 +++ examples/bin_api/uflow/uflow.go | 299 +++++++++ examples/example_client.go | 269 ++++++++ examples/examples | Bin 0 -> 3001869 bytes 16 files changed, 4579 insertions(+) create mode 100644 examples/bin_api/acl.api.json create mode 100644 examples/bin_api/acl/acl.go create mode 100644 examples/bin_api/af_packet.api.json create mode 100644 examples/bin_api/af_packet/af_packet.go create mode 100644 examples/bin_api/interface.api.json create mode 100644 examples/bin_api/interfaces/interfaces.go create mode 100644 examples/bin_api/ip.api.json create mode 100644 examples/bin_api/ip/ip.go create mode 100644 examples/bin_api/memif.api.json create mode 100644 examples/bin_api/memif/memif.go create mode 100644 examples/bin_api/tap.api.json create mode 100644 examples/bin_api/tap/tap.go create mode 100644 examples/bin_api/uflow.api.json create mode 100644 examples/bin_api/uflow/uflow.go create mode 100644 examples/example_client.go create mode 100755 examples/examples (limited to 'examples') diff --git a/examples/bin_api/acl.api.json b/examples/bin_api/acl.api.json new file mode 100644 index 0000000..1c2e2bf --- /dev/null +++ b/examples/bin_api/acl.api.json @@ -0,0 +1,212 @@ +{ + "types" : [ + ["acl_rule", + ["u8", "is_permit"], + ["u8", "is_ipv6"], + ["u8", "src_ip_addr", 16], + ["u8", "src_ip_prefix_len"], + ["u8", "dst_ip_addr", 16], + ["u8", "dst_ip_prefix_len"], + ["u8", "proto"], + ["u16", "srcport_or_icmptype_first"], + ["u16", "srcport_or_icmptype_last"], + ["u16", "dstport_or_icmpcode_first"], + ["u16", "dstport_or_icmpcode_last"], + ["u8", "tcp_flags_mask"], + ["u8", "tcp_flags_value"], + {"crc" : "0x2715e1c0"} + ], + ["macip_acl_rule", + ["u8", "is_permit"], + ["u8", "is_ipv6"], + ["u8", "src_mac", 6], + ["u8", "src_mac_mask", 6], + ["u8", "src_ip_addr", 16], + ["u8", "src_ip_prefix_len"], + {"crc" : "0x6723f13e"} + ] + ], + "messages" : [ + ["acl_plugin_get_version", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + {"crc" : "0xd7c07748"} + ], + ["acl_plugin_get_version_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["u32", "major"], + ["u32", "minor"], + {"crc" : "0x43eb59a5"} + ], + ["acl_add_replace", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "acl_index"], + ["u8", "tag", 64], + ["u32", "count"], + ["vl_api_acl_rule_t", "r", 0, "count"], + {"crc" : "0x3c317936"} + ], + ["acl_add_replace_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["u32", "acl_index"], + ["i32", "retval"], + {"crc" : "0xa5e6d0cf"} + ], + ["acl_del", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "acl_index"], + {"crc" : "0x82cc30ed"} + ], + ["acl_del_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0xbbb83d84"} + ], + ["acl_interface_add_del", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u8", "is_add"], + ["u8", "is_input"], + ["u32", "sw_if_index"], + ["u32", "acl_index"], + {"crc" : "0x98b53725"} + ], + ["acl_interface_add_del_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0xc1b3c077"} + ], + ["acl_interface_set_acl_list", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "sw_if_index"], + ["u8", "count"], + ["u8", "n_input"], + ["u32", "acls", 0, "count"], + {"crc" : "0x7562419c"} + ], + ["acl_interface_set_acl_list_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0x435ddc2b"} + ], + ["acl_dump", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "acl_index"], + {"crc" : "0xc188156d"} + ], + ["acl_details", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["u32", "acl_index"], + ["u8", "tag", 64], + ["u32", "count"], + ["vl_api_acl_rule_t", "r", 0, "count"], + {"crc" : "0x1c8916b7"} + ], + ["acl_interface_list_dump", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "sw_if_index"], + {"crc" : "0xadfe84b8"} + ], + ["acl_interface_list_details", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["u32", "sw_if_index"], + ["u8", "count"], + ["u8", "n_input"], + ["u32", "acls", 0, "count"], + {"crc" : "0xc8150656"} + ], + ["macip_acl_add", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u8", "tag", 64], + ["u32", "count"], + ["vl_api_macip_acl_rule_t", "r", 0, "count"], + {"crc" : "0x33356284"} + ], + ["macip_acl_add_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["u32", "acl_index"], + ["i32", "retval"], + {"crc" : "0x472edb4c"} + ], + ["macip_acl_del", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "acl_index"], + {"crc" : "0xdde1141f"} + ], + ["macip_acl_del_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0xeeb60e0f"} + ], + ["macip_acl_interface_add_del", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u8", "is_add"], + ["u32", "sw_if_index"], + ["u32", "acl_index"], + {"crc" : "0x03a4fab2"} + ], + ["macip_acl_interface_add_del_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0x9e9ee485"} + ], + ["macip_acl_dump", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "acl_index"], + {"crc" : "0xd38227cb"} + ], + ["macip_acl_details", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["u32", "acl_index"], + ["u8", "tag", 64], + ["u32", "count"], + ["vl_api_macip_acl_rule_t", "r", 0, "count"], + {"crc" : "0xee1c50db"} + ], + ["macip_acl_interface_get", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + {"crc" : "0x317ce31c"} + ], + ["macip_acl_interface_get_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["u32", "count"], + ["u32", "acls", 0, "count"], + {"crc" : "0x6c86a56c"} + ] + ], +"vl_api_version" :"0x3cd02d84" +} diff --git a/examples/bin_api/acl/acl.go b/examples/bin_api/acl/acl.go new file mode 100644 index 0000000..89b3805 --- /dev/null +++ b/examples/bin_api/acl/acl.go @@ -0,0 +1,788 @@ +// Package acl represents the VPP binary API of the 'acl' VPP module. +// DO NOT EDIT. Generated from 'bin_api/acl.api.json' on Fri, 21 Apr 2017 17:10:06 CEST. +package acl + +import "gerrit.fd.io/r/govpp/api" + +// VlApiVersion contains version of the API. +const VlAPIVersion = 0x3cd02d84 + +// ACLRule represents the VPP binary API data type 'acl_rule'. +// Generated from 'bin_api/acl.api.json', line 3: +// +// ["acl_rule", +// ["u8", "is_permit"], +// ["u8", "is_ipv6"], +// ["u8", "src_ip_addr", 16], +// ["u8", "src_ip_prefix_len"], +// ["u8", "dst_ip_addr", 16], +// ["u8", "dst_ip_prefix_len"], +// ["u8", "proto"], +// ["u16", "srcport_or_icmptype_first"], +// ["u16", "srcport_or_icmptype_last"], +// ["u16", "dstport_or_icmpcode_first"], +// ["u16", "dstport_or_icmpcode_last"], +// ["u8", "tcp_flags_mask"], +// ["u8", "tcp_flags_value"], +// {"crc" : "0x2715e1c0"} +// ], +// +type ACLRule struct { + IsPermit uint8 + IsIpv6 uint8 + SrcIPAddr []byte `struc:"[16]byte"` + SrcIPPrefixLen uint8 + DstIPAddr []byte `struc:"[16]byte"` + DstIPPrefixLen uint8 + Proto uint8 + SrcportOrIcmptypeFirst uint16 + SrcportOrIcmptypeLast uint16 + DstportOrIcmpcodeFirst uint16 + DstportOrIcmpcodeLast uint16 + TCPFlagsMask uint8 + TCPFlagsValue uint8 +} + +func (*ACLRule) GetTypeName() string { + return "acl_rule" +} +func (*ACLRule) GetCrcString() string { + return "2715e1c0" +} + +// MacipACLRule represents the VPP binary API data type 'macip_acl_rule'. +// Generated from 'bin_api/acl.api.json', line 19: +// +// ["macip_acl_rule", +// ["u8", "is_permit"], +// ["u8", "is_ipv6"], +// ["u8", "src_mac", 6], +// ["u8", "src_mac_mask", 6], +// ["u8", "src_ip_addr", 16], +// ["u8", "src_ip_prefix_len"], +// {"crc" : "0x6723f13e"} +// ] +// +type MacipACLRule struct { + IsPermit uint8 + IsIpv6 uint8 + SrcMac []byte `struc:"[6]byte"` + SrcMacMask []byte `struc:"[6]byte"` + SrcIPAddr []byte `struc:"[16]byte"` + SrcIPPrefixLen uint8 +} + +func (*MacipACLRule) GetTypeName() string { + return "macip_acl_rule" +} +func (*MacipACLRule) GetCrcString() string { + return "6723f13e" +} + +// ACLPluginGetVersion represents the VPP binary API message 'acl_plugin_get_version'. +// Generated from 'bin_api/acl.api.json', line 30: +// +// ["acl_plugin_get_version", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// {"crc" : "0xd7c07748"} +// ], +// +type ACLPluginGetVersion struct { +} + +func (*ACLPluginGetVersion) GetMessageName() string { + return "acl_plugin_get_version" +} +func (*ACLPluginGetVersion) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*ACLPluginGetVersion) GetCrcString() string { + return "d7c07748" +} +func NewACLPluginGetVersion() api.Message { + return &ACLPluginGetVersion{} +} + +// ACLPluginGetVersionReply represents the VPP binary API message 'acl_plugin_get_version_reply'. +// Generated from 'bin_api/acl.api.json', line 36: +// +// ["acl_plugin_get_version_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["u32", "major"], +// ["u32", "minor"], +// {"crc" : "0x43eb59a5"} +// ], +// +type ACLPluginGetVersionReply struct { + Major uint32 + Minor uint32 +} + +func (*ACLPluginGetVersionReply) GetMessageName() string { + return "acl_plugin_get_version_reply" +} +func (*ACLPluginGetVersionReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*ACLPluginGetVersionReply) GetCrcString() string { + return "43eb59a5" +} +func NewACLPluginGetVersionReply() api.Message { + return &ACLPluginGetVersionReply{} +} + +// ACLAddReplace represents the VPP binary API message 'acl_add_replace'. +// Generated from 'bin_api/acl.api.json', line 43: +// +// ["acl_add_replace", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "acl_index"], +// ["u8", "tag", 64], +// ["u32", "count"], +// ["vl_api_acl_rule_t", "r", 0, "count"], +// {"crc" : "0x3c317936"} +// ], +// +type ACLAddReplace struct { + ACLIndex uint32 + Tag []byte `struc:"[64]byte"` + Count uint32 `struc:"sizeof=R"` + R []ACLRule +} + +func (*ACLAddReplace) GetMessageName() string { + return "acl_add_replace" +} +func (*ACLAddReplace) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*ACLAddReplace) GetCrcString() string { + return "3c317936" +} +func NewACLAddReplace() api.Message { + return &ACLAddReplace{} +} + +// ACLAddReplaceReply represents the VPP binary API message 'acl_add_replace_reply'. +// Generated from 'bin_api/acl.api.json', line 53: +// +// ["acl_add_replace_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["u32", "acl_index"], +// ["i32", "retval"], +// {"crc" : "0xa5e6d0cf"} +// ], +// +type ACLAddReplaceReply struct { + ACLIndex uint32 + Retval int32 +} + +func (*ACLAddReplaceReply) GetMessageName() string { + return "acl_add_replace_reply" +} +func (*ACLAddReplaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*ACLAddReplaceReply) GetCrcString() string { + return "a5e6d0cf" +} +func NewACLAddReplaceReply() api.Message { + return &ACLAddReplaceReply{} +} + +// ACLDel represents the VPP binary API message 'acl_del'. +// Generated from 'bin_api/acl.api.json', line 60: +// +// ["acl_del", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "acl_index"], +// {"crc" : "0x82cc30ed"} +// ], +// +type ACLDel struct { + ACLIndex uint32 +} + +func (*ACLDel) GetMessageName() string { + return "acl_del" +} +func (*ACLDel) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*ACLDel) GetCrcString() string { + return "82cc30ed" +} +func NewACLDel() api.Message { + return &ACLDel{} +} + +// ACLDelReply represents the VPP binary API message 'acl_del_reply'. +// Generated from 'bin_api/acl.api.json', line 67: +// +// ["acl_del_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0xbbb83d84"} +// ], +// +type ACLDelReply struct { + Retval int32 +} + +func (*ACLDelReply) GetMessageName() string { + return "acl_del_reply" +} +func (*ACLDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*ACLDelReply) GetCrcString() string { + return "bbb83d84" +} +func NewACLDelReply() api.Message { + return &ACLDelReply{} +} + +// ACLInterfaceAddDel represents the VPP binary API message 'acl_interface_add_del'. +// Generated from 'bin_api/acl.api.json', line 73: +// +// ["acl_interface_add_del", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u8", "is_add"], +// ["u8", "is_input"], +// ["u32", "sw_if_index"], +// ["u32", "acl_index"], +// {"crc" : "0x98b53725"} +// ], +// +type ACLInterfaceAddDel struct { + IsAdd uint8 + IsInput uint8 + SwIfIndex uint32 + ACLIndex uint32 +} + +func (*ACLInterfaceAddDel) GetMessageName() string { + return "acl_interface_add_del" +} +func (*ACLInterfaceAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*ACLInterfaceAddDel) GetCrcString() string { + return "98b53725" +} +func NewACLInterfaceAddDel() api.Message { + return &ACLInterfaceAddDel{} +} + +// ACLInterfaceAddDelReply represents the VPP binary API message 'acl_interface_add_del_reply'. +// Generated from 'bin_api/acl.api.json', line 83: +// +// ["acl_interface_add_del_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0xc1b3c077"} +// ], +// +type ACLInterfaceAddDelReply struct { + Retval int32 +} + +func (*ACLInterfaceAddDelReply) GetMessageName() string { + return "acl_interface_add_del_reply" +} +func (*ACLInterfaceAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*ACLInterfaceAddDelReply) GetCrcString() string { + return "c1b3c077" +} +func NewACLInterfaceAddDelReply() api.Message { + return &ACLInterfaceAddDelReply{} +} + +// ACLInterfaceSetACLList represents the VPP binary API message 'acl_interface_set_acl_list'. +// Generated from 'bin_api/acl.api.json', line 89: +// +// ["acl_interface_set_acl_list", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// ["u8", "count"], +// ["u8", "n_input"], +// ["u32", "acls", 0, "count"], +// {"crc" : "0x7562419c"} +// ], +// +type ACLInterfaceSetACLList struct { + SwIfIndex uint32 + Count uint8 `struc:"sizeof=Acls"` + NInput uint8 + Acls []uint32 +} + +func (*ACLInterfaceSetACLList) GetMessageName() string { + return "acl_interface_set_acl_list" +} +func (*ACLInterfaceSetACLList) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*ACLInterfaceSetACLList) GetCrcString() string { + return "7562419c" +} +func NewACLInterfaceSetACLList() api.Message { + return &ACLInterfaceSetACLList{} +} + +// ACLInterfaceSetACLListReply represents the VPP binary API message 'acl_interface_set_acl_list_reply'. +// Generated from 'bin_api/acl.api.json', line 99: +// +// ["acl_interface_set_acl_list_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0x435ddc2b"} +// ], +// +type ACLInterfaceSetACLListReply struct { + Retval int32 +} + +func (*ACLInterfaceSetACLListReply) GetMessageName() string { + return "acl_interface_set_acl_list_reply" +} +func (*ACLInterfaceSetACLListReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*ACLInterfaceSetACLListReply) GetCrcString() string { + return "435ddc2b" +} +func NewACLInterfaceSetACLListReply() api.Message { + return &ACLInterfaceSetACLListReply{} +} + +// ACLDump represents the VPP binary API message 'acl_dump'. +// Generated from 'bin_api/acl.api.json', line 105: +// +// ["acl_dump", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "acl_index"], +// {"crc" : "0xc188156d"} +// ], +// +type ACLDump struct { + ACLIndex uint32 +} + +func (*ACLDump) GetMessageName() string { + return "acl_dump" +} +func (*ACLDump) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*ACLDump) GetCrcString() string { + return "c188156d" +} +func NewACLDump() api.Message { + return &ACLDump{} +} + +// ACLDetails represents the VPP binary API message 'acl_details'. +// Generated from 'bin_api/acl.api.json', line 112: +// +// ["acl_details", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["u32", "acl_index"], +// ["u8", "tag", 64], +// ["u32", "count"], +// ["vl_api_acl_rule_t", "r", 0, "count"], +// {"crc" : "0x1c8916b7"} +// ], +// +type ACLDetails struct { + ACLIndex uint32 + Tag []byte `struc:"[64]byte"` + Count uint32 `struc:"sizeof=R"` + R []ACLRule +} + +func (*ACLDetails) GetMessageName() string { + return "acl_details" +} +func (*ACLDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*ACLDetails) GetCrcString() string { + return "1c8916b7" +} +func NewACLDetails() api.Message { + return &ACLDetails{} +} + +// ACLInterfaceListDump represents the VPP binary API message 'acl_interface_list_dump'. +// Generated from 'bin_api/acl.api.json', line 121: +// +// ["acl_interface_list_dump", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// {"crc" : "0xadfe84b8"} +// ], +// +type ACLInterfaceListDump struct { + SwIfIndex uint32 +} + +func (*ACLInterfaceListDump) GetMessageName() string { + return "acl_interface_list_dump" +} +func (*ACLInterfaceListDump) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*ACLInterfaceListDump) GetCrcString() string { + return "adfe84b8" +} +func NewACLInterfaceListDump() api.Message { + return &ACLInterfaceListDump{} +} + +// ACLInterfaceListDetails represents the VPP binary API message 'acl_interface_list_details'. +// Generated from 'bin_api/acl.api.json', line 128: +// +// ["acl_interface_list_details", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// ["u8", "count"], +// ["u8", "n_input"], +// ["u32", "acls", 0, "count"], +// {"crc" : "0xc8150656"} +// ], +// +type ACLInterfaceListDetails struct { + SwIfIndex uint32 + Count uint8 `struc:"sizeof=Acls"` + NInput uint8 + Acls []uint32 +} + +func (*ACLInterfaceListDetails) GetMessageName() string { + return "acl_interface_list_details" +} +func (*ACLInterfaceListDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*ACLInterfaceListDetails) GetCrcString() string { + return "c8150656" +} +func NewACLInterfaceListDetails() api.Message { + return &ACLInterfaceListDetails{} +} + +// MacipACLAdd represents the VPP binary API message 'macip_acl_add'. +// Generated from 'bin_api/acl.api.json', line 137: +// +// ["macip_acl_add", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u8", "tag", 64], +// ["u32", "count"], +// ["vl_api_macip_acl_rule_t", "r", 0, "count"], +// {"crc" : "0x33356284"} +// ], +// +type MacipACLAdd struct { + Tag []byte `struc:"[64]byte"` + Count uint32 `struc:"sizeof=R"` + R []MacipACLRule +} + +func (*MacipACLAdd) GetMessageName() string { + return "macip_acl_add" +} +func (*MacipACLAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*MacipACLAdd) GetCrcString() string { + return "33356284" +} +func NewMacipACLAdd() api.Message { + return &MacipACLAdd{} +} + +// MacipACLAddReply represents the VPP binary API message 'macip_acl_add_reply'. +// Generated from 'bin_api/acl.api.json', line 146: +// +// ["macip_acl_add_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["u32", "acl_index"], +// ["i32", "retval"], +// {"crc" : "0x472edb4c"} +// ], +// +type MacipACLAddReply struct { + ACLIndex uint32 + Retval int32 +} + +func (*MacipACLAddReply) GetMessageName() string { + return "macip_acl_add_reply" +} +func (*MacipACLAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*MacipACLAddReply) GetCrcString() string { + return "472edb4c" +} +func NewMacipACLAddReply() api.Message { + return &MacipACLAddReply{} +} + +// MacipACLDel represents the VPP binary API message 'macip_acl_del'. +// Generated from 'bin_api/acl.api.json', line 153: +// +// ["macip_acl_del", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "acl_index"], +// {"crc" : "0xdde1141f"} +// ], +// +type MacipACLDel struct { + ACLIndex uint32 +} + +func (*MacipACLDel) GetMessageName() string { + return "macip_acl_del" +} +func (*MacipACLDel) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*MacipACLDel) GetCrcString() string { + return "dde1141f" +} +func NewMacipACLDel() api.Message { + return &MacipACLDel{} +} + +// MacipACLDelReply represents the VPP binary API message 'macip_acl_del_reply'. +// Generated from 'bin_api/acl.api.json', line 160: +// +// ["macip_acl_del_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0xeeb60e0f"} +// ], +// +type MacipACLDelReply struct { + Retval int32 +} + +func (*MacipACLDelReply) GetMessageName() string { + return "macip_acl_del_reply" +} +func (*MacipACLDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*MacipACLDelReply) GetCrcString() string { + return "eeb60e0f" +} +func NewMacipACLDelReply() api.Message { + return &MacipACLDelReply{} +} + +// MacipACLInterfaceAddDel represents the VPP binary API message 'macip_acl_interface_add_del'. +// Generated from 'bin_api/acl.api.json', line 166: +// +// ["macip_acl_interface_add_del", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u8", "is_add"], +// ["u32", "sw_if_index"], +// ["u32", "acl_index"], +// {"crc" : "0x03a4fab2"} +// ], +// +type MacipACLInterfaceAddDel struct { + IsAdd uint8 + SwIfIndex uint32 + ACLIndex uint32 +} + +func (*MacipACLInterfaceAddDel) GetMessageName() string { + return "macip_acl_interface_add_del" +} +func (*MacipACLInterfaceAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*MacipACLInterfaceAddDel) GetCrcString() string { + return "03a4fab2" +} +func NewMacipACLInterfaceAddDel() api.Message { + return &MacipACLInterfaceAddDel{} +} + +// MacipACLInterfaceAddDelReply represents the VPP binary API message 'macip_acl_interface_add_del_reply'. +// Generated from 'bin_api/acl.api.json', line 175: +// +// ["macip_acl_interface_add_del_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0x9e9ee485"} +// ], +// +type MacipACLInterfaceAddDelReply struct { + Retval int32 +} + +func (*MacipACLInterfaceAddDelReply) GetMessageName() string { + return "macip_acl_interface_add_del_reply" +} +func (*MacipACLInterfaceAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*MacipACLInterfaceAddDelReply) GetCrcString() string { + return "9e9ee485" +} +func NewMacipACLInterfaceAddDelReply() api.Message { + return &MacipACLInterfaceAddDelReply{} +} + +// MacipACLDump represents the VPP binary API message 'macip_acl_dump'. +// Generated from 'bin_api/acl.api.json', line 181: +// +// ["macip_acl_dump", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "acl_index"], +// {"crc" : "0xd38227cb"} +// ], +// +type MacipACLDump struct { + ACLIndex uint32 +} + +func (*MacipACLDump) GetMessageName() string { + return "macip_acl_dump" +} +func (*MacipACLDump) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*MacipACLDump) GetCrcString() string { + return "d38227cb" +} +func NewMacipACLDump() api.Message { + return &MacipACLDump{} +} + +// MacipACLDetails represents the VPP binary API message 'macip_acl_details'. +// Generated from 'bin_api/acl.api.json', line 188: +// +// ["macip_acl_details", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["u32", "acl_index"], +// ["u8", "tag", 64], +// ["u32", "count"], +// ["vl_api_macip_acl_rule_t", "r", 0, "count"], +// {"crc" : "0xee1c50db"} +// ], +// +type MacipACLDetails struct { + ACLIndex uint32 + Tag []byte `struc:"[64]byte"` + Count uint32 `struc:"sizeof=R"` + R []MacipACLRule +} + +func (*MacipACLDetails) GetMessageName() string { + return "macip_acl_details" +} +func (*MacipACLDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*MacipACLDetails) GetCrcString() string { + return "ee1c50db" +} +func NewMacipACLDetails() api.Message { + return &MacipACLDetails{} +} + +// MacipACLInterfaceGet represents the VPP binary API message 'macip_acl_interface_get'. +// Generated from 'bin_api/acl.api.json', line 197: +// +// ["macip_acl_interface_get", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// {"crc" : "0x317ce31c"} +// ], +// +type MacipACLInterfaceGet struct { +} + +func (*MacipACLInterfaceGet) GetMessageName() string { + return "macip_acl_interface_get" +} +func (*MacipACLInterfaceGet) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*MacipACLInterfaceGet) GetCrcString() string { + return "317ce31c" +} +func NewMacipACLInterfaceGet() api.Message { + return &MacipACLInterfaceGet{} +} + +// MacipACLInterfaceGetReply represents the VPP binary API message 'macip_acl_interface_get_reply'. +// Generated from 'bin_api/acl.api.json', line 203: +// +// ["macip_acl_interface_get_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["u32", "count"], +// ["u32", "acls", 0, "count"], +// {"crc" : "0x6c86a56c"} +// ] +// +type MacipACLInterfaceGetReply struct { + Count uint32 `struc:"sizeof=Acls"` + Acls []uint32 +} + +func (*MacipACLInterfaceGetReply) GetMessageName() string { + return "macip_acl_interface_get_reply" +} +func (*MacipACLInterfaceGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*MacipACLInterfaceGetReply) GetCrcString() string { + return "6c86a56c" +} +func NewMacipACLInterfaceGetReply() api.Message { + return &MacipACLInterfaceGetReply{} +} diff --git a/examples/bin_api/af_packet.api.json b/examples/bin_api/af_packet.api.json new file mode 100644 index 0000000..211fc3e --- /dev/null +++ b/examples/bin_api/af_packet.api.json @@ -0,0 +1,37 @@ +{ + "types" : [ + + ], + "messages" : [ + ["af_packet_create", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u8", "host_if_name", 64], + ["u8", "hw_addr", 6], + ["u8", "use_random_hw_addr"], + {"crc" : "0x92768640"} + ], + ["af_packet_create_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + ["u32", "sw_if_index"], + {"crc" : "0x718bac92"} + ], + ["af_packet_delete", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u8", "host_if_name", 64], + {"crc" : "0xc063ce85"} + ], + ["af_packet_delete_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0x1a80431a"} + ] + ], +"vl_api_version" :"0x4ca71f33" +} diff --git a/examples/bin_api/af_packet/af_packet.go b/examples/bin_api/af_packet/af_packet.go new file mode 100644 index 0000000..4b89e76 --- /dev/null +++ b/examples/bin_api/af_packet/af_packet.go @@ -0,0 +1,124 @@ +// Package af_packet represents the VPP binary API of the 'af_packet' VPP module. +// DO NOT EDIT. Generated from 'bin_api/af_packet.api.json' on Fri, 21 Apr 2017 17:10:06 CEST. +package af_packet + +import "gerrit.fd.io/r/govpp/api" + +// VlApiVersion contains version of the API. +const VlAPIVersion = 0x4ca71f33 + +// AfPacketCreate represents the VPP binary API message 'af_packet_create'. +// Generated from 'bin_api/af_packet.api.json', line 6: +// +// ["af_packet_create", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u8", "host_if_name", 64], +// ["u8", "hw_addr", 6], +// ["u8", "use_random_hw_addr"], +// {"crc" : "0x92768640"} +// ], +// +type AfPacketCreate struct { + HostIfName []byte `struc:"[64]byte"` + HwAddr []byte `struc:"[6]byte"` + UseRandomHwAddr uint8 +} + +func (*AfPacketCreate) GetMessageName() string { + return "af_packet_create" +} +func (*AfPacketCreate) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*AfPacketCreate) GetCrcString() string { + return "92768640" +} +func NewAfPacketCreate() api.Message { + return &AfPacketCreate{} +} + +// AfPacketCreateReply represents the VPP binary API message 'af_packet_create_reply'. +// Generated from 'bin_api/af_packet.api.json', line 15: +// +// ["af_packet_create_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// ["u32", "sw_if_index"], +// {"crc" : "0x718bac92"} +// ], +// +type AfPacketCreateReply struct { + Retval int32 + SwIfIndex uint32 +} + +func (*AfPacketCreateReply) GetMessageName() string { + return "af_packet_create_reply" +} +func (*AfPacketCreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*AfPacketCreateReply) GetCrcString() string { + return "718bac92" +} +func NewAfPacketCreateReply() api.Message { + return &AfPacketCreateReply{} +} + +// AfPacketDelete represents the VPP binary API message 'af_packet_delete'. +// Generated from 'bin_api/af_packet.api.json', line 22: +// +// ["af_packet_delete", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u8", "host_if_name", 64], +// {"crc" : "0xc063ce85"} +// ], +// +type AfPacketDelete struct { + HostIfName []byte `struc:"[64]byte"` +} + +func (*AfPacketDelete) GetMessageName() string { + return "af_packet_delete" +} +func (*AfPacketDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*AfPacketDelete) GetCrcString() string { + return "c063ce85" +} +func NewAfPacketDelete() api.Message { + return &AfPacketDelete{} +} + +// AfPacketDeleteReply represents the VPP binary API message 'af_packet_delete_reply'. +// Generated from 'bin_api/af_packet.api.json', line 29: +// +// ["af_packet_delete_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0x1a80431a"} +// ] +// +type AfPacketDeleteReply struct { + Retval int32 +} + +func (*AfPacketDeleteReply) GetMessageName() string { + return "af_packet_delete_reply" +} +func (*AfPacketDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*AfPacketDeleteReply) GetCrcString() string { + return "1a80431a" +} +func NewAfPacketDeleteReply() api.Message { + return &AfPacketDeleteReply{} +} diff --git a/examples/bin_api/interface.api.json b/examples/bin_api/interface.api.json new file mode 100644 index 0000000..81f81bd --- /dev/null +++ b/examples/bin_api/interface.api.json @@ -0,0 +1,195 @@ +{ + "types" : [ + + ], + "messages" : [ + ["sw_interface_set_flags", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "sw_if_index"], + ["u8", "admin_up_down"], + ["u8", "link_up_down"], + ["u8", "deleted"], + {"crc" : "0xc230f9b1"} + ], + ["sw_interface_set_flags_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0xdfbf3afa"} + ], + ["sw_interface_set_mtu", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "sw_if_index"], + ["u16", "mtu"], + {"crc" : "0x535dab1d"} + ], + ["sw_interface_set_mtu_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0x0cc22552"} + ], + ["want_interface_events", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "enable_disable"], + ["u32", "pid"], + {"crc" : "0xa0cbf57e"} + ], + ["want_interface_events_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0x33788c73"} + ], + ["sw_interface_details", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["u32", "sw_if_index"], + ["u32", "sup_sw_if_index"], + ["u32", "l2_address_length"], + ["u8", "l2_address", 8], + ["u8", "interface_name", 64], + ["u8", "admin_up_down"], + ["u8", "link_up_down"], + ["u8", "link_duplex"], + ["u8", "link_speed"], + ["u16", "link_mtu"], + ["u32", "sub_id"], + ["u8", "sub_dot1ad"], + ["u8", "sub_dot1ah"], + ["u8", "sub_number_of_tags"], + ["u16", "sub_outer_vlan_id"], + ["u16", "sub_inner_vlan_id"], + ["u8", "sub_exact_match"], + ["u8", "sub_default"], + ["u8", "sub_outer_vlan_id_any"], + ["u8", "sub_inner_vlan_id_any"], + ["u32", "vtr_op"], + ["u32", "vtr_push_dot1q"], + ["u32", "vtr_tag1"], + ["u32", "vtr_tag2"], + ["u8", "tag", 64], + ["u16", "outer_tag"], + ["u8", "b_dmac", 6], + ["u8", "b_smac", 6], + ["u16", "b_vlanid"], + ["u32", "i_sid"], + {"crc" : "0xe2d855bb"} + ], + ["sw_interface_dump", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u8", "name_filter_valid"], + ["u8", "name_filter", 49], + {"crc" : "0x9a2f9d4d"} + ], + ["sw_interface_add_del_address", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "sw_if_index"], + ["u8", "is_add"], + ["u8", "is_ipv6"], + ["u8", "del_all"], + ["u8", "address_length"], + ["u8", "address", 16], + {"crc" : "0x4e24d2df"} + ], + ["sw_interface_add_del_address_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0xabe29452"} + ], + ["sw_interface_set_table", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "sw_if_index"], + ["u8", "is_ipv6"], + ["u32", "vrf_id"], + {"crc" : "0xa94df510"} + ], + ["sw_interface_set_table_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0x99df273c"} + ], + ["sw_interface_get_table", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "sw_if_index"], + ["u8", "is_ipv6"], + {"crc" : "0xf5a1d557"} + ], + ["sw_interface_get_table_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + ["u32", "vrf_id"], + {"crc" : "0xab44111d"} + ], + ["vnet_interface_counters", + ["u16", "_vl_msg_id"], + ["u8", "vnet_counter_type"], + ["u8", "is_combined"], + ["u32", "first_sw_if_index"], + ["u32", "count"], + ["u8", "data", 0, "count"], + {"crc" : "0x312082b4"} + ], + ["sw_interface_set_unnumbered", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "sw_if_index"], + ["u32", "unnumbered_sw_if_index"], + ["u8", "is_add"], + {"crc" : "0xee0047b0"} + ], + ["sw_interface_set_unnumbered_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0x5b2275e1"} + ], + ["sw_interface_clear_stats", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "sw_if_index"], + {"crc" : "0x9600fd50"} + ], + ["sw_interface_clear_stats_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0x21f50dd9"} + ], + ["sw_interface_tag_add_del", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u8", "is_add"], + ["u32", "sw_if_index"], + ["u8", "tag", 64], + {"crc" : "0x50ae8d92"} + ], + ["sw_interface_tag_add_del_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0x761cbcb0"} + ] + ], +"vl_api_version" :"0x6857f668" +} diff --git a/examples/bin_api/interfaces/interfaces.go b/examples/bin_api/interfaces/interfaces.go new file mode 100644 index 0000000..b0424f0 --- /dev/null +++ b/examples/bin_api/interfaces/interfaces.go @@ -0,0 +1,688 @@ +// Package interfaces represents the VPP binary API of the 'interfaces' VPP module. +// DO NOT EDIT. Generated from 'bin_api/interface.api.json' on Fri, 21 Apr 2017 17:10:06 CEST. +package interfaces + +import "gerrit.fd.io/r/govpp/api" + +// VlApiVersion contains version of the API. +const VlAPIVersion = 0x6857f668 + +// SwInterfaceSetFlags represents the VPP binary API message 'sw_interface_set_flags'. +// Generated from 'bin_api/interface.api.json', line 6: +// +// ["sw_interface_set_flags", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// ["u8", "admin_up_down"], +// ["u8", "link_up_down"], +// ["u8", "deleted"], +// {"crc" : "0xc230f9b1"} +// ], +// +type SwInterfaceSetFlags struct { + SwIfIndex uint32 + AdminUpDown uint8 + LinkUpDown uint8 + Deleted uint8 +} + +func (*SwInterfaceSetFlags) GetMessageName() string { + return "sw_interface_set_flags" +} +func (*SwInterfaceSetFlags) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*SwInterfaceSetFlags) GetCrcString() string { + return "c230f9b1" +} +func NewSwInterfaceSetFlags() api.Message { + return &SwInterfaceSetFlags{} +} + +// SwInterfaceSetFlagsReply represents the VPP binary API message 'sw_interface_set_flags_reply'. +// Generated from 'bin_api/interface.api.json', line 16: +// +// ["sw_interface_set_flags_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0xdfbf3afa"} +// ], +// +type SwInterfaceSetFlagsReply struct { + Retval int32 +} + +func (*SwInterfaceSetFlagsReply) GetMessageName() string { + return "sw_interface_set_flags_reply" +} +func (*SwInterfaceSetFlagsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*SwInterfaceSetFlagsReply) GetCrcString() string { + return "dfbf3afa" +} +func NewSwInterfaceSetFlagsReply() api.Message { + return &SwInterfaceSetFlagsReply{} +} + +// SwInterfaceSetMtu represents the VPP binary API message 'sw_interface_set_mtu'. +// Generated from 'bin_api/interface.api.json', line 22: +// +// ["sw_interface_set_mtu", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// ["u16", "mtu"], +// {"crc" : "0x535dab1d"} +// ], +// +type SwInterfaceSetMtu struct { + SwIfIndex uint32 + Mtu uint16 +} + +func (*SwInterfaceSetMtu) GetMessageName() string { + return "sw_interface_set_mtu" +} +func (*SwInterfaceSetMtu) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*SwInterfaceSetMtu) GetCrcString() string { + return "535dab1d" +} +func NewSwInterfaceSetMtu() api.Message { + return &SwInterfaceSetMtu{} +} + +// SwInterfaceSetMtuReply represents the VPP binary API message 'sw_interface_set_mtu_reply'. +// Generated from 'bin_api/interface.api.json', line 30: +// +// ["sw_interface_set_mtu_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0x0cc22552"} +// ], +// +type SwInterfaceSetMtuReply struct { + Retval int32 +} + +func (*SwInterfaceSetMtuReply) GetMessageName() string { + return "sw_interface_set_mtu_reply" +} +func (*SwInterfaceSetMtuReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*SwInterfaceSetMtuReply) GetCrcString() string { + return "0cc22552" +} +func NewSwInterfaceSetMtuReply() api.Message { + return &SwInterfaceSetMtuReply{} +} + +// WantInterfaceEvents represents the VPP binary API message 'want_interface_events'. +// Generated from 'bin_api/interface.api.json', line 36: +// +// ["want_interface_events", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "enable_disable"], +// ["u32", "pid"], +// {"crc" : "0xa0cbf57e"} +// ], +// +type WantInterfaceEvents struct { + EnableDisable uint32 + Pid uint32 +} + +func (*WantInterfaceEvents) GetMessageName() string { + return "want_interface_events" +} +func (*WantInterfaceEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*WantInterfaceEvents) GetCrcString() string { + return "a0cbf57e" +} +func NewWantInterfaceEvents() api.Message { + return &WantInterfaceEvents{} +} + +// WantInterfaceEventsReply represents the VPP binary API message 'want_interface_events_reply'. +// Generated from 'bin_api/interface.api.json', line 44: +// +// ["want_interface_events_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0x33788c73"} +// ], +// +type WantInterfaceEventsReply struct { + Retval int32 +} + +func (*WantInterfaceEventsReply) GetMessageName() string { + return "want_interface_events_reply" +} +func (*WantInterfaceEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*WantInterfaceEventsReply) GetCrcString() string { + return "33788c73" +} +func NewWantInterfaceEventsReply() api.Message { + return &WantInterfaceEventsReply{} +} + +// SwInterfaceDetails represents the VPP binary API message 'sw_interface_details'. +// Generated from 'bin_api/interface.api.json', line 50: +// +// ["sw_interface_details", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// ["u32", "sup_sw_if_index"], +// ["u32", "l2_address_length"], +// ["u8", "l2_address", 8], +// ["u8", "interface_name", 64], +// ["u8", "admin_up_down"], +// ["u8", "link_up_down"], +// ["u8", "link_duplex"], +// ["u8", "link_speed"], +// ["u16", "link_mtu"], +// ["u32", "sub_id"], +// ["u8", "sub_dot1ad"], +// ["u8", "sub_dot1ah"], +// ["u8", "sub_number_of_tags"], +// ["u16", "sub_outer_vlan_id"], +// ["u16", "sub_inner_vlan_id"], +// ["u8", "sub_exact_match"], +// ["u8", "sub_default"], +// ["u8", "sub_outer_vlan_id_any"], +// ["u8", "sub_inner_vlan_id_any"], +// ["u32", "vtr_op"], +// ["u32", "vtr_push_dot1q"], +// ["u32", "vtr_tag1"], +// ["u32", "vtr_tag2"], +// ["u8", "tag", 64], +// ["u16", "outer_tag"], +// ["u8", "b_dmac", 6], +// ["u8", "b_smac", 6], +// ["u16", "b_vlanid"], +// ["u32", "i_sid"], +// {"crc" : "0xe2d855bb"} +// ], +// +type SwInterfaceDetails struct { + SwIfIndex uint32 + SupSwIfIndex uint32 + L2AddressLength uint32 + L2Address []byte `struc:"[8]byte"` + InterfaceName []byte `struc:"[64]byte"` + AdminUpDown uint8 + LinkUpDown uint8 + LinkDuplex uint8 + LinkSpeed uint8 + LinkMtu uint16 + SubID uint32 + SubDot1ad uint8 + SubDot1ah uint8 + SubNumberOfTags uint8 + SubOuterVlanID uint16 + SubInnerVlanID uint16 + SubExactMatch uint8 + SubDefault uint8 + SubOuterVlanIDAny uint8 + SubInnerVlanIDAny uint8 + VtrOp uint32 + VtrPushDot1q uint32 + VtrTag1 uint32 + VtrTag2 uint32 + Tag []byte `struc:"[64]byte"` + OuterTag uint16 + BDmac []byte `struc:"[6]byte"` + BSmac []byte `struc:"[6]byte"` + BVlanid uint16 + ISid uint32 +} + +func (*SwInterfaceDetails) GetMessageName() string { + return "sw_interface_details" +} +func (*SwInterfaceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*SwInterfaceDetails) GetCrcString() string { + return "e2d855bb" +} +func NewSwInterfaceDetails() api.Message { + return &SwInterfaceDetails{} +} + +// SwInterfaceDump represents the VPP binary API message 'sw_interface_dump'. +// Generated from 'bin_api/interface.api.json', line 85: +// +// ["sw_interface_dump", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u8", "name_filter_valid"], +// ["u8", "name_filter", 49], +// {"crc" : "0x9a2f9d4d"} +// ], +// +type SwInterfaceDump struct { + NameFilterValid uint8 + NameFilter []byte `struc:"[49]byte"` +} + +func (*SwInterfaceDump) GetMessageName() string { + return "sw_interface_dump" +} +func (*SwInterfaceDump) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*SwInterfaceDump) GetCrcString() string { + return "9a2f9d4d" +} +func NewSwInterfaceDump() api.Message { + return &SwInterfaceDump{} +} + +// SwInterfaceAddDelAddress represents the VPP binary API message 'sw_interface_add_del_address'. +// Generated from 'bin_api/interface.api.json', line 93: +// +// ["sw_interface_add_del_address", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// ["u8", "is_add"], +// ["u8", "is_ipv6"], +// ["u8", "del_all"], +// ["u8", "address_length"], +// ["u8", "address", 16], +// {"crc" : "0x4e24d2df"} +// ], +// +type SwInterfaceAddDelAddress struct { + SwIfIndex uint32 + IsAdd uint8 + IsIpv6 uint8 + DelAll uint8 + AddressLength uint8 + Address []byte `struc:"[16]byte"` +} + +func (*SwInterfaceAddDelAddress) GetMessageName() string { + return "sw_interface_add_del_address" +} +func (*SwInterfaceAddDelAddress) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*SwInterfaceAddDelAddress) GetCrcString() string { + return "4e24d2df" +} +func NewSwInterfaceAddDelAddress() api.Message { + return &SwInterfaceAddDelAddress{} +} + +// SwInterfaceAddDelAddressReply represents the VPP binary API message 'sw_interface_add_del_address_reply'. +// Generated from 'bin_api/interface.api.json', line 105: +// +// ["sw_interface_add_del_address_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0xabe29452"} +// ], +// +type SwInterfaceAddDelAddressReply struct { + Retval int32 +} + +func (*SwInterfaceAddDelAddressReply) GetMessageName() string { + return "sw_interface_add_del_address_reply" +} +func (*SwInterfaceAddDelAddressReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*SwInterfaceAddDelAddressReply) GetCrcString() string { + return "abe29452" +} +func NewSwInterfaceAddDelAddressReply() api.Message { + return &SwInterfaceAddDelAddressReply{} +} + +// SwInterfaceSetTable represents the VPP binary API message 'sw_interface_set_table'. +// Generated from 'bin_api/interface.api.json', line 111: +// +// ["sw_interface_set_table", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// ["u8", "is_ipv6"], +// ["u32", "vrf_id"], +// {"crc" : "0xa94df510"} +// ], +// +type SwInterfaceSetTable struct { + SwIfIndex uint32 + IsIpv6 uint8 + VrfID uint32 +} + +func (*SwInterfaceSetTable) GetMessageName() string { + return "sw_interface_set_table" +} +func (*SwInterfaceSetTable) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*SwInterfaceSetTable) GetCrcString() string { + return "a94df510" +} +func NewSwInterfaceSetTable() api.Message { + return &SwInterfaceSetTable{} +} + +// SwInterfaceSetTableReply represents the VPP binary API message 'sw_interface_set_table_reply'. +// Generated from 'bin_api/interface.api.json', line 120: +// +// ["sw_interface_set_table_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0x99df273c"} +// ], +// +type SwInterfaceSetTableReply struct { + Retval int32 +} + +func (*SwInterfaceSetTableReply) GetMessageName() string { + return "sw_interface_set_table_reply" +} +func (*SwInterfaceSetTableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*SwInterfaceSetTableReply) GetCrcString() string { + return "99df273c" +} +func NewSwInterfaceSetTableReply() api.Message { + return &SwInterfaceSetTableReply{} +} + +// SwInterfaceGetTable represents the VPP binary API message 'sw_interface_get_table'. +// Generated from 'bin_api/interface.api.json', line 126: +// +// ["sw_interface_get_table", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// ["u8", "is_ipv6"], +// {"crc" : "0xf5a1d557"} +// ], +// +type SwInterfaceGetTable struct { + SwIfIndex uint32 + IsIpv6 uint8 +} + +func (*SwInterfaceGetTable) GetMessageName() string { + return "sw_interface_get_table" +} +func (*SwInterfaceGetTable) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*SwInterfaceGetTable) GetCrcString() string { + return "f5a1d557" +} +func NewSwInterfaceGetTable() api.Message { + return &SwInterfaceGetTable{} +} + +// SwInterfaceGetTableReply represents the VPP binary API message 'sw_interface_get_table_reply'. +// Generated from 'bin_api/interface.api.json', line 134: +// +// ["sw_interface_get_table_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// ["u32", "vrf_id"], +// {"crc" : "0xab44111d"} +// ], +// +type SwInterfaceGetTableReply struct { + Retval int32 + VrfID uint32 +} + +func (*SwInterfaceGetTableReply) GetMessageName() string { + return "sw_interface_get_table_reply" +} +func (*SwInterfaceGetTableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*SwInterfaceGetTableReply) GetCrcString() string { + return "ab44111d" +} +func NewSwInterfaceGetTableReply() api.Message { + return &SwInterfaceGetTableReply{} +} + +// VnetInterfaceCounters represents the VPP binary API message 'vnet_interface_counters'. +// Generated from 'bin_api/interface.api.json', line 141: +// +// ["vnet_interface_counters", +// ["u16", "_vl_msg_id"], +// ["u8", "vnet_counter_type"], +// ["u8", "is_combined"], +// ["u32", "first_sw_if_index"], +// ["u32", "count"], +// ["u8", "data", 0, "count"], +// {"crc" : "0x312082b4"} +// ], +// +type VnetInterfaceCounters struct { + VnetCounterType uint8 + IsCombined uint8 + FirstSwIfIndex uint32 + Count uint32 `struc:"sizeof=Data"` + Data []byte +} + +func (*VnetInterfaceCounters) GetMessageName() string { + return "vnet_interface_counters" +} +func (*VnetInterfaceCounters) GetMessageType() api.MessageType { + return api.OtherMessage +} +func (*VnetInterfaceCounters) GetCrcString() string { + return "312082b4" +} +func NewVnetInterfaceCounters() api.Message { + return &VnetInterfaceCounters{} +} + +// SwInterfaceSetUnnumbered represents the VPP binary API message 'sw_interface_set_unnumbered'. +// Generated from 'bin_api/interface.api.json', line 150: +// +// ["sw_interface_set_unnumbered", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// ["u32", "unnumbered_sw_if_index"], +// ["u8", "is_add"], +// {"crc" : "0xee0047b0"} +// ], +// +type SwInterfaceSetUnnumbered struct { + SwIfIndex uint32 + UnnumberedSwIfIndex uint32 + IsAdd uint8 +} + +func (*SwInterfaceSetUnnumbered) GetMessageName() string { + return "sw_interface_set_unnumbered" +} +func (*SwInterfaceSetUnnumbered) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*SwInterfaceSetUnnumbered) GetCrcString() string { + return "ee0047b0" +} +func NewSwInterfaceSetUnnumbered() api.Message { + return &SwInterfaceSetUnnumbered{} +} + +// SwInterfaceSetUnnumberedReply represents the VPP binary API message 'sw_interface_set_unnumbered_reply'. +// Generated from 'bin_api/interface.api.json', line 159: +// +// ["sw_interface_set_unnumbered_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0x5b2275e1"} +// ], +// +type SwInterfaceSetUnnumberedReply struct { + Retval int32 +} + +func (*SwInterfaceSetUnnumberedReply) GetMessageName() string { + return "sw_interface_set_unnumbered_reply" +} +func (*SwInterfaceSetUnnumberedReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*SwInterfaceSetUnnumberedReply) GetCrcString() string { + return "5b2275e1" +} +func NewSwInterfaceSetUnnumberedReply() api.Message { + return &SwInterfaceSetUnnumberedReply{} +} + +// SwInterfaceClearStats represents the VPP binary API message 'sw_interface_clear_stats'. +// Generated from 'bin_api/interface.api.json', line 165: +// +// ["sw_interface_clear_stats", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// {"crc" : "0x9600fd50"} +// ], +// +type SwInterfaceClearStats struct { + SwIfIndex uint32 +} + +func (*SwInterfaceClearStats) GetMessageName() string { + return "sw_interface_clear_stats" +} +func (*SwInterfaceClearStats) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*SwInterfaceClearStats) GetCrcString() string { + return "9600fd50" +} +func NewSwInterfaceClearStats() api.Message { + return &SwInterfaceClearStats{} +} + +// SwInterfaceClearStatsReply represents the VPP binary API message 'sw_interface_clear_stats_reply'. +// Generated from 'bin_api/interface.api.json', line 172: +// +// ["sw_interface_clear_stats_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0x21f50dd9"} +// ], +// +type SwInterfaceClearStatsReply struct { + Retval int32 +} + +func (*SwInterfaceClearStatsReply) GetMessageName() string { + return "sw_interface_clear_stats_reply" +} +func (*SwInterfaceClearStatsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*SwInterfaceClearStatsReply) GetCrcString() string { + return "21f50dd9" +} +func NewSwInterfaceClearStatsReply() api.Message { + return &SwInterfaceClearStatsReply{} +} + +// SwInterfaceTagAddDel represents the VPP binary API message 'sw_interface_tag_add_del'. +// Generated from 'bin_api/interface.api.json', line 178: +// +// ["sw_interface_tag_add_del", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u8", "is_add"], +// ["u32", "sw_if_index"], +// ["u8", "tag", 64], +// {"crc" : "0x50ae8d92"} +// ], +// +type SwInterfaceTagAddDel struct { + IsAdd uint8 + SwIfIndex uint32 + Tag []byte `struc:"[64]byte"` +} + +func (*SwInterfaceTagAddDel) GetMessageName() string { + return "sw_interface_tag_add_del" +} +func (*SwInterfaceTagAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*SwInterfaceTagAddDel) GetCrcString() string { + return "50ae8d92" +} +func NewSwInterfaceTagAddDel() api.Message { + return &SwInterfaceTagAddDel{} +} + +// SwInterfaceTagAddDelReply represents the VPP binary API message 'sw_interface_tag_add_del_reply'. +// Generated from 'bin_api/interface.api.json', line 187: +// +// ["sw_interface_tag_add_del_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0x761cbcb0"} +// ] +// +type SwInterfaceTagAddDelReply struct { + Retval int32 +} + +func (*SwInterfaceTagAddDelReply) GetMessageName() string { + return "sw_interface_tag_add_del_reply" +} +func (*SwInterfaceTagAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*SwInterfaceTagAddDelReply) GetCrcString() string { + return "761cbcb0" +} +func NewSwInterfaceTagAddDelReply() api.Message { + return &SwInterfaceTagAddDelReply{} +} diff --git a/examples/bin_api/ip.api.json b/examples/bin_api/ip.api.json new file mode 100644 index 0000000..970ec4b --- /dev/null +++ b/examples/bin_api/ip.api.json @@ -0,0 +1,292 @@ +{ + "types" : [ + ["fib_path", + ["u32", "sw_if_index"], + ["u32", "weight"], + ["u8", "is_local"], + ["u8", "is_drop"], + ["u8", "is_unreach"], + ["u8", "is_prohibit"], + ["u8", "afi"], + ["u8", "next_hop", 16], + {"crc" : "0x315b1889"} + ] + ], + "messages" : [ + ["ip_fib_dump", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + {"crc" : "0x5fe56ca3"} + ], + ["ip_fib_details", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["u32", "table_id"], + ["u8", "address_length"], + ["u8", "address", 4], + ["u32", "count"], + ["vl_api_fib_path_t", "path", 0, "count"], + {"crc" : "0xfd8c6584"} + ], + ["ip6_fib_dump", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + {"crc" : "0x25c89676"} + ], + ["ip6_fib_details", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["u32", "table_id"], + ["u8", "address_length"], + ["u8", "address", 16], + ["u32", "count"], + ["vl_api_fib_path_t", "path", 0, "count"], + {"crc" : "0xe0825cb5"} + ], + ["ip_neighbor_dump", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "sw_if_index"], + ["u8", "is_ipv6"], + {"crc" : "0x3289e160"} + ], + ["ip_neighbor_details", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["u8", "is_static"], + ["u8", "is_ipv6"], + ["u8", "mac_address", 6], + ["u8", "ip_address", 16], + {"crc" : "0x3a00e32a"} + ], + ["ip_neighbor_add_del", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "vrf_id"], + ["u32", "sw_if_index"], + ["u8", "is_add"], + ["u8", "is_ipv6"], + ["u8", "is_static"], + ["u8", "mac_address", 6], + ["u8", "dst_address", 16], + {"crc" : "0x66f2112c"} + ], + ["ip_neighbor_add_del_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0xe5b0f318"} + ], + ["set_ip_flow_hash", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "vrf_id"], + ["u8", "is_ipv6"], + ["u8", "src"], + ["u8", "dst"], + ["u8", "sport"], + ["u8", "dport"], + ["u8", "proto"], + ["u8", "reverse"], + {"crc" : "0x92ad3798"} + ], + ["set_ip_flow_hash_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0x35a9e5eb"} + ], + ["sw_interface_ip6nd_ra_config", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "sw_if_index"], + ["u8", "suppress"], + ["u8", "managed"], + ["u8", "other"], + ["u8", "ll_option"], + ["u8", "send_unicast"], + ["u8", "cease"], + ["u8", "is_no"], + ["u8", "default_router"], + ["u32", "max_interval"], + ["u32", "min_interval"], + ["u32", "lifetime"], + ["u32", "initial_count"], + ["u32", "initial_interval"], + {"crc" : "0xec4a29f6"} + ], + ["sw_interface_ip6nd_ra_config_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0x16e25c5b"} + ], + ["sw_interface_ip6nd_ra_prefix", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "sw_if_index"], + ["u8", "address", 16], + ["u8", "address_length"], + ["u8", "use_default"], + ["u8", "no_advertise"], + ["u8", "off_link"], + ["u8", "no_autoconfig"], + ["u8", "no_onlink"], + ["u8", "is_no"], + ["u32", "val_lifetime"], + ["u32", "pref_lifetime"], + {"crc" : "0x5db6555c"} + ], + ["sw_interface_ip6nd_ra_prefix_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0x8050adb3"} + ], + ["sw_interface_ip6_enable_disable", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "sw_if_index"], + ["u8", "enable"], + {"crc" : "0x4a4e5405"} + ], + ["sw_interface_ip6_enable_disable_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0xeb8b4a40"} + ], + ["sw_interface_ip6_set_link_local_address", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "sw_if_index"], + ["u8", "address", 16], + {"crc" : "0x3db6d52b"} + ], + ["sw_interface_ip6_set_link_local_address_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0x0a781e17"} + ], + ["ip_add_del_route", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "next_hop_sw_if_index"], + ["u32", "table_id"], + ["u32", "classify_table_index"], + ["u32", "next_hop_table_id"], + ["u8", "create_vrf_if_needed"], + ["u8", "is_add"], + ["u8", "is_drop"], + ["u8", "is_unreach"], + ["u8", "is_prohibit"], + ["u8", "is_ipv6"], + ["u8", "is_local"], + ["u8", "is_classify"], + ["u8", "is_multipath"], + ["u8", "is_resolve_host"], + ["u8", "is_resolve_attached"], + ["u8", "not_last"], + ["u8", "next_hop_weight"], + ["u8", "dst_address_length"], + ["u8", "dst_address", 16], + ["u8", "next_hop_address", 16], + ["u8", "next_hop_n_out_labels"], + ["u32", "next_hop_via_label"], + ["u32", "next_hop_out_label_stack", 0, "next_hop_n_out_labels"], + {"crc" : "0xa0ab24bf"} + ], + ["ip_add_del_route_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0xea57492b"} + ], + ["ip_mroute_add_del", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "next_hop_sw_if_index"], + ["u32", "table_id"], + ["u32", "entry_flags"], + ["u32", "itf_flags"], + ["u16", "grp_address_length"], + ["u8", "create_vrf_if_needed"], + ["u8", "is_add"], + ["u8", "is_ipv6"], + ["u8", "is_local"], + ["u8", "grp_address", 16], + ["u8", "src_address", 16], + {"crc" : "0x8312830f"} + ], + ["ip_mroute_add_del_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0x8cabe02c"} + ], + ["ip_address_details", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u8", "ip", 16], + ["u8", "prefix_length"], + ["u32", "sw_if_index"], + ["u8", "is_ipv6"], + {"crc" : "0x190d4266"} + ], + ["ip_address_dump", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "sw_if_index"], + ["u8", "is_ipv6"], + {"crc" : "0x632e859a"} + ], + ["ip_details", + ["u16", "_vl_msg_id"], + ["u32", "sw_if_index"], + ["u32", "context"], + ["u8", "is_ipv6"], + {"crc" : "0x695c8227"} + ], + ["ip_dump", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u8", "is_ipv6"], + {"crc" : "0x3c1e33e0"} + ], + ["mfib_signal_dump", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + {"crc" : "0xbbbbd40d"} + ], + ["mfib_signal_details", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "sw_if_index"], + ["u32", "table_id"], + ["u16", "grp_address_len"], + ["u8", "grp_address", 16], + ["u8", "src_address", 16], + ["u16", "ip_packet_len"], + ["u8", "ip_packet_data", 256], + {"crc" : "0x6ba92c72"} + ] + ], +"vl_api_version" :"0x6a819870" +} diff --git a/examples/bin_api/ip/ip.go b/examples/bin_api/ip/ip.go new file mode 100644 index 0000000..7c2a80c --- /dev/null +++ b/examples/bin_api/ip/ip.go @@ -0,0 +1,993 @@ +// Package ip represents the VPP binary API of the 'ip' VPP module. +// DO NOT EDIT. Generated from 'bin_api/ip.api.json' on Fri, 21 Apr 2017 17:10:06 CEST. +package ip + +import "gerrit.fd.io/r/govpp/api" + +// VlApiVersion contains version of the API. +const VlAPIVersion = 0x6a819870 + +// FibPath represents the VPP binary API data type 'fib_path'. +// Generated from 'bin_api/ip.api.json', line 3: +// +// ["fib_path", +// ["u32", "sw_if_index"], +// ["u32", "weight"], +// ["u8", "is_local"], +// ["u8", "is_drop"], +// ["u8", "is_unreach"], +// ["u8", "is_prohibit"], +// ["u8", "afi"], +// ["u8", "next_hop", 16], +// {"crc" : "0x315b1889"} +// ] +// +type FibPath struct { + SwIfIndex uint32 + Weight uint32 + IsLocal uint8 + IsDrop uint8 + IsUnreach uint8 + IsProhibit uint8 + Afi uint8 + NextHop []byte `struc:"[16]byte"` +} + +func (*FibPath) GetTypeName() string { + return "fib_path" +} +func (*FibPath) GetCrcString() string { + return "315b1889" +} + +// IPFibDump represents the VPP binary API message 'ip_fib_dump'. +// Generated from 'bin_api/ip.api.json', line 16: +// +// ["ip_fib_dump", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// {"crc" : "0x5fe56ca3"} +// ], +// +type IPFibDump struct { +} + +func (*IPFibDump) GetMessageName() string { + return "ip_fib_dump" +} +func (*IPFibDump) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*IPFibDump) GetCrcString() string { + return "5fe56ca3" +} +func NewIPFibDump() api.Message { + return &IPFibDump{} +} + +// IPFibDetails represents the VPP binary API message 'ip_fib_details'. +// Generated from 'bin_api/ip.api.json', line 22: +// +// ["ip_fib_details", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["u32", "table_id"], +// ["u8", "address_length"], +// ["u8", "address", 4], +// ["u32", "count"], +// ["vl_api_fib_path_t", "path", 0, "count"], +// {"crc" : "0xfd8c6584"} +// ], +// +type IPFibDetails struct { + TableID uint32 + AddressLength uint8 + Address []byte `struc:"[4]byte"` + Count uint32 `struc:"sizeof=Path"` + Path []FibPath +} + +func (*IPFibDetails) GetMessageName() string { + return "ip_fib_details" +} +func (*IPFibDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*IPFibDetails) GetCrcString() string { + return "fd8c6584" +} +func NewIPFibDetails() api.Message { + return &IPFibDetails{} +} + +// IP6FibDump represents the VPP binary API message 'ip6_fib_dump'. +// Generated from 'bin_api/ip.api.json', line 32: +// +// ["ip6_fib_dump", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// {"crc" : "0x25c89676"} +// ], +// +type IP6FibDump struct { +} + +func (*IP6FibDump) GetMessageName() string { + return "ip6_fib_dump" +} +func (*IP6FibDump) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*IP6FibDump) GetCrcString() string { + return "25c89676" +} +func NewIP6FibDump() api.Message { + return &IP6FibDump{} +} + +// IP6FibDetails represents the VPP binary API message 'ip6_fib_details'. +// Generated from 'bin_api/ip.api.json', line 38: +// +// ["ip6_fib_details", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["u32", "table_id"], +// ["u8", "address_length"], +// ["u8", "address", 16], +// ["u32", "count"], +// ["vl_api_fib_path_t", "path", 0, "count"], +// {"crc" : "0xe0825cb5"} +// ], +// +type IP6FibDetails struct { + TableID uint32 + AddressLength uint8 + Address []byte `struc:"[16]byte"` + Count uint32 `struc:"sizeof=Path"` + Path []FibPath +} + +func (*IP6FibDetails) GetMessageName() string { + return "ip6_fib_details" +} +func (*IP6FibDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*IP6FibDetails) GetCrcString() string { + return "e0825cb5" +} +func NewIP6FibDetails() api.Message { + return &IP6FibDetails{} +} + +// IPNeighborDump represents the VPP binary API message 'ip_neighbor_dump'. +// Generated from 'bin_api/ip.api.json', line 48: +// +// ["ip_neighbor_dump", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// ["u8", "is_ipv6"], +// {"crc" : "0x3289e160"} +// ], +// +type IPNeighborDump struct { + SwIfIndex uint32 + IsIpv6 uint8 +} + +func (*IPNeighborDump) GetMessageName() string { + return "ip_neighbor_dump" +} +func (*IPNeighborDump) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*IPNeighborDump) GetCrcString() string { + return "3289e160" +} +func NewIPNeighborDump() api.Message { + return &IPNeighborDump{} +} + +// IPNeighborDetails represents the VPP binary API message 'ip_neighbor_details'. +// Generated from 'bin_api/ip.api.json', line 56: +// +// ["ip_neighbor_details", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["u8", "is_static"], +// ["u8", "is_ipv6"], +// ["u8", "mac_address", 6], +// ["u8", "ip_address", 16], +// {"crc" : "0x3a00e32a"} +// ], +// +type IPNeighborDetails struct { + IsStatic uint8 + IsIpv6 uint8 + MacAddress []byte `struc:"[6]byte"` + IPAddress []byte `struc:"[16]byte"` +} + +func (*IPNeighborDetails) GetMessageName() string { + return "ip_neighbor_details" +} +func (*IPNeighborDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*IPNeighborDetails) GetCrcString() string { + return "3a00e32a" +} +func NewIPNeighborDetails() api.Message { + return &IPNeighborDetails{} +} + +// IPNeighborAddDel represents the VPP binary API message 'ip_neighbor_add_del'. +// Generated from 'bin_api/ip.api.json', line 65: +// +// ["ip_neighbor_add_del", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "vrf_id"], +// ["u32", "sw_if_index"], +// ["u8", "is_add"], +// ["u8", "is_ipv6"], +// ["u8", "is_static"], +// ["u8", "mac_address", 6], +// ["u8", "dst_address", 16], +// {"crc" : "0x66f2112c"} +// ], +// +type IPNeighborAddDel struct { + VrfID uint32 + SwIfIndex uint32 + IsAdd uint8 + IsIpv6 uint8 + IsStatic uint8 + MacAddress []byte `struc:"[6]byte"` + DstAddress []byte `struc:"[16]byte"` +} + +func (*IPNeighborAddDel) GetMessageName() string { + return "ip_neighbor_add_del" +} +func (*IPNeighborAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*IPNeighborAddDel) GetCrcString() string { + return "66f2112c" +} +func NewIPNeighborAddDel() api.Message { + return &IPNeighborAddDel{} +} + +// IPNeighborAddDelReply represents the VPP binary API message 'ip_neighbor_add_del_reply'. +// Generated from 'bin_api/ip.api.json', line 78: +// +// ["ip_neighbor_add_del_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0xe5b0f318"} +// ], +// +type IPNeighborAddDelReply struct { + Retval int32 +} + +func (*IPNeighborAddDelReply) GetMessageName() string { + return "ip_neighbor_add_del_reply" +} +func (*IPNeighborAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*IPNeighborAddDelReply) GetCrcString() string { + return "e5b0f318" +} +func NewIPNeighborAddDelReply() api.Message { + return &IPNeighborAddDelReply{} +} + +// SetIPFlowHash represents the VPP binary API message 'set_ip_flow_hash'. +// Generated from 'bin_api/ip.api.json', line 84: +// +// ["set_ip_flow_hash", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "vrf_id"], +// ["u8", "is_ipv6"], +// ["u8", "src"], +// ["u8", "dst"], +// ["u8", "sport"], +// ["u8", "dport"], +// ["u8", "proto"], +// ["u8", "reverse"], +// {"crc" : "0x92ad3798"} +// ], +// +type SetIPFlowHash struct { + VrfID uint32 + IsIpv6 uint8 + Src uint8 + Dst uint8 + Sport uint8 + Dport uint8 + Proto uint8 + Reverse uint8 +} + +func (*SetIPFlowHash) GetMessageName() string { + return "set_ip_flow_hash" +} +func (*SetIPFlowHash) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*SetIPFlowHash) GetCrcString() string { + return "92ad3798" +} +func NewSetIPFlowHash() api.Message { + return &SetIPFlowHash{} +} + +// SetIPFlowHashReply represents the VPP binary API message 'set_ip_flow_hash_reply'. +// Generated from 'bin_api/ip.api.json', line 98: +// +// ["set_ip_flow_hash_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0x35a9e5eb"} +// ], +// +type SetIPFlowHashReply struct { + Retval int32 +} + +func (*SetIPFlowHashReply) GetMessageName() string { + return "set_ip_flow_hash_reply" +} +func (*SetIPFlowHashReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*SetIPFlowHashReply) GetCrcString() string { + return "35a9e5eb" +} +func NewSetIPFlowHashReply() api.Message { + return &SetIPFlowHashReply{} +} + +// SwInterfaceIP6ndRaConfig represents the VPP binary API message 'sw_interface_ip6nd_ra_config'. +// Generated from 'bin_api/ip.api.json', line 104: +// +// ["sw_interface_ip6nd_ra_config", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// ["u8", "suppress"], +// ["u8", "managed"], +// ["u8", "other"], +// ["u8", "ll_option"], +// ["u8", "send_unicast"], +// ["u8", "cease"], +// ["u8", "is_no"], +// ["u8", "default_router"], +// ["u32", "max_interval"], +// ["u32", "min_interval"], +// ["u32", "lifetime"], +// ["u32", "initial_count"], +// ["u32", "initial_interval"], +// {"crc" : "0xec4a29f6"} +// ], +// +type SwInterfaceIP6ndRaConfig struct { + SwIfIndex uint32 + Suppress uint8 + Managed uint8 + Other uint8 + LlOption uint8 + SendUnicast uint8 + Cease uint8 + IsNo uint8 + DefaultRouter uint8 + MaxInterval uint32 + MinInterval uint32 + Lifetime uint32 + InitialCount uint32 + InitialInterval uint32 +} + +func (*SwInterfaceIP6ndRaConfig) GetMessageName() string { + return "sw_interface_ip6nd_ra_config" +} +func (*SwInterfaceIP6ndRaConfig) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*SwInterfaceIP6ndRaConfig) GetCrcString() string { + return "ec4a29f6" +} +func NewSwInterfaceIP6ndRaConfig() api.Message { + return &SwInterfaceIP6ndRaConfig{} +} + +// SwInterfaceIP6ndRaConfigReply represents the VPP binary API message 'sw_interface_ip6nd_ra_config_reply'. +// Generated from 'bin_api/ip.api.json', line 124: +// +// ["sw_interface_ip6nd_ra_config_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0x16e25c5b"} +// ], +// +type SwInterfaceIP6ndRaConfigReply struct { + Retval int32 +} + +func (*SwInterfaceIP6ndRaConfigReply) GetMessageName() string { + return "sw_interface_ip6nd_ra_config_reply" +} +func (*SwInterfaceIP6ndRaConfigReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*SwInterfaceIP6ndRaConfigReply) GetCrcString() string { + return "16e25c5b" +} +func NewSwInterfaceIP6ndRaConfigReply() api.Message { + return &SwInterfaceIP6ndRaConfigReply{} +} + +// SwInterfaceIP6ndRaPrefix represents the VPP binary API message 'sw_interface_ip6nd_ra_prefix'. +// Generated from 'bin_api/ip.api.json', line 130: +// +// ["sw_interface_ip6nd_ra_prefix", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// ["u8", "address", 16], +// ["u8", "address_length"], +// ["u8", "use_default"], +// ["u8", "no_advertise"], +// ["u8", "off_link"], +// ["u8", "no_autoconfig"], +// ["u8", "no_onlink"], +// ["u8", "is_no"], +// ["u32", "val_lifetime"], +// ["u32", "pref_lifetime"], +// {"crc" : "0x5db6555c"} +// ], +// +type SwInterfaceIP6ndRaPrefix struct { + SwIfIndex uint32 + Address []byte `struc:"[16]byte"` + AddressLength uint8 + UseDefault uint8 + NoAdvertise uint8 + OffLink uint8 + NoAutoconfig uint8 + NoOnlink uint8 + IsNo uint8 + ValLifetime uint32 + PrefLifetime uint32 +} + +func (*SwInterfaceIP6ndRaPrefix) GetMessageName() string { + return "sw_interface_ip6nd_ra_prefix" +} +func (*SwInterfaceIP6ndRaPrefix) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*SwInterfaceIP6ndRaPrefix) GetCrcString() string { + return "5db6555c" +} +func NewSwInterfaceIP6ndRaPrefix() api.Message { + return &SwInterfaceIP6ndRaPrefix{} +} + +// SwInterfaceIP6ndRaPrefixReply represents the VPP binary API message 'sw_interface_ip6nd_ra_prefix_reply'. +// Generated from 'bin_api/ip.api.json', line 147: +// +// ["sw_interface_ip6nd_ra_prefix_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0x8050adb3"} +// ], +// +type SwInterfaceIP6ndRaPrefixReply struct { + Retval int32 +} + +func (*SwInterfaceIP6ndRaPrefixReply) GetMessageName() string { + return "sw_interface_ip6nd_ra_prefix_reply" +} +func (*SwInterfaceIP6ndRaPrefixReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*SwInterfaceIP6ndRaPrefixReply) GetCrcString() string { + return "8050adb3" +} +func NewSwInterfaceIP6ndRaPrefixReply() api.Message { + return &SwInterfaceIP6ndRaPrefixReply{} +} + +// SwInterfaceIP6EnableDisable represents the VPP binary API message 'sw_interface_ip6_enable_disable'. +// Generated from 'bin_api/ip.api.json', line 153: +// +// ["sw_interface_ip6_enable_disable", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// ["u8", "enable"], +// {"crc" : "0x4a4e5405"} +// ], +// +type SwInterfaceIP6EnableDisable struct { + SwIfIndex uint32 + Enable uint8 +} + +func (*SwInterfaceIP6EnableDisable) GetMessageName() string { + return "sw_interface_ip6_enable_disable" +} +func (*SwInterfaceIP6EnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*SwInterfaceIP6EnableDisable) GetCrcString() string { + return "4a4e5405" +} +func NewSwInterfaceIP6EnableDisable() api.Message { + return &SwInterfaceIP6EnableDisable{} +} + +// SwInterfaceIP6EnableDisableReply represents the VPP binary API message 'sw_interface_ip6_enable_disable_reply'. +// Generated from 'bin_api/ip.api.json', line 161: +// +// ["sw_interface_ip6_enable_disable_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0xeb8b4a40"} +// ], +// +type SwInterfaceIP6EnableDisableReply struct { + Retval int32 +} + +func (*SwInterfaceIP6EnableDisableReply) GetMessageName() string { + return "sw_interface_ip6_enable_disable_reply" +} +func (*SwInterfaceIP6EnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*SwInterfaceIP6EnableDisableReply) GetCrcString() string { + return "eb8b4a40" +} +func NewSwInterfaceIP6EnableDisableReply() api.Message { + return &SwInterfaceIP6EnableDisableReply{} +} + +// SwInterfaceIP6SetLinkLocalAddress represents the VPP binary API message 'sw_interface_ip6_set_link_local_address'. +// Generated from 'bin_api/ip.api.json', line 167: +// +// ["sw_interface_ip6_set_link_local_address", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// ["u8", "address", 16], +// {"crc" : "0x3db6d52b"} +// ], +// +type SwInterfaceIP6SetLinkLocalAddress struct { + SwIfIndex uint32 + Address []byte `struc:"[16]byte"` +} + +func (*SwInterfaceIP6SetLinkLocalAddress) GetMessageName() string { + return "sw_interface_ip6_set_link_local_address" +} +func (*SwInterfaceIP6SetLinkLocalAddress) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*SwInterfaceIP6SetLinkLocalAddress) GetCrcString() string { + return "3db6d52b" +} +func NewSwInterfaceIP6SetLinkLocalAddress() api.Message { + return &SwInterfaceIP6SetLinkLocalAddress{} +} + +// SwInterfaceIP6SetLinkLocalAddressReply represents the VPP binary API message 'sw_interface_ip6_set_link_local_address_reply'. +// Generated from 'bin_api/ip.api.json', line 175: +// +// ["sw_interface_ip6_set_link_local_address_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0x0a781e17"} +// ], +// +type SwInterfaceIP6SetLinkLocalAddressReply struct { + Retval int32 +} + +func (*SwInterfaceIP6SetLinkLocalAddressReply) GetMessageName() string { + return "sw_interface_ip6_set_link_local_address_reply" +} +func (*SwInterfaceIP6SetLinkLocalAddressReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*SwInterfaceIP6SetLinkLocalAddressReply) GetCrcString() string { + return "0a781e17" +} +func NewSwInterfaceIP6SetLinkLocalAddressReply() api.Message { + return &SwInterfaceIP6SetLinkLocalAddressReply{} +} + +// IPAddDelRoute represents the VPP binary API message 'ip_add_del_route'. +// Generated from 'bin_api/ip.api.json', line 181: +// +// ["ip_add_del_route", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "next_hop_sw_if_index"], +// ["u32", "table_id"], +// ["u32", "classify_table_index"], +// ["u32", "next_hop_table_id"], +// ["u8", "create_vrf_if_needed"], +// ["u8", "is_add"], +// ["u8", "is_drop"], +// ["u8", "is_unreach"], +// ["u8", "is_prohibit"], +// ["u8", "is_ipv6"], +// ["u8", "is_local"], +// ["u8", "is_classify"], +// ["u8", "is_multipath"], +// ["u8", "is_resolve_host"], +// ["u8", "is_resolve_attached"], +// ["u8", "not_last"], +// ["u8", "next_hop_weight"], +// ["u8", "dst_address_length"], +// ["u8", "dst_address", 16], +// ["u8", "next_hop_address", 16], +// ["u8", "next_hop_n_out_labels"], +// ["u32", "next_hop_via_label"], +// ["u32", "next_hop_out_label_stack", 0, "next_hop_n_out_labels"], +// {"crc" : "0xa0ab24bf"} +// ], +// +type IPAddDelRoute struct { + NextHopSwIfIndex uint32 + TableID uint32 + ClassifyTableIndex uint32 + NextHopTableID uint32 + CreateVrfIfNeeded uint8 + IsAdd uint8 + IsDrop uint8 + IsUnreach uint8 + IsProhibit uint8 + IsIpv6 uint8 + IsLocal uint8 + IsClassify uint8 + IsMultipath uint8 + IsResolveHost uint8 + IsResolveAttached uint8 + NotLast uint8 + NextHopWeight uint8 + DstAddressLength uint8 + DstAddress []byte `struc:"[16]byte"` + NextHopAddress []byte `struc:"[16]byte"` + NextHopNOutLabels uint8 `struc:"sizeof=NextHopOutLabelStack"` + NextHopViaLabel uint32 + NextHopOutLabelStack []uint32 +} + +func (*IPAddDelRoute) GetMessageName() string { + return "ip_add_del_route" +} +func (*IPAddDelRoute) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*IPAddDelRoute) GetCrcString() string { + return "a0ab24bf" +} +func NewIPAddDelRoute() api.Message { + return &IPAddDelRoute{} +} + +// IPAddDelRouteReply represents the VPP binary API message 'ip_add_del_route_reply'. +// Generated from 'bin_api/ip.api.json', line 210: +// +// ["ip_add_del_route_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0xea57492b"} +// ], +// +type IPAddDelRouteReply struct { + Retval int32 +} + +func (*IPAddDelRouteReply) GetMessageName() string { + return "ip_add_del_route_reply" +} +func (*IPAddDelRouteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*IPAddDelRouteReply) GetCrcString() string { + return "ea57492b" +} +func NewIPAddDelRouteReply() api.Message { + return &IPAddDelRouteReply{} +} + +// IPMrouteAddDel represents the VPP binary API message 'ip_mroute_add_del'. +// Generated from 'bin_api/ip.api.json', line 216: +// +// ["ip_mroute_add_del", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "next_hop_sw_if_index"], +// ["u32", "table_id"], +// ["u32", "entry_flags"], +// ["u32", "itf_flags"], +// ["u16", "grp_address_length"], +// ["u8", "create_vrf_if_needed"], +// ["u8", "is_add"], +// ["u8", "is_ipv6"], +// ["u8", "is_local"], +// ["u8", "grp_address", 16], +// ["u8", "src_address", 16], +// {"crc" : "0x8312830f"} +// ], +// +type IPMrouteAddDel struct { + NextHopSwIfIndex uint32 + TableID uint32 + EntryFlags uint32 + ItfFlags uint32 + GrpAddressLength uint16 + CreateVrfIfNeeded uint8 + IsAdd uint8 + IsIpv6 uint8 + IsLocal uint8 + GrpAddress []byte `struc:"[16]byte"` + SrcAddress []byte `struc:"[16]byte"` +} + +func (*IPMrouteAddDel) GetMessageName() string { + return "ip_mroute_add_del" +} +func (*IPMrouteAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*IPMrouteAddDel) GetCrcString() string { + return "8312830f" +} +func NewIPMrouteAddDel() api.Message { + return &IPMrouteAddDel{} +} + +// IPMrouteAddDelReply represents the VPP binary API message 'ip_mroute_add_del_reply'. +// Generated from 'bin_api/ip.api.json', line 233: +// +// ["ip_mroute_add_del_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0x8cabe02c"} +// ], +// +type IPMrouteAddDelReply struct { + Retval int32 +} + +func (*IPMrouteAddDelReply) GetMessageName() string { + return "ip_mroute_add_del_reply" +} +func (*IPMrouteAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*IPMrouteAddDelReply) GetCrcString() string { + return "8cabe02c" +} +func NewIPMrouteAddDelReply() api.Message { + return &IPMrouteAddDelReply{} +} + +// IPAddressDetails represents the VPP binary API message 'ip_address_details'. +// Generated from 'bin_api/ip.api.json', line 239: +// +// ["ip_address_details", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u8", "ip", 16], +// ["u8", "prefix_length"], +// ["u32", "sw_if_index"], +// ["u8", "is_ipv6"], +// {"crc" : "0x190d4266"} +// ], +// +type IPAddressDetails struct { + IP []byte `struc:"[16]byte"` + PrefixLength uint8 + SwIfIndex uint32 + IsIpv6 uint8 +} + +func (*IPAddressDetails) GetMessageName() string { + return "ip_address_details" +} +func (*IPAddressDetails) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*IPAddressDetails) GetCrcString() string { + return "190d4266" +} +func NewIPAddressDetails() api.Message { + return &IPAddressDetails{} +} + +// IPAddressDump represents the VPP binary API message 'ip_address_dump'. +// Generated from 'bin_api/ip.api.json', line 249: +// +// ["ip_address_dump", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// ["u8", "is_ipv6"], +// {"crc" : "0x632e859a"} +// ], +// +type IPAddressDump struct { + SwIfIndex uint32 + IsIpv6 uint8 +} + +func (*IPAddressDump) GetMessageName() string { + return "ip_address_dump" +} +func (*IPAddressDump) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*IPAddressDump) GetCrcString() string { + return "632e859a" +} +func NewIPAddressDump() api.Message { + return &IPAddressDump{} +} + +// IPDetails represents the VPP binary API message 'ip_details'. +// Generated from 'bin_api/ip.api.json', line 257: +// +// ["ip_details", +// ["u16", "_vl_msg_id"], +// ["u32", "sw_if_index"], +// ["u32", "context"], +// ["u8", "is_ipv6"], +// {"crc" : "0x695c8227"} +// ], +// +type IPDetails struct { + SwIfIndex uint32 + IsIpv6 uint8 +} + +func (*IPDetails) GetMessageName() string { + return "ip_details" +} +func (*IPDetails) GetMessageType() api.MessageType { + return api.OtherMessage +} +func (*IPDetails) GetCrcString() string { + return "695c8227" +} +func NewIPDetails() api.Message { + return &IPDetails{} +} + +// IPDump represents the VPP binary API message 'ip_dump'. +// Generated from 'bin_api/ip.api.json', line 264: +// +// ["ip_dump", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u8", "is_ipv6"], +// {"crc" : "0x3c1e33e0"} +// ], +// +type IPDump struct { + IsIpv6 uint8 +} + +func (*IPDump) GetMessageName() string { + return "ip_dump" +} +func (*IPDump) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*IPDump) GetCrcString() string { + return "3c1e33e0" +} +func NewIPDump() api.Message { + return &IPDump{} +} + +// MfibSignalDump represents the VPP binary API message 'mfib_signal_dump'. +// Generated from 'bin_api/ip.api.json', line 271: +// +// ["mfib_signal_dump", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// {"crc" : "0xbbbbd40d"} +// ], +// +type MfibSignalDump struct { +} + +func (*MfibSignalDump) GetMessageName() string { + return "mfib_signal_dump" +} +func (*MfibSignalDump) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*MfibSignalDump) GetCrcString() string { + return "bbbbd40d" +} +func NewMfibSignalDump() api.Message { + return &MfibSignalDump{} +} + +// MfibSignalDetails represents the VPP binary API message 'mfib_signal_details'. +// Generated from 'bin_api/ip.api.json', line 277: +// +// ["mfib_signal_details", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// ["u32", "table_id"], +// ["u16", "grp_address_len"], +// ["u8", "grp_address", 16], +// ["u8", "src_address", 16], +// ["u16", "ip_packet_len"], +// ["u8", "ip_packet_data", 256], +// {"crc" : "0x6ba92c72"} +// ] +// +type MfibSignalDetails struct { + SwIfIndex uint32 + TableID uint32 + GrpAddressLen uint16 + GrpAddress []byte `struc:"[16]byte"` + SrcAddress []byte `struc:"[16]byte"` + IPPacketLen uint16 + IPPacketData []byte `struc:"[256]byte"` +} + +func (*MfibSignalDetails) GetMessageName() string { + return "mfib_signal_details" +} +func (*MfibSignalDetails) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*MfibSignalDetails) GetCrcString() string { + return "6ba92c72" +} +func NewMfibSignalDetails() api.Message { + return &MfibSignalDetails{} +} diff --git a/examples/bin_api/memif.api.json b/examples/bin_api/memif.api.json new file mode 100644 index 0000000..e41c82d --- /dev/null +++ b/examples/bin_api/memif.api.json @@ -0,0 +1,61 @@ +{ + "types" : [ + + ], + "messages" : [ + ["memif_create", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u8", "role"], + ["u64", "key"], + ["u8", "socket_filename", 128], + ["u32", "ring_size"], + ["u16", "buffer_size"], + ["u8", "hw_addr", 6], + {"crc" : "0x23fe3309"} + ], + ["memif_create_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + ["u32", "sw_if_index"], + {"crc" : "0x93d7498b"} + ], + ["memif_delete", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "sw_if_index"], + {"crc" : "0x12814e3d"} + ], + ["memif_delete_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0x72c9fa3c"} + ], + ["memif_details", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["u32", "sw_if_index"], + ["u8", "if_name", 64], + ["u8", "hw_addr", 6], + ["u64", "key"], + ["u8", "role"], + ["u8", "socket_filename", 128], + ["u32", "ring_size"], + ["u16", "buffer_size"], + ["u8", "admin_up_down"], + ["u8", "link_up_down"], + {"crc" : "0xcf105583"} + ], + ["memif_dump", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + {"crc" : "0x68d39e95"} + ] + ], +"vl_api_version" :"0xadb63e82" +} diff --git a/examples/bin_api/memif/memif.go b/examples/bin_api/memif/memif.go new file mode 100644 index 0000000..2800edc --- /dev/null +++ b/examples/bin_api/memif/memif.go @@ -0,0 +1,201 @@ +// Package memif represents the VPP binary API of the 'memif' VPP module. +// DO NOT EDIT. Generated from 'bin_api/memif.api.json' on Fri, 21 Apr 2017 17:10:06 CEST. +package memif + +import "gerrit.fd.io/r/govpp/api" + +// VlApiVersion contains version of the API. +const VlAPIVersion = 0xadb63e82 + +// MemifCreate represents the VPP binary API message 'memif_create'. +// Generated from 'bin_api/memif.api.json', line 6: +// +// ["memif_create", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u8", "role"], +// ["u64", "key"], +// ["u8", "socket_filename", 128], +// ["u32", "ring_size"], +// ["u16", "buffer_size"], +// ["u8", "hw_addr", 6], +// {"crc" : "0x23fe3309"} +// ], +// +type MemifCreate struct { + Role uint8 + Key uint64 + SocketFilename []byte `struc:"[128]byte"` + RingSize uint32 + BufferSize uint16 + HwAddr []byte `struc:"[6]byte"` +} + +func (*MemifCreate) GetMessageName() string { + return "memif_create" +} +func (*MemifCreate) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*MemifCreate) GetCrcString() string { + return "23fe3309" +} +func NewMemifCreate() api.Message { + return &MemifCreate{} +} + +// MemifCreateReply represents the VPP binary API message 'memif_create_reply'. +// Generated from 'bin_api/memif.api.json', line 18: +// +// ["memif_create_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// ["u32", "sw_if_index"], +// {"crc" : "0x93d7498b"} +// ], +// +type MemifCreateReply struct { + Retval int32 + SwIfIndex uint32 +} + +func (*MemifCreateReply) GetMessageName() string { + return "memif_create_reply" +} +func (*MemifCreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*MemifCreateReply) GetCrcString() string { + return "93d7498b" +} +func NewMemifCreateReply() api.Message { + return &MemifCreateReply{} +} + +// MemifDelete represents the VPP binary API message 'memif_delete'. +// Generated from 'bin_api/memif.api.json', line 25: +// +// ["memif_delete", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// {"crc" : "0x12814e3d"} +// ], +// +type MemifDelete struct { + SwIfIndex uint32 +} + +func (*MemifDelete) GetMessageName() string { + return "memif_delete" +} +func (*MemifDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*MemifDelete) GetCrcString() string { + return "12814e3d" +} +func NewMemifDelete() api.Message { + return &MemifDelete{} +} + +// MemifDeleteReply represents the VPP binary API message 'memif_delete_reply'. +// Generated from 'bin_api/memif.api.json', line 32: +// +// ["memif_delete_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0x72c9fa3c"} +// ], +// +type MemifDeleteReply struct { + Retval int32 +} + +func (*MemifDeleteReply) GetMessageName() string { + return "memif_delete_reply" +} +func (*MemifDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*MemifDeleteReply) GetCrcString() string { + return "72c9fa3c" +} +func NewMemifDeleteReply() api.Message { + return &MemifDeleteReply{} +} + +// MemifDetails represents the VPP binary API message 'memif_details'. +// Generated from 'bin_api/memif.api.json', line 38: +// +// ["memif_details", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// ["u8", "if_name", 64], +// ["u8", "hw_addr", 6], +// ["u64", "key"], +// ["u8", "role"], +// ["u8", "socket_filename", 128], +// ["u32", "ring_size"], +// ["u16", "buffer_size"], +// ["u8", "admin_up_down"], +// ["u8", "link_up_down"], +// {"crc" : "0xcf105583"} +// ], +// +type MemifDetails struct { + SwIfIndex uint32 + IfName []byte `struc:"[64]byte"` + HwAddr []byte `struc:"[6]byte"` + Key uint64 + Role uint8 + SocketFilename []byte `struc:"[128]byte"` + RingSize uint32 + BufferSize uint16 + AdminUpDown uint8 + LinkUpDown uint8 +} + +func (*MemifDetails) GetMessageName() string { + return "memif_details" +} +func (*MemifDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*MemifDetails) GetCrcString() string { + return "cf105583" +} +func NewMemifDetails() api.Message { + return &MemifDetails{} +} + +// MemifDump represents the VPP binary API message 'memif_dump'. +// Generated from 'bin_api/memif.api.json', line 53: +// +// ["memif_dump", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// {"crc" : "0x68d39e95"} +// ] +// +type MemifDump struct { +} + +func (*MemifDump) GetMessageName() string { + return "memif_dump" +} +func (*MemifDump) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*MemifDump) GetCrcString() string { + return "68d39e95" +} +func NewMemifDump() api.Message { + return &MemifDump{} +} diff --git a/examples/bin_api/tap.api.json b/examples/bin_api/tap.api.json new file mode 100644 index 0000000..7143010 --- /dev/null +++ b/examples/bin_api/tap.api.json @@ -0,0 +1,78 @@ +{ + "types" : [ + + ], + "messages" : [ + ["tap_connect", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u8", "use_random_mac"], + ["u8", "tap_name", 64], + ["u8", "mac_address", 6], + ["u8", "renumber"], + ["u32", "custom_dev_instance"], + ["u8", "ip4_address_set"], + ["u8", "ip4_address", 4], + ["u8", "ip4_mask_width"], + ["u8", "ip6_address_set"], + ["u8", "ip6_address", 16], + ["u8", "ip6_mask_width"], + ["u8", "tag", 64], + {"crc" : "0x91720de3"} + ], + ["tap_connect_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + ["u32", "sw_if_index"], + {"crc" : "0xf47feac1"} + ], + ["tap_modify", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "sw_if_index"], + ["u8", "use_random_mac"], + ["u8", "tap_name", 64], + ["u8", "mac_address", 6], + ["u8", "renumber"], + ["u32", "custom_dev_instance"], + {"crc" : "0x8abcd5f3"} + ], + ["tap_modify_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + ["u32", "sw_if_index"], + {"crc" : "0x00aaf940"} + ], + ["tap_delete", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "sw_if_index"], + {"crc" : "0xe99d41c1"} + ], + ["tap_delete_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0x0e47d140"} + ], + ["sw_interface_tap_dump", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + {"crc" : "0xbc6ddbe2"} + ], + ["sw_interface_tap_details", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["u32", "sw_if_index"], + ["u8", "dev_name", 64], + {"crc" : "0x0df07bc3"} + ] + ], +"vl_api_version" :"0x1aedb9f2" +} diff --git a/examples/bin_api/tap/tap.go b/examples/bin_api/tap/tap.go new file mode 100644 index 0000000..4d892ac --- /dev/null +++ b/examples/bin_api/tap/tap.go @@ -0,0 +1,264 @@ +// Package tap represents the VPP binary API of the 'tap' VPP module. +// DO NOT EDIT. Generated from 'bin_api/tap.api.json' on Fri, 21 Apr 2017 17:10:06 CEST. +package tap + +import "gerrit.fd.io/r/govpp/api" + +// VlApiVersion contains version of the API. +const VlAPIVersion = 0x1aedb9f2 + +// TapConnect represents the VPP binary API message 'tap_connect'. +// Generated from 'bin_api/tap.api.json', line 6: +// +// ["tap_connect", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u8", "use_random_mac"], +// ["u8", "tap_name", 64], +// ["u8", "mac_address", 6], +// ["u8", "renumber"], +// ["u32", "custom_dev_instance"], +// ["u8", "ip4_address_set"], +// ["u8", "ip4_address", 4], +// ["u8", "ip4_mask_width"], +// ["u8", "ip6_address_set"], +// ["u8", "ip6_address", 16], +// ["u8", "ip6_mask_width"], +// ["u8", "tag", 64], +// {"crc" : "0x91720de3"} +// ], +// +type TapConnect struct { + UseRandomMac uint8 + TapName []byte `struc:"[64]byte"` + MacAddress []byte `struc:"[6]byte"` + Renumber uint8 + CustomDevInstance uint32 + IP4AddressSet uint8 + IP4Address []byte `struc:"[4]byte"` + IP4MaskWidth uint8 + IP6AddressSet uint8 + IP6Address []byte `struc:"[16]byte"` + IP6MaskWidth uint8 + Tag []byte `struc:"[64]byte"` +} + +func (*TapConnect) GetMessageName() string { + return "tap_connect" +} +func (*TapConnect) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*TapConnect) GetCrcString() string { + return "91720de3" +} +func NewTapConnect() api.Message { + return &TapConnect{} +} + +// TapConnectReply represents the VPP binary API message 'tap_connect_reply'. +// Generated from 'bin_api/tap.api.json', line 24: +// +// ["tap_connect_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// ["u32", "sw_if_index"], +// {"crc" : "0xf47feac1"} +// ], +// +type TapConnectReply struct { + Retval int32 + SwIfIndex uint32 +} + +func (*TapConnectReply) GetMessageName() string { + return "tap_connect_reply" +} +func (*TapConnectReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*TapConnectReply) GetCrcString() string { + return "f47feac1" +} +func NewTapConnectReply() api.Message { + return &TapConnectReply{} +} + +// TapModify represents the VPP binary API message 'tap_modify'. +// Generated from 'bin_api/tap.api.json', line 31: +// +// ["tap_modify", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// ["u8", "use_random_mac"], +// ["u8", "tap_name", 64], +// ["u8", "mac_address", 6], +// ["u8", "renumber"], +// ["u32", "custom_dev_instance"], +// {"crc" : "0x8abcd5f3"} +// ], +// +type TapModify struct { + SwIfIndex uint32 + UseRandomMac uint8 + TapName []byte `struc:"[64]byte"` + MacAddress []byte `struc:"[6]byte"` + Renumber uint8 + CustomDevInstance uint32 +} + +func (*TapModify) GetMessageName() string { + return "tap_modify" +} +func (*TapModify) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*TapModify) GetCrcString() string { + return "8abcd5f3" +} +func NewTapModify() api.Message { + return &TapModify{} +} + +// TapModifyReply represents the VPP binary API message 'tap_modify_reply'. +// Generated from 'bin_api/tap.api.json', line 43: +// +// ["tap_modify_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// ["u32", "sw_if_index"], +// {"crc" : "0x00aaf940"} +// ], +// +type TapModifyReply struct { + Retval int32 + SwIfIndex uint32 +} + +func (*TapModifyReply) GetMessageName() string { + return "tap_modify_reply" +} +func (*TapModifyReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*TapModifyReply) GetCrcString() string { + return "00aaf940" +} +func NewTapModifyReply() api.Message { + return &TapModifyReply{} +} + +// TapDelete represents the VPP binary API message 'tap_delete'. +// Generated from 'bin_api/tap.api.json', line 50: +// +// ["tap_delete", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// {"crc" : "0xe99d41c1"} +// ], +// +type TapDelete struct { + SwIfIndex uint32 +} + +func (*TapDelete) GetMessageName() string { + return "tap_delete" +} +func (*TapDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*TapDelete) GetCrcString() string { + return "e99d41c1" +} +func NewTapDelete() api.Message { + return &TapDelete{} +} + +// TapDeleteReply represents the VPP binary API message 'tap_delete_reply'. +// Generated from 'bin_api/tap.api.json', line 57: +// +// ["tap_delete_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0x0e47d140"} +// ], +// +type TapDeleteReply struct { + Retval int32 +} + +func (*TapDeleteReply) GetMessageName() string { + return "tap_delete_reply" +} +func (*TapDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*TapDeleteReply) GetCrcString() string { + return "0e47d140" +} +func NewTapDeleteReply() api.Message { + return &TapDeleteReply{} +} + +// SwInterfaceTapDump represents the VPP binary API message 'sw_interface_tap_dump'. +// Generated from 'bin_api/tap.api.json', line 63: +// +// ["sw_interface_tap_dump", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// {"crc" : "0xbc6ddbe2"} +// ], +// +type SwInterfaceTapDump struct { +} + +func (*SwInterfaceTapDump) GetMessageName() string { + return "sw_interface_tap_dump" +} +func (*SwInterfaceTapDump) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*SwInterfaceTapDump) GetCrcString() string { + return "bc6ddbe2" +} +func NewSwInterfaceTapDump() api.Message { + return &SwInterfaceTapDump{} +} + +// SwInterfaceTapDetails represents the VPP binary API message 'sw_interface_tap_details'. +// Generated from 'bin_api/tap.api.json', line 69: +// +// ["sw_interface_tap_details", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// ["u8", "dev_name", 64], +// {"crc" : "0x0df07bc3"} +// ] +// +type SwInterfaceTapDetails struct { + SwIfIndex uint32 + DevName []byte `struc:"[64]byte"` +} + +func (*SwInterfaceTapDetails) GetMessageName() string { + return "sw_interface_tap_details" +} +func (*SwInterfaceTapDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*SwInterfaceTapDetails) GetCrcString() string { + return "0df07bc3" +} +func NewSwInterfaceTapDetails() api.Message { + return &SwInterfaceTapDetails{} +} diff --git a/examples/bin_api/uflow.api.json b/examples/bin_api/uflow.api.json new file mode 100644 index 0000000..df63772 --- /dev/null +++ b/examples/bin_api/uflow.api.json @@ -0,0 +1,78 @@ +{ + "types" : [ + ["uflow_idx", + ["u32", "vslot"], + ["u32", "md"], + ["u32", "sid"], + {"crc" : "0x3310d92c"} + ], + ["uflow_ent", + ["u32", "cm_dpidx"], + ["u32", "vbundle_dpidx"], + {"crc" : "0x50fa3f43"} + ], + ["uflow_row", + ["vl_api_uflow_idx_t", "idx"], + ["vl_api_uflow_ent_t", "ent"], + {"crc" : "0x3b73b975"} + ] + ], + "messages" : [ + ["uflow_enable_disable", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["u32", "sw_if_index"], + ["u8", "enable_disable"], + {"crc" : "0x4c7f1b8a"} + ], + ["uflow_enable_disable_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0xf47b6600"} + ], + ["uflow_set_ent", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["vl_api_uflow_idx_t", "idx"], + ["vl_api_uflow_ent_t", "ent"], + {"crc" : "0x6bfeac11"} + ], + ["uflow_set_ent_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0xc49943f5"} + ], + ["uflow_clr_ent", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + ["vl_api_uflow_idx_t", "idx"], + {"crc" : "0x9c0b61a7"} + ], + ["uflow_clr_ent_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + {"crc" : "0x6ca429f7"} + ], + ["uflow_dump", + ["u16", "_vl_msg_id"], + ["u32", "client_index"], + ["u32", "context"], + {"crc" : "0xf0ac7601"} + ], + ["uflow_dump_reply", + ["u16", "_vl_msg_id"], + ["u32", "context"], + ["i32", "retval"], + ["u32", "num"], + ["vl_api_uflow_row_t", "row", 0, "num"], + {"crc" : "0x85b96451"} + ] + ], +"vl_api_version" :"0x85909300" +} diff --git a/examples/bin_api/uflow/uflow.go b/examples/bin_api/uflow/uflow.go new file mode 100644 index 0000000..ecf1674 --- /dev/null +++ b/examples/bin_api/uflow/uflow.go @@ -0,0 +1,299 @@ +// Package uflow represents the VPP binary API of the 'uflow' VPP module. +// DO NOT EDIT. Generated from 'bin_api/uflow.api.json' on Fri, 21 Apr 2017 17:10:06 CEST. +package uflow + +import "gerrit.fd.io/r/govpp/api" + +// VlApiVersion contains version of the API. +const VlAPIVersion = 0x85909300 + +// UflowIdx represents the VPP binary API data type 'uflow_idx'. +// Generated from 'bin_api/uflow.api.json', line 3: +// +// ["uflow_idx", +// ["u32", "vslot"], +// ["u32", "md"], +// ["u32", "sid"], +// {"crc" : "0x3310d92c"} +// ], +// +type UflowIdx struct { + Vslot uint32 + Md uint32 + Sid uint32 +} + +func (*UflowIdx) GetTypeName() string { + return "uflow_idx" +} +func (*UflowIdx) GetCrcString() string { + return "3310d92c" +} + +// UflowEnt represents the VPP binary API data type 'uflow_ent'. +// Generated from 'bin_api/uflow.api.json', line 9: +// +// ["uflow_ent", +// ["u32", "cm_dpidx"], +// ["u32", "vbundle_dpidx"], +// {"crc" : "0x50fa3f43"} +// ], +// +type UflowEnt struct { + CmDpidx uint32 + VbundleDpidx uint32 +} + +func (*UflowEnt) GetTypeName() string { + return "uflow_ent" +} +func (*UflowEnt) GetCrcString() string { + return "50fa3f43" +} + +// UflowRow represents the VPP binary API data type 'uflow_row'. +// Generated from 'bin_api/uflow.api.json', line 14: +// +// ["uflow_row", +// ["vl_api_uflow_idx_t", "idx"], +// ["vl_api_uflow_ent_t", "ent"], +// {"crc" : "0x3b73b975"} +// ] +// +type UflowRow struct { + Idx UflowIdx + Ent UflowEnt +} + +func (*UflowRow) GetTypeName() string { + return "uflow_row" +} +func (*UflowRow) GetCrcString() string { + return "3b73b975" +} + +// UflowEnableDisable represents the VPP binary API message 'uflow_enable_disable'. +// Generated from 'bin_api/uflow.api.json', line 21: +// +// ["uflow_enable_disable", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["u32", "sw_if_index"], +// ["u8", "enable_disable"], +// {"crc" : "0x4c7f1b8a"} +// ], +// +type UflowEnableDisable struct { + SwIfIndex uint32 + EnableDisable uint8 +} + +func (*UflowEnableDisable) GetMessageName() string { + return "uflow_enable_disable" +} +func (*UflowEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*UflowEnableDisable) GetCrcString() string { + return "4c7f1b8a" +} +func NewUflowEnableDisable() api.Message { + return &UflowEnableDisable{} +} + +// UflowEnableDisableReply represents the VPP binary API message 'uflow_enable_disable_reply'. +// Generated from 'bin_api/uflow.api.json', line 29: +// +// ["uflow_enable_disable_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0xf47b6600"} +// ], +// +type UflowEnableDisableReply struct { + Retval int32 +} + +func (*UflowEnableDisableReply) GetMessageName() string { + return "uflow_enable_disable_reply" +} +func (*UflowEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*UflowEnableDisableReply) GetCrcString() string { + return "f47b6600" +} +func NewUflowEnableDisableReply() api.Message { + return &UflowEnableDisableReply{} +} + +// UflowSetEnt represents the VPP binary API message 'uflow_set_ent'. +// Generated from 'bin_api/uflow.api.json', line 35: +// +// ["uflow_set_ent", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["vl_api_uflow_idx_t", "idx"], +// ["vl_api_uflow_ent_t", "ent"], +// {"crc" : "0x6bfeac11"} +// ], +// +type UflowSetEnt struct { + Idx UflowIdx + Ent UflowEnt +} + +func (*UflowSetEnt) GetMessageName() string { + return "uflow_set_ent" +} +func (*UflowSetEnt) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*UflowSetEnt) GetCrcString() string { + return "6bfeac11" +} +func NewUflowSetEnt() api.Message { + return &UflowSetEnt{} +} + +// UflowSetEntReply represents the VPP binary API message 'uflow_set_ent_reply'. +// Generated from 'bin_api/uflow.api.json', line 43: +// +// ["uflow_set_ent_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0xc49943f5"} +// ], +// +type UflowSetEntReply struct { + Retval int32 +} + +func (*UflowSetEntReply) GetMessageName() string { + return "uflow_set_ent_reply" +} +func (*UflowSetEntReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*UflowSetEntReply) GetCrcString() string { + return "c49943f5" +} +func NewUflowSetEntReply() api.Message { + return &UflowSetEntReply{} +} + +// UflowClrEnt represents the VPP binary API message 'uflow_clr_ent'. +// Generated from 'bin_api/uflow.api.json', line 49: +// +// ["uflow_clr_ent", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// ["vl_api_uflow_idx_t", "idx"], +// {"crc" : "0x9c0b61a7"} +// ], +// +type UflowClrEnt struct { + Idx UflowIdx +} + +func (*UflowClrEnt) GetMessageName() string { + return "uflow_clr_ent" +} +func (*UflowClrEnt) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*UflowClrEnt) GetCrcString() string { + return "9c0b61a7" +} +func NewUflowClrEnt() api.Message { + return &UflowClrEnt{} +} + +// UflowClrEntReply represents the VPP binary API message 'uflow_clr_ent_reply'. +// Generated from 'bin_api/uflow.api.json', line 56: +// +// ["uflow_clr_ent_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// {"crc" : "0x6ca429f7"} +// ], +// +type UflowClrEntReply struct { + Retval int32 +} + +func (*UflowClrEntReply) GetMessageName() string { + return "uflow_clr_ent_reply" +} +func (*UflowClrEntReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*UflowClrEntReply) GetCrcString() string { + return "6ca429f7" +} +func NewUflowClrEntReply() api.Message { + return &UflowClrEntReply{} +} + +// UflowDump represents the VPP binary API message 'uflow_dump'. +// Generated from 'bin_api/uflow.api.json', line 62: +// +// ["uflow_dump", +// ["u16", "_vl_msg_id"], +// ["u32", "client_index"], +// ["u32", "context"], +// {"crc" : "0xf0ac7601"} +// ], +// +type UflowDump struct { +} + +func (*UflowDump) GetMessageName() string { + return "uflow_dump" +} +func (*UflowDump) GetMessageType() api.MessageType { + return api.RequestMessage +} +func (*UflowDump) GetCrcString() string { + return "f0ac7601" +} +func NewUflowDump() api.Message { + return &UflowDump{} +} + +// UflowDumpReply represents the VPP binary API message 'uflow_dump_reply'. +// Generated from 'bin_api/uflow.api.json', line 68: +// +// ["uflow_dump_reply", +// ["u16", "_vl_msg_id"], +// ["u32", "context"], +// ["i32", "retval"], +// ["u32", "num"], +// ["vl_api_uflow_row_t", "row", 0, "num"], +// {"crc" : "0x85b96451"} +// ] +// +type UflowDumpReply struct { + Retval int32 + Num uint32 `struc:"sizeof=Row"` + Row []UflowRow +} + +func (*UflowDumpReply) GetMessageName() string { + return "uflow_dump_reply" +} +func (*UflowDumpReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (*UflowDumpReply) GetCrcString() string { + return "85b96451" +} +func NewUflowDumpReply() api.Message { + return &UflowDumpReply{} +} diff --git a/examples/example_client.go b/examples/example_client.go new file mode 100644 index 0000000..fd858ee --- /dev/null +++ b/examples/example_client.go @@ -0,0 +1,269 @@ +// Copyright (c) 2017 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Example VPP management application that exercises the govpp API on real-world use-cases. +package main + +// Generates Go bindings for all VPP APIs located in the json directory. +//go:generate binapi_generator --input-dir=bin_api --output-dir=bin_api + +import ( + "fmt" + "net" + "os" + "os/signal" + + "gerrit.fd.io/r/govpp" + "gerrit.fd.io/r/govpp/api" + "gerrit.fd.io/r/govpp/api/ifcounters" + "gerrit.fd.io/r/govpp/core/bin_api/vpe" + "gerrit.fd.io/r/govpp/examples/bin_api/acl" + "gerrit.fd.io/r/govpp/examples/bin_api/interfaces" + "gerrit.fd.io/r/govpp/examples/bin_api/tap" +) + +func main() { + fmt.Println("Starting example VPP client...") + + // connect to VPP and create an API channel that will be used in the examples + conn, _ := govpp.Connect() + defer conn.Disconnect() + + ch, _ := conn.NewAPIChannel() + defer ch.Close() + + // check whether the VPP supports our version of some messages + compatibilityCheck(ch) + + // individual examples + aclVersion(ch) + aclConfig(ch) + aclDump(ch) + + tapConnect(ch) + + interfaceDump(ch) + interfaceNotifications(ch) + + //interfaceCounters(ch) +} + +// compatibilityCheck shows how an management application can check whether generated API messages are +// compatible with the version of VPP which the library is connected to. +func compatibilityCheck(ch *api.Channel) { + err := ch.CheckMessageCompatibility( + &interfaces.SwInterfaceDump{}, + &interfaces.SwInterfaceDetails{}, + ) + if err != nil { + fmt.Println(err) + os.Exit(1) + } +} + +// aclVersion is the simplest API example - one empty request message and one reply message. +func aclVersion(ch *api.Channel) { + req := &acl.ACLPluginGetVersion{} + reply := &acl.ACLPluginGetVersionReply{} + + err := ch.SendRequest(req).ReceiveReply(reply) + + if err != nil { + fmt.Println("Error:", err) + } else { + fmt.Printf("%+v\n", reply) + } +} + +// aclConfig is another simple API example - in this case, the request contains structured data. +func aclConfig(ch *api.Channel) { + req := &acl.ACLAddReplace{ + ACLIndex: ^uint32(0), + Tag: []byte("access list 1"), + R: []acl.ACLRule{ + { + IsPermit: 1, + SrcIPAddr: net.ParseIP("10.0.0.0").To4(), + SrcIPPrefixLen: 8, + DstIPAddr: net.ParseIP("192.168.1.0").To4(), + DstIPPrefixLen: 24, + Proto: 6, + }, + { + IsPermit: 1, + SrcIPAddr: net.ParseIP("8.8.8.8").To4(), + SrcIPPrefixLen: 32, + DstIPAddr: net.ParseIP("172.16.0.0").To4(), + DstIPPrefixLen: 16, + Proto: 6, + }, + }, + } + reply := &acl.ACLAddReplaceReply{} + + err := ch.SendRequest(req).ReceiveReply(reply) + + if err != nil { + fmt.Println("Error:", err) + } else { + fmt.Printf("%+v\n", reply) + } +} + +// aclDump shows an example where SendRequest and ReceiveReply are not chained together. +func aclDump(ch *api.Channel) { + req := &acl.ACLDump{} + reply := &acl.ACLDetails{} + + reqCtx := ch.SendRequest(req) + err := reqCtx.ReceiveReply(reply) + + if err != nil { + fmt.Println("Error:", err) + } else { + fmt.Printf("%+v\n", reply) + } +} + +// tapConnect example shows how the Go channels in the API channel can be accessed directly instead +// of using SendRequest and ReceiveReply wrappers. +func tapConnect(ch *api.Channel) { + req := &tap.TapConnect{ + TapName: []byte("testtap"), + UseRandomMac: 1, + } + + // send the request to the request go channel + ch.ReqChan <- &api.VppRequest{Message: req} + + // receive a reply from the reply go channel + vppReply := <-ch.ReplyChan + if vppReply.Error != nil { + fmt.Println("Error:", vppReply.Error) + return + } + + // decode the message + reply := &tap.TapConnectReply{} + err := ch.MsgDecoder.DecodeMsg(vppReply.Data, reply) + + if err != nil { + fmt.Println("Error:", err) + } else { + fmt.Printf("%+v\n", reply) + } +} + +// interfaceDump shows an example of multipart request (multiple replies are expected). +func interfaceDump(ch *api.Channel) { + req := &interfaces.SwInterfaceDump{} + reqCtx := ch.SendMultiRequest(req) + + for { + msg := &interfaces.SwInterfaceDetails{} + stop, err := reqCtx.ReceiveReply(msg) + if stop { + break // break out of the loop + } + if err != nil { + fmt.Println("Error:", err) + } + fmt.Printf("%+v\n", msg) + } +} + +// interfaceNotifications shows the usage of notification API. Note that for notifications, +// you are supposed to create your own Go channel with your preferred buffer size. If the channel's +// buffer is full, the notifications will not be delivered into it. +func interfaceNotifications(ch *api.Channel) { + // subscribe for specific notification message + notifChan := make(chan api.Message, 100) + subs, _ := ch.SubscribeNotification(notifChan, interfaces.NewSwInterfaceSetFlags) + + // enable interface events in VPP + ch.SendRequest(&interfaces.WantInterfaceEvents{ + Pid: uint32(os.Getpid()), + EnableDisable: 1, + }).ReceiveReply(&interfaces.WantInterfaceEventsReply{}) + + // generate some events in VPP + ch.SendRequest(&interfaces.SwInterfaceSetFlags{ + SwIfIndex: 0, + AdminUpDown: 0, + }).ReceiveReply(&interfaces.SwInterfaceSetFlagsReply{}) + ch.SendRequest(&interfaces.SwInterfaceSetFlags{ + SwIfIndex: 0, + AdminUpDown: 1, + }).ReceiveReply(&interfaces.SwInterfaceSetFlagsReply{}) + + // receive one notification + notif := (<-notifChan).(*interfaces.SwInterfaceSetFlags) + fmt.Printf("%+v\n", notif) + + // unsubscribe from delivery of the notifications + ch.UnsubscribeNotification(subs) +} + +// interfaceCounters is an example of using notification API to periodically retrieve interface statistics. +// The ifcounters package contains the API that can be used to decode the strange VnetInterfaceCounters message. +func interfaceCounters(ch *api.Channel) { + // subscribe for interface counters notifications + notifChan := make(chan api.Message, 100) + subs, _ := ch.SubscribeNotification(notifChan, interfaces.NewVnetInterfaceCounters) + + // enable interface counters notifications from VPP + ch.SendRequest(&vpe.WantStats{ + Pid: uint32(os.Getpid()), + EnableDisable: 1, + }).ReceiveReply(&vpe.WantStatsReply{}) + + // create channel for Interrupt signal + sigChan := make(chan os.Signal, 1) + signal.Notify(sigChan, os.Interrupt) + + // loop until Interrupt signal is received +loop: + for { + select { + case <-sigChan: + // interrupt received + break loop + case notifMsg := <-notifChan: + notif := notifMsg.(*interfaces.VnetInterfaceCounters) + // notification received + fmt.Printf("%+v\n", notif) + + if notif.IsCombined == 0 { + // simple counter + counters, err := ifcounters.DecodeCounters(ifcounters.VnetInterfaceCounters(*notif)) + if err != nil { + fmt.Println("Error:", err) + } else { + fmt.Printf("%+v\n", counters) + } + } else { + // combined counter + counters, err := ifcounters.DecodeCombinedCounters(ifcounters.VnetInterfaceCounters(*notif)) + if err != nil { + fmt.Println("Error:", err) + } else { + fmt.Printf("%+v\n", counters) + } + } + } + } + + // unsubscribe from delivery of the notifications + ch.UnsubscribeNotification(subs) +} diff --git a/examples/examples b/examples/examples new file mode 100755 index 0000000..30dde52 Binary files /dev/null and b/examples/examples differ -- cgit 1.2.3-korg