1 /***********************************************************************/
5 /* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
7 /* Copyright 1996 Institut National de Recherche en Informatique et */
8 /* en Automatique. All rights reserved. This file is distributed */
9 /* under the terms of the GNU Library General Public License, with */
10 /* the special exception on linking described in file ../../LICENSE. */
12 /***********************************************************************/
17 #include <sys/types.h>
18 #include <sys/socket.h>
20 #include <netinet/in.h>
21 #include <arpa/inet.h>
23 union sock_addr_union
{
24 struct sockaddr s_gen
;
25 struct sockaddr_un s_unix
;
26 struct sockaddr_in s_inet
;
28 struct sockaddr_in6 s_inet6
;
33 typedef socklen_t socklen_param_type
;
35 typedef int socklen_param_type
;
38 extern void get_sockaddr (value mladdr
,
39 union sock_addr_union
* addr
/*out*/,
40 socklen_param_type
* addr_len
/*out*/);
41 CAMLexport value
alloc_sockaddr (union sock_addr_union
* addr
/*in*/,
42 socklen_param_type addr_len
, int close_on_error
);
43 CAMLexport value
alloc_inet_addr (struct in_addr
* inaddr
);
44 #define GET_INET_ADDR(v) (*((struct in_addr *) (v)))
47 CAMLexport value
alloc_inet6_addr (struct in6_addr
* inaddr
);
48 #define GET_INET6_ADDR(v) (*((struct in6_addr *) (v)))