1 /* Hey Emacs use -*- mode: C -*- */
3 * Copyright (c) 2020 Doc.ai 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:
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 option version = "0.2.0";
19 import "vnet/interface_types.api";
20 import "vnet/ip/ip_types.api";
22 /** \brief Create wireguard interface
23 @param client_index - opaque cookie to identify the sender
24 @param context - sender context, to match reply w/ request
25 @param private_key - private key in binary format of this device
26 @param public_key - public key in binary format of this device
27 @param port - port of this device
28 @param src_ip - packet sent through this interface us this
29 address as the IP source.
31 typedef wireguard_interface
33 u32 user_instance [default=0xffffffff];
34 vl_api_interface_index_t sw_if_index;
38 vl_api_address_t src_ip;
41 /** \brief Create an Wireguard interface
43 define wireguard_interface_create {
46 vl_api_wireguard_interface_t interface;
50 /** \brief Add Wireguard interface interface response
51 @param context - sender context, to match reply w/ request
52 @param retval - return status
53 @param sw_if_index - sw_if_index of new interface (for successful add)
55 define wireguard_interface_create_reply
59 vl_api_interface_index_t sw_if_index;
62 autoreply define wireguard_interface_delete
66 vl_api_interface_index_t sw_if_index;
69 define wireguard_interface_dump
73 bool show_private_key;
74 vl_api_interface_index_t sw_if_index;
77 define wireguard_interface_details
80 vl_api_wireguard_interface_t interface;
83 enum wireguard_peer_flags : u8
85 WIREGUARD_PEER_STATUS_DEAD = 0x1,
86 WIREGUARD_PEER_ESTABLISHED = 0x2,
89 /** \brief Create new peer
90 @param public_key - public key (in binary format) of destination peer
91 @param port - destination port
92 @param table_id - The IP table in which 'endpoint' is reachable
93 @param endpoint - destination ip
94 @param allowed_ip - allowed incoming ip tunnel
95 @param tun_sw_if_index - tunnel interface
96 @param persistent_keepalive - keepalive packet timeout
98 typedef wireguard_peer
102 u16 persistent_keepalive;
104 vl_api_address_t endpoint;
105 vl_api_interface_index_t sw_if_index;
106 vl_api_wireguard_peer_flags_t flags;
108 vl_api_prefix_t allowed_ips[n_allowed_ips];
112 rpc want_wireguard_peer_events returns want_wireguard_peer_events_reply
113 events wireguard_peer_event;
115 /** \brief Register for wireguard peer events
116 @param client_index - opaque cookie to identify the sender
117 @param context - sender context, to match reply w/ request
118 @param sw_if_index - index of the interface to dump peer info on, ~0 if on all
119 @param peer_index - index of the peer to dump info on, ~0 if on all
120 @param enable_disable - 1 => register for events, 0 => cancel registration
121 @param pid - sender's pid
123 autoreply define want_wireguard_peer_events
127 vl_api_interface_index_t sw_if_index [default=0xFFFFFFFF];
128 u32 peer_index [default=0xFFFFFFFF];
132 /** \brief Interface Event generated by want_wireguard_peer_events
133 @param client_index - opaque cookie to identify the sender
134 @param pid - client pid registered to receive notification
135 @param peer_index - index of the peer for this event
136 @param deleted - interface was deleted
138 define wireguard_peer_event
143 vl_api_wireguard_peer_flags_t flags;
146 /** \brief Create new peer
147 @param client_index - opaque cookie to identify the sender
148 @param context - sender context, to match reply w/ request
149 @param peer - peer to create
151 define wireguard_peer_add
155 vl_api_wireguard_peer_t peer;
157 define wireguard_peer_add_reply
164 /** \brief Remove peer by public_key
165 @param client_index - opaque cookie to identify the sender
166 @param context - sender context, to match reply w/ request
169 autoreply define wireguard_peer_remove
176 /** \brief Dump all peers
177 @param client_index - opaque cookie to identify the sender
178 @param context - sender context, to match reply w/ request
179 @param peer_index - peer index to be dumped. If 0xFFFFFFFF dumps all peers
181 define wireguard_peers_dump {
184 u32 peer_index [default=0xFFFFFFFF];
187 /** \brief Dump peers response
188 @param context - sender context, to match reply w/ request
189 @param is_dead - is peer valid yet
190 @param public_key - peer public_key
191 @param ip4_address - ip4 endpoint address
193 define wireguard_peers_details {
195 vl_api_wireguard_peer_t peer;
198 /** \brief Wireguard Set Async mode
199 @param client_index - opaque cookie to identify the sender
200 @param context - sender context, to match reply w/ request
201 @param async_enable - wireguard async mode on or off
203 autoreply define wg_set_async_mode {
211 * eval: (c-set-style "gnu")