ip-neighbor: populate neighbor age via API
[vpp.git] / src / vnet / ip-neighbor / ip_neighbor.api
1 /* Hey Emacs use -*- mode: C -*- */
2 /*
3  * Copyright (c) 2018 Cisco and/or its affiliates.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /** \file
18
19     This file defines vpp IP neighbor control-plane API messages which are generally
20     called through a shared memory interface. 
21 */
22
23 option version = "1.0.0";
24
25 import "vnet/ip/ip_types.api";
26 import "vnet/ethernet/ethernet_types.api";
27 import "vnet/interface_types.api";
28
29 /** \brief IP neighbor flags
30     @param is_static - A static neighbor Entry - there are not flushed
31                        If the interface goes down.
32     @param is_no_fib_entry - Do not create a corresponding entry in the FIB
33                            table for the neighbor.
34 */
35 enum ip_neighbor_flags: u8
36 {
37   IP_API_NEIGHBOR_FLAG_NONE = 0,
38   IP_API_NEIGHBOR_FLAG_STATIC = 0x1,
39   IP_API_NEIGHBOR_FLAG_NO_FIB_ENTRY = 0x2,
40 };
41
42 /** \brief IP neighbor
43     @param sw_if_index - interface used to reach neighbor
44     @param flags - flags for the nieghbor
45     @param mac_address - l2 address of the neighbor
46     @param ip_address - ip4 or ip6 address of the neighbor
47 */
48 typedef ip_neighbor {
49   vl_api_interface_index_t sw_if_index;
50   vl_api_ip_neighbor_flags_t flags;
51   vl_api_mac_address_t mac_address;
52   vl_api_address_t ip_address;
53 };
54
55 /** \brief IP neighbor add / del request
56     @param client_index - opaque cookie to identify the sender
57     @param context - sender context, to match reply w/ request
58     @param is_add - 1 to add neighbor, 0 to delete
59     @param neighbor - the neighor to add/remove
60 */
61 define ip_neighbor_add_del
62 {
63   u32 client_index;
64   u32 context;
65   /* 1 = add, 0 = delete */
66   bool is_add;
67   vl_api_ip_neighbor_t neighbor;
68 };
69 /** \brief IP neighbor add / del reply
70     @param client_index - opaque cookie to identify the sender
71     @param context - sender context, to match reply w/ request
72     @param retval - return value
73     @param stats_index - the index to use for this neighbor in the stats segement
74 */
75 define ip_neighbor_add_del_reply
76 {
77   u32 context;
78   i32 retval;
79   u32 stats_index;
80 };
81
82 /** \brief Dump IP neighboors
83     @param client_index - opaque cookie to identify the sender
84     @param context - sender context, to match reply w/ request
85     @param sw_if_index - the interface to dump neighboors, ~0 == all
86     @param af - address family is ipv[6|4]
87 */
88 define ip_neighbor_dump
89 {
90   u32 client_index;
91   u32 context;
92   vl_api_interface_index_t sw_if_index  [default=0xffffffff];
93   vl_api_address_family_t af;
94 };
95
96 /** \brief IP neighboors dump response
97     @param context - sender context which was passed in the request
98     @param neighbour - the neighbor
99 */
100 define ip_neighbor_details {
101   u32 context;
102   f64 age;
103   vl_api_ip_neighbor_t neighbor;
104 };
105
106 /** \brief Enable/disable periodic IP neighbor scan
107     @param client_index - opaque cookie to identify the sender
108     @param context - sender context, to match reply w/ request
109     @param af - Address family v4/v6
110     @param max_number - The maximum number of neighbours that will be created.
111                          default 50k
112     @param max_age - The maximum age (in seconds) before an inactive neighbour
113                      is flushed
114                          default 0 => never
115     @param recycle - If max_number of neighbours is reached and new ones need
116                       to be created should the oldest neighbour be 'recycled'.
117 */
118 autoreply define ip_neighbor_config
119 {
120   u32 client_index;
121   u32 context;
122   vl_api_address_family_t af;
123   u32 max_number;
124   u32 max_age;
125   bool recycle;
126 };
127
128 /** \brief Register for IP4 ARP resolution event on receing ARP reply or
129            MAC/IP info from ARP requests in L2 BDs
130     @param client_index - opaque cookie to identify the sender
131     @param context - sender context, to match reply w/ request
132     @param enable - 1 => register for events, 0 => cancel registration
133     @param pid - sender's pid
134     @param ip - exact IP address of interested neighbor resolution event
135     @param sw_if_index - interface on which the IP address is present.
136 */
137 autoreply define want_ip_neighbor_events
138 {
139   u32 client_index;
140   u32 context;
141   bool enable;
142   u32 pid;
143   vl_api_address_t ip;
144   vl_api_interface_index_t sw_if_index [default=0xffffffff];
145 };
146
147 /** \brief Tell client about an IP4 ARP resolution event or
148            MAC/IP info from ARP requests in L2 BDs
149     @param client_index - opaque cookie to identify the sender
150     @param pid - client pid registered to receive notification
151     @param neighbor - new neighbor created
152 */
153 define ip_neighbor_event
154 {
155   u32 client_index;
156   u32 pid;
157   vl_api_ip_neighbor_t neighbor;
158 };
159
160 service {
161   rpc want_ip_neighbor_events returns want_ip_neighbor_events_reply
162     events ip_neighbor_event;
163 };
164
165 /*
166  * Local Variables:
167  * eval: (c-set-style "gnu")
168  * End:
169  */