5 * Copyright 2003, 2004 Porchdog Software. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without modification,
8 * are permitted provided that the following conditions are met:
10 * 1. Redistributions of source code must retain the above copyright notice,
11 * this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright notice,
13 * this list of conditions and the following disclaimer in the documentation
14 * and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
20 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
24 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
25 * OF THE POSSIBILITY OF SUCH DAMAGE.
27 * The views and conclusions contained in the software and documentation are those
28 * of the authors and should not be interpreted as representing official policies,
29 * either expressed or implied, of Porchdog Software.
32 #include <salt/platform.h>
33 #include <salt/address.h>
43 typedef struct _sw_socket * sw_socket;
44 struct _sw_socket_options;
45 typedef struct _sw_socket_options * sw_socket_options;
46 typedef sw_uint16 sw_port;
56 sw_tcp_socket_init_with_desc(
67 sw_multicast_socket_init(
79 sw_ipv4_address address,
84 sw_socket_join_multicast_group(
86 sw_ipv4_address local_address,
87 sw_ipv4_address multicast_address,
92 sw_socket_leave_multicast_group(
105 sw_ipv4_address address,
120 sw_size_t * bytesWritten);
128 sw_size_t * bytesWritten,
147 sw_ipv4_address * from,
149 sw_ipv4_address * dest,
150 sw_uint32 * interface_index);
154 sw_socket_set_blocking_mode(
156 sw_bool blocking_mode);
160 sw_socket_set_options(
162 sw_socket_options options);
165 sw_ipv4_address HOWL_API
166 sw_socket_ipv4_address(
175 sw_sockdesc_t HOWL_API
186 sw_socket_options_init(
187 sw_socket_options * self);
191 sw_socket_options_fina(
192 sw_socket_options self);
196 sw_socket_options_set_debug(
197 sw_socket_options self,
202 sw_socket_options_set_nodelay(
203 sw_socket_options self,
208 sw_socket_options_set_dontroute(
209 sw_socket_options self,
214 sw_socket_options_set_keepalive(
215 sw_socket_options self,
220 sw_socket_options_set_linger(
221 sw_socket_options self,
227 sw_socket_options_set_reuseaddr(
228 sw_socket_options self,
233 sw_socket_options_set_rcvbuf(
234 sw_socket_options self,
239 sw_socket_options_set_sndbuf(
240 sw_socket_options self,
245 sw_socket_error_code(void);
248 #define SW_E_SOCKET_BASE 0x80000200
249 #define SW_E_SOCKET (SW_E_SOCKET_BASE) + 1
250 #define SW_E_BIND (SW_E_SOCKET_BASE) + 2
251 #define SW_E_GETSOCKNAME (SW_E_SOCKET_BASE) + 3
252 #define SW_E_ADD_MEMBERSHIP (SW_E_SOCKET_BASE) + 4
253 #define SW_E_MULTICAST_TTL (SW_E_SOCKET_BASE) + 5
254 #define SW_E_NOCONNECTION (SW_E_SOCKET_BASE) + 6
255 #define SW_E_INPROGRESS (SW_E_SOCKET_BASE) + 7