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 /***********************************************************************/
14 /* $Id: strofaddr.c 6824 2005-03-24 17:20:54Z doligez $ */
19 #include "unixsupport.h"
23 #include "socketaddr.h"
25 CAMLprim value unix_string_of_inet_addr(value a)
30 if (string_length(a) == 16)
32 inet_ntop(AF_INET6, (const void *) &GET_INET6_ADDR(a),
33 buffer, sizeof(buffer));
36 inet_ntop(AF_INET, (const void *) &GET_INET_ADDR(a),
37 buffer, sizeof(buffer));
39 res = inet_ntoa(GET_INET_ADDR(a));
41 if (res == NULL) uerror("string_of_inet_addr", Nothing);
42 return copy_string(res);
47 CAMLprim value unix_string_of_inet_addr(value a)
48 { invalid_argument("string_of_inet_addr not implemented"); }