| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
#ifndef _NET_OVPN_DCO_SOCK_H_ |
| 11 |
#define _NET_OVPN_DCO_SOCK_H_ |
| 12 |
|
| 13 |
#include <linux/net.h> |
| 14 |
#include <linux/kref.h> |
| 15 |
#include <linux/ptr_ring.h> |
| 16 |
#include <net/sock.h> |
| 17 |
|
| 18 |
#include "peer.h" |
| 19 |
|
| 20 |
struct ovpn_struct; |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
struct ovpn_socket { |
| 26 |
union { |
| 27 |
|
| 28 |
struct ovpn_struct *ovpn; |
| 29 |
|
| 30 |
|
| 31 |
struct { |
| 32 |
|
| 33 |
struct ovpn_peer *peer; |
| 34 |
struct ptr_ring recv_ring; |
| 35 |
}; |
| 36 |
}; |
| 37 |
|
| 38 |
|
| 39 |
struct socket *sock; |
| 40 |
|
| 41 |
|
| 42 |
struct kref refcount; |
| 43 |
|
| 44 |
|
| 45 |
struct rcu_head rcu; |
| 46 |
}; |
| 47 |
|
| 48 |
struct ovpn_struct *ovpn_from_udp_sock(struct sock *sk); |
| 49 |
|
| 50 |
void ovpn_socket_release_kref(struct kref *kref); |
| 51 |
|
| 52 |
static inline void ovpn_socket_put(struct ovpn_socket *sock) |
| 53 |
{ |
| 54 |
kref_put(&sock->refcount, ovpn_socket_release_kref); |
| 55 |
} |
| 56 |
|
| 57 |
struct ovpn_socket *ovpn_socket_new(struct socket *sock, struct ovpn_peer *peer); |
| 58 |
|
| 59 |
#endif |