IP directed broadcast
[vpp.git] / src / vnet / interface.api
1 option version = "2.0.0";
2
3 service {
4   rpc want_interface_events returns want_interface_events_reply
5     events sw_interface_event;
6 };
7
8 /** \brief Set flags on the interface
9     @param client_index - opaque cookie to identify the sender
10     @param context - sender context, to match reply w/ request
11     @param sw_if_index - index of the interface to set flags on
12     @param admin_up_down - set the admin state, 1 = up, 0 = down
13     @param link_up_down - Oper state sent on change event, not used in config.
14 */
15 autoreply define sw_interface_set_flags
16 {
17   u32 client_index;
18   u32 context;
19   u32 sw_if_index;
20   /* 1 = up, 0 = down */
21   u8 admin_up_down;
22 };
23
24 /** \brief Set interface physical MTU
25     @param client_index - opaque cookie to identify the sender
26     @param context - sender context, to match reply w/ request
27     @param sw_if_index - index of the interface to set MTU on
28     @param mtu - MTU
29 */
30 autoreply define hw_interface_set_mtu
31 {
32   u32 client_index;
33   u32 context;
34   u32 sw_if_index;
35   u16 mtu;
36 };
37
38 /** \brief Set interface L3 MTU */
39 autoreply define sw_interface_set_mtu
40 {
41   u32 client_index;
42   u32 context;
43   u32 sw_if_index;
44   /* $$$$ Replace with enum */
45   u32 mtu[4]; /* 0 - L3, 1 - IP4, 2 - IP6, 3 - MPLS */
46 };
47
48 /** \brief Set IP4 directed broadcast
49     The directed broadcast enabled a packet sent to the interface's
50     subnet address will be broadcast on the interface
51     @param sw_if_index
52     @param enable
53 */
54 autoreply define sw_interface_set_ip_directed_broadcast
55 {
56   u32 client_index;
57   u32 context;
58   u32 sw_if_index;
59   u8  enable;
60 };
61
62
63 /** \brief Interface Event generated by want_interface_events
64     @param client_index - opaque cookie to identify the sender
65     @param pid - client pid registered to receive notification
66     @param sw_if_index - index of the interface of the event
67     @param admin_up_down - The administrative state; 1 = up, 0 = down
68     @param link_up_down - The operational state; 1 = up, 0 = down
69     @param deleted - interface was deleted
70 */
71 define sw_interface_event
72 {
73   u32 client_index;
74   u32 pid;
75   u32 sw_if_index;
76   u8 admin_up_down;
77   u8 link_up_down;
78   u8 deleted;
79 };
80
81 /** \brief Register for interface events
82     @param client_index - opaque cookie to identify the sender
83     @param context - sender context, to match reply w/ request
84     @param enable_disable - 1 => register for events, 0 => cancel registration
85     @param pid - sender's pid
86 */
87 autoreply define want_interface_events
88 {
89   u32 client_index;
90   u32 context;
91   u32 enable_disable;
92   u32 pid;
93 };
94
95 /** \brief Interface details structure (fix this) 
96     @param sw_if_index - index of the interface
97     @param sup_sw_if_index - index of parent interface if any, else same as sw_if_index  
98     @param l2_address_length - length of the interface's l2 address
99     @param pid - the interface's l2 address
100     @param interface_name - name of the interface
101     @param link_duplex - 1 if half duplex, 2 if full duplex
102     @param link_speed - 1 = 10M, 2 = 100M, 4 = 1G, 8 = 10G, 16 = 40G, 32 = 100G
103     @param link_MTU - max. transmittion unit
104     @param sub_if_id - A number 0-N to uniquely identify this subif on super if
105     @param sub_dot1ad - 0 = dot1q, 1 = dot1ad
106     @param sub_dot1ah - 1 = dot1ah, 0 = otherwise
107     @param sub_number_of_tags - Number of tags (0 - 2)
108     @param sub_outer_vlan_id
109     @param sub_inner_vlan_id
110     @param sub_exact_match
111     @param sub_default
112     @param sub_outer_vlan_id_any
113     @param sub_inner_vlan_id_any
114     @param vtr_op - vlan tag rewrite operation
115     @param vtr_push_dot1q
116     @param vtr_tag1
117     @param vtr_tag2
118     @param pbb_outer_tag - translate pbb s-tag
119     @param pbb_b_dmac[6] - B-tag remote mac address
120     @param pbb_b_smac[6] - B-tag local mac address
121     @param pbb_b_vlanid - B-tag vlanid
122     @param pbb_i_sid - I-tag service id
123 */
124 define sw_interface_details
125 {
126   u32 context;
127   u32 sw_if_index;
128
129   /* index of sup interface (e.g. hw interface).
130      equal to sw_if_index for super hw interface. */
131   u32 sup_sw_if_index;
132
133   /* Layer 2 address, if applicable */
134   u32 l2_address_length;
135   u8 l2_address[8];
136
137   /* Interface name */
138   u8 interface_name[64];
139
140   /* 1 = up, 0 = down */
141   u8 admin_up_down;
142   u8 link_up_down;
143
144   /* 1 = half duplex, 2 = full duplex */
145   u8 link_duplex;
146
147   /* 1 = 10M, 2 = 100M, 4 = 1G, 8 = 10G, 16 = 40G, 32 = 100G */
148   u8 link_speed;
149
150   /* MTU */
151   u16 link_mtu;
152
153   /* Per protocol MTUs */
154   u32 mtu[4]; /* 0 - L3, 1 - IP4, 2 - IP6, 3 - MPLS */
155
156   /* Subinterface ID. A number 0-N to uniquely identify this subinterface under the super interface */
157   u32 sub_id;
158
159   /* 0 = dot1q, 1=dot1ad */
160   u8 sub_dot1ad;
161   /* 1 = dot1h, 1=otherwise */
162   u8 sub_dot1ah;
163
164   /* Number of tags 0-2 */
165   u8 sub_number_of_tags;
166   u16 sub_outer_vlan_id;
167   u16 sub_inner_vlan_id;
168   u8 sub_exact_match;
169   u8 sub_default;
170   u8 sub_outer_vlan_id_any;
171   u8 sub_inner_vlan_id_any;
172
173   /* vlan tag rewrite state */
174   u32 vtr_op;
175   u32 vtr_push_dot1q;           // ethertype of first pushed tag is dot1q/dot1ad
176   u32 vtr_tag1;                 // first pushed tag
177   u32 vtr_tag2;                 // second pushed tag
178   u8 tag[64];
179   
180   /* pbb tag rewrite info */
181   u16 outer_tag;
182   u8  b_dmac[6];
183   u8  b_smac[6];
184   u16 b_vlanid;
185   u32 i_sid;
186 };
187
188 /* works */
189 define sw_interface_dump
190 {
191   u32 client_index;
192   u32 context;
193   u8 name_filter_valid;
194   u8 name_filter[49];
195 };
196
197 /** \brief Set or delete one or all ip addresses on a specified interface
198     @param client_index - opaque cookie to identify the sender
199     @param context - sender context, to match reply w/ request
200     @param sw_if_index - index of the interface to add/del addresses 
201     @param is_add - add address if non-zero, else delete
202     @param is_ipv6 - if non-zero the address is ipv6, else ipv4
203     @param del_all - if non-zero delete all addresses on the interface
204     @param address_length - address length in bytes, 4 for ip4, 16 for ip6
205     @param address - array of address bytes
206 */
207 autoreply define sw_interface_add_del_address
208 {
209   u32 client_index;
210   u32 context;
211   u32 sw_if_index;
212   u8 is_add;
213   u8 is_ipv6;
214   u8 del_all;
215   u8 address_length;
216   u8 address[16];
217 };
218
219 /** \brief Associate the specified interface with a fib table
220     @param client_index - opaque cookie to identify the sender
221     @param context - sender context, to match reply w/ request
222     @param sw_if_index - index of the interface
223     @param is_ipv6 - if non-zero ipv6, else ipv4
224     @param vrf_id - fib table/vrd id to associate the interface with
225 */
226 autoreply define sw_interface_set_table
227 {
228   u32 client_index;
229   u32 context;
230   u32 sw_if_index;
231   u8 is_ipv6;
232   u32 vrf_id;
233 };
234
235 /** \brief Get VRF id assigned to interface
236     @param client_index - opaque cookie to identify the sender
237     @param context - sender context, to match reply w/ request
238     @param sw_if_index - index of the interface
239 */
240 define sw_interface_get_table
241 {
242   u32 client_index;
243   u32 context;
244   u32 sw_if_index;
245   u8 is_ipv6;
246 };
247
248 /** \brief Reply to get_sw_interface_vrf
249     @param context - sender context which was passed in the request
250     @param vrf_id - VRF id assigned to the interface
251 */
252 define sw_interface_get_table_reply
253 {
254   u32 context;
255   i32 retval;
256   u32 vrf_id;
257 };
258
259 typeonly manual_print manual_endian define vlib_counter
260 {
261   u64 packets;                  /**< packet counter */
262   u64 bytes;                    /**< byte counter  */
263 };
264
265 /** \brief Combined interface counter data type for vnet_interface_combined_counters
266     @param sw_if_index - interface indexes for counters
267     @param rx_packets - received packet count
268     @param rx_bytes - received byte count
269     @param rx_unicast_packets - received unicast packet count
270     @param rx_unicast_bytes - received unicast byte count
271     @param rx_multicast_packets - received multicast packet count
272     @param rx_multicast_bytes - received multicast byte count
273     @param rx_broadcast_packets - received broadcast packet count
274     @param rx_broadcast_bytes - received broadcast byte count
275     @param tx_packets - transmitted packet count
276     @param tx_bytes - transmitted byte count
277     @param tx_unicast_packets - transmitted unicast packet count
278     @param tx_unicast_bytes - transmitted unicast byte count
279     @param tx_multicast_packets - transmitted multicast packet count
280     @param tx_multicast_bytes - transmitted multicast byte count
281     @param tx_broadcast_packets - transmitted broadcast packet count
282     @param tx_broadcast_bytes - transmitted broadcast byte count
283
284 */
285 typeonly manual_print manual_endian define vnet_combined_counter
286 {
287   u32 sw_if_index;
288   u64 rx_packets;                               /**< packet counter */
289   u64 rx_bytes;                                 /**< byte counter  */
290   u64 rx_unicast_packets;                       /**< packet counter */
291   u64 rx_unicast_bytes;                         /**< byte counter  */
292   u64 rx_multicast_packets;                     /**< packet counter */
293   u64 rx_multicast_bytes;                       /**< byte counter  */
294   u64 rx_broadcast_packets;                     /**< packet counter */
295   u64 rx_broadcast_bytes;                       /**< byte counter  */
296   u64 tx_packets;                               /**< packet counter */
297   u64 tx_bytes;                                 /**< byte counter  */
298   u64 tx_unicast_packets;                       /**< packet counter */
299   u64 tx_unicast_bytes;                         /**< byte counter  */
300   u64 tx_multicast_packets;                     /**< packet counter */
301   u64 tx_multicast_bytes;                       /**< byte counter  */
302   u64 tx_broadcast_packets;                     /**< packet counter */
303   u64 tx_broadcast_bytes;                       /**< byte counter  */
304 };
305
306 /** \brief Simple interface counter data type for vnet_interface_simple_counters
307     @param sw_if_index - interface indexes for counters
308     @param drop - RX or TX drops due to buffer starvation
309     @param punt - used with VNET "punt" disposition
310     @param rx_ip4 - received IP4 packets
311     @param rx_ip6 - received IP6 packets
312     @param rx_no_buffer - no RX buffers available
313     @param rx_miss - receive misses
314     @param rx_error - receive errors
315     @param tx_error - transmit errors
316     @param rx_mpls - received MPLS packet
317
318 */
319 typeonly manual_print manual_endian define vnet_simple_counter
320 {
321   u32 sw_if_index;
322   u64 drop;
323   u64 punt;
324   u64 rx_ip4;
325   u64 rx_ip6;
326   u64 rx_no_buffer;
327   u64 rx_miss;
328   u64 rx_error;
329   u64 tx_error;
330   u64 rx_mpls;
331 };
332
333 /** \brief Set unnumbered interface add / del request
334     @param client_index - opaque cookie to identify the sender
335     @param context - sender context, to match reply w/ request
336     @param sw_if_index - interface with an IP address
337     @param unnumbered_sw_if_index - interface which will use the address
338     @param is_add - if non-zero set the association, else unset it
339 */
340 autoreply define sw_interface_set_unnumbered
341 {
342   u32 client_index;
343   u32 context;
344   u32 sw_if_index;              /* use this intfc address */
345   u32 unnumbered_sw_if_index;   /* on this interface */
346   u8 is_add;
347 };
348
349 /** \brief Clear interface statistics
350     @param client_index - opaque cookie to identify the sender
351     @param context - sender context, to match reply w/ request
352     @param sw_if_index - index of the interface to clear statistics
353 */
354 autoreply define sw_interface_clear_stats
355 {
356   u32 client_index;
357   u32 context;
358   u32 sw_if_index;
359 };
360
361 /** \brief Set / clear software interface tag
362     @param client_index - opaque cookie to identify the sender
363     @param context - sender context, to match reply w/ request
364     @param sw_if_index - the interface
365     @param add_del - 1 = add, 0 = delete
366     @param tag - an ascii tag
367 */
368 autoreply define sw_interface_tag_add_del 
369 {
370     u32 client_index;
371     u32 context;
372     u8 is_add;
373     u32 sw_if_index;
374     u8 tag[64];
375 };
376
377 /** \brief Set an interface's MAC address
378     @param client_index - opaque cookie to identify the sender
379     @param context - sender context, to match reply w/ request
380     @param sw_if_index - the interface whose MAC will be set
381     @param mac_addr - the new MAC address
382 */
383 autoreply define sw_interface_set_mac_address
384 {
385     u32 client_index;
386     u32 context;
387     u32 sw_if_index;
388     u8 mac_address[6];
389 };
390
391 /** \brief Get interface's MAC address
392     @param client_index - opaque cookie to identify the sender
393     @param context - sender context, to match reply w/ request
394     @param sw_if_index - the interface whose MAC will be returned
395 */
396 define sw_interface_get_mac_address
397 {
398     u32 client_index;
399     u32 context;
400     u32 sw_if_index;
401 };
402
403 /** \brief Reply for get interface's MAC address request
404     @param context - returned sender context, to match reply w/ request
405     @param retval - return code
406     @param mac_addr - returned interface's MAC address
407 */
408 define sw_interface_get_mac_address_reply
409 {
410     u32 context;
411     i32 retval;
412     u8 mac_address[6];
413 };
414
415 /** \brief Set an interface's rx-mode
416     @param client_index - opaque cookie to identify the sender
417     @param context - sender context, to match reply w/ request
418     @param sw_if_index - the interface whose rx-mode will be set
419     @param queue_id_valid - 1 = the queue_id field is valid. 0 means all
420       queue_id's
421     @param queue_id - the queue number whose rx-mode will be set. Only valid
422       if queue_id_valid is 1
423     @param mode - polling=1, interrupt=2, adaptive=3
424 */
425 autoreply define sw_interface_set_rx_mode
426 {
427     u32 client_index;
428     u32 context;
429     u32 sw_if_index;
430     u8 queue_id_valid;
431     u32 queue_id;
432     u8 mode;
433 };
434
435 /* Gross kludge, DGMS */
436 autoreply define interface_name_renumber
437 {
438   u32 client_index;
439   u32 context;
440   u32 sw_if_index;
441   u32 new_show_dev_instance;
442 };
443
444 define create_subif
445 {
446   u32 client_index;
447   u32 context;
448   u32 sw_if_index;
449   u32 sub_id;
450
451   /* These fields map directly onto the subif template */
452   u8 no_tags;
453   u8 one_tag;
454   u8 two_tags;
455   u8 dot1ad;                    // 0 = dot1q, 1=dot1ad
456   u8 exact_match;
457   u8 default_sub;
458   u8 outer_vlan_id_any;
459   u8 inner_vlan_id_any;
460   u16 outer_vlan_id;
461   u16 inner_vlan_id;
462 };
463
464 define create_subif_reply
465 {
466   u32 context;
467   i32 retval;
468   u32 sw_if_index;
469 };
470
471 /** \brief Create a new subinterface with the given vlan id
472     @param client_index - opaque cookie to identify the sender
473     @param context - sender context, to match reply w/ request
474     @param sw_if_index - software index of the new vlan's parent interface
475     @param vlan_id - vlan tag of the new interface
476 */
477 define create_vlan_subif
478 {
479   u32 client_index;
480   u32 context;
481   u32 sw_if_index;
482   u32 vlan_id;
483 };
484
485 /** \brief Reply for the vlan subinterface create request
486     @param context - returned sender context, to match reply w/ request
487     @param retval - return code
488     @param sw_if_index - software index allocated for the new subinterface
489 */
490 define create_vlan_subif_reply
491 {
492   u32 context;
493   i32 retval;
494   u32 sw_if_index;
495 };
496
497 /** \brief Delete sub interface request
498     @param client_index - opaque cookie to identify the sender
499     @param context - sender context, to match reply w/ request
500     @param sw_if_index - sw index of the interface that was created by create_subif
501 */
502 autoreply define delete_subif {
503   u32 client_index;
504   u32 context;
505   u32 sw_if_index;
506 };
507
508 /** \brief Create loopback interface request
509     @param client_index - opaque cookie to identify the sender
510     @param context - sender context, to match reply w/ request
511     @param mac_address - mac addr to assign to the interface if none-zero
512 */
513 define create_loopback
514 {
515   u32 client_index;
516   u32 context;
517   u8 mac_address[6];
518 };
519
520 /** \brief Create loopback interface response
521     @param context - sender context, to match reply w/ request
522     @param sw_if_index - sw index of the interface that was created
523     @param retval - return code for the request
524 */
525 define create_loopback_reply
526 {
527   u32 context;
528   i32 retval;
529   u32 sw_if_index;
530 };
531
532 /** \brief Create loopback interface instance request
533     @param client_index - opaque cookie to identify the sender
534     @param context - sender context, to match reply w/ request
535     @param mac_address - mac addr to assign to the interface if none-zero
536     @param is_specified - if non-0, a specific user_instance is being requested
537     @param user_instance - requested instance, ~0 => dynamically allocate
538 */
539 define create_loopback_instance
540 {
541   u32 client_index;
542   u32 context;
543   u8 mac_address[6];
544   u8 is_specified;
545   u32 user_instance;
546 };
547
548 /** \brief Create loopback interface instance response
549     @param context - sender context, to match reply w/ request
550     @param sw_if_index - sw index of the interface that was created
551     @param retval - return code for the request
552 */
553 define create_loopback_instance_reply
554 {
555   u32 context;
556   i32 retval;
557   u32 sw_if_index;
558 };
559
560 /** \brief Delete loopback interface request
561     @param client_index - opaque cookie to identify the sender
562     @param context - sender context, to match reply w/ request
563     @param sw_if_index - sw index of the interface that was created
564 */
565 autoreply define delete_loopback
566 {
567   u32 client_index;
568   u32 context;
569   u32 sw_if_index;
570 };
571
572 /** \brief Enable or disable detailed interface stats
573     @param client_index - opaque cookie to identify the sender
574     @param context - sender context, to match reply w/ request
575     @param sw_if_index - The interface to collect detail stats on. ~0 implies
576                          all interfaces.
577     @param enable_disable - set to 1 to enable, 0 to disable detailed stats
578 */
579 autoreply define collect_detailed_interface_stats
580 {
581   u32 client_index;
582   u32 context;
583   u32 sw_if_index;
584   u8  enable_disable;
585 };
586
587 /*
588  * Local Variables:
589  * eval: (c-set-style "gnu")
590  * End:
591  */