1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
3*7c478bd9Sstevel@tonic-gate * Use is subject to license terms.
4*7c478bd9Sstevel@tonic-gate */
5*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI"
6*7c478bd9Sstevel@tonic-gate
7*7c478bd9Sstevel@tonic-gate /*
8*7c478bd9Sstevel@tonic-gate * On socket-only systems, fromhost() is nothing but an alias for the
9*7c478bd9Sstevel@tonic-gate * socket-specific sock_host() function.
10*7c478bd9Sstevel@tonic-gate *
11*7c478bd9Sstevel@tonic-gate * On systems with sockets and TLI, fromhost() determines the type of API
12*7c478bd9Sstevel@tonic-gate * (sockets, TLI), then invokes the appropriate API-specific routines.
13*7c478bd9Sstevel@tonic-gate *
14*7c478bd9Sstevel@tonic-gate * Diagnostics are reported through syslog(3).
15*7c478bd9Sstevel@tonic-gate *
16*7c478bd9Sstevel@tonic-gate * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
17*7c478bd9Sstevel@tonic-gate */
18*7c478bd9Sstevel@tonic-gate
19*7c478bd9Sstevel@tonic-gate #ifndef lint
20*7c478bd9Sstevel@tonic-gate static char sccsid[] = "@(#) fromhost.c 1.17 94/12/28 17:42:23";
21*7c478bd9Sstevel@tonic-gate #endif
22*7c478bd9Sstevel@tonic-gate
23*7c478bd9Sstevel@tonic-gate #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
24*7c478bd9Sstevel@tonic-gate
25*7c478bd9Sstevel@tonic-gate /* System libraries. */
26*7c478bd9Sstevel@tonic-gate
27*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
28*7c478bd9Sstevel@tonic-gate #include <sys/tiuser.h>
29*7c478bd9Sstevel@tonic-gate #include <stropts.h>
30*7c478bd9Sstevel@tonic-gate
31*7c478bd9Sstevel@tonic-gate /* Local stuff. */
32*7c478bd9Sstevel@tonic-gate
33*7c478bd9Sstevel@tonic-gate #include "tcpd.h"
34*7c478bd9Sstevel@tonic-gate
35*7c478bd9Sstevel@tonic-gate /* fromhost - find out what network API we should use */
36*7c478bd9Sstevel@tonic-gate
fromhost(request)37*7c478bd9Sstevel@tonic-gate void fromhost(request)
38*7c478bd9Sstevel@tonic-gate struct request_info *request;
39*7c478bd9Sstevel@tonic-gate {
40*7c478bd9Sstevel@tonic-gate
41*7c478bd9Sstevel@tonic-gate /*
42*7c478bd9Sstevel@tonic-gate * On systems with streams support the IP network protocol family may be
43*7c478bd9Sstevel@tonic-gate * accessible via more than one programming interface: Berkeley sockets
44*7c478bd9Sstevel@tonic-gate * and the Transport Level Interface (TLI).
45*7c478bd9Sstevel@tonic-gate *
46*7c478bd9Sstevel@tonic-gate * Thus, we must first find out what programming interface to use: sockets
47*7c478bd9Sstevel@tonic-gate * or TLI. On some systems, sockets are not part of the streams system,
48*7c478bd9Sstevel@tonic-gate * so if request->fd is not a stream we simply assume sockets.
49*7c478bd9Sstevel@tonic-gate */
50*7c478bd9Sstevel@tonic-gate
51*7c478bd9Sstevel@tonic-gate if (ioctl(request->fd, I_FIND, "timod") > 0) {
52*7c478bd9Sstevel@tonic-gate tli_host(request);
53*7c478bd9Sstevel@tonic-gate } else {
54*7c478bd9Sstevel@tonic-gate sock_host(request);
55*7c478bd9Sstevel@tonic-gate }
56*7c478bd9Sstevel@tonic-gate }
57*7c478bd9Sstevel@tonic-gate
58*7c478bd9Sstevel@tonic-gate #endif /* TLI || PTX || TLI_SEQUENT */
59