inet_pton.c revision 55682
159191Skris/*
259191Skris * Copyright (c) 1999 Kungliga Tekniska H�gskolan
3160814Ssimon * (Royal Institute of Technology, Stockholm, Sweden).
4160814Ssimon * All rights reserved.
5280304Sjkim *
6280304Sjkim * Redistribution and use in source and binary forms, with or without
7280304Sjkim * modification, are permitted provided that the following conditions
8280304Sjkim * are met:
9160814Ssimon *
10280304Sjkim * 1. Redistributions of source code must retain the above copyright
11160814Ssimon *    notice, this list of conditions and the following disclaimer.
12280304Sjkim *
13280304Sjkim * 2. Redistributions in binary form must reproduce the above copyright
14280304Sjkim *    notice, this list of conditions and the following disclaimer in the
1559191Skris *    documentation and/or other materials provided with the distribution.
1659191Skris *
1759191Skris * 3. Neither the name of the Institute nor the names of its contributors
18280304Sjkim *    may be used to endorse or promote products derived from this software
1959191Skris *    without specific prior written permission.
20280304Sjkim *
21280304Sjkim * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22280304Sjkim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23280304Sjkim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24280304Sjkim * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25280304Sjkim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26280304Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27280304Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28280304Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29280304Sjkim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30280304Sjkim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31280304Sjkim * SUCH DAMAGE.
3259191Skris */
3359191Skris
3459191Skris#ifdef HAVE_CONFIG_H
35280304Sjkim#include <config.h>
36280304SjkimRCSID("$Id: inet_pton.c,v 1.2 1999/12/02 16:58:47 joda Exp $");
37280304Sjkim#endif
38280304Sjkim
39280304Sjkim#include <errno.h>
40280304Sjkim#ifdef HAVE_SYS_TYPES_H
41280304Sjkim#include <sys/types.h>
42280304Sjkim#endif
43280304Sjkim#ifdef HAVE_SYS_SOCKET_H
44280304Sjkim#include <sys/socket.h>
45280304Sjkim#endif
46280304Sjkim#ifdef HAVE_NETINET_IN_H
47280304Sjkim#include <netinet/in.h>
48280304Sjkim#endif
49280304Sjkim#ifdef HAVE_NETINET_IN6_H
50280304Sjkim#include <netinet/in6.h>
51280304Sjkim#endif
52280304Sjkim#ifdef HAVE_NETINET6_IN6_H
53280304Sjkim#include <netinet6/in6.h>
54280304Sjkim#endif
55280304Sjkim
56280304Sjkim#include <roken.h>
57280304Sjkim
58280304Sjkimint
59280304Sjkiminet_pton(int af, const char *src, void *dst)
60280304Sjkim{
61280304Sjkim    if (af != AF_INET) {
62280304Sjkim	errno = EAFNOSUPPORT;
63280304Sjkim	return -1;
64280304Sjkim    }
65280304Sjkim    return inet_aton (src, dst);
66280304Sjkim}
67280304Sjkim