wireguard: initial implementation of wireguard protocol
[vpp.git] / src / plugins / wireguard / wireguard.api
1 /* Hey Emacs use -*- mode: C -*- */
2 /*
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:
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 option version = "0.1.0";
18
19 import "vnet/interface_types.api";
20 import "vnet/ip/ip_types.api";
21
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 port - port of this device
27     @param src_ip - packet sent through this interface us this
28                     address as the IP source.
29 */
30 typedef wireguard_interface
31 {
32   u32 user_instance [default=0xffffffff];
33   vl_api_interface_index_t sw_if_index;
34   u8 private_key[32];
35   u16 port;
36   vl_api_address_t src_ip;
37 };
38
39 /** \brief Create an Wireguard interface
40  */
41 define wireguard_interface_create {
42   u32 client_index;
43   u32 context;
44   vl_api_wireguard_interface_t interface;
45   bool generate_key;
46 };
47
48 /** \brief Add Wireguard interface interface response
49     @param context - sender context, to match reply w/ request
50     @param retval - return status
51     @param sw_if_index - sw_if_index of new interface (for successful add)
52 */
53 define wireguard_interface_create_reply
54 {
55   u32 context;
56   i32 retval;
57   vl_api_interface_index_t sw_if_index;
58 };
59
60 autoreply define wireguard_interface_delete
61 {
62   u32 client_index;
63   u32 context;
64   vl_api_interface_index_t sw_if_index;
65 };
66
67 define wireguard_interface_dump
68 {
69   u32 client_index;
70   u32 context;
71   bool show_private_key;
72   vl_api_interface_index_t sw_if_index;
73 };
74
75 define wireguard_interface_details
76 {
77   u32 context;
78   vl_api_wireguard_interface_t interface;
79 };
80
81 enum wireguard_peer_flags : u8
82 {
83   WIREGUARD_PEER_STATUS_DEAD = 0x1,
84 };
85
86 /** \brief Create new peer
87     @param public_key - public key (in binary format) of destination peer
88     @param port - destination port
89     @param table_id - The IP table in which 'endpoint' is reachable
90     @param endpoint - destination ip
91     @param allowed_ip - allowed incoming ip tunnel
92     @param tun_sw_if_index - tunnel interface
93     @param persistent_keepalive - keepalive packet timeout
94 */
95 typedef wireguard_peer
96 {
97   u8 public_key[32];
98   u16 port;
99   u16 persistent_keepalive;
100   u32 table_id;
101   vl_api_address_t endpoint;
102   vl_api_interface_index_t sw_if_index;
103   vl_api_wireguard_peer_flags_t flags;
104   u8 n_allowed_ips;
105   vl_api_prefix_t allowed_ips[n_allowed_ips];
106 };
107
108 /** \brief Create new peer
109     @param client_index - opaque cookie to identify the sender
110     @param context - sender context, to match reply w/ request
111     @param peer - peer to create
112 */
113 define wireguard_peer_add
114 {
115   u32 client_index;
116   u32 context;
117   vl_api_wireguard_peer_t peer;
118 };
119 define wireguard_peer_add_reply
120 {
121   u32 context;
122   i32 retval;
123   u32 peer_index;
124 };
125
126 /** \brief Remove peer by public_key
127     @param client_index - opaque cookie to identify the sender
128     @param context - sender context, to match reply w/ request
129     @param public_key
130 */
131 autoreply define wireguard_peer_remove
132 {
133   u32 client_index;
134   u32 context;
135   u32 peer_index;
136 };
137
138 /** \brief Dump all peers
139     @param client_index - opaque cookie to identify the sender
140     @param context - sender context, to match reply w/ request
141 */
142 define wireguard_peers_dump {
143   u32 client_index;
144   u32 context;
145 };
146
147 /** \brief Dump peers response
148     @param context - sender context, to match reply w/ request
149     @param is_dead - is peer valid yet
150     @param public_key - peer public_key
151     @param ip4_address - ip4 endpoint address
152 */
153 define wireguard_peers_details {
154   u32 context;
155   vl_api_wireguard_peer_t peer;
156 };
157
158 /*
159  * Local Variables:
160  * eval: (c-set-style "gnu")
161  * End:
162  */