summaryrefslogtreecommitdiff
path: root/drivers/net/ovpn/socket.h
blob: ade8c94619d7b2f905b5284373dc73f590188399 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* SPDX-License-Identifier: GPL-2.0-only */
/*  OpenVPN data channel offload
 *
 *  Copyright (C) 2020-2025 OpenVPN, Inc.
 *
 *  Author:	James Yonan <james@openvpn.net>
 *		Antonio Quartulli <antonio@openvpn.net>
 */

#ifndef _NET_OVPN_SOCK_H_
#define _NET_OVPN_SOCK_H_

#include <linux/net.h>
#include <linux/kref.h>
#include <net/sock.h>

struct ovpn_priv;
struct ovpn_peer;

/**
 * struct ovpn_socket - a kernel socket referenced in the ovpn code
 * @ovpn: ovpn instance owning this socket (UDP only)
 * @sock: the low level sock object
 * @refcount: amount of contexts currently referencing this object
 * @rcu: member used to schedule RCU destructor callback
 */
struct ovpn_socket {
	struct ovpn_priv *ovpn;
	struct socket *sock;
	struct kref refcount;
	struct rcu_head rcu;
};

struct ovpn_socket *ovpn_socket_new(struct socket *sock,
				    struct ovpn_peer *peer);
void ovpn_socket_release(struct ovpn_peer *peer);

#endif /* _NET_OVPN_SOCK_H_ */