/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Portions of this source code were derived from Berkeley 4.3 BSD
* under license from the Regents of the University of California.
*/
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
/*
* XXX The functions in this file are only needed to support transport
* providers that have not yet been converted to use /etc/sock2path.d.
* Once all transport providers have been converted this file can be
* removed.
*/
void **nethandle);
/*
* The following two string arrays map a number as specified
* by a user of sockets, to the string as would be returned
* by a call to getnetconfig().
*
* They are used by _s_match_netconf();
*
* proto_sw contains protocol entries for which there is a corresponding
* /dev device. All others would presumably use raw IP and download the
* desired protocol.
*/
static char *proto_sw[] = {
"",
"icmp", /* 1 = ICMP */
"",
"",
"",
"",
"tcp", /* 6 = TCP */
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"udp", /* 17 = UDP */
};
static char *family_sw[] = {
"-", /* 0 = AF_UNSPEC */
"loopback", /* 1 = AF_UNIX */
"inet", /* 2 = AF_INET */
"implink", /* 3 = AF_IMPLINK */
"pup", /* 4 = AF_PUP */
"chaos", /* 5 = AF_CHAOS */
"ns", /* 6 = AF_NS */
"nbs", /* 7 = AF_NBS */
"ecma", /* 8 = AF_ECMA */
"datakit", /* 9 = AF_DATAKIT */
"ccitt", /* 10 = AF_CCITT */
"sna", /* 11 = AF_SNA */
"decnet", /* 12 = AF_DECnet */
"dli", /* 13 = AF_DLI */
"lat", /* 14 = AF_LAT */
"hylink", /* 15 = AF_HYLINK */
"appletalk", /* 16 = AF_APPLETALK */
"nit", /* 17 = AF_NIT */
"ieee802", /* 18 = AF_802 */
"osi", /* 19 = AF_OSI */
"x25", /* 20 = AF_X25 */
"osinet", /* 21 = AF_OSINET */
"gosip", /* 22 = AF_GOSIP */
"ipx", /* 23 = AF_IPX */
"route", /* 24 = AF_ROUTE */
"link", /* 25 = AF_LINK */
"inet6", /* 26 = AF_INET6 */
"key", /* 27 = AF_KEY */
};
/*
* Returns the pathname and a prototype value (to be passed into SO_PROTOTYPE)
* The path is malloc'ed and has to be freed by the caller.
*/
int
{
void *nethandle;
return (-1);
*prototype = 0;
else
switch (errno) {
case EINTR:
goto retry;
case ENOENT:
case ENOLINK:
case ELOOP:
case EMULTIHOP:
case ENOTDIR:
break;
}
(void) endnetconfig(nethandle);
return (-1);
}
(void) endnetconfig(nethandle);
return (-1);
}
(void) endnetconfig(nethandle);
return (-1);
}
(void) endnetconfig(nethandle);
return (0);
}
/*
* Match config entry for protocol
* requested.
*/
static struct netconfig *
{
char *oproto;
if (family < 0 ||
return (NULL);
}
if (proto) {
oproto = "";
else
}
/*
* Loop through each entry in netconfig
* until one matches or we reach the end.
*/
return (NULL);
}
/*
* We make a copy of net->nc_semantics rather than modifying
* it in place because the network selection code shares the
* structures returned by getnetconfig() among all its callers.
* See bug #1160886 for more details.
*/
if (semantics == NC_TPI_COTS_ORD)
if (proto) {
break;
continue;
} else {
break;
}
}
}
(void) endnetconfig(*nethandle);
return (NULL);
}
return (net);
}