work around bluetooth linger bug
[trinity.git] / include / net.h
blob0b1b15688778ff262ffb32d32bfcae27dbd9d598
1 #ifndef _NET_H
2 #define _NET_H 1
4 #include <netinet/in.h>
6 extern unsigned int nr_sockets;
8 /* protocol decoding */
9 extern unsigned int specific_proto;
12 /* glibc headers might be older than the kernel, so chances are we know
13 * about more protocols than glibc does. So we define our own PF_MAX */
14 #define TRINITY_PF_MAX 41
16 #define TYPE_MAX 10
17 #define PROTO_MAX 256
19 #define PF_NOHINT (-1)
21 struct socket_triplet {
22 unsigned int family;
23 unsigned int type;
24 unsigned int protocol;
27 struct sockopt {
28 unsigned int level;
29 unsigned long optname;
30 unsigned long optval;
31 unsigned long optlen;
34 /* We create one of these per socket fd we open, and store them in shm->sockets */
35 struct socketinfo {
36 struct socket_triplet triplet;
37 int fd;
40 void open_sockets(void);
41 void close_sockets(void);
43 void generate_sockaddr(unsigned long *addr, unsigned long *addrlen, int pf);
45 void do_setsockopt(struct sockopt *so);
47 void rand_proto_type(struct socket_triplet *st);
48 int sanitise_socket_triplet(struct socket_triplet *st);
49 void gen_socket_args(struct socket_triplet *st);
51 /* Ethernet */
52 int get_random_ether_type(void);
54 /* ipv4 */
55 in_addr_t random_ipv4_address(void);
56 void ipv4_gen_sockaddr(unsigned long *addr, unsigned long *addrlen);
57 void inet_rand_socket(struct socket_triplet *st);
58 void ip_setsockopt(struct sockopt *so);
60 /* ipv6 */
61 void ipv6_gen_sockaddr(unsigned long *addr, unsigned long *addrlen);
62 void inet6_rand_socket(struct socket_triplet *st);
63 void inet6_setsockopt(struct sockopt *so);
65 /* pppox */
66 void pppox_gen_sockaddr(unsigned long *addr, unsigned long *addrlen);
67 void pppol2tp_setsockopt(struct sockopt *so);
69 /* unix */
70 void unix_gen_sockaddr(unsigned long *addr, unsigned long *addrlen);
71 void unix_rand_socket(struct socket_triplet *st);
73 /* bpf */
74 void gen_bpf(unsigned long *addr, unsigned long *addrlen);
75 void gen_seccomp_bpf(unsigned long *addr, unsigned long *addrlen);
77 /* caif */
78 void caif_gen_sockaddr(unsigned long *addr, unsigned long *addrlen);
79 void caif_rand_socket(struct socket_triplet *st);
80 void caif_setsockopt(struct sockopt *so);
82 /* alg */
83 void alg_gen_sockaddr(unsigned long *addr, unsigned long *addrlen);
84 void alg_setsockopt(struct sockopt *so);
86 /* nfc */
87 void nfc_gen_sockaddr(unsigned long *addr, unsigned long *addrlen);
88 void nfc_rand_socket(struct socket_triplet *st);
89 void nfc_setsockopt(struct sockopt *so);
91 /* ax25 */
92 void ax25_gen_sockaddr(unsigned long *addr, unsigned long *addrlen);
93 void ax25_rand_socket(struct socket_triplet *st);
94 void ax25_setsockopt(struct sockopt *so);
96 /* ipx */
97 void ipx_gen_sockaddr(unsigned long *addr, unsigned long *addrlen);
98 void ipx_rand_socket(struct socket_triplet *st);
99 void ipx_setsockopt(struct sockopt *so);
101 /* appletalk */
102 void atalk_gen_sockaddr(unsigned long *addr, unsigned long *addrlen);
103 void atalk_rand_socket(struct socket_triplet *st);
104 void atalk_setsockopt(struct sockopt *so);
106 /* atm */
107 void atmpvc_gen_sockaddr(unsigned long *addr, unsigned long *addrlen);
108 void atmsvc_gen_sockaddr(unsigned long *addr, unsigned long *addrlen);
109 void atm_setsockopt(struct sockopt *so);
111 /* x25 */
112 void x25_gen_sockaddr(unsigned long *addr, unsigned long *addrlen);
113 void x25_rand_socket(struct socket_triplet *st);
114 void x25_setsockopt(struct sockopt *so);
116 /* rose */
117 void rose_gen_sockaddr(unsigned long *addr, unsigned long *addrlen);
118 void rose_setsockopt(struct sockopt *so);
120 /* decnet */
121 void decnet_gen_sockaddr(unsigned long *addr, unsigned long *addrlen);
122 void decnet_rand_socket(struct socket_triplet *st);
123 void decnet_setsockopt(struct sockopt *so);
125 /* llc */
126 void llc_gen_sockaddr(unsigned long *addr, unsigned long *addrlen);
127 void llc_rand_socket(struct socket_triplet *st);
128 void llc_setsockopt(struct sockopt *so);
130 /* netlink */
131 void netlink_gen_sockaddr(unsigned long *addr, unsigned long *addrlen);
132 void netlink_rand_socket(struct socket_triplet *st);
133 void netlink_setsockopt(struct sockopt *so);
135 /* packet */
136 void packet_gen_sockaddr(unsigned long *addr, unsigned long *addrlen);
137 void packet_rand_socket(struct socket_triplet *st);
138 void packet_setsockopt(struct sockopt *so);
140 /* econet */
141 void econet_gen_sockaddr(unsigned long *addr, unsigned long *addrlen);
143 /* irda */
144 void irda_gen_sockaddr(unsigned long *addr, unsigned long *addrlen);
145 void irda_rand_socket(struct socket_triplet *st);
146 void irda_setsockopt(struct sockopt *so);
148 /* can */
149 void can_gen_sockaddr(unsigned long *addr, unsigned long *addrlen);
150 void can_rand_socket(struct socket_triplet *st);
152 /* tipc */
153 void tipc_gen_sockaddr(unsigned long *addr, unsigned long *addrlen);
154 void tipc_rand_socket(struct socket_triplet *st);
155 void tipc_setsockopt(struct sockopt *so);
157 /* phonet */
158 void phonet_gen_sockaddr(unsigned long *addr, unsigned long *addrlen);
159 void phonet_rand_socket(struct socket_triplet *st);
161 /* rds */
162 void rds_rand_socket(struct socket_triplet *st);
163 void rds_setsockopt(struct sockopt *so);
165 /* setsockopt functions */
166 void socket_setsockopt(struct sockopt *so);
167 void tcp_setsockopt(struct sockopt *so);
168 void udp_setsockopt(struct sockopt *so);
169 void udplite_setsockopt(struct sockopt *so);
170 void icmpv6_setsockopt(struct sockopt *so);
171 void sctp_setsockopt(struct sockopt *so);
172 void raw_setsockopt(struct sockopt *so);
173 void netrom_setsockopt(struct sockopt *so);
174 void aal_setsockopt(struct sockopt *so);
175 void netbeui_setsockopt(struct sockopt *so);
176 void dccp_setsockopt(struct sockopt *so);
177 void rxrpc_setsockopt(struct sockopt *so);
178 void bluetooth_setsockopt(struct sockopt *so);
179 void pnpipe_setsockopt(struct sockopt *so);
180 void iucv_setsockopt(struct sockopt *so);
182 #endif /* _NET_H */