diff options
author | Ondrej Fabry <ofabry@cisco.com> | 2018-12-13 10:21:49 +0100 |
---|---|---|
committer | Ondrej Fabry <ofabry@cisco.com> | 2018-12-13 10:21:49 +0100 |
commit | 868b541e296dc47748ad03b8f0174c828d996529 (patch) | |
tree | a43650ea7d9c96434d536e557177b38c5f84bd34 /examples/bin_api/af_packet/af_packet.ba.go | |
parent | 1768c495416997c7a6769c6a92b33b37c89eed25 (diff) |
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 <ofabry@cisco.com>
Diffstat (limited to 'examples/bin_api/af_packet/af_packet.ba.go')
-rw-r--r-- | examples/bin_api/af_packet/af_packet.ba.go | 378 |
1 files changed, 197 insertions, 181 deletions
diff --git a/examples/bin_api/af_packet/af_packet.ba.go b/examples/bin_api/af_packet/af_packet.ba.go index 81c2b9d..93d5e58 100644 --- a/examples/bin_api/af_packet/af_packet.ba.go +++ b/examples/bin_api/af_packet/af_packet.ba.go @@ -20,40 +20,65 @@ var _ = api.RegisterMessage var _ = struc.Pack var _ = bytes.NewBuffer +// Services represents VPP binary API services: +// +// "services": { +// "af_packet_dump": { +// "reply": "af_packet_details", +// "stream": true +// }, +// "af_packet_set_l4_cksum_offload": { +// "reply": "af_packet_set_l4_cksum_offload_reply" +// }, +// "af_packet_delete": { +// "reply": "af_packet_delete_reply" +// }, +// "af_packet_create": { +// "reply": "af_packet_create_reply" +// } +// }, +// +type Services interface { + DumpAfPacket(*AfPacketDump) ([]*AfPacketDetails, error) + AfPacketCreate(*AfPacketCreate) (*AfPacketCreateReply, error) + AfPacketDelete(*AfPacketDelete) (*AfPacketDeleteReply, error) + AfPacketSetL4CksumOffload(*AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) +} + /* Messages */ -// AfPacketCreate represents the VPP binary API message 'af_packet_create'. +// AfPacketCreate represents VPP binary API message 'af_packet_create': // -// "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": "0x6d5d30d6" -// } +// "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": "0x6d5d30d6" +// } // type AfPacketCreate struct { HostIfName []byte `struc:"[64]byte"` @@ -71,28 +96,28 @@ func (*AfPacketCreate) GetMessageType() api.MessageType { return api.RequestMessage } -// AfPacketCreateReply represents the VPP binary API message 'af_packet_create_reply'. +// AfPacketCreateReply represents VPP binary API message 'af_packet_create_reply': // -// "af_packet_create_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0xfda5941f" -// } +// "af_packet_create_reply", +// [ +// "u16", +// "_vl_msg_id" +// ], +// [ +// "u32", +// "context" +// ], +// [ +// "i32", +// "retval" +// ], +// [ +// "u32", +// "sw_if_index" +// ], +// { +// "crc": "0xfda5941f" +// } // type AfPacketCreateReply struct { Retval int32 @@ -109,29 +134,29 @@ func (*AfPacketCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// AfPacketDelete represents the VPP binary API message 'af_packet_delete'. +// AfPacketDelete represents VPP binary API message 'af_packet_delete': // -// "af_packet_delete", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "host_if_name", -// 64 -// ], -// { -// "crc": "0x3efceda3" -// } +// "af_packet_delete", +// [ +// "u16", +// "_vl_msg_id" +// ], +// [ +// "u32", +// "client_index" +// ], +// [ +// "u32", +// "context" +// ], +// [ +// "u8", +// "host_if_name", +// 64 +// ], +// { +// "crc": "0x3efceda3" +// } // type AfPacketDelete struct { HostIfName []byte `struc:"[64]byte"` @@ -147,24 +172,24 @@ func (*AfPacketDelete) GetMessageType() api.MessageType { return api.RequestMessage } -// AfPacketDeleteReply represents the VPP binary API message 'af_packet_delete_reply'. +// AfPacketDeleteReply represents VPP binary API message 'af_packet_delete_reply': // -// "af_packet_delete_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } +// "af_packet_delete_reply", +// [ +// "u16", +// "_vl_msg_id" +// ], +// [ +// "u32", +// "context" +// ], +// [ +// "i32", +// "retval" +// ], +// { +// "crc": "0xe8d4e804" +// } // type AfPacketDeleteReply struct { Retval int32 @@ -180,32 +205,32 @@ func (*AfPacketDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// AfPacketSetL4CksumOffload represents the VPP binary API message 'af_packet_set_l4_cksum_offload'. +// AfPacketSetL4CksumOffload represents VPP binary API message 'af_packet_set_l4_cksum_offload': // -// "af_packet_set_l4_cksum_offload", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "sw_if_index" -// ], -// [ -// "u8", -// "set" -// ], -// { -// "crc": "0x86538585" -// } +// "af_packet_set_l4_cksum_offload", +// [ +// "u16", +// "_vl_msg_id" +// ], +// [ +// "u32", +// "client_index" +// ], +// [ +// "u32", +// "context" +// ], +// [ +// "u8", +// "sw_if_index" +// ], +// [ +// "u8", +// "set" +// ], +// { +// "crc": "0x86538585" +// } // type AfPacketSetL4CksumOffload struct { SwIfIndex uint8 @@ -222,24 +247,24 @@ func (*AfPacketSetL4CksumOffload) GetMessageType() api.MessageType { return api.RequestMessage } -// AfPacketSetL4CksumOffloadReply represents the VPP binary API message 'af_packet_set_l4_cksum_offload_reply'. +// AfPacketSetL4CksumOffloadReply represents VPP binary API message 'af_packet_set_l4_cksum_offload_reply': // -// "af_packet_set_l4_cksum_offload_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } +// "af_packet_set_l4_cksum_offload_reply", +// [ +// "u16", +// "_vl_msg_id" +// ], +// [ +// "u32", +// "context" +// ], +// [ +// "i32", +// "retval" +// ], +// { +// "crc": "0xe8d4e804" +// } // type AfPacketSetL4CksumOffloadReply struct { Retval int32 @@ -255,24 +280,24 @@ func (*AfPacketSetL4CksumOffloadReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// AfPacketDump represents the VPP binary API message 'af_packet_dump'. +// AfPacketDump represents VPP binary API message 'af_packet_dump': // -// "af_packet_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } +// "af_packet_dump", +// [ +// "u16", +// "_vl_msg_id" +// ], +// [ +// "u32", +// "client_index" +// ], +// [ +// "u32", +// "context" +// ], +// { +// "crc": "0x51077d14" +// } // type AfPacketDump struct{} @@ -286,29 +311,29 @@ func (*AfPacketDump) GetMessageType() api.MessageType { return api.RequestMessage } -// AfPacketDetails represents the VPP binary API message 'af_packet_details'. +// AfPacketDetails represents VPP binary API message 'af_packet_details': // -// "af_packet_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "host_if_name", -// 64 -// ], -// { -// "crc": "0x057205fa" -// } +// "af_packet_details", +// [ +// "u16", +// "_vl_msg_id" +// ], +// [ +// "u32", +// "context" +// ], +// [ +// "u32", +// "sw_if_index" +// ], +// [ +// "u8", +// "host_if_name", +// 64 +// ], +// { +// "crc": "0x057205fa" +// } // type AfPacketDetails struct { SwIfIndex uint32 @@ -325,15 +350,6 @@ func (*AfPacketDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -/* Services */ - -type Services interface { - DumpAfPacket(*AfPacketDump) (*AfPacketDetails, error) - AfPacketCreate(*AfPacketCreate) (*AfPacketCreateReply, error) - AfPacketDelete(*AfPacketDelete) (*AfPacketDeleteReply, error) - AfPacketSetL4CksumOffload(*AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) -} - func init() { api.RegisterMessage((*AfPacketCreate)(nil), "af_packet.AfPacketCreate") api.RegisterMessage((*AfPacketCreateReply)(nil), "af_packet.AfPacketCreateReply") |