xref: /freebsd/sys/net/if_ovpn.h (revision af23369a6deaaeb612ab266eb88b8bb8d560c322)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3  *
4  * Copyright (c) 2021-2022 Rubicon Communications, LLC (Netgate)
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  */
27 
28 #ifndef _NET_IF_OVPN_H_
29 #define _NET_IF_OVPN_H_
30 
31 #include <sys/types.h>
32 #include <netinet/in.h>
33 
34 /* Maximum size of an ioctl request. */
35 #define OVPN_MAX_REQUEST_SIZE	4096
36 
37 enum ovpn_notif_type {
38 	OVPN_NOTIF_DEL_PEER,
39 };
40 
41 enum ovpn_del_reason {
42 	OVPN_DEL_REASON_REQUESTED	= 0,
43 	OVPN_DEL_REASON_TIMEOUT		= 1
44 };
45 
46 enum ovpn_key_slot {
47 	OVPN_KEY_SLOT_PRIMARY	= 0,
48 	OVPN_KEY_SLOT_SECONDARY	= 1
49 };
50 
51 enum ovpn_key_cipher {
52 	OVPN_CIPHER_ALG_NONE			= 0,
53 	OVPN_CIPHER_ALG_AES_GCM			= 1,
54 	OVPN_CIPHER_ALG_CHACHA20_POLY1305	= 2
55 };
56 
57 #define OVPN_NEW_PEER		_IO  ('D', 1)
58 #define OVPN_DEL_PEER		_IO  ('D', 2)
59 #define OVPN_GET_STATS		_IO  ('D', 3)
60 #define OVPN_NEW_KEY		_IO  ('D', 4)
61 #define OVPN_SWAP_KEYS		_IO  ('D', 5)
62 #define OVPN_DEL_KEY		_IO  ('D', 6)
63 #define OVPN_SET_PEER		_IO  ('D', 7)
64 #define OVPN_START_VPN		_IO  ('D', 8)
65 /* OVPN_SEND_PKT		_IO  ('D', 9) */
66 #define OVPN_POLL_PKT		_IO  ('D', 10)
67 #define OVPN_GET_PKT		_IO  ('D', 11)
68 #define OVPN_SET_IFMODE		_IO  ('D', 12)
69 #define OVPN_GET_PEER_STATS	_IO  ('D', 13)
70 
71 #endif
72