Debian Codegraph @

drivers/net/ovpn-dco/tcp.h

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* OpenVPN data channel accelerator
3 *
4 * Copyright (C) 2019-2023 OpenVPN, Inc.
5 *
6 * Author: Antonio Quartulli <[email protected]>
7 */
8
9 #ifndef _NET_OVPN_DCO_TCP_H_
10 #define _NET_OVPN_DCO_TCP_H_
11
12 #include "peer.h"
13
14 #include <linux/net.h>
15 #include <linux/skbuff.h>
16 #include <linux/types.h>
17 #include <linux/workqueue.h>
18
19 /* Initialize TCP static objects */
20 int __init ovpn_tcp_init(void);
21
22 void ovpn_queue_tcp_skb(struct ovpn_peer *peer, struct sk_buff *skb);
23
24 int ovpn_tcp_socket_attach(struct socket *sock, struct ovpn_peer *peer);
25 void ovpn_tcp_socket_detach(struct socket *sock);
26
27 /* Prepare skb and enqueue it for sending to peer.
28 *
29 * Preparation consist in prepending the skb payload with its size.
30 * Required by the OpenVPN protocol in order to extract packets from
31 * the TCP stream on the receiver side.
32 */
33 static inline void ovpn_tcp_send_skb(struct ovpn_peer *peer, struct sk_buff *skb)
34 {
35 u16 len = skb->len;
36
37 *(__be16 *)__skb_push(skb, sizeof(u16)) = htons(len);
38 ovpn_queue_tcp_skb(peer, skb);
39 }
40
41 #endif /* _NET_OVPN_DCO_TCP_H_ */