* cygwin.din (inet_pton): Export.

(inet_ntop): Export.
	* net.cc (cygwin_inet_pton): Implement inet_pton for AF_INET for now.
	(cygwin_inet_ntop): Implement inet_ntop for AF_INET for now.
	* include/arpa/inet.h (inet_pton): Declare.
	(inet_ntop): Declare.
	* include/cygwin/version.h: Bump API minor number.
This commit is contained in:
Corinna Vinschen 2005-06-17 20:01:59 +00:00
parent 2778b3e2b6
commit b3ba5059da
5 changed files with 62 additions and 1 deletions

View File

@ -1,3 +1,13 @@
2005-06-17 Corinna Vinschen <corinna@vinschen.de>
* cygwin.din (inet_pton): Export.
(inet_ntop): Export.
* net.cc (cygwin_inet_pton): Implement inet_pton for AF_INET for now.
(cygwin_inet_ntop): Implement inet_ntop for AF_INET for now.
* include/arpa/inet.h (inet_pton): Declare.
(inet_ntop): Declare.
* include/cygwin/version.h: Bump API minor number.
2005-06-17 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (fhandler_union): Add missing members corresponding to

View File

@ -324,8 +324,10 @@ herror = cygwin_herror SIGFE
hstrerror = cygwin_hstrerror NOSIGFE
inet_addr = cygwin_inet_addr SIGFE
inet_aton = cygwin_inet_aton SIGFE
inet_pton = cygwin_inet_pton SIGFE
inet_network = cygwin_inet_network SIGFE
inet_ntoa = cygwin_inet_ntoa SIGFE
inet_ntop = cygwin_inet_ntop SIGFE
cygwin_internal NOSIGFE
cygwin32_internal = cygwin_internal NOSIGFE
listen = cygwin_listen SIGFE

View File

@ -26,6 +26,8 @@ struct in_addr inet_makeaddr (unsigned long , unsigned long);
in_addr_t inet_netof (struct in_addr);
in_addr_t inet_network (const char *);
char *inet_ntoa (struct in_addr);
int inet_pton (int, const char *, void *);
const char *inet_ntop (int, const void *, char *, size_t);
#endif
#ifdef __cplusplus

View File

@ -257,12 +257,13 @@ details. */
128: Export pselect.
129: Export mkdtemp.
130: Export strtoimax, strtoumax, llabs, imaxabs, lldiv, imaxdiv.
131: Export inet_ntop, inet_pton.
*/
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
#define CYGWIN_VERSION_API_MAJOR 0
#define CYGWIN_VERSION_API_MINOR 130
#define CYGWIN_VERSION_API_MINOR 131
/* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible

View File

@ -2259,3 +2259,49 @@ cygwin_sendmsg (int fd, const struct msghdr *msg, int flags)
syscall_printf ("%d = sendmsg (%d, %p, %x)", res, fd, msg, flags);
return res;
}
/* See "UNIX Network Programming, Networing APIs: Sockets and XTI",
W. Richard Stevens, Prentice Hall PTR, 1998. */
extern "C" int
cygwin_inet_pton (int family, const char *strptr, void *addrptr)
{
if (family == AF_INET)
{
struct in_addr in_val;
if (cygwin_inet_aton (strptr, &in_val))
{
memcpy (addrptr, &in_val, sizeof (struct in_addr));
return 1;
}
return 0;
}
set_errno (EAFNOSUPPORT);
return -1;
}
/* See "UNIX Network Programming, Networing APIs: Sockets and XTI",
W. Richard Stevens, Prentice Hall PTR, 1998. */
extern "C" const char *
cygwin_inet_ntop (int family, const void *addrptr, char *strptr, size_t len)
{
const u_char *p = (const u_char *) addrptr;
if (__check_null_invalid_struct_errno (strptr, len))
return NULL;
if (family == AF_INET)
{
char temp[64]; /* Big enough for 4 ints ... */
__small_sprintf (temp, "%u.%u.%u.%u", p[0], p[1], p[2], p[3]);
if (strlen (temp) >= len)
{
set_errno (ENOSPC);
return NULL;
}
strcpy (strptr, temp);
return strptr;
}
set_errno (EAFNOSUPPORT);
return NULL;
}