12aef6930SMark Murray /*
22aef6930SMark Murray * On socket-only systems, fromhost() is nothing but an alias for the
32aef6930SMark Murray * socket-specific sock_host() function.
42aef6930SMark Murray *
52aef6930SMark Murray * On systems with sockets and TLI, fromhost() determines the type of API
62aef6930SMark Murray * (sockets, TLI), then invokes the appropriate API-specific routines.
72aef6930SMark Murray *
82aef6930SMark Murray * Diagnostics are reported through syslog(3).
92aef6930SMark Murray *
102aef6930SMark Murray * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
112aef6930SMark Murray */
122aef6930SMark Murray
132aef6930SMark Murray #ifndef lint
142aef6930SMark Murray static char sccsid[] = "@(#) fromhost.c 1.17 94/12/28 17:42:23";
152aef6930SMark Murray #endif
162aef6930SMark Murray
172aef6930SMark Murray #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
182aef6930SMark Murray
192aef6930SMark Murray /* System libraries. */
202aef6930SMark Murray
212aef6930SMark Murray #include <sys/types.h>
222aef6930SMark Murray #include <sys/tiuser.h>
232aef6930SMark Murray #include <stropts.h>
242aef6930SMark Murray
252aef6930SMark Murray /* Local stuff. */
262aef6930SMark Murray
272aef6930SMark Murray #include "tcpd.h"
282aef6930SMark Murray
292aef6930SMark Murray /* fromhost - find out what network API we should use */
302aef6930SMark Murray
fromhost(struct request_info * request)31*14f102eaSEd Maste void fromhost(struct request_info *request)
322aef6930SMark Murray {
332aef6930SMark Murray
342aef6930SMark Murray /*
352aef6930SMark Murray * On systems with streams support the IP network protocol family may be
362aef6930SMark Murray * accessible via more than one programming interface: Berkeley sockets
372aef6930SMark Murray * and the Transport Level Interface (TLI).
382aef6930SMark Murray *
392aef6930SMark Murray * Thus, we must first find out what programming interface to use: sockets
402aef6930SMark Murray * or TLI. On some systems, sockets are not part of the streams system,
412aef6930SMark Murray * so if request->fd is not a stream we simply assume sockets.
422aef6930SMark Murray */
432aef6930SMark Murray
442aef6930SMark Murray if (ioctl(request->fd, I_FIND, "timod") > 0) {
452aef6930SMark Murray tli_host(request);
462aef6930SMark Murray } else {
472aef6930SMark Murray sock_host(request);
482aef6930SMark Murray }
492aef6930SMark Murray }
502aef6930SMark Murray
512aef6930SMark Murray #endif /* TLI || PTX || TLI_SEQUENT */
52