wireguard: initial implementation of wireguard protocol
[vpp.git] / src / plugins / wireguard / wireguard.c
1 /*
2  * Copyright (c) 2020 Doc.ai and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16 #include <vnet/vnet.h>
17 #include <vnet/plugin/plugin.h>
18 #include <vnet/ipip/ipip.h>
19 #include <vpp/app/version.h>
20 #include <vnet/udp/udp.h>
21
22 #include <wireguard/wireguard_send.h>
23 #include <wireguard/wireguard_key.h>
24 #include <wireguard/wireguard_if.h>
25 #include <wireguard/wireguard.h>
26
27 wg_main_t wg_main;
28
29 static clib_error_t *
30 wg_init (vlib_main_t * vm)
31 {
32   wg_main_t *wmp = &wg_main;
33
34   wmp->vlib_main = vm;
35   wmp->peers = 0;
36
37   return (NULL);
38 }
39
40 VLIB_INIT_FUNCTION (wg_init);
41
42 /* *INDENT-OFF* */
43
44 VNET_FEATURE_INIT (wg_output_tun, static) =
45 {
46   .arc_name = "ip4-output",
47   .node_name = "wg-output-tun",
48 };
49
50 VLIB_PLUGIN_REGISTER () =
51 {
52   .version = VPP_BUILD_VER,
53   .description = "Wireguard Protocol",
54 };
55 /* *INDENT-ON* */
56
57 /*
58  * fd.io coding-style-patch-verification: ON
59  *
60  * Local Variables:
61  * eval: (c-set-style "gnu")
62  * End:
63  */