home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / N / TCPIP / NETKIT-A.06 / NETKIT-A / NetKit-A-0.06 / tcp_wrapper-6.3 / log_tcp.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-27  |  2.5 KB  |  72 lines

  1. /* @(#) log_tcp.h 1.11 93/12/13 22:23:12 */
  2.  
  3. /* Structure filled in by the fromhost() routine. */
  4.  
  5. struct client_info {
  6.     char   *name;            /* host name */
  7.     char   *addr;            /* host address */
  8.     char   *user;            /* user name ("" if not looked up) */
  9.     int     fd;                /* socket handle */
  10.     struct sockaddr_in *rmt_sin;    /* their side of the link */
  11.     struct sockaddr_in *our_sin;    /* our side of the link */
  12.     void  (*sink)();            /* datagram sink function */
  13. };
  14.  
  15. #define from_host client_info        /* backwards compatibility */
  16.  
  17. #define FROM_UNKNOWN    "unknown"    /* name or address lookup failed */
  18. #define FROM_HOST(f) \
  19.     (((f)->name[0] && strcmp((f)->name, FROM_UNKNOWN)) ? (f)->name : \
  20.     (f)->addr[0] ? (f)->addr : FROM_UNKNOWN)
  21.  
  22. /* The following are to be used in assignment context, not in comparisons. */
  23.  
  24. #define FROM_GOOD    1        /* AIX pre-empts GOOD */
  25. #define FROM_BAD    0        /* AIX pre-empts BAD */
  26.  
  27. /* Global functions. */
  28.  
  29. extern int fromhost();            /* get/validate remote host info */
  30. extern int hosts_access();        /* access control */
  31. extern void refuse();            /* refuse request */
  32. extern void shell_cmd();        /* execute shell command */
  33. extern void percent_x();        /* do %<char> expansion */
  34. extern char *rfc931();            /* remote name from RFC 931 daemon */
  35. extern char *hosts_info();        /* show origin of connection */
  36. extern void clean_exit();        /* clean up and exit */
  37. extern void init_client();        /* init a client_info structure */
  38.  
  39. #define RFC931_POSSIBLE(f) ((f)->sink == 0 && (f)->rmt_sin && (f)->our_sin)
  40.  
  41. /* Global variables. */
  42.  
  43. extern int allow_severity;        /* for connection logging */
  44. extern int deny_severity;        /* for connection logging */
  45. extern char *hosts_allow_table;        /* for verification mode redirection */
  46. extern char *hosts_deny_table;        /* for verification mode redirection */
  47. extern char *hosts_access_file;        /* for diagnostics */
  48. extern int hosts_access_line;        /* for diagnostics */
  49. extern int rfc931_timeout;        /* username lookup period */
  50.  
  51. /* Bug workarounds. */
  52.  
  53. #ifdef INET_ADDR_BUG            /* inet_addr() returns struct */
  54. #define inet_addr fix_inet_addr
  55. extern long fix_inet_addr();
  56. #endif     /* INET_ADDR_BUG */
  57.  
  58. #ifdef BROKEN_FGETS            /* partial reads from sockets */
  59. #define fgets fix_fgets
  60. extern char *fix_fgets();
  61. #endif     /* BROKEN_FGETS */
  62.  
  63. #ifdef RECVFROM_BUG            /* no address family info */
  64. #define recvfrom fix_recvfrom
  65. extern int fix_recvfrom();
  66. #endif     /* RECVFROM_BUG */
  67.  
  68. #ifdef GETPEERNAME_BUG            /* claims success with UDP */
  69. #define getpeername     fix_getpeername
  70. extern int fix_getpeername();
  71. #endif     /* GETPEERNAME_BUG */
  72.