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>
33 /* set up (server) listening sockfd
36 setup_listener( const char* ipaddr
, int port
, int* sockfd
, int bklog
);
39 /* set up the socket to receive multicast data
43 setup_mcast_listener( struct sockaddr_in
* sa
,
44 const struct in_addr
* mifaddr
,
49 /* unsubscribe from multicast and close the reader socket
53 close_mcast_listener( int msockfd
, const struct in_addr
* mifaddr
);
56 /* add or drop membership in a multicast group
59 set_multicast( int msockfd
, const struct in_addr
* mifaddr
,
63 /* drop from and add into a multicast group
66 renew_multicast( int msockfd
, const struct in_addr
* mifaddr
);
69 /* set send/receive timeouts on socket(s)
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
80 set_sendbuf( int sockfd
, const size_t len
);
83 /* set socket's send buffer value
86 set_rcvbuf( int sockfd
, const size_t len
);
89 /* get socket's send buffer size
92 get_sendbuf( int sockfd
, size_t* const len
);
95 /* get socket's send buffer size
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
110 get_sockinfo (int sockfd
, char* addr
, size_t alen
, int* port
);
112 get_peerinfo (int sockfd
, char* addr
, size_t alen
, int* port
);
119 #endif /* NETOP_UDPXY_0313082217_ */