144743Smarkm /*
244743Smarkm  * On socket-only systems, fromhost() is nothing but an alias for the
344743Smarkm  * socket-specific sock_host() function.
444743Smarkm  *
544743Smarkm  * On systems with sockets and TLI, fromhost() determines the type of API
644743Smarkm  * (sockets, TLI), then invokes the appropriate API-specific routines.
744743Smarkm  *
844743Smarkm  * Diagnostics are reported through syslog(3).
944743Smarkm  *
1044743Smarkm  * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
1144743Smarkm  */
1244743Smarkm
1344743Smarkm#ifndef lint
1444743Smarkmstatic char sccsid[] = "@(#) fromhost.c 1.17 94/12/28 17:42:23";
1544743Smarkm#endif
1644743Smarkm
1744743Smarkm#if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
1844743Smarkm
1944743Smarkm/* System libraries. */
2044743Smarkm
2144743Smarkm#include <sys/types.h>
2244743Smarkm#include <sys/tiuser.h>
2344743Smarkm#include <stropts.h>
2444743Smarkm
2544743Smarkm/* Local stuff. */
2644743Smarkm
2744743Smarkm#include "tcpd.h"
2844743Smarkm
2944743Smarkm/* fromhost - find out what network API we should use */
3044743Smarkm
3144743Smarkmvoid    fromhost(request)
3244743Smarkmstruct request_info *request;
3344743Smarkm{
3444743Smarkm
3544743Smarkm    /*
3644743Smarkm     * On systems with streams support the IP network protocol family may be
3744743Smarkm     * accessible via more than one programming interface: Berkeley sockets
3844743Smarkm     * and the Transport Level Interface (TLI).
3944743Smarkm     *
4044743Smarkm     * Thus, we must first find out what programming interface to use: sockets
4144743Smarkm     * or TLI. On some systems, sockets are not part of the streams system,
4244743Smarkm     * so if request->fd is not a stream we simply assume sockets.
4344743Smarkm     */
4444743Smarkm
4544743Smarkm    if (ioctl(request->fd, I_FIND, "timod") > 0) {
4644743Smarkm	tli_host(request);
4744743Smarkm    } else {
4844743Smarkm	sock_host(request);
4944743Smarkm    }
5044743Smarkm}
5144743Smarkm
5244743Smarkm#endif /* TLI || PTX || TLI_SEQUENT */
53