version 1.7.3.0
[socat.git] / xio-socket.h
bloba4bef6688184fcc9d5a47a83c83229e92cab0092
1 /* source: xio-socket.h */
2 /* Copyright Gerhard Rieger 2001-2009 */
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 OS defined on Solaris, HP-UX; we lend this for a more
9 general purpose */
10 #ifndef SO_PROTOTYPE
11 #define SO_PROTOTYPE 0x9999
12 #endif
14 extern const struct addrdesc xioaddr_socket_connect;
15 extern const struct addrdesc xioaddr_socket_listen;
16 extern const struct addrdesc xioaddr_socket_sendto;
17 extern const struct addrdesc xioaddr_socket_datagram;
18 extern const struct addrdesc xioaddr_socket_recvfrom;
19 extern const struct addrdesc xioaddr_socket_recv;
21 extern const struct optdesc opt_connect_timeout;
22 extern const struct optdesc opt_so_debug;
23 extern const struct optdesc opt_so_acceptconn;
24 extern const struct optdesc opt_so_broadcast;
25 extern const struct optdesc opt_so_reuseaddr;
26 extern const struct optdesc opt_so_keepalive;
27 extern const struct optdesc opt_so_linger;
28 extern const struct optdesc opt_so_linger;
29 extern const struct optdesc opt_so_oobinline;
30 extern const struct optdesc opt_so_sndbuf;
31 extern const struct optdesc opt_so_sndbuf_late;
32 extern const struct optdesc opt_so_rcvbuf;
33 extern const struct optdesc opt_so_rcvbuf_late;
34 extern const struct optdesc opt_so_error;
35 extern const struct optdesc opt_so_type;
36 extern const struct optdesc opt_so_dontroute;
37 extern const struct optdesc opt_so_rcvlowat;
38 extern const struct optdesc opt_so_rcvtimeo;
39 extern const struct optdesc opt_so_sndlowat;
40 extern const struct optdesc opt_so_sndtimeo;
41 extern const struct optdesc opt_so_audit;
42 extern const struct optdesc opt_so_attach_filter;
43 extern const struct optdesc opt_so_detach_filter;
44 extern const struct optdesc opt_so_bindtodevice;
45 extern const struct optdesc opt_so_bsdcompat;
46 extern const struct optdesc opt_so_cksumrecv;
47 extern const struct optdesc opt_so_timestamp;
48 extern const struct optdesc opt_so_kernaccept;
49 extern const struct optdesc opt_so_no_check;
50 extern const struct optdesc opt_so_noreuseaddr;
51 extern const struct optdesc opt_so_passcred;
52 extern const struct optdesc opt_so_peercred;
53 extern const struct optdesc opt_so_priority;
54 extern const struct optdesc opt_so_reuseport;
55 extern const struct optdesc opt_so_security_authentication;
56 extern const struct optdesc opt_so_security_encryption_network;
57 extern const struct optdesc opt_so_security_encryption_transport;
58 extern const struct optdesc opt_so_use_ifbufs;
59 extern const struct optdesc opt_so_useloopback;
60 extern const struct optdesc opt_so_dgram_errind;
61 extern const struct optdesc opt_so_dontlinger;
62 extern const struct optdesc opt_so_prototype;
63 extern const struct optdesc opt_fiosetown;
64 extern const struct optdesc opt_siocspgrp;
65 extern const struct optdesc opt_bind;
66 extern const struct optdesc opt_protocol_family;
67 extern const struct optdesc opt_setsockopt_int;
68 extern const struct optdesc opt_setsockopt_bin;
69 extern const struct optdesc opt_setsockopt_string;
70 extern const struct optdesc opt_null_eof;
73 extern
74 char *xiogetifname(int ind, char *val, int ins);
76 extern int retropt_socket_pf(struct opt *opts, int *pf);
78 extern int xioopen_connect(struct single *fd,
79 struct sockaddr *us, size_t uslen,
80 struct sockaddr *them, size_t themlen,
81 struct opt *opts,
82 int pf, int socktype, int protocol,
83 bool alt);
84 extern int _xioopen_connect(struct single *fd,
85 struct sockaddr *us, size_t uslen,
86 struct sockaddr *them, size_t themlen,
87 struct opt *opts,
88 int pf, int socktype, int protocol,
89 bool alt, int level);
91 /* common to xioopen_udp_sendto, ..unix_sendto, ..rawip */
92 extern
93 int _xioopen_dgram_sendto(/* them is already in xfd->peersa */
94 union sockaddr_union *us, socklen_t uslen,
95 struct opt *opts,
96 int xioflags, xiosingle_t *xfd, unsigned groups,
97 int pf, int socktype, int ipproto);
98 extern
99 int _xioopen_dgram_recvfrom(struct single *xfd, int xioflags,
100 struct sockaddr *us, socklen_t uslen,
101 struct opt *opts,
102 int pf, int socktype, int proto, int level);
103 extern
104 int _xioopen_dgram_recv(struct single *xfd, int xioflags,
105 struct sockaddr *us, socklen_t uslen,
106 struct opt *opts, int pf, int socktype, int proto,
107 int level);
108 extern
109 int xiodopacketinfo(struct msghdr *msgh, bool withlog, bool withenv);
110 extern
111 int xiogetpacketsrc(int fd, struct msghdr *msgh);
112 extern
113 int xiocheckpeer(xiosingle_t *xfd,
114 union sockaddr_union *pa, union sockaddr_union *la);
115 extern
116 int xiosetsockaddrenv(const char *lr, union sockaddr_union *sau, socklen_t salen, int proto);
118 extern
119 int xioparsenetwork(const char *rangename, int pf,
120 struct xiorange *range);
121 extern
122 int xioparserange(const char *rangename, int pf, struct xiorange *range);
124 extern int
125 xiosocket(struct opt *opts, int pf, int socktype, int proto, int level);
126 extern int
127 xiosocketpair(struct opt *opts, int pf, int socktype, int proto, int sv[2]);
129 #endif /* !defined(__xio_socket_h_included) */