1: /*
   2: ** ident.h
   3: **
   4: ** Author: Peter Eriksson <pen@lysator.liu.se>
   5: ** Intruder: Pär Emanuelsson <pell@lysator.liu.se>
   6: */
   7: 
   8: #ifndef __IDENT_H__
   9: #define __IDENT_H__
  10: 
  11: #ifdef  __cplusplus
  12: extern "C" {
  13: #endif
  14: 
  15: /* Sigh */
  16: #ifdef __STDC__
  17: #  if __STDC__ == 1
  18: #    define IS_STDC 1
  19: #  endif
  20: #endif
  21: 
  22: #ifdef __P
  23: #  undef __P
  24: #endif
  25: 
  26: #ifdef IS_STDC
  27: #  define __P(AL)                     AL
  28: 
  29: #ifdef IN_LIBIDENT_SRC
  30: 
  31: #  define __P1(t1,a1) \
  32:     (t1 a1)
  33: 
  34: #  define __P2(t1,a1,t2,a2) \
  35:     (t1 a1, t2 a2)
  36: 
  37: #  define __P3(t1,a1,t2,a2,t3,a3) \
  38:     (t1 a1, t2 a2, t3 a3)
  39: 
  40: #  define __P4(t1,a1,t2,a2,t3,a3,t4,a4) \
  41:     (t1 a1, t2 a2, t3 a3, t4 a4)
  42: 
  43: #  define __P5(t1,a1,t2,a2,t3,a3,t4,a4,t5,a5) \
  44:     (t1 a1, t2 a2, t3 a3, t4 a4, t5 a5)
  45: 
  46: #  define __P7(t1,a1,t2,a2,t3,a3,t4,a4,t5,a5,t6,a6,t7,a7) \
  47:     (t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7)
  48: #endif
  49: 
  50: #else
  51: 
  52: #  define __P(AL)                     ()
  53: 
  54: #ifdef IN_LIBIDENT_SRC
  55: 
  56: #  define __P1(t1,a1)                     (a1) \
  57:     t1 a1;
  58: #  define __P2(t1,a1,t2,a2)               (a1, a2) \
  59:     t1 a1; \
  60:     t2 a2;
  61: #  define __P3(t1,a1,t2,a2,t3,a3)         (a1, a2, a3) \
  62:     t1 a1; \
  63:     t2 a2; \
  64:     t3 a3;
  65: #  define __P4(t1,a1,t2,a2,t3,a3,t4,a4)   (a1, a2, a3, a4) \
  66:     t1 a1; \
  67:     t2 a2; \
  68:     t3 a3; \
  69:     t4 a4;
  70: #  define __P5(t1,a1,t2,a2,t3,a3,t4,a4,t5,a5)   (a1, a2, a3, a4, a5) \
  71:     t1 a1; \
  72:     t2 a2; \
  73:     t3 a3; \
  74:     t4 a4; \
  75:     t5 a5;
  76: #  define __P7(t1,a1,t2,a2,t3,a3,t4,a4,t5,a5,t6,a6,t7,a7) \
  77:     (a1, a2, a3, a4, a5, a6, a7) \
  78:     t1 a1; \
  79:     t2 a2; \
  80:     t3 a3; \
  81:     t4 a4; \
  82:     t5 a5; \
  83:     t6 a6; \
  84:     t7 a7;
  85: #endif
  86: #endif
  87: 
  88: #ifdef IS_STDC
  89: #  undef IS_STDC
  90: #endif
  91: 
  92: #ifdef _AIX
  93: #  include <sys/select.h>
  94: #endif
  95: #ifdef __sgi
  96: #  include <bstring.h>
  97: #endif
  98: #include <sys/types.h>
  99: #include <netinet/in.h>
 100: #include <sys/time.h>
 101: 
 102: #if defined(VMS) && !defined(FD_SETSIZE)
 103: #  define FD_SETSIZE 64
 104: #endif
 105: 
 106: /*
 107:  * Sigh, GCC v2 complains when using undefined struct tags
 108:  * in function prototypes...
 109:  */
 110: #if defined(__GNUC__) && !defined(INADDR_ANY)
 111: #  define __STRUCT_IN_ADDR_P    void *
 112: #else
 113: #  define __STRUCT_IN_ADDR_P    struct in_addr *
 114: #endif
 115: 
 116: #if defined(__GNUC__) && !defined(DST_NONE)
 117: #  define __STRUCT_TIMEVAL_P    void *
 118: #else
 119: #  define __STRUCT_TIMEVAL_P    struct timeval *
 120: #endif
 121: 
 122: #if defined(__sgi) && defined(_POSIX_SOURCE)
 123: #  undef  __STRUCT_TIMEVAL_P
 124: #  define __STRUCT_TIMEVAL_P    void *
 125: #endif
 126: 
 127: #ifndef IDBUFSIZE
 128: #  define IDBUFSIZE 2048
 129: #endif
 130: 
 131: #ifndef IDPORT
 132: #  define IDPORT    113
 133: #endif
 134: 
 135: typedef struct
 136: {
 137:   int fd;
 138:   char buf[IDBUFSIZE];
 139: } ident_t;
 140: 
 141: typedef struct {
 142:   int lport;                    /* Local port */
 143:   int fport;                    /* Far (remote) port */
 144:   char *identifier;             /* Normally user name */
 145:   char *opsys;                  /* OS */
 146:   char *charset;                /* Charset (what did you expect?) */
 147: } IDENT;                        /* For higher-level routines */
 148: 
 149: /* Low-level calls and macros */
 150: #define id_fileno(ID)   ((ID)->fd)
 151: 
 152: extern ident_t * id_open __P((__STRUCT_IN_ADDR_P laddr,
 153:                __STRUCT_IN_ADDR_P faddr,
 154:                __STRUCT_TIMEVAL_P timeout));
 155: 
 156: extern int    id_close __P((ident_t *id));
 157: 
 158: extern int    id_query __P((ident_t *id,
 159:                 int lport,
 160:                 int fport,
 161:                 __STRUCT_TIMEVAL_P timeout));
 162: 
 163: extern int    id_parse __P((ident_t *id,
 164:                 __STRUCT_TIMEVAL_P timeout,
 165:                 int *lport,
 166:                 int *fport,
 167:                 char **identifier,
 168:                 char **opsys,
 169:                 char **charset));
 170: 
 171: /* High-level calls */
 172: 
 173: extern IDENT *ident_lookup __P((int fd, int timeout));
 174: 
 175: extern char  *ident_id __P((int fd, int timeout));
 176: 
 177: extern IDENT *ident_query __P(( __STRUCT_IN_ADDR_P laddr, __STRUCT_IN_ADDR_P raddr, int lport, int rport, int timeout));
 178: 
 179: extern void   ident_free __P((IDENT *id));
 180: 
 181: extern char  id_version[];
 182: 
 183: #ifdef IN_LIBIDENT_SRC
 184: 
 185: extern char *id_strdup __P((char *str));
 186: extern char *id_strtok __P((char *cp, char *cs, char *dc));
 187: 
 188: #endif
 189: 
 190: #ifdef  __cplusplus
 191: }
 192: #endif
 193: 
 194: #endif

Defined macros

FD_SETSIZE defined in line 103; used 1 times
IDBUFSIZE defined in line 128; used 2 times
IDPORT defined in line 132; used 1 times
IS_STDC defined in line 18; used 3 times
__IDENT_H__ defined in line 9; used 1 times
  • in line 8
__P defined in line 52; used 12 times
__P1 defined in line 56; never used
__P2 defined in line 58; never used
__P3 defined in line 61; never used
__P4 defined in line 65; never used
__P5 defined in line 70; never used
__P7 defined in line 76; never used
__STRUCT_IN_ADDR_P defined in line 113; used 4 times
__STRUCT_TIMEVAL_P defined in line 124; used 4 times
id_fileno defined in line 150; never used

Usage of this include

Last modified: 1999-11-27
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2753
Valid CSS Valid XHTML 1.0 Strict