-
Notifications
You must be signed in to change notification settings - Fork 26
/
forge_socket.h
62 lines (48 loc) · 1.49 KB
/
forge_socket.h
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef _FORGE_H
#define _FORGE_H
#include <linux/types.h>
#define SOCK_FORGE 9 /* new protocol */
#define TCP_STATE 18 /* new TCP sockopt */
struct tcp_state {
__be32 src_ip;
__be32 dst_ip;
__be16 sport;
__be16 dport;
__u32 seq;
__u32 ack;
__u32 snd_una; /* First byte we want an ack for */
__u8 tstamp_ok;
__u8 sack_ok;
__u8 wscale_ok;
__u8 ecn_ok;
__u8 snd_wscale;
__u8 rcv_wscale;
__u32 snd_wnd;
__u32 rcv_wnd;
__u32 ts_recent; /* Timestamp to echo next. */
__u32 ts_val; /* Timestamp to use next. */
__u32 mss_clamp;
/*
* Fields that are below the TCP layer, but that we
* might want to mess with anyway.
*/
__s16 inet_ttl; /* unicast IP ttl (use -1 for the default) */
};
#ifdef __KERNEL__
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)
int forge_setsockopt(struct sock *sk, int level, int optname,
char __user *optval, unsigned int optlen);
#else
int forge_setsockopt(struct sock *sk, int level, int optname,
sockptr_t optval, unsigned int optlen);
#endif
int forge_getsockopt(struct sock *sk, int level, int optname,
char __user *optval, int __user *optlen);
int forge_getsockopt_socket(struct socket *sock, int level, int optname,
char __user *optval, int __user *optlen)
{
return forge_getsockopt(sock->sk, level, optname, optval, optlen);
}
struct sock *forge_csk_accept(struct sock *sk, int flags, int *err);
#endif
#endif