summaryrefslogtreecommitdiffstats
path: root/src/tools/vppapigen/VPPAPI.md
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/vppapigen/VPPAPI.md')
+};
+
+```
+
+Which states that the request want_interface_events returns a
+want_interface_events_reply and if enabled the client will
+receive sw_interface_event messages whenever interface states changes.
+
+```
+ service : SERVICE '{' service_statements '}' ';'
+ service_statements : service_statement
+ | service_statements service_statement
+ service_statement : RPC ID RETURNS NULL ';'
+ | RPC ID RETURNS ID ';'
+ | RPC ID RETURNS STREAM ID ';'
+ | RPC ID RETURNS ID EVENTS event_list ';'
+ event_list : events
+ | event_list events
+ events : ID
+ | ID ','
+```
+
+
+## Types
+### Scalar Value Types
+
+.api type|size|C type|Python type
+---------|----|------------------
+i8 | 1|i8 |int
+u8 | 1|u8 |int
+i16 | 2|i16 |int
+u16 | 2|u16 |int
+i32 | 4|i32 |int
+u32 | 4|u32 |int
+i64 | 8|i64 |int
+u64 | 8|u64 |int
+f64 | 8|f64 |float
+bool | 1|bool |boolean
+string |variable|vl_api_string_t|str
+
+### User Defined Types
+#### vnet/ip/ip_types.api
+
+.api type|size|C type|Python type
+---------|----|------|-----------
+vl_api_address_t|20|vl_api_address_t|`<class 'ipaddress.IPv4Address'> or <class 'ipaddress.IPv6Address'>`
+vl_api_ip4_address_t|4|vl_api_ip4_address_t|`<class 'ipaddress.IPv4Address'>`
+vl_api_ip6_address_t|16|vl_api_ip6_address_t|`<class 'ipaddress.IPv6Address'>`
+vl_api_prefix_t|21|vl_api_prefix_t|`<class 'ipaddress.IPv4Network'> or <class 'ipaddress.IPv6Network'>`
+vl_api_ip4_prefix_t|5|vl_api_ip4_prefix_t|`<class 'ipaddress.IPv4Network'>`
+vl_api_ip6_prefix_t|17|vl_api_ip6_prefix_t|`<class 'ipaddress.IPv6Network'>`
+
+#### vnet/ethernet/ethernet_types.api
+.api type|size|C type|Python type
+---------|----|------|-----------
+vl_api_mac_address_t|6|vl_api_mac_address_t|`class 'vpp_papi.MACAddress'>`
+
+#### vnet/interface_types.api
+.api type|size|C type|Python type
+---------|----|------|-----------
+vl_api_interface_index_t|4|vl_api_interface_index_t|int
+
+### New explicit types
+
+#### String versus bytes
+A byte string with a maximum length of 64:
+```
+u8 name[64];
+```
+Before the "string" type was added, text string were defined like this.
+The implications of that was the user would have to know if the field
+represented a \0 ended C-string or a fixed length byte string.
+The wire format of the 'string' type is a u32 length
+
+An IPv4 or IPv6 address was previously defined like:
+```
+u8 is_ip6;
+u8 address[16];
+```
+
+Which made it hard for language bindings to represent the
+address as anything but a byte string.
+The new explicit address types are shown above.
+
+## Language generators
+
+The VPP API compiler currently has two output modules. One generating JSON
+and one generating C header files that are directly used by the VPP
+infrastructure and plugins.
+
+The C/C++, Python, Go Lua, and Java language bindings are generated based
+on the JSON files.
+
+### Future considerations
+- [ ] Generate C/C++ (vapi) client code directly from vppapigen
+- [ ] Embed JSON definitions into the API server, so dynamic languages
+ can download them directly without going via the filesystem and JSON
+ files.