comparison src/libident/ident.h @ 10:26e34ae9a3e3

changed indention and line wrapping to a more consistent style
author meillo@marmaro.de
date Mon, 27 Oct 2008 16:23:10 +0100
parents 08114f7dcc23
children
comparison
equal deleted inserted replaced
9:31cc8a89cb74 10:26e34ae9a3e3
6 */ 6 */
7 7
8 #ifndef __IDENT_H__ 8 #ifndef __IDENT_H__
9 #define __IDENT_H__ 9 #define __IDENT_H__
10 10
11 #ifdef __cplusplus 11 #ifdef __cplusplus
12 extern "C" { 12 extern "C" {
13 #endif 13 #endif
14 14
15 /* Sigh */ 15 /* Sigh */
16 #ifdef __STDC__ 16 #ifdef __STDC__
20 #endif 20 #endif
21 21
22 #ifdef __P 22 #ifdef __P
23 # undef __P 23 # undef __P
24 #endif 24 #endif
25 25
26 #ifdef IS_STDC 26 #ifdef IS_STDC
27 # define __P(AL) AL 27 # define __P(AL) AL
28 28
29 #ifdef IN_LIBIDENT_SRC 29 #ifdef IN_LIBIDENT_SRC
30 30
31 # define __P1(t1,a1) \ 31 # define __P1(t1,a1) \
32 (t1 a1) 32 (t1 a1)
33 33
34 # define __P2(t1,a1,t2,a2) \ 34 # define __P2(t1,a1,t2,a2) \
35 (t1 a1, t2 a2) 35 (t1 a1, t2 a2)
36 36
37 # define __P3(t1,a1,t2,a2,t3,a3) \ 37 # define __P3(t1,a1,t2,a2,t3,a3) \
38 (t1 a1, t2 a2, t3 a3) 38 (t1 a1, t2 a2, t3 a3)
39 39
40 # define __P4(t1,a1,t2,a2,t3,a3,t4,a4) \ 40 # define __P4(t1,a1,t2,a2,t3,a3,t4,a4) \
41 (t1 a1, t2 a2, t3 a3, t4 a4) 41 (t1 a1, t2 a2, t3 a3, t4 a4)
42 42
43 # define __P5(t1,a1,t2,a2,t3,a3,t4,a4,t5,a5) \ 43 # define __P5(t1,a1,t2,a2,t3,a3,t4,a4,t5,a5) \
44 (t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) 44 (t1 a1, t2 a2, t3 a3, t4 a4, t5 a5)
45 45
46 # define __P7(t1,a1,t2,a2,t3,a3,t4,a4,t5,a5,t6,a6,t7,a7) \ 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) 47 (t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7)
48 #endif 48 #endif
49 49
50 #else 50 #else
51 51
52 # define __P(AL) () 52 # define __P(AL) ()
53 53
54 #ifdef IN_LIBIDENT_SRC 54 #ifdef IN_LIBIDENT_SRC
55 55
56 # define __P1(t1,a1) (a1) \ 56 # define __P1(t1,a1) (a1) \
57 t1 a1; 57 t1 a1;
58 # define __P2(t1,a1,t2,a2) (a1, a2) \ 58 # define __P2(t1,a1,t2,a2) (a1, a2) \
59 t1 a1; \ 59 t1 a1; \
60 t2 a2; 60 t2 a2;
106 /* 106 /*
107 * Sigh, GCC v2 complains when using undefined struct tags 107 * Sigh, GCC v2 complains when using undefined struct tags
108 * in function prototypes... 108 * in function prototypes...
109 */ 109 */
110 #if defined(__GNUC__) && !defined(INADDR_ANY) 110 #if defined(__GNUC__) && !defined(INADDR_ANY)
111 # define __STRUCT_IN_ADDR_P void * 111 # define __STRUCT_IN_ADDR_P void *
112 #else 112 #else
113 # define __STRUCT_IN_ADDR_P struct in_addr * 113 # define __STRUCT_IN_ADDR_P struct in_addr *
114 #endif 114 #endif
115 115
116 #if defined(__GNUC__) && !defined(DST_NONE) 116 #if defined(__GNUC__) && !defined(DST_NONE)
117 # define __STRUCT_TIMEVAL_P void * 117 # define __STRUCT_TIMEVAL_P void *
118 #else 118 #else
119 # define __STRUCT_TIMEVAL_P struct timeval * 119 # define __STRUCT_TIMEVAL_P struct timeval *
120 #endif 120 #endif
121 121
122 #if defined(__sgi) && defined(_POSIX_SOURCE) 122 #if defined(__sgi) && defined(_POSIX_SOURCE)
123 # undef __STRUCT_TIMEVAL_P 123 # undef __STRUCT_TIMEVAL_P
124 # define __STRUCT_TIMEVAL_P void * 124 # define __STRUCT_TIMEVAL_P void *
125 #endif 125 #endif
126 126
127 #ifndef IDBUFSIZE 127 #ifndef IDBUFSIZE
128 # define IDBUFSIZE 2048 128 # define IDBUFSIZE 2048
129 #endif 129 #endif
130 130
131 #ifndef IDPORT 131 #ifndef IDPORT
132 # define IDPORT 113 132 # define IDPORT 113
133 #endif 133 #endif
134 134
135 typedef struct 135 typedef struct {
136 { 136 int fd;
137 int fd; 137 char buf[IDBUFSIZE];
138 char buf[IDBUFSIZE]; 138 } ident_t;
139 } ident_t;
140 139
141 typedef struct { 140 typedef struct {
142 int lport; /* Local port */ 141 int lport; /* Local port */
143 int fport; /* Far (remote) port */ 142 int fport; /* Far (remote) port */
144 char *identifier; /* Normally user name */ 143 char *identifier; /* Normally user name */
145 char *opsys; /* OS */ 144 char *opsys; /* OS */
146 char *charset; /* Charset (what did you expect?) */ 145 char *charset; /* Charset (what did you expect?) */
147 } IDENT; /* For higher-level routines */ 146 } IDENT; /* For higher-level routines */
148 147
149 /* Low-level calls and macros */ 148 /* Low-level calls and macros */
150 #define id_fileno(ID) ((ID)->fd) 149 #define id_fileno(ID) ((ID)->fd)
151 150
152 extern ident_t * id_open __P((__STRUCT_IN_ADDR_P laddr, 151 extern ident_t *id_open __P((__STRUCT_IN_ADDR_P laddr, __STRUCT_IN_ADDR_P faddr, __STRUCT_TIMEVAL_P timeout));
153 __STRUCT_IN_ADDR_P faddr, 152
154 __STRUCT_TIMEVAL_P timeout)); 153 extern int id_close __P((ident_t * id));
155 154
156 extern int id_close __P((ident_t *id)); 155 extern int id_query __P((ident_t * id, int lport, int fport, __STRUCT_TIMEVAL_P timeout));
157 156
158 extern int id_query __P((ident_t *id, 157 extern int id_parse __P((ident_t * id, __STRUCT_TIMEVAL_P timeout, int *lport, int *fport, char **identifier, char **opsys, char **charset));
159 int lport, 158
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 */ 159 /* High-level calls */
172 160
173 extern IDENT *ident_lookup __P((int fd, int timeout)); 161 extern IDENT *ident_lookup __P((int fd, int timeout));
174 162
175 extern char *ident_id __P((int fd, int timeout)); 163 extern char *ident_id __P((int fd, int timeout));
176 164
177 extern IDENT *ident_query __P(( __STRUCT_IN_ADDR_P laddr, __STRUCT_IN_ADDR_P raddr, int lport, int rport, int timeout)); 165 extern IDENT *ident_query __P((__STRUCT_IN_ADDR_P laddr, __STRUCT_IN_ADDR_P raddr, int lport, int rport, int timeout));
178 166
179 extern void ident_free __P((IDENT *id)); 167 extern void ident_free __P((IDENT * id));
180 168
181 extern char id_version[]; 169 extern char id_version[];
182 170
183 #ifdef IN_LIBIDENT_SRC 171 #ifdef IN_LIBIDENT_SRC
184 172
185 extern char *id_strdup __P((char *str)); 173 extern char *id_strdup __P((char *str));
186 extern char *id_strtok __P((char *cp, char *cs, char *dc)); 174 extern char *id_strtok __P((char *cp, char *cs, char *dc));
187 175
188 #endif 176 #endif
189 177
190 #ifdef __cplusplus 178 #ifdef __cplusplus
191 } 179 }
192 #endif 180 #endif
193
194 #endif 181 #endif