From 868b541e296dc47748ad03b8f0174c828d996529 Mon Sep 17 00:00:00 2001 From: Ondrej Fabry Date: Thu, 13 Dec 2018 10:21:49 +0100 Subject: Add support for aliases and boolean type - aliases are now generated as new types or arrays (if length > 0) - bool is recognized as a boolean type and generated as Go bool - comment with original JSON is now prepended for each object type - interface Services is now generated at the top of the file to provide overview of what RPC services does the current module consists of - dump services now correctly return slice of the particular details type Change-Id: I788babc1c0f2de33e0febd87e5b200d54065b244 Signed-off-by: Ondrej Fabry --- examples/bin_api/tap/tap.ba.go | 498 +++++++++++++++++++++-------------------- 1 file changed, 257 insertions(+), 241 deletions(-) (limited to 'examples/bin_api/tap/tap.ba.go') diff --git a/examples/bin_api/tap/tap.ba.go b/examples/bin_api/tap/tap.ba.go index d4daa1d..f94f7be 100644 --- a/examples/bin_api/tap/tap.ba.go +++ b/examples/bin_api/tap/tap.ba.go @@ -20,79 +20,104 @@ var _ = api.RegisterMessage var _ = struc.Pack var _ = bytes.NewBuffer +// Services represents VPP binary API services: +// +// "services": { +// "tap_delete": { +// "reply": "tap_delete_reply" +// }, +// "sw_interface_tap_dump": { +// "reply": "sw_interface_tap_details", +// "stream": true +// }, +// "tap_modify": { +// "reply": "tap_modify_reply" +// }, +// "tap_connect": { +// "reply": "tap_connect_reply" +// } +// }, +// +type Services interface { + DumpSwInterfaceTap(*SwInterfaceTapDump) ([]*SwInterfaceTapDetails, error) + TapConnect(*TapConnect) (*TapConnectReply, error) + TapDelete(*TapDelete) (*TapDeleteReply, error) + TapModify(*TapModify) (*TapModifyReply, error) +} + /* Messages */ -// TapConnect represents the VPP binary API message 'tap_connect'. +// TapConnect represents VPP binary API message 'tap_connect': // -// "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": "0x9b9c396f" -// } +// "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": "0x9b9c396f" +// } // type TapConnect struct { UseRandomMac uint8 @@ -119,28 +144,28 @@ func (*TapConnect) GetMessageType() api.MessageType { return api.RequestMessage } -// TapConnectReply represents the VPP binary API message 'tap_connect_reply'. +// TapConnectReply represents VPP binary API message 'tap_connect_reply': // -// "tap_connect_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0xfda5941f" -// } +// "tap_connect_reply", +// [ +// "u16", +// "_vl_msg_id" +// ], +// [ +// "u32", +// "context" +// ], +// [ +// "i32", +// "retval" +// ], +// [ +// "u32", +// "sw_if_index" +// ], +// { +// "crc": "0xfda5941f" +// } // type TapConnectReply struct { Retval int32 @@ -157,50 +182,50 @@ func (*TapConnectReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// TapModify represents the VPP binary API message 'tap_modify'. +// TapModify represents VPP binary API message 'tap_modify': // -// "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": "0x8047ae5c" -// } +// "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": "0x8047ae5c" +// } // type TapModify struct { SwIfIndex uint32 @@ -221,28 +246,28 @@ func (*TapModify) GetMessageType() api.MessageType { return api.RequestMessage } -// TapModifyReply represents the VPP binary API message 'tap_modify_reply'. +// TapModifyReply represents VPP binary API message 'tap_modify_reply': // -// "tap_modify_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0xfda5941f" -// } +// "tap_modify_reply", +// [ +// "u16", +// "_vl_msg_id" +// ], +// [ +// "u32", +// "context" +// ], +// [ +// "i32", +// "retval" +// ], +// [ +// "u32", +// "sw_if_index" +// ], +// { +// "crc": "0xfda5941f" +// } // type TapModifyReply struct { Retval int32 @@ -259,28 +284,28 @@ func (*TapModifyReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// TapDelete represents the VPP binary API message 'tap_delete'. +// TapDelete represents VPP binary API message 'tap_delete': // -// "tap_delete", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0x529cb13f" -// } +// "tap_delete", +// [ +// "u16", +// "_vl_msg_id" +// ], +// [ +// "u32", +// "client_index" +// ], +// [ +// "u32", +// "context" +// ], +// [ +// "u32", +// "sw_if_index" +// ], +// { +// "crc": "0x529cb13f" +// } // type TapDelete struct { SwIfIndex uint32 @@ -296,24 +321,24 @@ func (*TapDelete) GetMessageType() api.MessageType { return api.RequestMessage } -// TapDeleteReply represents the VPP binary API message 'tap_delete_reply'. +// TapDeleteReply represents VPP binary API message 'tap_delete_reply': // -// "tap_delete_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } +// "tap_delete_reply", +// [ +// "u16", +// "_vl_msg_id" +// ], +// [ +// "u32", +// "context" +// ], +// [ +// "i32", +// "retval" +// ], +// { +// "crc": "0xe8d4e804" +// } // type TapDeleteReply struct { Retval int32 @@ -329,24 +354,24 @@ func (*TapDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceTapDump represents the VPP binary API message 'sw_interface_tap_dump'. +// SwInterfaceTapDump represents VPP binary API message 'sw_interface_tap_dump': // -// "sw_interface_tap_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } +// "sw_interface_tap_dump", +// [ +// "u16", +// "_vl_msg_id" +// ], +// [ +// "u32", +// "client_index" +// ], +// [ +// "u32", +// "context" +// ], +// { +// "crc": "0x51077d14" +// } // type SwInterfaceTapDump struct{} @@ -360,29 +385,29 @@ func (*SwInterfaceTapDump) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceTapDetails represents the VPP binary API message 'sw_interface_tap_details'. +// SwInterfaceTapDetails represents VPP binary API message 'sw_interface_tap_details': // -// "sw_interface_tap_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "dev_name", -// 64 -// ], -// { -// "crc": "0x76229a57" -// } +// "sw_interface_tap_details", +// [ +// "u16", +// "_vl_msg_id" +// ], +// [ +// "u32", +// "context" +// ], +// [ +// "u32", +// "sw_if_index" +// ], +// [ +// "u8", +// "dev_name", +// 64 +// ], +// { +// "crc": "0x76229a57" +// } // type SwInterfaceTapDetails struct { SwIfIndex uint32 @@ -399,15 +424,6 @@ func (*SwInterfaceTapDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -/* Services */ - -type Services interface { - DumpSwInterfaceTap(*SwInterfaceTapDump) (*SwInterfaceTapDetails, error) - TapConnect(*TapConnect) (*TapConnectReply, error) - TapDelete(*TapDelete) (*TapDeleteReply, error) - TapModify(*TapModify) (*TapModifyReply, error) -} - func init() { api.RegisterMessage((*TapConnect)(nil), "tap.TapConnect") api.RegisterMessage((*TapConnectReply)(nil), "tap.TapConnectReply") -- cgit 1.2.3-korg