dnscrypto-proxy: Support files updated.
[tomato.git] / release / src / router / udpxy / netop.h
blob85f6dfac47d780f315727f3aca5ad5837f1f29b4
1 /* @(#) interface to network operations for udpxy
3 * Copyright 2008-2011 Pavel V. Cherenkov (pcherenkov@gmail.com) (pcherenkov@gmail.com)
5 * This file is part of udpxy.
7 * udpxy is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * udpxy is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with udpxy. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef NETOP_UDPXY_0313082217_
22 #define NETOP_UDPXY_0313082217_
24 #include <sys/types.h>
26 struct in_addr;
27 struct sockaddr_in;
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
33 /* set up (server) listening sockfd
35 int
36 setup_listener( const char* ipaddr, int port, int* sockfd, int bklog );
39 /* set up the socket to receive multicast data
42 int
43 setup_mcast_listener( struct sockaddr_in* sa,
44 const struct in_addr* mifaddr,
45 int* mcastfd,
46 int sockbuflen );
49 /* unsubscribe from multicast and close the reader socket
52 void
53 close_mcast_listener( int msockfd, const struct in_addr* mifaddr );
56 /* add or drop membership in a multicast group
58 int
59 set_multicast( int msockfd, const struct in_addr* mifaddr,
60 int opname );
63 /* drop from and add into a multicast group
65 int
66 renew_multicast( int msockfd, const struct in_addr* mifaddr );
69 /* set send/receive timeouts on socket(s)
71 int
72 set_timeouts( int rsock, int ssock,
73 u_short rcv_tmout_sec, u_short rcv_tmout_usec,
74 u_short snd_tmout_sec, u_short snd_tmout_usec );
77 /* set socket's send buffer value
79 int
80 set_sendbuf( int sockfd, const size_t len );
83 /* set socket's send buffer value
85 int
86 set_rcvbuf( int sockfd, const size_t len );
89 /* get socket's send buffer size
91 int
92 get_sendbuf( int sockfd, size_t* const len );
95 /* get socket's send buffer size
97 int
98 get_rcvbuf( int sockfd, size_t* const len );
101 /* set/clear file/socket's mode as non-blocking
104 set_nblock( int fd, int set );
106 /* retrieve string address, int port of local/remote
107 end of the socket
110 get_sockinfo (int sockfd, char* addr, size_t alen, int* port);
112 get_peerinfo (int sockfd, char* addr, size_t alen, int* port);
114 #ifdef __cplusplus
116 #endif
119 #endif /* NETOP_UDPXY_0313082217_ */
122 /* __EOF__ */