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