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