Version 1.8.0.0
[socat.git] / xio-socket.h
blobc4ce86475cbf7f0207d4f8d2a7972e66d7a73d50
1 /* source: xio-socket.h */
2 /* Copyright Gerhard Rieger and contributors (see file CHANGES) */
3 /* Published under the GNU General Public License V.2, see file COPYING */
5 #ifndef __xio_socket_h_included
6 #define __xio_socket_h_included 1
8 /* SO_PROTOTYPE is defined on Solaris, HP-UX
9 SO_PROTOCOL in Linux, is the better name, but came much later */
10 #ifdef SO_PROTOCOL
11 # undef SO_PROTOTYPE
12 # define SO_PROTOTYPE SO_PROTOCOL
13 #else
14 # ifdef SO_PROTOTYPE
15 # define SO_PROTOCOL SO_PROTOTYPE
16 # else
17 # define SO_PROTOCOL 0x9999
18 # define SO_PROTOTYPE SO_PROTOCOL
19 # endif
20 #endif
22 extern const struct addrdesc xioaddr_socket_connect;
23 extern const struct addrdesc xioaddr_socket_listen;
24 extern const struct addrdesc xioaddr_socket_sendto;
25 extern const struct addrdesc xioaddr_socket_datagram;
26 extern const struct addrdesc xioaddr_socket_recvfrom;
27 extern const struct addrdesc xioaddr_socket_recv;
29 extern const struct optdesc opt_connect_timeout;
30 extern const struct optdesc opt_so_debug;
31 extern const struct optdesc opt_so_acceptconn;
32 extern const struct optdesc opt_so_broadcast;
33 extern const struct optdesc opt_so_reuseaddr;
34 extern const struct optdesc opt_so_keepalive;
35 extern const struct optdesc opt_so_linger;
36 extern const struct optdesc opt_so_linger;
37 extern const struct optdesc opt_so_oobinline;
38 extern const struct optdesc opt_so_sndbuf;
39 extern const struct optdesc opt_so_sndbuf_late;
40 extern const struct optdesc opt_so_rcvbuf;
41 extern const struct optdesc opt_so_rcvbuf_late;
42 extern const struct optdesc opt_so_error;
43 extern const struct optdesc opt_so_type;
44 extern const struct optdesc opt_so_dontroute;
45 extern const struct optdesc opt_so_rcvlowat;
46 extern const struct optdesc opt_so_sndlowat;
47 extern const struct optdesc opt_so_rcvtimeo;
48 extern const struct optdesc opt_so_sndtimeo;
49 extern const struct optdesc opt_so_audit;
50 extern const struct optdesc opt_so_attach_filter;
51 extern const struct optdesc opt_so_detach_filter;
52 extern const struct optdesc opt_so_bindtodevice;
53 extern const struct optdesc opt_so_bsdcompat;
54 extern const struct optdesc opt_so_cksumrecv;
55 extern const struct optdesc opt_so_timestamp;
56 extern const struct optdesc opt_so_kernaccept;
57 extern const struct optdesc opt_so_no_check;
58 extern const struct optdesc opt_so_noreuseaddr;
59 extern const struct optdesc opt_so_passcred;
60 extern const struct optdesc opt_so_peercred;
61 extern const struct optdesc opt_so_priority;
62 extern const struct optdesc opt_so_reuseport;
63 extern const struct optdesc opt_so_security_authentication;
64 extern const struct optdesc opt_so_security_encryption_network;
65 extern const struct optdesc opt_so_security_encryption_transport;
66 extern const struct optdesc opt_so_use_ifbufs;
67 extern const struct optdesc opt_so_useloopback;
68 extern const struct optdesc opt_so_dgram_errind;
69 extern const struct optdesc opt_so_dontlinger;
70 extern const struct optdesc opt_so_prototype;
71 extern const struct optdesc opt_fiosetown;
72 extern const struct optdesc opt_siocspgrp;
73 extern const struct optdesc opt_bind;
74 extern const struct optdesc opt_protocol_family;
75 extern const struct optdesc opt_setsockopt;
76 extern const struct optdesc opt_setsockopt_int;
77 extern const struct optdesc opt_setsockopt_bin;
78 extern const struct optdesc opt_setsockopt_string;
79 extern const struct optdesc opt_setsockopt_listen;
80 extern const struct optdesc opt_null_eof;
83 extern
84 char *xiogetifname(int ind, char *val, int ins);
86 extern int retropt_socket_pf(struct opt *opts, int *pf);
87 extern int xiogetancillary(int fd, struct msghdr *msgh, int flags);
89 extern int xioopen_connect(struct single *fd,
90 union sockaddr_union *us, size_t uslen,
91 struct sockaddr *them, size_t themlen,
92 struct opt *opts,
93 int pf, int socktype, int protocol,
94 bool alt);
95 extern int _xioopen_connect(struct single *fd,
96 union sockaddr_union *us, size_t uslen,
97 struct sockaddr *them, size_t themlen,
98 struct opt *opts,
99 int pf, int socktype, int protocol,
100 bool alt, int level);
102 /* common to xioopen_udp_sendto, ..unix_sendto, ..rawip */
103 extern
104 int _xioopen_dgram_sendto(/* them is already in xfd->peersa */
105 union sockaddr_union *us, socklen_t uslen,
106 struct opt *opts,
107 int xioflags, xiosingle_t *xfd, groups_t groups,
108 int pf, int socktype, int ipproto, bool alt);
109 extern
110 int _xioopen_dgram_recvfrom(struct single *xfd, int xioflags,
111 struct sockaddr *us, socklen_t uslen,
112 struct opt *opts,
113 int pf, int socktype, int proto, int level);
114 extern
115 int _xioopen_dgram_recv(struct single *xfd, int xioflags,
116 struct sockaddr *us, socklen_t uslen,
117 struct opt *opts, int pf, int socktype, int proto,
118 int level);
119 extern int xiodopacketinfo(struct single *sfd, struct msghdr *msgh, bool withlog, bool withenv);
120 extern
121 int xiogetpacketsrc(int fd, struct msghdr *msgh, int flags);
122 extern
123 int xiocheckpeer(xiosingle_t *xfd,
124 union sockaddr_union *pa, union sockaddr_union *la);
125 extern
126 int xiosetsockaddrenv(const char *lr, union sockaddr_union *sau, socklen_t salen, int proto);
128 extern int xioparsenetwork(const char *rangename, int pf, struct xiorange *range, const int ai_flags[2]);
129 extern int xioparserange(const char *rangename, int pf, struct xiorange *range, const int ai_flags[2]);
131 extern int
132 xiosocket(struct opt *opts, int pf, int socktype, int proto, int level);
133 extern int
134 xiosocketpair(struct opt *opts, int pf, int socktype, int proto, int sv[2]);
135 extern int xiosock_reuseaddr(int fd, int ipproto, struct opt *opts);
137 #endif /* !defined(__xio_socket_h_included) */