masqmail-0.2

diff src/libident/ident.h @ 0:08114f7dcc23

this is masqmail-0.2.21 from oliver kurth
author meillo@marmaro.de
date Fri, 26 Sep 2008 17:05:23 +0200
parents
children 26e34ae9a3e3
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/libident/ident.h	Fri Sep 26 17:05:23 2008 +0200
     1.3 @@ -0,0 +1,194 @@
     1.4 +/*
     1.5 +** ident.h
     1.6 +**
     1.7 +** Author: Peter Eriksson <pen@lysator.liu.se>
     1.8 +** Intruder: Pär Emanuelsson <pell@lysator.liu.se>
     1.9 +*/
    1.10 +
    1.11 +#ifndef __IDENT_H__
    1.12 +#define __IDENT_H__
    1.13 +
    1.14 +#ifdef	__cplusplus
    1.15 +extern "C" {
    1.16 +#endif
    1.17 +
    1.18 +/* Sigh */
    1.19 +#ifdef __STDC__
    1.20 +#  if __STDC__ == 1
    1.21 +#    define IS_STDC 1
    1.22 +#  endif
    1.23 +#endif
    1.24 +
    1.25 +#ifdef __P
    1.26 +#  undef __P
    1.27 +#endif
    1.28 +    
    1.29 +#ifdef IS_STDC
    1.30 +#  define __P(AL)	                  AL
    1.31 +
    1.32 +#ifdef IN_LIBIDENT_SRC
    1.33 +    
    1.34 +#  define __P1(t1,a1) \
    1.35 +    (t1 a1)
    1.36 +    
    1.37 +#  define __P2(t1,a1,t2,a2) \
    1.38 +    (t1 a1, t2 a2)
    1.39 +	
    1.40 +#  define __P3(t1,a1,t2,a2,t3,a3) \
    1.41 +    (t1 a1, t2 a2, t3 a3)
    1.42 +	    
    1.43 +#  define __P4(t1,a1,t2,a2,t3,a3,t4,a4) \
    1.44 +    (t1 a1, t2 a2, t3 a3, t4 a4)
    1.45 +
    1.46 +#  define __P5(t1,a1,t2,a2,t3,a3,t4,a4,t5,a5) \
    1.47 +    (t1 a1, t2 a2, t3 a3, t4 a4, t5 a5)
    1.48 +
    1.49 +#  define __P7(t1,a1,t2,a2,t3,a3,t4,a4,t5,a5,t6,a6,t7,a7) \
    1.50 +    (t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7)
    1.51 +#endif
    1.52 +    
    1.53 +#else
    1.54 +
    1.55 +#  define __P(AL)	                  ()
    1.56 +
    1.57 +#ifdef IN_LIBIDENT_SRC
    1.58 +    
    1.59 +#  define __P1(t1,a1)                     (a1) \
    1.60 +    t1 a1;
    1.61 +#  define __P2(t1,a1,t2,a2)               (a1, a2) \
    1.62 +    t1 a1; \
    1.63 +    t2 a2;
    1.64 +#  define __P3(t1,a1,t2,a2,t3,a3)         (a1, a2, a3) \
    1.65 +    t1 a1; \
    1.66 +    t2 a2; \
    1.67 +    t3 a3;
    1.68 +#  define __P4(t1,a1,t2,a2,t3,a3,t4,a4)   (a1, a2, a3, a4) \
    1.69 +    t1 a1; \
    1.70 +    t2 a2; \
    1.71 +    t3 a3; \
    1.72 +    t4 a4;
    1.73 +#  define __P5(t1,a1,t2,a2,t3,a3,t4,a4,t5,a5)   (a1, a2, a3, a4, a5) \
    1.74 +    t1 a1; \
    1.75 +    t2 a2; \
    1.76 +    t3 a3; \
    1.77 +    t4 a4; \
    1.78 +    t5 a5;
    1.79 +#  define __P7(t1,a1,t2,a2,t3,a3,t4,a4,t5,a5,t6,a6,t7,a7) \
    1.80 +    (a1, a2, a3, a4, a5, a6, a7) \
    1.81 +    t1 a1; \
    1.82 +    t2 a2; \
    1.83 +    t3 a3; \
    1.84 +    t4 a4; \
    1.85 +    t5 a5; \
    1.86 +    t6 a6; \
    1.87 +    t7 a7;
    1.88 +#endif
    1.89 +#endif
    1.90 +
    1.91 +#ifdef IS_STDC
    1.92 +#  undef IS_STDC
    1.93 +#endif
    1.94 +
    1.95 +#ifdef _AIX
    1.96 +#  include <sys/select.h>
    1.97 +#endif
    1.98 +#ifdef __sgi
    1.99 +#  include <bstring.h>
   1.100 +#endif
   1.101 +#include <sys/types.h>
   1.102 +#include <netinet/in.h>
   1.103 +#include <sys/time.h>
   1.104 +
   1.105 +#if defined(VMS) && !defined(FD_SETSIZE)
   1.106 +#  define FD_SETSIZE 64
   1.107 +#endif
   1.108 +
   1.109 +/*
   1.110 + * Sigh, GCC v2 complains when using undefined struct tags
   1.111 + * in function prototypes...
   1.112 + */
   1.113 +#if defined(__GNUC__) && !defined(INADDR_ANY)
   1.114 +#  define __STRUCT_IN_ADDR_P	void *
   1.115 +#else
   1.116 +#  define __STRUCT_IN_ADDR_P	struct in_addr *
   1.117 +#endif
   1.118 +
   1.119 +#if defined(__GNUC__) && !defined(DST_NONE)
   1.120 +#  define __STRUCT_TIMEVAL_P	void *
   1.121 +#else
   1.122 +#  define __STRUCT_TIMEVAL_P	struct timeval *
   1.123 +#endif
   1.124 +
   1.125 +#if defined(__sgi) && defined(_POSIX_SOURCE)
   1.126 +#  undef  __STRUCT_TIMEVAL_P
   1.127 +#  define __STRUCT_TIMEVAL_P	void *
   1.128 +#endif
   1.129 +	
   1.130 +#ifndef IDBUFSIZE
   1.131 +#  define IDBUFSIZE 2048
   1.132 +#endif
   1.133 +
   1.134 +#ifndef IDPORT
   1.135 +#  define IDPORT	113
   1.136 +#endif
   1.137 +
   1.138 +typedef struct
   1.139 +{
   1.140 +  int fd;
   1.141 +  char buf[IDBUFSIZE];
   1.142 +} ident_t;
   1.143 +
   1.144 +typedef struct {
   1.145 +  int lport;                    /* Local port */
   1.146 +  int fport;                    /* Far (remote) port */
   1.147 +  char *identifier;             /* Normally user name */
   1.148 +  char *opsys;                  /* OS */
   1.149 +  char *charset;                /* Charset (what did you expect?) */
   1.150 +} IDENT;                        /* For higher-level routines */
   1.151 +
   1.152 +/* Low-level calls and macros */
   1.153 +#define id_fileno(ID)	((ID)->fd)
   1.154 +
   1.155 +extern ident_t * id_open __P((__STRUCT_IN_ADDR_P laddr,
   1.156 +			   __STRUCT_IN_ADDR_P faddr,
   1.157 +			   __STRUCT_TIMEVAL_P timeout));
   1.158 +  
   1.159 +extern int    id_close __P((ident_t *id));
   1.160 +  
   1.161 +extern int    id_query __P((ident_t *id,
   1.162 +			    int lport,
   1.163 +			    int fport,
   1.164 +			    __STRUCT_TIMEVAL_P timeout));
   1.165 +  
   1.166 +extern int    id_parse __P((ident_t *id,
   1.167 +			    __STRUCT_TIMEVAL_P timeout,
   1.168 +			    int *lport,
   1.169 +			    int *fport,
   1.170 +			    char **identifier,
   1.171 +			    char **opsys,
   1.172 +			    char **charset));
   1.173 +  
   1.174 +/* High-level calls */
   1.175 +
   1.176 +extern IDENT *ident_lookup __P((int fd, int timeout));
   1.177 +
   1.178 +extern char  *ident_id __P((int fd, int timeout));
   1.179 +
   1.180 +extern IDENT *ident_query __P(( __STRUCT_IN_ADDR_P laddr, __STRUCT_IN_ADDR_P raddr, int lport, int rport, int timeout));
   1.181 +
   1.182 +extern void   ident_free __P((IDENT *id));
   1.183 +
   1.184 +extern char  id_version[];
   1.185 +
   1.186 +#ifdef IN_LIBIDENT_SRC
   1.187 +
   1.188 +extern char *id_strdup __P((char *str));
   1.189 +extern char *id_strtok __P((char *cp, char *cs, char *dc));
   1.190 +
   1.191 +#endif
   1.192 +
   1.193 +#ifdef	__cplusplus
   1.194 +}
   1.195 +#endif
   1.196 +
   1.197 +#endif