1 /*
2  * This file is part of the Sofia-SIP package
3  *
4  * Copyright (C) 2005 Nokia Corporation.
5  *
6  * Contact: Pekka Pessi <pekka.pessi@nokia.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation; either version 2.1 of
11  * the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  *
23  */
24 
25 #ifndef TPORT_TAG_H
26 /** Defined when <sofia-sip/tport_tag.h> has been included. */
27 #define TPORT_TAG_H
28 
29 /**@file sofia-sip/tport_tag.h
30  * @brief Tags for tport module.
31  *
32  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
33  *
34  * @date Created: Sat Oct 12 18:39:48 2002 ppessi
35  */
36 
37 #ifndef SU_TAG_H
38 #include <sofia-sip/su_tag.h>
39 #endif
40 
41 SOFIA_BEGIN_DECLS
42 
43 /** List of all tport tags. */
44 TPORT_DLL extern tagi_t tport_tag_list[];
45 
46 /** Filter list matching any tport tag. */
47 TPORT_DLL extern tagi_t tport_tags[];
48 
49 /** Filter tag matching any tport tag. */
50 #define TPTAG_ANY()         tptag_any, ((tag_value_t)0)
51 TPORT_DLL extern tag_typedef_t tptag_any;
52 
53 TPORT_DLL extern tag_typedef_t tptag_ident;
54 #define TPTAG_IDENT(x) tptag_ident, tag_str_v((x))
55 
56 TPORT_DLL extern tag_typedef_t tptag_ident_ref;
57 #define TPTAG_IDENT_REF(x) tptag_ident_ref, tag_str_vr(&(x))
58 
59 TPORT_DLL extern tag_typedef_t tptag_reuse;
60 #define TPTAG_REUSE(x) tptag_reuse, tag_bool_v((x))
61 
62 TPORT_DLL extern tag_typedef_t tptag_reuse_ref;
63 #define TPTAG_REUSE_REF(x) tptag_reuse_ref, tag_bool_vr(&(x))
64 
65 TPORT_DLL extern tag_typedef_t tptag_fresh;
66 #define TPTAG_FRESH(x) tptag_fresh, tag_bool_v((x))
67 
68 TPORT_DLL extern tag_typedef_t tptag_fresh_ref;
69 #define TPTAG_FRESH_REF(x) tptag_fresh_ref, tag_bool_vr(&(x))
70 
71 TPORT_DLL extern tag_typedef_t tptag_server;
72 #define TPTAG_SERVER(x) tptag_server, tag_bool_v((x))
73 
74 TPORT_DLL extern tag_typedef_t tptag_server_ref;
75 #define TPTAG_SERVER_REF(x) tptag_server_ref, tag_bool_vr(&(x))
76 
77 /** Define how the public transport connects to Internet.
78  *
79  * @sa TPTAG_PUBLIC(), tport_is_public().
80  */
81 typedef enum tport_via {
82   tport_type_local = 0,
83   tport_type_server = 0,
84   tport_type_client = 1,
85   tport_type_stun = 2,
86   tport_type_upnp = 3,
87   tport_type_connect = 4,
88   tport_type_socks = 5,
89 } tport_pri_type_t;
90 
91 TPORT_DLL extern tag_typedef_t tptag_public;
92 #define TPTAG_PUBLIC(x) tptag_public, tag_int_v((x))
93 
94 TPORT_DLL extern tag_typedef_t tptag_public_ref;
95 #define TPTAG_PUBLIC_REF(x) tptag_public_ref, tag_int_vr(&(x))
96 
97 TPORT_DLL extern tag_typedef_t tptag_mtu;
98 #define TPTAG_MTU(x) tptag_mtu, tag_usize_v((x))
99 
100 TPORT_DLL extern tag_typedef_t tptag_mtu_ref;
101 #define TPTAG_MTU_REF(x) tptag_mtu_ref, tag_usize_vr(&(x))
102 
103 TPORT_DLL extern tag_typedef_t tptag_connect;
104 #define TPTAG_CONNECT(x) tptag_connect, tag_bool_v((x))
105 
106 TPORT_DLL extern tag_typedef_t tptag_connect_ref;
107 #define TPTAG_CONNECT_REF(x) tptag_connect_ref, tag_bool_vr(&(x))
108 
109 TPORT_DLL extern tag_typedef_t tptag_queuesize;
110 #define TPTAG_QUEUESIZE(x) tptag_queuesize, tag_uint_v((x))
111 
112 TPORT_DLL extern tag_typedef_t tptag_queuesize_ref;
113 #define TPTAG_QUEUESIZE_REF(x) tptag_queuesize_ref, tag_uint_vr(&(x))
114 
115 TPORT_DLL extern tag_typedef_t tptag_sdwn_error;
116 #define TPTAG_SDWN_ERROR(x) tptag_sdwn_error, tag_bool_v((x))
117 
118 TPORT_DLL extern tag_typedef_t tptag_sdwn_error_ref;
119 #define TPTAG_SDWN_ERROR_REF(x) tptag_sdwn_error_ref, tag_bool_vr(&(x))
120 
121 TPORT_DLL extern tag_typedef_t tptag_sdwn_after;
122 #define TPTAG_SDWN_AFTER(x) tptag_sdwn_after, tag_bool_v((x))
123 
124 TPORT_DLL extern tag_typedef_t tptag_sdwn_after_ref;
125 #define TPTAG_SDWN_AFTER_REF(x) tptag_sdwn_after_ref, tag_bool_vr(&(x))
126 
127 TPORT_DLL extern tag_typedef_t tptag_close_after;
128 #define TPTAG_CLOSE_AFTER(x) tptag_close_after, tag_bool_v((x))
129 
130 TPORT_DLL extern tag_typedef_t tptag_close_after_ref;
131 #define TPTAG_CLOSE_AFTER_REF(x) tptag_close_after_ref, tag_bool_vr(&(x))
132 
133 TPORT_DLL extern tag_typedef_t tptag_idle;
134 #define TPTAG_IDLE(x) tptag_idle, tag_uint_v((x))
135 
136 TPORT_DLL extern tag_typedef_t tptag_idle_ref;
137 #define TPTAG_IDLE_REF(x) tptag_idle_ref, tag_uint_vr(&(x))
138 
139 TPORT_DLL extern tag_typedef_t tptag_timeout;
140 #define TPTAG_TIMEOUT(x) tptag_timeout, tag_uint_v((x))
141 
142 TPORT_DLL extern tag_typedef_t tptag_timeout_ref;
143 #define TPTAG_TIMEOUT_REF(x) tptag_timeout_ref, tag_uint_vr(&(x))
144 
145 TPORT_DLL extern tag_typedef_t tptag_socket_keepalive;
146 #define TPTAG_SOCKET_KEEPALIVE(x) tptag_socket_keepalive, tag_uint_v((x))
147 
148 TPORT_DLL extern tag_typedef_t tptag_socket_keepalive_ref;
149 #define TPTAG_SOCKET_KEEPALIVE_REF(x) tptag_socket_keepalive_ref, tag_uint_vr(&(x))
150 
151 TPORT_DLL extern tag_typedef_t tptag_keepalive;
152 #define TPTAG_KEEPALIVE(x) tptag_keepalive, tag_uint_v((x))
153 
154 TPORT_DLL extern tag_typedef_t tptag_keepalive_ref;
155 #define TPTAG_KEEPALIVE_REF(x) tptag_keepalive_ref, tag_uint_vr(&(x))
156 
157 TPORT_DLL extern tag_typedef_t tptag_pingpong;
158 #define TPTAG_PINGPONG(x) tptag_pingpong, tag_uint_v((x))
159 
160 TPORT_DLL extern tag_typedef_t tptag_pingpong_ref;
161 #define TPTAG_PINGPONG_REF(x) tptag_pingpong_ref, tag_uint_vr(&(x))
162 
163 TPORT_DLL extern tag_typedef_t tptag_pong2ping;
164 #define TPTAG_PONG2PING(x) tptag_pong2ping, tag_bool_v((x))
165 
166 TPORT_DLL extern tag_typedef_t tptag_pong2ping_ref;
167 #define TPTAG_PONG2PING_REF(x) tptag_pong2ping_ref, tag_bool_vr(&(x))
168 
169 TPORT_DLL extern tag_typedef_t tptag_sigcomp_lifetime;
170 #define TPTAG_SIGCOMP_LIFETIME(x) tptag_sigcomp_lifetime, tag_uint_v((x))
171 
172 TPORT_DLL extern tag_typedef_t tptag_sigcomp_lifetime_ref;
173 #define TPTAG_SIGCOMP_LIFETIME_REF(x) \
174 tptag_sigcomp_lifetime_ref, tag_uint_vr(&(x))
175 
176 TPORT_DLL extern tag_typedef_t tptag_compartment;
177 #define TPTAG_COMPARTMENT(x) tptag_compartment, tag_ptr_v((x))
178 
179 TPORT_DLL extern tag_typedef_t tptag_compartment_ref;
180 #define TPTAG_COMPARTMENT_REF(x) \
181   tptag_compartment_ref, tag_ptr_vr(&(x), x)
182 
183 TPORT_DLL extern tag_typedef_t tptag_certificate;
184 #define TPTAG_CERTIFICATE(x) tptag_certificate, tag_str_v((x))
185 
186 TPORT_DLL extern tag_typedef_t tptag_certificate_ref;
187 #define TPTAG_CERTIFICATE_REF(x) tptag_certificate_ref, tag_str_vr(&(x))
188 
189 TPORT_DLL extern tag_typedef_t tptag_tls_ciphers;
190 #define TPTAG_TLS_CIPHERS(x) tptag_tls_ciphers, tag_str_v((x))
191 
192 TPORT_DLL extern tag_typedef_t tptag_tls_ciphers_ref;
193 #define TPTAG_TLS_CIPHERS_REF(x) tptag_tls_ciphers_ref, tag_str_vr(&(x))
194 
195 enum tport_tls_version {
196   TPTLS_VERSION_SSLv2 = (1 << 0),
197   TPTLS_VERSION_SSLv3 = (1 << 1),
198   TPTLS_VERSION_TLSv1 = (1 << 2),
199   TPTLS_VERSION_TLSv1_1 = (1 << 3),
200   TPTLS_VERSION_TLSv1_2 = (1 << 4),
201 };
202 
203 TPORT_DLL extern tag_typedef_t tptag_tls_version;
204 #define TPTAG_TLS_VERSION(x) tptag_tls_version, tag_uint_v((x))
205 
206 TPORT_DLL extern tag_typedef_t tptag_tls_version_ref;
207 #define TPTAG_TLS_VERSION_REF(x) tptag_tls_version_ref, tag_uint_vr(&(x))
208 
209 enum tport_tls_verify_policy {
210   TPTLS_VERIFY_NONE         = 0x0,
211   TPTLS_VERIFY_INCOMING     = 0x1,
212   TPTLS_VERIFY_IN           = 0x1,
213   TPTLS_VERIFY_OUTGOING     = 0x2,
214   TPTLS_VERIFY_OUT          = 0x2,
215   TPTLS_VERIFY_ALL          = 0x3,
216   TPTLS_VERIFY_SUBJECTS_IN  = 0x5, /* 0x4 | TPTLS_VERIFY_INCOMING */
217   TPTLS_VERIFY_SUBJECTS_OUT = 0xA, /* 0x8 | TPTLS_VERIFY_OUTGOING */
218   TPTLS_VERIFY_SUBJECTS_ALL = 0xF,
219 };
220 
221 TPORT_DLL extern tag_typedef_t tptag_tls_timeout;
222 #define TPTAG_TLS_TIMEOUT(x) tptag_tls_timeout, tag_uint_v((x))
223 
224 TPORT_DLL extern tag_typedef_t tptag_tls_timeout_ref;
225 #define TPTAG_TLS_TIMEOUT_REF(x) tptag_tls_timeout_ref, tag_uint_vr(&(x))
226 
227 TPORT_DLL extern tag_typedef_t tptag_tls_passphrase;
228 #define TPTAG_TLS_PASSPHRASE(x)  tptag_tls_passphrase, tag_str_v(x)
229 
230 TPORT_DLL extern tag_typedef_t tptag_tls_passphrase_ref;
231 #define TPTAG_TLS_PASSPHRASE_REF(x)  tptag_tls_passphrase_ref, tag_str_vr(&(x))
232 
233 TPORT_DLL extern tag_typedef_t tptag_tls_verify_policy;
234 #define TPTAG_TLS_VERIFY_POLICY(x) tptag_tls_verify_policy, tag_uint_v((x))
235 
236 TPORT_DLL extern tag_typedef_t tptag_tls_verify_policy_ref;
237 #define TPTAG_TLS_VERIFY_POLICY_REF(x) tptag_tls_verify_policy_ref, tag_uint_vr(&(x))
238 
239 TPORT_DLL extern tag_typedef_t tptag_tls_verify_depth;
240 #define TPTAG_TLS_VERIFY_DEPTH(x) tptag_tls_verify_depth, tag_uint_v((x))
241 
242 TPORT_DLL extern tag_typedef_t tptag_tls_verify_depth_ref;
243 #define TPTAG_TLS_VERIFY_DEPTH_REF(x) \
244              tptag_tls_verify_depth_ref, tag_uint_vr(&(x))
245 
246 TPORT_DLL extern tag_typedef_t tptag_tls_verify_date;
247 #define TPTAG_TLS_VERIFY_DATE(x) tptag_tls_verify_date, tag_uint_v((x))
248 
249 TPORT_DLL extern tag_typedef_t tptag_tls_verify_date_ref;
250 #define TPTAG_TLS_VERIFY_DATE_REF(x) \
251              tptag_tls_verify_date_ref, tag_uint_vr(&(x))
252 
253 TPORT_DLL extern tag_typedef_t tptag_tls_verify_subjects;
254 #define TPTAG_TLS_VERIFY_SUBJECTS(x) tptag_tls_verify_subjects, tag_cptr_v((x))
255 
256 TPORT_DLL extern tag_typedef_t tptag_tls_verify_subjects_ref;
257 #define TPTAG_TLS_VERIFY_SUBJECTS_REF(x) \
258              tptag_tls_verify_subjects_ref, tag_cptr_vr(&(x), (x))
259 
260 /* TPTAG_TLS_VERIFY_PEER is depreciated - Use TPTAG_TLS_VERIFY_POLICY */
261 TPORT_DLL extern tag_typedef_t tptag_tls_verify_peer;
262 #define TPTAG_TLS_VERIFY_PEER(x) TPTAG_TLS_VERIFY_POLICY( (x) ? \
263            TPTLS_VERIFY_ALL : TPTLS_VERIFY_NONE)
264 
265 TPORT_DLL extern tag_typedef_t tptag_tls_verify_peer_ref;
266 #define TPTAG_TLS_VERIFY_PEER_REF(x) tptag_tls_verify_peer_ref, tag_uint_vr(&(x))
267 
268 #if 0
269 TPORT_DLL extern tag_typedef_t tport_x509_subject;
270 #define TPTAG_X509_SUBJECT(x) tptag_x509_subject, tag_str_v((x))
271 
272 TPORT_DLL extern tag_typedef_t tptag_x509_subject_ref;
273 #define TPTAG_X509_SUBJECT_REF(x) tptag_x509_subject_ref, tag_str_vr(&(x))
274 #endif
275 
276 TPORT_DLL extern tag_typedef_t tptag_debug_drop;
277 #define TPTAG_DEBUG_DROP(x) tptag_debug_drop, tag_uint_v((x))
278 
279 TPORT_DLL extern tag_typedef_t tptag_debug_drop_ref;
280 #define TPTAG_DEBUG_DROP_REF(x) tptag_debug_drop_ref, tag_uint_vr(&(x))
281 
282 TPORT_DLL extern tag_typedef_t tptag_udp_rmem;
283 #define TPTAG_UDP_RMEM(x) tptag_udp_rmem, tag_uint_v((x))
284 
285 TPORT_DLL extern tag_typedef_t tptag_udp_rmem_ref;
286 #define TPTAG_UDP_RMEM_REF(x) tptag_udp_rmem_ref, tag_uint_vr(&(x))
287 
288 TPORT_DLL extern tag_typedef_t tptag_udp_wmem;
289 #define TPTAG_UDP_WMEM(x) tptag_udp_wmem, tag_uint_v((x))
290 
291 TPORT_DLL extern tag_typedef_t tptag_udp_wmem_ref;
292 #define TPTAG_UDP_WMEM_REF(x) tptag_udp_wmem_ref, tag_uint_vr(&(x))
293 
294 TPORT_DLL extern tag_typedef_t tptag_thrpsize;
295 #define TPTAG_THRPSIZE(x) tptag_thrpsize, tag_uint_v((x))
296 
297 TPORT_DLL extern tag_typedef_t tptag_thrpsize_ref;
298 #define TPTAG_THRPSIZE_REF(x) tptag_thrpsize_ref, tag_uint_vr(&(x))
299 
300 TPORT_DLL extern tag_typedef_t tptag_thrprqsize;
301 #define TPTAG_THRPRQSIZE(x) tptag_thrprqsize, tag_uint_v((x))
302 
303 TPORT_DLL extern tag_typedef_t tptag_thrprqsize_ref;
304 #define TPTAG_THRPRQSIZE_REF(x) tptag_thrprqsize_ref, tag_uint_vr(&(x))
305 
306 TPORT_DLL extern tag_typedef_t tptag_http_connect;
307 #define TPTAG_HTTP_CONNECT(x) tptag_http_connect, tag_str_v((x))
308 
309 TPORT_DLL extern tag_typedef_t tptag_http_connect_ref;
310 #define TPTAG_HTTP_CONNECT_REF(x) tptag_http_connect_ref, tag_str_vr(&(x))
311 
312 TPORT_DLL extern tag_typedef_t tptag_stun_server;
313 #define TPTAG_STUN_SERVER(x) tptag_stun_server, tag_bool_v((x))
314 
315 TPORT_DLL extern tag_typedef_t tptag_stun_server_ref;
316 #define TPTAG_STUN_SERVER_REF(x) tptag_stun_server_ref, tag_bool_vr(&(x))
317 
318 TPORT_DLL extern tag_typedef_t tptag_tos;
319 #define TPTAG_TOS(x) tptag_tos, tag_int_v((x))
320 
321 TPORT_DLL extern tag_typedef_t tptag_tos_ref;
322 #define TPTAG_TOS_REF(x) tptag_tos_ref, tag_int_vr(&(x))
323 
324 TPORT_DLL extern tag_typedef_t tptag_log;
325 #define TPTAG_LOG(x) tptag_log, tag_bool_v((x))
326 
327 TPORT_DLL extern tag_typedef_t tptag_log_ref;
328 #define TPTAG_LOG_REF(x) tptag_log_ref, tag_bool_vr(&(x))
329 
330 TPORT_DLL extern tag_typedef_t tptag_dump;
331 #define TPTAG_DUMP(x) tptag_dump, tag_str_v((x))
332 
333 TPORT_DLL extern tag_typedef_t tptag_dump_ref;
334 #define TPTAG_DUMP_REF(x) tptag_dump_ref, tag_str_vr(&(x))
335 
336 TPORT_DLL extern tag_typedef_t tptag_capt;
337 #define TPTAG_CAPT(x) tptag_capt, tag_str_v((x))
338 
339 TPORT_DLL extern tag_typedef_t tptag_capt_ref;
340 #define TPTAG_CAPT_REF(x) tptag_capt_ref, tag_str_vr(&(x))
341 
342 SOFIA_END_DECLS
343 
344 #endif /* !defined TPORT_TAG_H */
345