Mercurial > masqmail
annotate src/libident/ident.h @ 69:c343f5012551 0.2.23
updated ChangeLog and NEWS
author | meillo@marmaro.de |
---|---|
date | Sun, 30 May 2010 21:01:05 +0200 (2010-05-30) |
parents | 26e34ae9a3e3 |
children |
rev | line source |
---|---|
0 | 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 | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
11 #ifdef __cplusplus |
0 | 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 | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
25 |
0 | 26 #ifdef IS_STDC |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
27 # define __P(AL) AL |
0 | 28 |
29 #ifdef IN_LIBIDENT_SRC | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
30 |
0 | 31 # define __P1(t1,a1) \ |
32 (t1 a1) | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
33 |
0 | 34 # define __P2(t1,a1,t2,a2) \ |
35 (t1 a1, t2 a2) | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
36 |
0 | 37 # define __P3(t1,a1,t2,a2,t3,a3) \ |
38 (t1 a1, t2 a2, t3 a3) | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
39 |
0 | 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 | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
49 |
0 | 50 #else |
51 | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
52 # define __P(AL) () |
0 | 53 |
54 #ifdef IN_LIBIDENT_SRC | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
55 |
0 | 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) | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
111 # define __STRUCT_IN_ADDR_P void * |
0 | 112 #else |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
113 # define __STRUCT_IN_ADDR_P struct in_addr * |
0 | 114 #endif |
115 | |
116 #if defined(__GNUC__) && !defined(DST_NONE) | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
117 # define __STRUCT_TIMEVAL_P void * |
0 | 118 #else |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
119 # define __STRUCT_TIMEVAL_P struct timeval * |
0 | 120 #endif |
121 | |
122 #if defined(__sgi) && defined(_POSIX_SOURCE) | |
123 # undef __STRUCT_TIMEVAL_P | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
124 # define __STRUCT_TIMEVAL_P void * |
0 | 125 #endif |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
126 |
0 | 127 #ifndef IDBUFSIZE |
128 # define IDBUFSIZE 2048 | |
129 #endif | |
130 | |
131 #ifndef IDPORT | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
132 # define IDPORT 113 |
0 | 133 #endif |
134 | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
135 typedef struct { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
136 int fd; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
137 char buf[IDBUFSIZE]; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
138 } ident_t; |
0 | 139 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
140 typedef struct { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
141 int lport; /* Local port */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
142 int fport; /* Far (remote) port */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
143 char *identifier; /* Normally user name */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
144 char *opsys; /* OS */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
145 char *charset; /* Charset (what did you expect?) */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
146 } IDENT; /* For higher-level routines */ |
0 | 147 |
148 /* Low-level calls and macros */ | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
149 #define id_fileno(ID) ((ID)->fd) |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
150 |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
151 extern ident_t *id_open __P((__STRUCT_IN_ADDR_P laddr, __STRUCT_IN_ADDR_P faddr, __STRUCT_TIMEVAL_P timeout)); |
0 | 152 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
153 extern int id_close __P((ident_t * id)); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
154 |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
155 extern int id_query __P((ident_t * id, int lport, int fport, __STRUCT_TIMEVAL_P timeout)); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
156 |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
157 extern int id_parse __P((ident_t * id, __STRUCT_TIMEVAL_P timeout, int *lport, int *fport, char **identifier, char **opsys, char **charset)); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
158 |
0 | 159 /* High-level calls */ |
160 | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
161 extern IDENT *ident_lookup __P((int fd, int timeout)); |
0 | 162 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
163 extern char *ident_id __P((int fd, int timeout)); |
0 | 164 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
165 extern IDENT *ident_query __P((__STRUCT_IN_ADDR_P laddr, __STRUCT_IN_ADDR_P raddr, int lport, int rport, int timeout)); |
0 | 166 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
167 extern void ident_free __P((IDENT * id)); |
0 | 168 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
169 extern char id_version[]; |
0 | 170 |
171 #ifdef IN_LIBIDENT_SRC | |
172 | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
173 extern char *id_strdup __P((char *str)); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
174 extern char *id_strtok __P((char *cp, char *cs, char *dc)); |
0 | 175 |
176 #endif | |
177 | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
178 #ifdef __cplusplus |
0 | 179 } |
180 #endif | |
181 #endif |