17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
37c478bd9Sstevel@tonic-gate * Use is subject to license terms.
47c478bd9Sstevel@tonic-gate */
57c478bd9Sstevel@tonic-gate
67c478bd9Sstevel@tonic-gate /*
77c478bd9Sstevel@tonic-gate * On socket-only systems, fromhost() is nothing but an alias for the
87c478bd9Sstevel@tonic-gate * socket-specific sock_host() function.
9*1da57d55SToomas Soome *
107c478bd9Sstevel@tonic-gate * On systems with sockets and TLI, fromhost() determines the type of API
117c478bd9Sstevel@tonic-gate * (sockets, TLI), then invokes the appropriate API-specific routines.
12*1da57d55SToomas Soome *
137c478bd9Sstevel@tonic-gate * Diagnostics are reported through syslog(3).
14*1da57d55SToomas Soome *
157c478bd9Sstevel@tonic-gate * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
167c478bd9Sstevel@tonic-gate */
177c478bd9Sstevel@tonic-gate
187c478bd9Sstevel@tonic-gate #ifndef lint
197c478bd9Sstevel@tonic-gate static char sccsid[] = "@(#) fromhost.c 1.17 94/12/28 17:42:23";
207c478bd9Sstevel@tonic-gate #endif
217c478bd9Sstevel@tonic-gate
227c478bd9Sstevel@tonic-gate #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
237c478bd9Sstevel@tonic-gate
247c478bd9Sstevel@tonic-gate /* System libraries. */
257c478bd9Sstevel@tonic-gate
267c478bd9Sstevel@tonic-gate #include <sys/types.h>
277c478bd9Sstevel@tonic-gate #include <sys/tiuser.h>
287c478bd9Sstevel@tonic-gate #include <stropts.h>
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gate /* Local stuff. */
317c478bd9Sstevel@tonic-gate
327c478bd9Sstevel@tonic-gate #include "tcpd.h"
337c478bd9Sstevel@tonic-gate
347c478bd9Sstevel@tonic-gate /* fromhost - find out what network API we should use */
357c478bd9Sstevel@tonic-gate
fromhost(request)367c478bd9Sstevel@tonic-gate void fromhost(request)
377c478bd9Sstevel@tonic-gate struct request_info *request;
387c478bd9Sstevel@tonic-gate {
397c478bd9Sstevel@tonic-gate
407c478bd9Sstevel@tonic-gate /*
417c478bd9Sstevel@tonic-gate * On systems with streams support the IP network protocol family may be
427c478bd9Sstevel@tonic-gate * accessible via more than one programming interface: Berkeley sockets
437c478bd9Sstevel@tonic-gate * and the Transport Level Interface (TLI).
44*1da57d55SToomas Soome *
457c478bd9Sstevel@tonic-gate * Thus, we must first find out what programming interface to use: sockets
467c478bd9Sstevel@tonic-gate * or TLI. On some systems, sockets are not part of the streams system,
477c478bd9Sstevel@tonic-gate * so if request->fd is not a stream we simply assume sockets.
487c478bd9Sstevel@tonic-gate */
497c478bd9Sstevel@tonic-gate
507c478bd9Sstevel@tonic-gate if (ioctl(request->fd, I_FIND, "timod") > 0) {
517c478bd9Sstevel@tonic-gate tli_host(request);
527c478bd9Sstevel@tonic-gate } else {
537c478bd9Sstevel@tonic-gate sock_host(request);
547c478bd9Sstevel@tonic-gate }
557c478bd9Sstevel@tonic-gate }
567c478bd9Sstevel@tonic-gate
577c478bd9Sstevel@tonic-gate #endif /* TLI || PTX || TLI_SEQUENT */
58