3 * Routines to dissect WSP component of WAP traffic.
5 * $Id: packet-wsp.c,v 1.67 2003/05/08 08:36:25 guy Exp $
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@ethereal.com>
9 * Copyright 1998 Gerald Combs
11 * WAP dissector based on original work by Ben Fowler
12 * Updated by Neil Hunter <neil.hunter@energis-squared.com>
13 * WTLS support by Alexandre P. Ferreira (Splice IP)
14 * Openwave header support by Dermot Bradley <dermot.bradley@openwave.com>
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
38 #ifdef NEED_SNPRINTF_H
39 # include "snprintf.h"
44 #include <epan/packet.h>
45 #include <epan/ipv6-utils.h>
46 #include <epan/conversation.h>
47 #include "packet-wap.h"
48 #include "packet-wsp.h"
50 /* File scoped variables for the protocol and registered fields */
51 static int proto_wsp = HF_EMPTY;
53 /* These fields used by fixed part of header */
54 static int hf_wsp_header_tid = HF_EMPTY;
55 static int hf_wsp_header_pdu_type = HF_EMPTY;
56 static int hf_wsp_version_major = HF_EMPTY;
57 static int hf_wsp_version_minor = HF_EMPTY;
58 static int hf_wsp_capability_length = HF_EMPTY;
59 static int hf_wsp_capabilities_section = HF_EMPTY;
60 static int hf_wsp_capabilities_client_SDU = HF_EMPTY;
61 static int hf_wsp_capabilities_server_SDU = HF_EMPTY;
62 static int hf_wsp_capabilities_protocol_opt = HF_EMPTY;
63 static int hf_wsp_capabilities_method_MOR = HF_EMPTY;
64 static int hf_wsp_capabilities_push_MOR = HF_EMPTY;
65 static int hf_wsp_capabilities_extended_methods = HF_EMPTY;
66 static int hf_wsp_capabilities_header_code_pages = HF_EMPTY;
67 static int hf_wsp_capabilities_aliases = HF_EMPTY;
68 static int hf_wsp_header_uri_len = HF_EMPTY;
69 static int hf_wsp_header_uri = HF_EMPTY;
70 static int hf_wsp_server_session_id = HF_EMPTY;
71 static int hf_wsp_header_status = HF_EMPTY;
72 static int hf_wsp_header_length = HF_EMPTY;
73 static int hf_wsp_headers_section = HF_EMPTY;
74 static int hf_wsp_header = HF_EMPTY;
75 static int hf_wsp_content_type = HF_EMPTY;
76 static int hf_wsp_content_type_str = HF_EMPTY;
77 static int hf_wsp_parameter_well_known_charset = HF_EMPTY;
78 static int hf_wsp_parameter_type = HF_EMPTY;
79 static int hf_wsp_parameter_name = HF_EMPTY;
80 static int hf_wsp_parameter_filename = HF_EMPTY;
81 static int hf_wsp_parameter_start = HF_EMPTY;
82 static int hf_wsp_parameter_start_info = HF_EMPTY;
83 static int hf_wsp_parameter_comment = HF_EMPTY;
84 static int hf_wsp_parameter_domain = HF_EMPTY;
85 static int hf_wsp_parameter_path = HF_EMPTY;
86 static int hf_wsp_parameter_sec = HF_EMPTY;
87 static int hf_wsp_parameter_mac = HF_EMPTY;
88 static int hf_wsp_parameter_upart_type = HF_EMPTY;
89 static int hf_wsp_parameter_upart_type_value = HF_EMPTY;
90 static int hf_wsp_reply_data = HF_EMPTY;
91 static int hf_wsp_post_data = HF_EMPTY;
92 static int hf_wsp_push_data = HF_EMPTY;
93 static int hf_wsp_multipart_data = HF_EMPTY;
94 static int hf_wsp_mpart = HF_EMPTY;
96 static int hf_wsp_header_shift_code = HF_EMPTY;
97 static int hf_wsp_header_accept = HF_EMPTY;
98 static int hf_wsp_header_accept_str = HF_EMPTY;
99 static int hf_wsp_header_accept_application = HF_EMPTY;
100 static int hf_wsp_header_accept_application_str = HF_EMPTY;
101 static int hf_wsp_header_accept_charset = HF_EMPTY;
102 static int hf_wsp_header_accept_charset_str = HF_EMPTY;
103 static int hf_wsp_header_accept_language = HF_EMPTY;
104 static int hf_wsp_header_accept_language_str = HF_EMPTY;
105 static int hf_wsp_header_accept_ranges = HF_EMPTY;
106 static int hf_wsp_header_accept_ranges_str = HF_EMPTY;
107 static int hf_wsp_header_cache_control = HF_EMPTY;
108 static int hf_wsp_header_cache_control_str = HF_EMPTY;
109 static int hf_wsp_header_cache_control_field_name = HF_EMPTY;
110 static int hf_wsp_header_connection = HF_EMPTY;
111 static int hf_wsp_header_connection_str = HF_EMPTY;
112 static int hf_wsp_header_cache_control_field_name_str = HF_EMPTY;
113 static int hf_wsp_header_content_length = HF_EMPTY;
114 static int hf_wsp_header_age = HF_EMPTY;
115 static int hf_wsp_header_bearer_indication = HF_EMPTY;
116 static int hf_wsp_header_date = HF_EMPTY;
117 static int hf_wsp_header_etag = HF_EMPTY;
118 static int hf_wsp_header_expires = HF_EMPTY;
119 static int hf_wsp_header_last_modified = HF_EMPTY;
120 static int hf_wsp_header_location = HF_EMPTY;
121 static int hf_wsp_header_if_modified_since = HF_EMPTY;
122 static int hf_wsp_header_profile = HF_EMPTY;
123 static int hf_wsp_header_pragma = HF_EMPTY;
124 static int hf_wsp_header_proxy_authenticate = HF_EMPTY;
125 static int hf_wsp_header_www_authenticate = HF_EMPTY;
126 static int hf_wsp_header_proxy_authorization = HF_EMPTY;
127 static int hf_wsp_header_proxy_authorization_scheme = HF_EMPTY;
128 static int hf_wsp_header_proxy_authorization_user_id = HF_EMPTY;
129 static int hf_wsp_header_proxy_authorization_password = HF_EMPTY;
130 static int hf_wsp_header_authorization = HF_EMPTY;
131 static int hf_wsp_header_authorization_scheme = HF_EMPTY;
132 static int hf_wsp_header_authorization_user_id = HF_EMPTY;
133 static int hf_wsp_header_authorization_password = HF_EMPTY;
134 static int hf_wsp_header_server = HF_EMPTY;
135 static int hf_wsp_header_user_agent = HF_EMPTY;
136 static int hf_wsp_header_warning = HF_EMPTY;
137 static int hf_wsp_header_warning_code = HF_EMPTY;
138 static int hf_wsp_header_warning_agent = HF_EMPTY;
139 static int hf_wsp_header_warning_text = HF_EMPTY;
140 static int hf_wsp_header_application_header = HF_EMPTY;
141 static int hf_wsp_header_application_value = HF_EMPTY;
142 static int hf_wsp_header_x_wap_tod = HF_EMPTY;
143 static int hf_wsp_header_content_ID = HF_EMPTY;
144 static int hf_wsp_header_transfer_encoding = HF_EMPTY;
145 static int hf_wsp_header_transfer_encoding_str = HF_EMPTY;
146 static int hf_wsp_header_via = HF_EMPTY;
147 static int hf_wsp_header_wap_application_id = HF_EMPTY;
148 static int hf_wsp_header_wap_application_id_str = HF_EMPTY;
151 /* Openwave-specific WSP headers */
152 static int hf_wsp_header_openwave_proxy_push_addr = HF_EMPTY;
153 static int hf_wsp_header_openwave_proxy_push_accept = HF_EMPTY;
154 static int hf_wsp_header_openwave_proxy_push_seq = HF_EMPTY;
155 static int hf_wsp_header_openwave_proxy_notify = HF_EMPTY;
156 static int hf_wsp_header_openwave_proxy_operator_domain = HF_EMPTY;
157 static int hf_wsp_header_openwave_proxy_home_page = HF_EMPTY;
158 static int hf_wsp_header_openwave_devcap_has_color = HF_EMPTY;
159 static int hf_wsp_header_openwave_devcap_num_softkeys = HF_EMPTY;
160 static int hf_wsp_header_openwave_devcap_softkey_size = HF_EMPTY;
161 static int hf_wsp_header_openwave_devcap_screen_chars = HF_EMPTY;
162 static int hf_wsp_header_openwave_devcap_screen_pixels = HF_EMPTY;
163 static int hf_wsp_header_openwave_devcap_em_size = HF_EMPTY;
164 static int hf_wsp_header_openwave_devcap_screen_depth = HF_EMPTY;
165 static int hf_wsp_header_openwave_devcap_immed_alert = HF_EMPTY;
166 static int hf_wsp_header_openwave_proxy_net_ask = HF_EMPTY;
167 static int hf_wsp_header_openwave_proxy_uplink_version = HF_EMPTY;
168 static int hf_wsp_header_openwave_proxy_tod = HF_EMPTY;
169 static int hf_wsp_header_openwave_proxy_ba_enable = HF_EMPTY;
170 static int hf_wsp_header_openwave_proxy_ba_realm = HF_EMPTY;
171 static int hf_wsp_header_openwave_proxy_redirect_enable = HF_EMPTY;
172 static int hf_wsp_header_openwave_proxy_request_uri = HF_EMPTY;
173 static int hf_wsp_header_openwave_proxy_redirect_status = HF_EMPTY;
174 static int hf_wsp_header_openwave_proxy_trans_charset = HF_EMPTY;
175 static int hf_wsp_header_openwave_proxy_trans_charset_str = HF_EMPTY;
176 static int hf_wsp_header_openwave_proxy_linger = HF_EMPTY;
177 static int hf_wsp_header_openwave_proxy_client_id = HF_EMPTY;
178 static int hf_wsp_header_openwave_proxy_enable_trust = HF_EMPTY;
179 static int hf_wsp_header_openwave_proxy_trust_old = HF_EMPTY;
180 static int hf_wsp_header_openwave_proxy_trust = HF_EMPTY;
181 static int hf_wsp_header_openwave_proxy_bookmark = HF_EMPTY;
182 static int hf_wsp_header_openwave_devcap_gui = HF_EMPTY;
185 static int hf_wsp_redirect_flags = HF_EMPTY;
186 static int hf_wsp_redirect_permanent = HF_EMPTY;
187 static int hf_wsp_redirect_reuse_security_session = HF_EMPTY;
188 static int hf_wsp_redirect_afl = HF_EMPTY;
189 static int hf_wsp_redirect_afl_bearer_type_included = HF_EMPTY;
190 static int hf_wsp_redirect_afl_port_number_included = HF_EMPTY;
191 static int hf_wsp_redirect_afl_address_len = HF_EMPTY;
192 static int hf_wsp_redirect_bearer_type = HF_EMPTY;
193 static int hf_wsp_redirect_port_num = HF_EMPTY;
194 static int hf_wsp_redirect_ipv4_addr = HF_EMPTY;
195 static int hf_wsp_redirect_ipv6_addr = HF_EMPTY;
196 static int hf_wsp_redirect_addr = HF_EMPTY;
198 /* Initialize the subtree pointers */
199 static gint ett_wsp = ETT_EMPTY;
200 static gint ett_content_type_parameters = ETT_EMPTY;
201 static gint ett_header = ETT_EMPTY;
202 static gint ett_headers = ETT_EMPTY;
203 static gint ett_header_warning = ETT_EMPTY;
204 static gint ett_header_cache_control_parameters = ETT_EMPTY;
205 static gint ett_header_cache_control_field_names = ETT_EMPTY;
206 static gint ett_capabilities = ETT_EMPTY;
207 static gint ett_post = ETT_EMPTY;
208 static gint ett_content_type = ETT_EMPTY;
209 static gint ett_redirect_flags = ETT_EMPTY;
210 static gint ett_redirect_afl = ETT_EMPTY;
211 static gint ett_multiparts = ETT_EMPTY;
212 static gint ett_mpartlist = ETT_EMPTY;
213 static gint ett_header_credentials = ETT_EMPTY;
215 /* Handle for WSP-over-UDP dissector */
216 static dissector_handle_t wsp_fromudp_handle;
218 /* Handle for WTP-over-UDP dissector */
219 static dissector_handle_t wtp_fromudp_handle;
221 /* Handle for WBXML dissector */
222 static dissector_handle_t wbxml_handle;
224 static const value_string vals_pdu_type[] = {
225 { 0x00, "Reserved" },
227 { 0x02, "ConnectReply" },
228 { 0x03, "Redirect" },
230 { 0x05, "Disconnect" },
232 { 0x07, "ConfirmedPush" },
236 /* 0x10 - 0x3F Unassigned */
244 /* 0x45 - 0x4F Unassigned (Get PDU) */
245 /* 0x50 - 0x5F Extended method (Get PDU) */
246 { 0x50, "Extended Get Method 0"},
247 { 0x51, "Extended Get Method 1"},
248 { 0x52, "Extended Get Method 2"},
249 { 0x53, "Extended Get Method 3"},
250 { 0x54, "Extended Get Method 4"},
251 { 0x55, "Extended Get Method 5"},
252 { 0x56, "Extended Get Method 6"},
253 { 0x57, "Extended Get Method 7"},
254 { 0x58, "Extended Get Method 8"},
255 { 0x59, "Extended Get Method 9"},
256 { 0x5A, "Extended Get Method 10"},
257 { 0x5B, "Extended Get Method 11"},
258 { 0x5C, "Extended Get Method 12"},
259 { 0x5D, "Extended Get Method 13"},
260 { 0x5E, "Extended Get Method 14"},
261 { 0x5F, "Extended Get Method 15"},
266 /* 0x62 - 0x6F Unassigned (Post PDU) */
267 /* 0x70 - 0x7F Extended method (Post PDU) */
268 { 0x70, "Extended Post Method 0"},
269 { 0x71, "Extended Post Method 1"},
270 { 0x72, "Extended Post Method 2"},
271 { 0x73, "Extended Post Method 3"},
272 { 0x74, "Extended Post Method 4"},
273 { 0x75, "Extended Post Method 5"},
274 { 0x76, "Extended Post Method 6"},
275 { 0x77, "Extended Post Method 7"},
276 { 0x78, "Extended Post Method 8"},
277 { 0x79, "Extended Post Method 9"},
278 { 0x7A, "Extended Post Method 10"},
279 { 0x7B, "Extended Post Method 11"},
280 { 0x7C, "Extended Post Method 12"},
281 { 0x7D, "Extended Post Method 13"},
282 { 0x7E, "Extended Post Method 14"},
283 { 0x7F, "Extended Post Method 15"},
285 /* 0x80 - 0xFF Reserved */
291 static const value_string vals_status[] = {
292 /* 0x00 - 0x0F Reserved */
294 { 0x10, "Continue" },
295 { 0x11, "Switching Protocols" },
299 { 0x22, "Accepted" },
300 { 0x23, "Non-Authoritative Information" },
301 { 0x24, "No Content" },
302 { 0x25, "Reset Content" },
303 { 0x26, "Partial Content" },
305 { 0x30, "Multiple Choices" },
306 { 0x31, "Moved Permanently" },
307 { 0x32, "Moved Temporarily" },
308 { 0x33, "See Other" },
309 { 0x34, "Not Modified" },
310 { 0x35, "Use Proxy" },
311 { 0x37, "Temporary Redirect" },
313 { 0x40, "Bad Request" },
314 { 0x41, "Unauthorised" },
315 { 0x42, "Payment Required" },
316 { 0x43, "Forbidden" },
317 { 0x44, "Not Found" },
318 { 0x45, "Method Not Allowed" },
319 { 0x46, "Not Acceptable" },
320 { 0x47, "Proxy Authentication Required" },
321 { 0x48, "Request Timeout" },
322 { 0x49, "Conflict" },
324 { 0x4B, "Length Required" },
325 { 0x4C, "Precondition Failed" },
326 { 0x4D, "Request Entity Too Large" },
327 { 0x4E, "Request-URI Too Large" },
328 { 0x4F, "Unsupported Media Type" },
329 { 0x50, "Requested Range Not Satisfiable" },
330 { 0x51, "Expectation Failed" },
332 { 0x60, "Internal Server Error" },
333 { 0x61, "Not Implemented" },
334 { 0x62, "Bad Gateway" },
335 { 0x63, "Service Unavailable" },
336 { 0x64, "Gateway Timeout" },
337 { 0x65, "HTTP Version Not Supported" },
344 #define FN_ACCEPT 0x00
345 #define FN_ACCEPT_CHARSET_DEP 0x01 /* encoding version 1.1, deprecated */
346 #define FN_ACCEPT_ENCODING_DEP 0x02 /* encoding version 1.1, deprecated */
347 #define FN_ACCEPT_LANGUAGE 0x03
348 #define FN_ACCEPT_RANGES 0x04
350 #define FN_ALLOW 0x06
351 #define FN_AUTHORIZATION 0x07
352 #define FN_CACHE_CONTROL_DEP 0x08 /* encoding version 1.1, deprecated */
353 #define FN_CONNECTION 0x09
354 #define FN_CONTENT_BASE 0x0A
355 #define FN_CONTENT_ENCODING 0x0B
356 #define FN_CONTENT_LANGUAGE 0x0C
357 #define FN_CONTENT_LENGTH 0x0D
358 #define FN_CONTENT_LOCATION 0x0E
359 #define FN_CONTENT_MD5 0x0F
360 #define FN_CONTENT_RANGE_DEP 0x10 /* encoding version 1.1, deprecated */
361 #define FN_CONTENT_TYPE 0x11
364 #define FN_EXPIRES 0x14
367 #define FN_IF_MODIFIED_SINCE 0x17
368 #define FN_IF_MATCH 0x18
369 #define FN_IF_NONE_MATCH 0x19
370 #define FN_IF_RANGE 0x1A
371 #define FN_IF_UNMODIFIED_SINCE 0x1B
372 #define FN_LOCATION 0x1C
373 #define FN_LAST_MODIFIED 0x1D
374 #define FN_MAX_FORWARDS 0x1E
375 #define FN_PRAGMA 0x1F
376 #define FN_PROXY_AUTHENTICATE 0x20
377 #define FN_PROXY_AUTHORIZATION 0x21
378 #define FN_PUBLIC 0x22
379 #define FN_RANGE 0x23
380 #define FN_REFERER 0x24
381 #define FN_RETRY_AFTER 0x25
382 #define FN_SERVER 0x26
383 #define FN_TRANSFER_ENCODING 0x27
384 #define FN_UPGRADE 0x28
385 #define FN_USER_AGENT 0x29
388 #define FN_WARNING 0x2C
389 #define FN_WWW_AUTHENTICATE 0x2D
390 #define FN_CONTENT_DISPOSITION 0x2E
391 #define FN_X_WAP_APPLICATION_ID 0x2F
392 #define FN_X_WAP_CONTENT_URI 0x30
393 #define FN_X_WAP_INITIATOR_URI 0x31
394 #define FN_ACCEPT_APPLICATION 0x32
395 #define FN_BEARER_INDICATION 0x33
396 #define FN_PUSH_FLAG 0x34
397 #define FN_PROFILE 0x35
398 #define FN_PROFILE_DIFF 0x36
399 #define FN_PROFILE_WARNING 0x37
400 #define FN_EXPECT 0x38
402 #define FN_TRAILER 0x3A
403 #define FN_ACCEPT_CHARSET 0x3B /* encoding version 1.3 */
404 #define FN_ACCEPT_ENCODING 0x3C /* encoding version 1.3 */
405 #define FN_CACHE_CONTROL 0x3D /* encoding version 1.3 */
406 #define FN_CONTENT_RANGE 0x3E /* encoding version 1.3 */
407 #define FN_X_WAP_TOD 0x3F
408 #define FN_CONTENT_ID 0x40
409 #define FN_SET_COOKIE 0x41
410 #define FN_COOKIE 0x42
411 #define FN_ENCODING_VERSION 0x43
412 #define FN_PROFILE_WARNING14 0x44 /* encoding version 1.4 */
413 #define FN_CONTENT_DISPOSITION14 0x45 /* encoding version 1.4 */
414 #define FN_X_WAP_SECURITY 0x46
415 #define FN_CACHE_CONTROL14 0x47 /* encoding version 1.4 */
419 * Openwave field names.
421 #define FN_OPENWAVE_PROXY_PUSH_ADDR 0x00
422 #define FN_OPENWAVE_PROXY_PUSH_ACCEPT 0x01
423 #define FN_OPENWAVE_PROXY_PUSH_SEQ 0x02
424 #define FN_OPENWAVE_PROXY_NOTIFY 0x03
425 #define FN_OPENWAVE_PROXY_OPERATOR_DOMAIN 0x04
426 #define FN_OPENWAVE_PROXY_HOME_PAGE 0x05
427 #define FN_OPENWAVE_DEVCAP_HAS_COLOR 0x06
428 #define FN_OPENWAVE_DEVCAP_NUM_SOFTKEYS 0x07
429 #define FN_OPENWAVE_DEVCAP_SOFTKEY_SIZE 0x08
430 #define FN_OPENWAVE_DEVCAP_SCREEN_CHARS 0x09
431 #define FN_OPENWAVE_DEVCAP_SCREEN_PIXELS 0x0A
432 #define FN_OPENWAVE_DEVCAP_EM_SIZE 0x0B
433 #define FN_OPENWAVE_DEVCAP_SCREEN_DEPTH 0x0C
434 #define FN_OPENWAVE_DEVCAP_IMMED_ALERT 0x0D
435 #define FN_OPENWAVE_PROXY_NET_ASK 0x0E
436 #define FN_OPENWAVE_PROXY_UPLINK_VERSION 0x0F
437 #define FN_OPENWAVE_PROXY_TOD 0x10
438 #define FN_OPENWAVE_PROXY_BA_ENABLE 0x11
439 #define FN_OPENWAVE_PROXY_BA_REALM 0x12
440 #define FN_OPENWAVE_PROXY_REDIRECT_ENABLE 0x13
441 #define FN_OPENWAVE_PROXY_REQUEST_URI 0x14
442 #define FN_OPENWAVE_PROXY_REDIRECT_STATUS 0x15
443 #define FN_OPENWAVE_PROXY_TRANS_CHARSET 0x16
444 #define FN_OPENWAVE_PROXY_LINGER 0x17
445 #define FN_OPENWAVE_PROXY_CLIENT_ID 0x18
446 #define FN_OPENWAVE_PROXY_ENABLE_TRUST 0x19
447 #define FN_OPENWAVE_PROXY_TRUST_OLD 0x1A
448 #define FN_OPENWAVE_PROXY_TRUST 0x20
449 #define FN_OPENWAVE_PROXY_BOOKMARK 0x21
450 #define FN_OPENWAVE_DEVCAP_GUI 0x22
452 static const value_string vals_openwave_field_names[] = {
453 { FN_OPENWAVE_PROXY_PUSH_ADDR, "x-up-proxy-push-addr" },
454 { FN_OPENWAVE_PROXY_PUSH_ACCEPT, "x-up-proxy-push-accept" },
455 { FN_OPENWAVE_PROXY_PUSH_SEQ, "x-up-proxy-seq" },
456 { FN_OPENWAVE_PROXY_NOTIFY, "x-up-proxy-notify" },
457 { FN_OPENWAVE_PROXY_OPERATOR_DOMAIN, "x-up-proxy-operator-domain" },
458 { FN_OPENWAVE_PROXY_HOME_PAGE, "x-up-proxy-home-page" },
459 { FN_OPENWAVE_DEVCAP_HAS_COLOR, "x-up-devcap-has-color" },
460 { FN_OPENWAVE_DEVCAP_NUM_SOFTKEYS, "x-up-devcap-num-softkeys" },
461 { FN_OPENWAVE_DEVCAP_SOFTKEY_SIZE, "x-up-devcap-softkey-size" },
462 { FN_OPENWAVE_DEVCAP_SCREEN_CHARS, "x-up-devcap-screen-chars" },
463 { FN_OPENWAVE_DEVCAP_SCREEN_PIXELS, "x-up-devcap-screen-pixels" },
464 { FN_OPENWAVE_DEVCAP_EM_SIZE, "x-up-devcap-em-size" },
465 { FN_OPENWAVE_DEVCAP_SCREEN_DEPTH, "x-up-devcap-screen-depth" },
466 { FN_OPENWAVE_DEVCAP_IMMED_ALERT, "x-up-devcap-immed-alert" },
467 { FN_OPENWAVE_PROXY_NET_ASK, "x-up-proxy-net-ask" },
468 { FN_OPENWAVE_PROXY_UPLINK_VERSION, "x-up-proxy-uplink-version" },
469 { FN_OPENWAVE_PROXY_TOD, "x-up-proxy-tod" },
470 { FN_OPENWAVE_PROXY_BA_ENABLE, "x-up-proxy-ba-enable" },
471 { FN_OPENWAVE_PROXY_BA_REALM, "x-up-proxy-ba-realm" },
472 { FN_OPENWAVE_PROXY_REDIRECT_ENABLE, "x-up-proxy-redirect-enable" },
473 { FN_OPENWAVE_PROXY_REQUEST_URI, "x-up-proxy-request-uri" },
474 { FN_OPENWAVE_PROXY_REDIRECT_STATUS, "x-up-proxy-redirect-status" },
475 { FN_OPENWAVE_PROXY_TRANS_CHARSET, "x-up-proxy-trans-charset" },
476 { FN_OPENWAVE_PROXY_LINGER, "x-up-proxy-linger" },
477 { FN_OPENWAVE_PROXY_CLIENT_ID, "x-up-proxy-client-id" },
478 { FN_OPENWAVE_PROXY_ENABLE_TRUST, "x-up-proxy-enable-trust" },
479 { FN_OPENWAVE_PROXY_TRUST_OLD, "x-up-proxy-trust-old" },
480 { FN_OPENWAVE_PROXY_TRUST, "x-up-proxy-trust" },
481 { FN_OPENWAVE_PROXY_BOOKMARK, "x-up-proxy-bookmark" },
482 { FN_OPENWAVE_DEVCAP_GUI, "x-up-devcap-gui" },
487 static const value_string vals_field_names[] = {
488 { FN_ACCEPT, "Accept" },
489 { FN_ACCEPT_CHARSET_DEP, "Accept-Charset (encoding 1.1)" },
490 { FN_ACCEPT_ENCODING_DEP, "Accept-Encoding (encoding 1.1)" },
491 { FN_ACCEPT_LANGUAGE, "Accept-Language" },
492 { FN_ACCEPT_RANGES, "Accept-Ranges" },
494 { FN_ALLOW, "Allow" },
495 { FN_AUTHORIZATION, "Authorization" },
496 { FN_CACHE_CONTROL_DEP, "Cache-Control (encoding 1.1)" },
497 { FN_CONNECTION, "Connection" },
498 { FN_CONTENT_BASE, "Content-Base" },
499 { FN_CONTENT_ENCODING, "Content-Encoding" },
500 { FN_CONTENT_LANGUAGE, "Content-Language" },
501 { FN_CONTENT_LENGTH, "Content-Length" },
502 { FN_CONTENT_LOCATION, "Content-Location" },
503 { FN_CONTENT_MD5, "Content-MD5" },
504 { FN_CONTENT_RANGE_DEP, "Content-Range (encoding 1.1)" },
505 { FN_CONTENT_TYPE, "Content-Type" },
508 { FN_EXPIRES, "Expires" },
511 { FN_IF_MODIFIED_SINCE, "If-Modified-Since" },
512 { FN_IF_MATCH, "If-Match" },
513 { FN_IF_NONE_MATCH, "If-None-Match" },
514 { FN_IF_RANGE, "If-Range" },
515 { FN_IF_UNMODIFIED_SINCE, "If-Unmodified-Since" },
516 { FN_LOCATION, "Location" },
517 { FN_LAST_MODIFIED, "Last-Modified" },
518 { FN_MAX_FORWARDS, "Max-Forwards" },
519 { FN_PRAGMA, "Pragma" },
520 { FN_PROXY_AUTHENTICATE, "Proxy-Authenticate" },
521 { FN_PROXY_AUTHORIZATION, "Proxy-Authorization" },
522 { FN_PUBLIC, "Public" },
523 { FN_RANGE, "Range" },
524 { FN_REFERER, "Referer" },
525 { FN_RETRY_AFTER, "Retry-After" },
526 { FN_SERVER, "Server" },
527 { FN_TRANSFER_ENCODING, "Transfer-Encoding" },
528 { FN_UPGRADE, "Upgrade" },
529 { FN_USER_AGENT, "User-Agent" },
532 { FN_WARNING, "Warning" },
533 { FN_WWW_AUTHENTICATE, "WWW-Authenticate" },
534 { FN_CONTENT_DISPOSITION, "Content-Disposition" },
535 { FN_X_WAP_APPLICATION_ID, "X-Wap-Application-ID" },
536 { FN_X_WAP_CONTENT_URI, "X-Wap-Content-URI" },
537 { FN_X_WAP_INITIATOR_URI, "X-Wap-Initiator-URI" },
538 { FN_ACCEPT_APPLICATION, "Accept-Application" },
539 { FN_BEARER_INDICATION, "Bearer-Indication" },
540 { FN_PUSH_FLAG, "Push-Flag" },
541 { FN_PROFILE, "Profile" },
542 { FN_PROFILE_DIFF, "Profile-Diff" },
543 { FN_PROFILE_WARNING, "Profile-Warning" },
544 { FN_EXPECT, "Expect" },
546 { FN_TRAILER, "Trailer" },
547 { FN_ACCEPT_CHARSET, "Accept-Charset" },
548 { FN_ACCEPT_ENCODING, "Accept-Encoding" },
549 { FN_CACHE_CONTROL, "Cache-Control" },
550 { FN_CONTENT_RANGE, "Content-Range" },
551 { FN_X_WAP_TOD, "X-Wap-Tod" },
552 { FN_CONTENT_ID, "Content-ID" },
553 { FN_SET_COOKIE, "Set-Cookie" },
554 { FN_COOKIE, "Cookie" },
555 { FN_ENCODING_VERSION, "Encoding-Version" },
556 { FN_PROFILE_WARNING14, "Profile-Warning (encoding 1.4)" },
557 { FN_CONTENT_DISPOSITION14,"Content-Disposition (encoding 1.4)" },
558 { FN_X_WAP_SECURITY, "X-WAP-Security" },
559 { FN_CACHE_CONTROL14, "Cache-Control (encoding 1.4)" },
564 * Bearer types (from the WDP specification).
568 #define BT_GSM_USSD 0x02
569 #define BT_GSM_SMS 0x03
570 #define BT_ANSI_136_GUTS 0x04
571 #define BT_IS_95_SMS 0x05
572 #define BT_IS_95_CSD 0x06
573 #define BT_IS_95_PACKET_DATA 0x07
574 #define BT_ANSI_136_CSD 0x08
575 #define BT_ANSI_136_PACKET_DATA 0x09
576 #define BT_GSM_CSD 0x0A
577 #define BT_GSM_GPRS 0x0B
578 #define BT_GSM_USSD_IPv4 0x0C
579 #define BT_AMPS_CDPD 0x0D
580 #define BT_PDC_CSD 0x0E
581 #define BT_PDC_PACKET_DATA 0x0F
582 #define BT_IDEN_SMS 0x10
583 #define BT_IDEN_CSD 0x11
584 #define BT_IDEN_PACKET_DATA 0x12
585 #define BT_PAGING_FLEX 0x13
586 #define BT_PHS_SMS 0x14
587 #define BT_PHS_CSD 0x15
588 #define BT_GSM_USSD_GSM_SC 0x16
589 #define BT_TETRA_SDS_ITSI 0x17
590 #define BT_TETRA_SDS_MSISDN 0x18
591 #define BT_TETRA_PACKET_DATA 0x19
592 #define BT_PAGING_REFLEX 0x1A
593 #define BT_GSM_USSD_MSISDN 0x1B
594 #define BT_MOBITEX_MPAK 0x1C
595 #define BT_ANSI_136_GHOST 0x1D
597 static const value_string vals_bearer_types[] = {
600 { BT_GSM_USSD, "GSM USSD" },
601 { BT_GSM_SMS, "GSM SMS" },
602 { BT_ANSI_136_GUTS, "ANSI-136 GUTS/R-Data" },
603 { BT_IS_95_SMS, "IS-95 CDMA SMS" },
604 { BT_IS_95_CSD, "IS-95 CDMA CSD" },
605 { BT_IS_95_PACKET_DATA, "IS-95 CDMA Packet data" },
606 { BT_ANSI_136_CSD, "ANSI-136 CSD" },
607 { BT_ANSI_136_PACKET_DATA, "ANSI-136 Packet data" },
608 { BT_GSM_CSD, "GSM CSD" },
609 { BT_GSM_GPRS, "GSM GPRS" },
610 { BT_GSM_USSD_IPv4, "GSM USSD (IPv4 addresses)" },
611 { BT_AMPS_CDPD, "AMPS CDPD" },
612 { BT_PDC_CSD, "PDC CSD" },
613 { BT_PDC_PACKET_DATA, "PDC Packet data" },
614 { BT_IDEN_SMS, "IDEN SMS" },
615 { BT_IDEN_CSD, "IDEN CSD" },
616 { BT_IDEN_PACKET_DATA, "IDEN Packet data" },
617 { BT_PAGING_FLEX, "Paging network FLEX(TM)" },
618 { BT_PHS_SMS, "PHS SMS" },
619 { BT_PHS_CSD, "PHS CSD" },
620 { BT_GSM_USSD_GSM_SC, "GSM USSD (GSM Service Code addresses)" },
621 { BT_TETRA_SDS_ITSI, "TETRA SDS (ITSI addresses)" },
622 { BT_TETRA_SDS_MSISDN, "TETRA SDS (MSISDN addresses)" },
623 { BT_TETRA_PACKET_DATA, "TETRA Packet data" },
624 { BT_PAGING_REFLEX, "Paging network ReFLEX(TM)" },
625 { BT_GSM_USSD_MSISDN, "GSM USSD (MSISDN addresses)" },
626 { BT_MOBITEX_MPAK, "Mobitex MPAK" },
627 { BT_ANSI_136_GHOST, "ANSI-136 GHOST/R-Data" },
631 static const value_string vals_content_types[] = {
634 { 0x02, "text/html" },
635 { 0x03, "text/plain" },
636 { 0x04, "text/x-hdml" },
637 { 0x05, "text/x-ttml" },
638 { 0x06, "text/x-vCalendar" },
639 { 0x07, "text/x-vCard" },
640 { 0x08, "text/vnd.wap.wml" },
641 { 0x09, "text/vnd.wap.wmlscript" },
642 { 0x0A, "text/vnd.wap.channel" },
643 { 0x0B, "Multipart/*" },
644 { 0x0C, "Multipart/mixed" },
645 { 0x0D, "Multipart/form-data" },
646 { 0x0E, "Multipart/byteranges" },
647 { 0x0F, "Multipart/alternative" },
648 { 0x10, "application/*" },
649 { 0x11, "application/java-vm" },
650 { 0x12, "application/x-www-form-urlencoded" },
651 { 0x13, "application/x-hdmlc" },
652 { 0x14, "application/vnd.wap.wmlc" },
653 { 0x15, "application/vnd.wap.wmlscriptc" },
654 { 0x16, "application/vnd.wap.channelc" },
655 { 0x17, "application/vnd.wap.uaprof" },
656 { 0x18, "application/vnd.wap.wtls-ca-certificate" },
657 { 0x19, "application/vnd.wap.wtls-user-certificate" },
658 { 0x1A, "application/x-x509-ca-cert" },
659 { 0x1B, "application/x-x509-user-cert" },
661 { 0x1D, "image/gif" },
662 { 0x1E, "image/jpeg" },
663 { 0x1F, "image/tiff" },
664 { 0x20, "image/png" },
665 { 0x21, "image/vnd.wap.wbmp" },
666 { 0x22, "application/vnd.wap.multipart.*" },
667 { 0x23, "application/vnd.wap.multipart.mixed" },
668 { 0x24, "application/vnd.wap.multipart.form-data" },
669 { 0x25, "application/vnd.wap.multipart.byteranges" },
670 { 0x26, "application/vnd.wap.multipart.alternative" },
671 { 0x27, "application/xml" },
672 { 0x28, "text/xml" },
673 { 0x29, "application/vnd.wap.wbxml" },
674 { 0x2A, "application/x-x968-cross-cert" },
675 { 0x2B, "application/x-x968-ca-cert" },
676 { 0x2C, "application/x-x968-user-cert" },
677 { 0x2D, "text/vnd.wap.si" },
678 { 0x2E, "application/vnd.wap.sic" },
679 { 0x2F, "text/vnd.wap.sl" },
680 { 0x30, "application/vnd.wap.slc" },
681 { 0x31, "text/vnd.wap.co" },
682 { 0x32, "application/vnd.wap.coc" },
683 { 0x33, "application/vnd.wap.multipart.related" },
684 { 0x34, "application/vnd.wap.sia" },
685 { 0x35, "text/vnd.wap.connectivity-xml" },
686 { 0x36, "application/vnd.wap.connectivity-wbxml" },
687 { 0x37, "application/pkcs7-mime" },
688 { 0x38, "application/vnd.wap.hashed-certificate" },
689 { 0x39, "application/vnd.wap.signed-certificate" },
690 { 0x3A, "application/vnd.wap.cert-response" },
691 { 0x3B, "application/xhtml+xml" },
692 { 0x3C, "application/wml+xml" },
693 { 0x3D, "text/css" },
694 { 0x3E, "application/vnd.wap.mms-message" },
695 { 0x3F, "application/vnd.wap.rollover-certificate" },
696 { 0x201, "application/vnd.uplanet.cachop-wbxml" },
697 { 0x202, "application/vnd.uplanet.signal" },
698 { 0x203, "application/vnd.uplanet.alert-wbxml" },
699 { 0x204, "application/vnd.uplanet.list-wbxml" },
700 { 0x205, "application/vnd.uplanet.listcmd-wbxml" },
701 { 0x206, "application/vnd.uplanet.channel-wbxml" },
702 { 0x207, "application/vnd.uplanet.provisioning-status-uri" },
703 { 0x208, "x-wap.multipart/vnd.uplanet.header-set" },
704 { 0x209, "application/vnd.uplanet.bearer-choice-wbxml" },
705 { 0x20A, "application/vnd.phonecom.mmc-wbxml" },
706 { 0x20B, "application/vnd.nokia.syncset+wbxml" },
710 static const value_string vals_languages[] = {
711 { 0x01, "Afar (aa)" },
712 { 0x02, "Abkhazian (ab)" },
713 { 0x03, "Afrikaans (af)" },
714 { 0x04, "Amharic (am)" },
715 { 0x05, "Arabic (ar)" },
716 { 0x06, "Assamese (as)" },
717 { 0x07, "Aymara (ay)" },
718 { 0x08, "Azerbaijani (az)" },
719 { 0x09, "Bashkir (ba)" },
720 { 0x0A, "Byelorussian (be)" },
721 { 0x0B, "Bulgarian (bg)" },
722 { 0x0C, "Bihari (bh)" },
723 { 0x0D, "Bislama (bi)" },
724 { 0x0E, "Bengali; Bangla (bn)" },
725 { 0x0F, "Tibetan (bo)" },
726 { 0x10, "Breton (br)" },
727 { 0x11, "Catalan (ca)" },
728 { 0x12, "Corsican (co)" },
729 { 0x13, "Czech (cs)" },
730 { 0x14, "Welsh (cy)" },
731 { 0x15, "Danish (da)" },
732 { 0x16, "German (de)" },
733 { 0x17, "Bhutani (dz)" },
734 { 0x18, "Greek (el)" },
735 { 0x19, "English (en)" },
736 { 0x1A, "Esperanto (eo)" },
737 { 0x1B, "Spanish (es)" },
738 { 0x1C, "Estonian (et)" },
739 { 0x1D, "Basque (eu)" },
740 { 0x1E, "Persian (fa)" },
741 { 0x1F, "Finnish (fi)" },
742 { 0x20, "Fiji (fj)" },
743 { 0x21, "Urdu (ur)" },
744 { 0x22, "French (fr)" },
745 { 0x23, "Uzbek (uz)" },
746 { 0x24, "Irish (ga)" },
747 { 0x25, "Scots Gaelic (gd)" },
748 { 0x26, "Galician (gl)" },
749 { 0x27, "Guarani (gn)" },
750 { 0x28, "Gujarati (gu)" },
751 { 0x29, "Hausa (ha)" },
752 { 0x2A, "Hebrew (formerly iw) (he)" },
753 { 0x2B, "Hindi (hi)" },
754 { 0x2C, "Croatian (hr)" },
755 { 0x2D, "Hungarian (hu)" },
756 { 0x2E, "Armenian (hy)" },
757 { 0x2F, "Vietnamese (vi)" },
758 { 0x30, "Indonesian (formerly in) (id)" },
759 { 0x31, "Wolof (wo)" },
760 { 0x32, "Xhosa (xh)" },
761 { 0x33, "Icelandic (is)" },
762 { 0x34, "Italian (it)" },
763 { 0x35, "Yoruba (yo)" },
764 { 0x36, "Japanese (ja)" },
765 { 0x37, "Javanese (jw)" },
766 { 0x38, "Georgian (ka)" },
767 { 0x39, "Kazakh (kk)" },
768 { 0x3A, "Zhuang (za)" },
769 { 0x3B, "Cambodian (km)" },
770 { 0x3C, "Kannada (kn)" },
771 { 0x3D, "Korean (ko)" },
772 { 0x3E, "Kashmiri (ks)" },
773 { 0x3F, "Kurdish (ku)" },
774 { 0x40, "Kirghiz (ky)" },
775 { 0x41, "Chinese (zh)" },
776 { 0x42, "Lingala (ln)" },
777 { 0x43, "Laothian (lo)" },
778 { 0x44, "Lithuanian (lt)" },
779 { 0x45, "Latvian, Lettish (lv)" },
780 { 0x46, "Malagasy (mg)" },
781 { 0x47, "Maori (mi)" },
782 { 0x48, "Macedonian (mk)" },
783 { 0x49, "Malayalam (ml)" },
784 { 0x4A, "Mongolian (mn)" },
785 { 0x4B, "Moldavian (mo)" },
786 { 0x4C, "Marathi (mr)" },
787 { 0x4D, "Malay (ms)" },
788 { 0x4E, "Maltese (mt)" },
789 { 0x4F, "Burmese (my)" },
790 { 0x50, "Ukrainian (uk)" },
791 { 0x51, "Nepali (ne)" },
792 { 0x52, "Dutch (nl)" },
793 { 0x53, "Norwegian (no)" },
794 { 0x54, "Occitan (oc)" },
795 { 0x55, "(Afan) Oromo (om)" },
796 { 0x56, "Oriya (or)" },
797 { 0x57, "Punjabi (pa)" },
798 { 0x58, "Polish (po)" },
799 { 0x59, "Pashto, Pushto (ps)" },
800 { 0x5A, "Portuguese (pt)" },
801 { 0x5B, "Quechua (qu)" },
802 { 0x5C, "Zulu (zu)" },
803 { 0x5D, "Kirundi (rn)" },
804 { 0x5E, "Romanian (ro)" },
805 { 0x5F, "Russian (ru)" },
806 { 0x60, "Kinyarwanda (rw)" },
807 { 0x61, "Sanskrit (sa)" },
808 { 0x62, "Sindhi (sd)" },
809 { 0x63, "Sangho (sg)" },
810 { 0x64, "Serbo-Croatian (sh)" },
811 { 0x65, "Sinhalese (si)" },
812 { 0x66, "Slovak (sk)" },
813 { 0x67, "Slovenian (sl)" },
814 { 0x68, "Samoan (sm)" },
815 { 0x69, "Shona (sn)" },
816 { 0x6A, "Somali (so)" },
817 { 0x6B, "Albanian (sq)" },
818 { 0x6C, "Serbian (sr)" },
819 { 0x6D, "Siswati (ss)" },
820 { 0x6E, "Sesotho (st)" },
821 { 0x6F, "Sundanese (su)" },
822 { 0x70, "Swedish (sv)" },
823 { 0x71, "Swahili (sw)" },
824 { 0x72, "Tamil (ta)" },
825 { 0x73, "Telugu (te)" },
826 { 0x74, "Tajik (tg)" },
827 { 0x75, "Thai (th)" },
828 { 0x76, "Tigrinya (ti)" },
829 { 0x77, "Turkmen (tk)" },
830 { 0x78, "Tagalog (tl)" },
831 { 0x79, "Setswana (tn)" },
832 { 0x7A, "Tonga (to)" },
833 { 0x7B, "Turkish (tr)" },
834 { 0x7C, "Tsonga (ts)" },
835 { 0x7D, "Tatar (tt)" },
836 { 0x7E, "Twi (tw)" },
837 { 0x7F, "Uighur (ug)" },
838 { 0x81, "Nauru (na)" },
839 { 0x82, "Faeroese (fo)" },
840 { 0x83, "Frisian (fy)" },
841 { 0x84, "Interlingua (ia)" },
842 { 0x85, "Volapuk (vo)" },
843 { 0x86, "Interlingue (ie)" },
844 { 0x87, "Inupiak (ik)" },
845 { 0x88, "Yiddish (formerly ji) (yi)" },
846 { 0x89, "Inuktitut (iu)" },
847 { 0x8A, "Greenlandic (kl)" },
848 { 0x8B, "Latin (la)" },
849 { 0x8C, "Rhaeto-Romance (rm)" },
853 static const value_string vals_accept_ranges[] = {
859 #define NO_CACHE 0x00
860 #define NO_STORE 0x01
862 #define MAX_STALE 0x03
863 #define MIN_FRESH 0x04
864 #define ONLY_IF_CACHED 0x05
867 #define NO_TRANSFORM 0x08
868 #define MUST_REVALIDATE 0x09
869 #define PROXY_REVALIDATE 0x0A
870 #define S_MAXAGE 0x0B
872 static const value_string vals_cache_control[] = {
873 { NO_CACHE, "No-cache" },
874 { NO_STORE, "No-store" },
875 { MAX_AGE, "Max-age" },
876 { MAX_STALE, "Max-stale" },
877 { MIN_FRESH, "Min-fresh" },
878 { ONLY_IF_CACHED, "Only-if-cached" },
879 { PUBLIC, "Public" },
880 { PRIVATE, "Private" },
881 { NO_TRANSFORM, "No-transform" },
882 { MUST_REVALIDATE, "Must-revalidate" },
883 { PROXY_REVALIDATE, "Proxy-revalidate" },
884 { S_MAXAGE, "S-max-age" },
888 static const value_string vals_connection[] = {
893 static const value_string vals_transfer_encoding[] = {
899 /* Parameters and well-known encodings */
900 static const value_string vals_wsp_parameter_sec[] = {
903 { 0x02, "USERNETWPIN" },
904 { 0x03, "USERPINMAC" },
909 /* Warning codes and mappings */
910 static const value_string vals_wsp_warning_code[] = {
911 { 10, "110 Response is stale" },
912 { 11, "111 Revalidation failed" },
913 { 12, "112 Disconnected operation" },
914 { 13, "113 Heuristic expiration" },
915 { 14, "214 Transformation applied" },
916 { 99, "199/299 Miscellaneous warning" },
921 static const value_string vals_wsp_warning_code_short[] = {
936 #define PERMANENT_REDIRECT 0x80
937 #define REUSE_SECURITY_SESSION 0x40
940 * Redirect address flags and length.
942 #define BEARER_TYPE_INCLUDED 0x80
943 #define PORT_NUMBER_INCLUDED 0x40
944 #define ADDRESS_LEN 0x3f
946 static const true_false_string yes_no_truth = {
952 * Windows appears to define DELETE.
962 REDIRECT = 0x03, /* No sample data */
965 PUSH = 0x06, /* No sample data */
966 CONFIRMEDPUSH = 0x07, /* No sample data */
967 SUSPEND = 0x08, /* No sample data */
968 RESUME = 0x09, /* No sample data */
971 OPTIONS = 0x41, /* No sample data */
972 HEAD = 0x42, /* No sample data */
973 DELETE = 0x43, /* No sample data */
974 TRACE = 0x44, /* No sample data */
977 PUT = 0x61, /* No sample data */
982 VALUE_IS_TEXT_STRING,
986 static dissector_table_t wsp_dissector_table;
987 static heur_dissector_list_t heur_subdissector_list;
989 static void add_uri (proto_tree *, packet_info *, tvbuff_t *, guint, guint);
990 static void add_headers (proto_tree *, tvbuff_t *);
991 static int add_well_known_header (proto_tree *, tvbuff_t *, int, guint8);
992 static int add_unknown_header (proto_tree *, tvbuff_t *, int, guint8);
993 static int add_application_header (proto_tree *, tvbuff_t *, int);
994 static void add_accept_header (proto_tree *, tvbuff_t *, int,
995 tvbuff_t *, value_type_t, int);
996 static void add_accept_xxx_header (proto_tree *, tvbuff_t *, int,
997 tvbuff_t *, value_type_t, int, int, int, const value_string *,
999 static void add_accept_ranges_header (proto_tree *, tvbuff_t *, int,
1000 tvbuff_t *, value_type_t, int);
1001 static void add_cache_control_header (proto_tree *, tvbuff_t *, int,
1002 tvbuff_t *, value_type_t, int);
1003 static int add_cache_control_field_name (proto_tree *, tvbuff_t *, int, guint);
1004 static void add_connection_header (proto_tree *, tvbuff_t *, int,
1005 tvbuff_t *, value_type_t, int);
1006 static void add_content_type_value (proto_tree *, tvbuff_t *, int, int,
1007 tvbuff_t *, value_type_t, int, int, int, guint *, const char **);
1008 static void add_wap_application_id_header (proto_tree *, tvbuff_t *, int,
1009 tvbuff_t *, value_type_t, int);
1010 static void add_integer_value_header_common (proto_tree *, tvbuff_t *, int,
1011 tvbuff_t *, value_type_t, int, int, guint8, const value_string *);
1012 static void add_integer_value_header (proto_tree *, tvbuff_t *, int,
1013 tvbuff_t *, value_type_t, int, int, guint8);
1014 static void add_string_value_header_common (proto_tree *, tvbuff_t *, int,
1015 tvbuff_t *, value_type_t, int, int, guint8, const value_string *);
1016 static void add_string_value_header (proto_tree *, tvbuff_t *, int,
1017 tvbuff_t *, value_type_t, int, int, guint8);
1018 static void add_quoted_string_value_header (proto_tree *, tvbuff_t *, int,
1019 tvbuff_t *, value_type_t, int, int, guint8);
1020 static void add_date_value_header (proto_tree *, tvbuff_t *, int,
1021 tvbuff_t *, value_type_t, int, int, guint8);
1022 static int add_parameter (proto_tree *, tvbuff_t *, int);
1023 static int add_untyped_parameter (proto_tree *, tvbuff_t *, int, int);
1024 static int add_parameter_charset (proto_tree *, tvbuff_t *, int, int);
1025 static int add_constrained_encoding (proto_tree *, tvbuff_t *, int, int);
1026 static int add_parameter_type (proto_tree *, tvbuff_t *, int, int);
1027 static int add_parameter_text (proto_tree *, tvbuff_t *, int, int, int, const char *);
1028 static void add_post_variable (proto_tree *, tvbuff_t *, guint, guint, guint, guint);
1029 static void add_multipart_data (proto_tree *, tvbuff_t *);
1030 static void add_pragma_header (proto_tree *, tvbuff_t *, int, tvbuff_t *,
1032 static void add_transfer_encoding_header (proto_tree *, tvbuff_t *, int,
1033 tvbuff_t *, value_type_t, int);
1034 static void add_warning_header (proto_tree *, tvbuff_t *, int, tvbuff_t *,
1036 static void add_accept_application_header (proto_tree *, tvbuff_t *, int,
1037 tvbuff_t *, value_type_t, int);
1038 static void add_credentials_value_header (proto_tree *tree,
1039 tvbuff_t *header_buff, int headerLen, tvbuff_t *value_buff,
1040 value_type_t valueType, int valueLen,
1041 int hf_main, int hf_scheme, int hf_basic_user_id, int hf_basic_password);
1042 static void add_capabilities (proto_tree *tree, tvbuff_t *tvb, int type);
1043 static void add_capability_vals(tvbuff_t *, gboolean, int, guint, guint, char *, size_t);
1044 static value_type_t get_value_type_len (tvbuff_t *, int, guint *, int *, int *);
1045 static guint get_uintvar (tvbuff_t *, guint, guint);
1046 static gint get_integer (tvbuff_t *, guint, guint, value_type_t, guint *);
1048 static int add_well_known_openwave_header (proto_tree *, tvbuff_t *, int, guint8);
1049 static void add_openwave_integer_value_header (proto_tree *, tvbuff_t *, int,
1050 tvbuff_t *, value_type_t, int, int, guint8);
1051 static void add_openwave_string_value_header (proto_tree *, tvbuff_t *, int,
1052 tvbuff_t *, value_type_t, int, int, guint8);
1055 /* Code to actually dissect the packets */
1057 dissect_redirect(tvbuff_t *tvb, int offset, packet_info *pinfo,
1058 proto_tree *tree, dissector_handle_t dissector_handle)
1062 proto_tree *flags_tree;
1064 guint8 address_flags_len;
1066 proto_tree *atf_tree;
1068 guint32 address_ipv4;
1069 struct e_in6_addr address_ipv6;
1070 address redir_address;
1071 conversation_t *conv;
1073 flags = tvb_get_guint8 (tvb, offset);
1075 ti = proto_tree_add_uint (tree, hf_wsp_redirect_flags,
1076 tvb, offset, 1, flags);
1077 flags_tree = proto_item_add_subtree (ti, ett_redirect_flags);
1078 proto_tree_add_boolean (flags_tree, hf_wsp_redirect_permanent,
1079 tvb, offset, 1, flags);
1080 proto_tree_add_boolean (flags_tree, hf_wsp_redirect_reuse_security_session,
1081 tvb, offset, 1, flags);
1084 while (tvb_reported_length_remaining (tvb, offset) > 0) {
1085 address_flags_len = tvb_get_guint8 (tvb, offset);
1087 ti = proto_tree_add_uint (tree, hf_wsp_redirect_afl,
1088 tvb, offset, 1, address_flags_len);
1089 atf_tree = proto_item_add_subtree (ti, ett_redirect_afl);
1090 proto_tree_add_boolean (atf_tree, hf_wsp_redirect_afl_bearer_type_included,
1091 tvb, offset, 1, address_flags_len);
1092 proto_tree_add_boolean (atf_tree, hf_wsp_redirect_afl_port_number_included,
1093 tvb, offset, 1, address_flags_len);
1094 proto_tree_add_uint (atf_tree, hf_wsp_redirect_afl_address_len,
1095 tvb, offset, 1, address_flags_len);
1098 if (address_flags_len & BEARER_TYPE_INCLUDED) {
1099 bearer_type = tvb_get_guint8 (tvb, offset);
1101 proto_tree_add_uint (tree, hf_wsp_redirect_bearer_type,
1102 tvb, offset, 1, bearer_type);
1106 bearer_type = 0x00; /* XXX */
1107 if (address_flags_len & PORT_NUMBER_INCLUDED) {
1108 port_num = tvb_get_ntohs (tvb, offset);
1110 proto_tree_add_uint (tree, hf_wsp_redirect_port_num,
1111 tvb, offset, 2, port_num);
1116 * Redirecting to the same server port number as was
1117 * being used, i.e. the source port number of this
1120 port_num = pinfo->srcport;
1122 address_len = address_flags_len & ADDRESS_LEN;
1123 if (!(address_flags_len & BEARER_TYPE_INCLUDED)) {
1125 * We don't have the bearer type in the message,
1126 * so we don't know the address type.
1127 * (It's the same bearer type as the original
1130 goto unknown_address_type;
1134 * We know the bearer type, so we know the address type.
1136 switch (bearer_type) {
1140 case BT_IS_95_PACKET_DATA:
1141 case BT_ANSI_136_CSD:
1142 case BT_ANSI_136_PACKET_DATA:
1145 case BT_GSM_USSD_IPv4:
1148 case BT_PDC_PACKET_DATA:
1150 case BT_IDEN_PACKET_DATA:
1152 case BT_TETRA_PACKET_DATA:
1156 if (address_len != 4) {
1160 goto unknown_address_type;
1162 tvb_memcpy(tvb, (guint8 *)&address_ipv4, offset, 4);
1164 proto_tree_add_ipv4 (tree,
1165 hf_wsp_redirect_ipv4_addr,
1166 tvb, offset, 4, address_ipv4);
1170 * Create a conversation so that the
1171 * redirected session will be dissected
1174 redir_address.type = AT_IPv4;
1175 redir_address.len = 4;
1176 redir_address.data = (const guint8 *)&address_ipv4;
1177 conv = find_conversation(&redir_address, &pinfo->dst,
1178 PT_UDP, port_num, 0, NO_PORT_B);
1180 conv = conversation_new(&redir_address,
1181 &pinfo->dst, PT_UDP, port_num, 0, NO_PORT2);
1183 conversation_set_dissector(conv, dissector_handle);
1190 if (address_len != 16) {
1194 goto unknown_address_type;
1196 tvb_memcpy(tvb, (guint8 *)&address_ipv6, offset, 16);
1198 proto_tree_add_ipv6 (tree,
1199 hf_wsp_redirect_ipv6_addr,
1200 tvb, offset, 16, (guint8 *)&address_ipv6);
1204 * Create a conversation so that the
1205 * redirected session will be dissected
1208 redir_address.type = AT_IPv6;
1209 redir_address.len = 16;
1210 redir_address.data = (const guint8 *)&address_ipv4;
1211 conv = find_conversation(&redir_address, &pinfo->dst,
1212 PT_UDP, port_num, 0, NO_PORT_B);
1214 conv = conversation_new(&redir_address,
1215 &pinfo->dst, PT_UDP, port_num, 0, NO_PORT2);
1217 conversation_set_dissector(conv, dissector_handle);
1220 unknown_address_type:
1222 if (address_len != 0) {
1224 proto_tree_add_item (tree,
1225 hf_wsp_redirect_addr,
1226 tvb, offset, address_len,
1232 offset += address_len;
1237 dissect_wsp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1238 dissector_handle_t dissector_handle, gboolean is_connectionless)
1245 guint uriLength = 0;
1247 guint capabilityLength = 0;
1248 guint capabilityStart = 0;
1249 guint headersLength = 0;
1250 guint headerLength = 0;
1251 guint headerStart = 0;
1252 guint nextOffset = 0;
1253 guint contentTypeStart = 0;
1254 guint contentType = 0;
1255 const char *contentTypeStr;
1258 /* Set up structures we will need to add the protocol subtree and manage it */
1260 proto_tree *wsp_tree = NULL;
1261 /* proto_tree *wsp_header_fixed; */
1263 /* This field shows up as the "Info" column in the display; you should make
1264 it, if possible, summarize what's in the packet, so that a user looking
1265 at the list of packets can tell what type of packet it is. */
1267 /* Connection-less mode has a TID first */
1268 if (is_connectionless)
1273 /* Find the PDU type */
1274 pdut = tvb_get_guint8 (tvb, offset);
1276 /* Develop the string to put in the Info column */
1277 if (check_col(pinfo->cinfo, COL_INFO))
1279 col_append_fstr(pinfo->cinfo, COL_INFO, "WSP %s",
1280 val_to_str (pdut, vals_pdu_type, "Unknown PDU type (0x%02x)"));
1283 /* In the interest of speed, if "tree" is NULL, don't do any work not
1284 necessary to generate protocol tree items. */
1286 ti = proto_tree_add_item(tree, proto_wsp, tvb, 0, -1,
1288 wsp_tree = proto_item_add_subtree(ti, ett_wsp);
1290 /* Code to process the packet goes here */
1292 wsp_header_fixed = proto_item_add_subtree(ti, ett_header );
1295 /* Add common items: only TID and PDU Type */
1297 /* If this is connectionless, then the TID Field is always first */
1298 if (is_connectionless)
1300 ti = proto_tree_add_item (wsp_tree, hf_wsp_header_tid,tvb,
1301 0,1,bo_little_endian);
1304 ti = proto_tree_add_item(
1305 wsp_tree, /* tree */
1306 hf_wsp_header_pdu_type, /* id */
1308 offset, /* start of high light */
1309 1, /* length of high light */
1310 bo_little_endian /* value */
1315 /* Map extended methods to the main method now the Column info has been written;
1316 * this way we can dissect the extended method PDUs. */
1317 if ((pdut >= 0x50) && (pdut <= 0x5F))
1319 else if ((pdut >= 0x70) && (pdut <= 0x7F))
1328 if (pdut == CONNECT)
1330 ti = proto_tree_add_item (wsp_tree, hf_wsp_version_major,tvb,offset,1,bo_little_endian);
1331 ti = proto_tree_add_item (wsp_tree, hf_wsp_version_minor,tvb,offset,1,bo_little_endian);
1334 count = 0; /* Initialise count */
1335 value = tvb_get_guintvar (tvb, offset, &count);
1336 ti = proto_tree_add_uint (wsp_tree, hf_wsp_server_session_id,tvb,offset,count,value);
1339 capabilityStart = offset;
1340 count = 0; /* Initialise count */
1341 capabilityLength = tvb_get_guintvar (tvb, offset, &count);
1343 ti = proto_tree_add_uint (wsp_tree, hf_wsp_capability_length,tvb,capabilityStart,count,capabilityLength);
1347 count = 0; /* Initialise count */
1348 headerLength = tvb_get_guintvar (tvb, offset, &count);
1349 ti = proto_tree_add_uint (wsp_tree, hf_wsp_header_length,tvb,offset,count,headerLength);
1351 capabilityStart = offset;
1352 headerStart = capabilityStart + capabilityLength;
1354 /* Resume computes the headerlength by remaining bytes */
1355 capabilityStart = offset;
1356 headerStart = capabilityStart + capabilityLength;
1357 headerLength = tvb_reported_length_remaining (tvb, headerStart);
1359 if (capabilityLength > 0)
1361 tmp_tvb = tvb_new_subset (tvb, offset, capabilityLength, capabilityLength);
1362 add_capabilities (wsp_tree, tmp_tvb, pdut);
1363 offset += capabilityLength;
1366 if (headerLength > 0)
1368 tmp_tvb = tvb_new_subset (tvb, offset, headerLength, headerLength);
1369 add_headers (wsp_tree, tmp_tvb);
1376 dissect_redirect(tvb, offset, pinfo, wsp_tree,
1383 count = 0; /* Initialise count */
1384 value = tvb_get_guintvar (tvb, offset, &count);
1385 ti = proto_tree_add_uint (wsp_tree, hf_wsp_server_session_id,tvb,offset,count,value);
1390 count = 0; /* Initialise count */
1391 /* Length of URI and size of URILen field */
1392 value = tvb_get_guintvar (tvb, offset, &count);
1393 nextOffset = offset + count;
1394 add_uri (wsp_tree, pinfo, tvb, offset, nextOffset);
1396 offset += (value+count); /* VERIFY */
1397 tmp_tvb = tvb_new_subset (tvb, offset, -1, -1);
1398 add_headers (wsp_tree, tmp_tvb);
1404 count = 0; /* Initialise count */
1405 uriLength = tvb_get_guintvar (tvb, offset, &count);
1406 headerStart = uriStart+count;
1407 count = 0; /* Initialise count */
1408 headersLength = tvb_get_guintvar (tvb, headerStart, &count);
1409 offset = headerStart + count;
1411 add_uri (wsp_tree, pinfo, tvb, uriStart, offset);
1413 offset += uriLength;
1415 ti = proto_tree_add_uint (wsp_tree, hf_wsp_header_length,tvb,headerStart,count,headersLength);
1417 if (headersLength == 0)
1420 contentTypeStart = offset;
1421 nextOffset = add_content_type (wsp_tree,
1422 tvb, offset, &contentType,
1425 /* Add headers subtree that will hold the headers fields */
1426 /* Runs from nextOffset for headersLength-(length of content-type field)*/
1427 headerLength = headersLength-(nextOffset-contentTypeStart);
1428 if (headerLength > 0)
1430 tmp_tvb = tvb_new_subset (tvb, nextOffset, headerLength, headerLength);
1431 add_headers (wsp_tree, tmp_tvb);
1433 offset = nextOffset+headerLength;
1435 /* POST data - First check whether a subdissector exists for the content type */
1436 if (tvb_reported_length_remaining(tvb, headerStart + count + uriLength + headersLength) > 0)
1438 tmp_tvb = tvb_new_subset (tvb, headerStart + count + uriLength + headersLength, -1, -1);
1439 /* Try finding a dissector for the content first, then fallback */
1440 if (!dissector_try_port(wsp_dissector_table, contentType, tmp_tvb, pinfo, tree))
1441 if (!dissector_try_heuristic(heur_subdissector_list, tmp_tvb, pinfo, tree))
1442 if (tree) /* Only display if needed */
1443 add_post_data (wsp_tree, tmp_tvb, contentType, contentTypeStr);
1448 count = 0; /* Initialise count */
1449 headersLength = tvb_get_guintvar (tvb, offset+1, &count);
1450 headerStart = offset + count + 1;
1452 ti = proto_tree_add_item (wsp_tree, hf_wsp_header_status,tvb,offset,1,bo_little_endian);
1453 nextOffset = offset + 1 + count;
1454 ti = proto_tree_add_uint (wsp_tree, hf_wsp_header_length,tvb,offset+1,count,headersLength);
1456 if (headersLength == 0)
1459 contentTypeStart = nextOffset;
1460 nextOffset = add_content_type (wsp_tree,
1461 tvb, nextOffset, &contentType,
1464 /* Add headers subtree that will hold the headers fields */
1465 /* Runs from nextOffset for headersLength-(length of content-type field)*/
1466 headerLength = headersLength-(nextOffset-contentTypeStart);
1467 if (headerLength > 0)
1469 tmp_tvb = tvb_new_subset (tvb, nextOffset, headerLength, headerLength);
1470 add_headers (wsp_tree, tmp_tvb);
1472 offset += count+headersLength+1;
1474 /* REPLY data - First check whether a subdissector exists for the content type */
1475 if (tvb_reported_length_remaining(tvb, headerStart + headersLength) > 0)
1477 tmp_tvb = tvb_new_subset (tvb, headerStart + headersLength, -1, -1);
1478 /* Try finding a dissector for the content first, then fallback */
1479 if (!dissector_try_port(wsp_dissector_table, contentType, tmp_tvb, pinfo, tree))
1480 if (!dissector_try_heuristic(heur_subdissector_list, tmp_tvb, pinfo, tree))
1481 if (tree) /* Only display if needed */
1482 ti = proto_tree_add_item (wsp_tree, hf_wsp_reply_data,
1483 tmp_tvb, 0, -1, bo_little_endian);
1489 count = 0; /* Initialise count */
1490 headersLength = tvb_get_guintvar (tvb, offset, &count);
1491 headerStart = offset + count;
1494 ti = proto_tree_add_uint (wsp_tree, hf_wsp_header_length,tvb,offset,count,headersLength);
1496 if (headersLength == 0)
1500 contentTypeStart = offset;
1501 nextOffset = add_content_type (wsp_tree,
1502 tvb, offset, &contentType,
1505 /* Add headers subtree that will hold the headers fields */
1506 /* Runs from nextOffset for headersLength-(length of content-type field)*/
1507 headerLength = headersLength-(nextOffset-contentTypeStart);
1508 if (headerLength > 0)
1510 tmp_tvb = tvb_new_subset (tvb, nextOffset, headerLength, headerLength);
1511 add_headers (wsp_tree, tmp_tvb);
1513 offset += headersLength;
1515 /* PUSH data - First check whether a subdissector exists for the content type */
1516 if (tvb_reported_length_remaining(tvb, headerStart + headersLength) > 0)
1518 tmp_tvb = tvb_new_subset (tvb, headerStart + headersLength, -1, -1);
1519 /* Try finding a dissector for the content first, then fallback */
1520 if (!dissector_try_port(wsp_dissector_table, contentType, tmp_tvb, pinfo, tree))
1521 if (!dissector_try_heuristic(heur_subdissector_list, tmp_tvb, pinfo, tree))
1522 if (tree) /* Only display if needed */
1523 ti = proto_tree_add_item (wsp_tree, hf_wsp_push_data,
1524 tmp_tvb, 0, -1, bo_little_endian);
1532 * Called directly from UDP.
1533 * Put "WSP" into the "Protocol" column.
1536 dissect_wsp_fromudp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1538 if (check_col(pinfo->cinfo, COL_PROTOCOL))
1539 col_set_str(pinfo->cinfo, COL_PROTOCOL, "WSP" );
1540 if (check_col(pinfo->cinfo, COL_INFO))
1541 col_clear(pinfo->cinfo, COL_INFO);
1543 dissect_wsp_common(tvb, pinfo, tree, wsp_fromudp_handle, TRUE);
1547 * Called from a higher-level WAP dissector, in connection-oriented mode.
1548 * Leave the "Protocol" column alone - the dissector calling us should
1552 dissect_wsp_fromwap_co(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1555 * XXX - what about WTLS->WTP->WSP?
1557 dissect_wsp_common(tvb, pinfo, tree, wtp_fromudp_handle, FALSE);
1561 * Called from a higher-level WAP dissector, in connectionless mode.
1562 * Leave the "Protocol" column alone - the dissector calling us should
1566 dissect_wsp_fromwap_cl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1569 * XXX - what about WTLS->WSP?
1571 if (check_col(pinfo->cinfo, COL_INFO))
1573 col_clear(pinfo->cinfo, COL_INFO);
1575 dissect_wsp_common(tvb, pinfo, tree, wtp_fromudp_handle, TRUE);
1579 add_uri (proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint URILenOffset, guint URIOffset)
1584 guint uriLen = tvb_get_guintvar (tvb, URILenOffset, &count);
1587 ti = proto_tree_add_uint (tree, hf_wsp_header_uri_len,tvb,URILenOffset,count,uriLen);
1590 ti = proto_tree_add_item (tree, hf_wsp_header_uri,tvb,URIOffset,uriLen,bo_little_endian);
1591 if (check_col(pinfo->cinfo, COL_INFO)) {
1592 col_append_fstr(pinfo->cinfo, COL_INFO, " %s",
1593 tvb_format_text (tvb, URIOffset, uriLen));
1598 add_headers (proto_tree *tree, tvbuff_t *tvb)
1601 proto_tree *wsp_headers;
1603 guint headersLen = tvb_reported_length (tvb);
1604 guint headerStart = 0;
1609 fprintf (stderr, "dissect_wsp: Offset is %d, size is %d\n", offset, headersLen);
1613 if (headersLen <= 0)
1619 fprintf (stderr, "dissect_wsp: Headers to process\n");
1622 ti = proto_tree_add_item (tree, hf_wsp_headers_section,tvb,offset,headersLen,bo_little_endian);
1623 wsp_headers = proto_item_add_subtree( ti, ett_headers );
1627 while (offset < headersLen)
1629 /* Loop round each header */
1630 headerStart = offset;
1631 peek = tvb_get_guint8 (tvb, headerStart);
1633 if (peek < 32) /* Short-cut shift delimiter */
1636 proto_tree_add_uint (wsp_headers,
1637 hf_wsp_header_shift_code, tvb, offset, 1,
1642 else if (peek == 0x7F) /* Shift delimiter */
1644 pageCode = tvb_get_guint8(tvb, offset+1);
1645 proto_tree_add_uint (wsp_headers,
1646 hf_wsp_header_shift_code, tvb, offset, 2,
1651 else if (peek < 127)
1654 fprintf (stderr, "dissect_wsp: header: application-header start %d (0x%02X)\n", peek, peek);
1657 * Token-text, followed by Application-specific-value.
1659 offset = add_application_header (wsp_headers, tvb,
1662 else if (peek & 0x80)
1665 fprintf (stderr, "dissect_wsp: header: well-known %d (0x%02X)\n", peek, peek);
1668 * Well-known-header; the lower 7 bits of "peek"
1669 * are the header code.
1673 offset = add_well_known_header (wsp_headers,
1674 tvb, headerStart, peek & 0x7F);
1679 offset = add_well_known_openwave_header (wsp_headers,
1680 tvb, headerStart, peek & 0x7F);
1684 offset = add_unknown_header (wsp_headers,
1685 tvb, headerStart, peek & 0x7F);
1693 add_well_known_header (proto_tree *tree, tvbuff_t *tvb, int offset,
1697 value_type_t valueType;
1701 tvbuff_t *header_buff;
1702 tvbuff_t *value_buff;
1705 fprintf (stderr, "dissect_wsp: Got header 0x%02x\n", headerType);
1707 headerStart = offset;
1710 * Skip the Short-Integer header type.
1715 * Get the value type and length (or, if the type is VALUE_IN_LEN,
1716 * meaning the value is a Short-integer, get the value type
1717 * and the value itself).
1719 valueType = get_value_type_len (tvb, offset, &valueLen,
1720 &valueStart, &offset);
1721 headerLen = offset - headerStart;
1724 * Get a tvbuff for the entire header.
1725 * XXX - cut the actual length short so that it doesn't run
1726 * past the actual length of tvb.
1728 header_buff = tvb_new_subset (tvb, headerStart, headerLen,
1732 * If the value wasn't in the length, get a tvbuff for the value.
1733 * XXX - can valueLen be 0?
1734 * XXX - cut the actual length short so that it doesn't run
1735 * past the actual length of tvb.
1737 if (valueType != VALUE_IN_LEN) {
1738 value_buff = tvb_new_subset (tvb, valueStart, valueLen,
1742 * XXX - when the last dissector is tvbuffified,
1743 * so that NULL is no longer a valid tvb pointer
1744 * value in "proto_tree_add" calls, just
1745 * set "value_buff" to NULL.
1747 * XXX - can we already do that? I.e., will that
1748 * cause us always to crash if we mistakenly try
1749 * to fetch the value of a VALUE_IN_LEN item?
1751 value_buff = tvb_new_subset (tvb, headerStart, 0, 0);
1754 switch (headerType) {
1756 case FN_ACCEPT: /* Accept */
1757 add_accept_header (tree, header_buff, headerLen,
1758 value_buff, valueType, valueLen);
1761 case FN_ACCEPT_CHARSET_DEP: /* Accept-Charset */
1763 * XXX - should both encoding versions 1.1 and
1764 * 1.3 be handled this way?
1766 add_accept_xxx_header (tree, header_buff, headerLen,
1767 value_buff, valueType, valueLen,
1768 hf_wsp_header_accept_charset,
1769 hf_wsp_header_accept_charset_str,
1770 vals_character_sets, "Unknown charset (0x%04x)");
1773 case FN_ACCEPT_LANGUAGE: /* Accept-Language */
1774 add_accept_xxx_header (tree, header_buff, headerLen,
1775 value_buff, valueType, valueLen,
1776 hf_wsp_header_accept_language,
1777 hf_wsp_header_accept_language_str,
1778 vals_languages, "Unknown language (0x%04x)");
1781 case FN_ACCEPT_RANGES: /* Accept-Ranges */
1782 add_accept_ranges_header (tree, header_buff, headerLen,
1783 value_buff, valueType, valueLen);
1786 case FN_AGE: /* Age */
1787 add_integer_value_header (tree, header_buff, headerLen,
1788 value_buff, valueType, valueLen, hf_wsp_header_age,
1792 case FN_CACHE_CONTROL_DEP: /* Cache-Control */
1793 case FN_CACHE_CONTROL:
1794 case FN_CACHE_CONTROL14:
1796 * XXX - is the only difference in the three different
1797 * versions (1.1, 1.3, 1.4) really only S_MAXAGE?
1799 add_cache_control_header (tree, header_buff, headerLen,
1800 value_buff, valueType, valueLen);
1803 case FN_CONNECTION: /* Connection */
1804 add_connection_header (tree, header_buff, headerLen,
1805 value_buff, valueType, valueLen);
1808 case FN_CONTENT_LENGTH: /* Content-Length */
1809 add_integer_value_header (tree, header_buff, headerLen,
1810 value_buff, valueType, valueLen,
1811 hf_wsp_header_content_length,
1815 case FN_DATE: /* Date */
1816 add_date_value_header (tree, header_buff, headerLen,
1817 value_buff, valueType, valueLen,
1818 hf_wsp_header_date, headerType);
1821 case FN_ETAG: /* Etag */
1822 add_string_value_header (tree, header_buff, headerLen,
1823 value_buff, valueType, valueLen,
1824 hf_wsp_header_etag, headerType);
1827 case FN_EXPIRES: /* Expires */
1828 add_date_value_header (tree, header_buff, headerLen,
1829 value_buff, valueType, valueLen,
1830 hf_wsp_header_expires, headerType);
1833 case FN_IF_MODIFIED_SINCE: /* If-Modified-Since */
1834 add_date_value_header (tree, header_buff, headerLen,
1835 value_buff, valueType, valueLen,
1836 hf_wsp_header_if_modified_since, headerType);
1839 case FN_LOCATION: /* Location */
1840 add_string_value_header (tree, header_buff, headerLen,
1841 value_buff, valueType, valueLen,
1842 hf_wsp_header_location, headerType);
1845 case FN_LAST_MODIFIED: /* Last-Modified */
1846 add_date_value_header (tree, header_buff, headerLen,
1847 value_buff, valueType, valueLen,
1848 hf_wsp_header_last_modified, headerType);
1851 case FN_PRAGMA: /* Pragma */
1852 add_pragma_header (tree, header_buff, headerLen,
1853 value_buff, valueType, valueLen);
1856 case FN_SERVER: /* Server */
1857 add_string_value_header (tree, header_buff, headerLen,
1858 value_buff, valueType, valueLen,
1859 hf_wsp_header_server, headerType);
1862 case FN_TRANSFER_ENCODING: /* Transfer-Encoding */
1863 add_transfer_encoding_header (tree, header_buff, headerLen,
1864 value_buff, valueType, valueLen);
1867 case FN_USER_AGENT: /* User-Agent */
1868 add_string_value_header (tree, header_buff, headerLen,
1869 value_buff, valueType, valueLen,
1870 hf_wsp_header_user_agent, headerType);
1873 case FN_VIA: /* Via */
1874 add_string_value_header (tree, header_buff, headerLen,
1875 value_buff, valueType, valueLen,
1876 hf_wsp_header_via, headerType);
1879 case FN_WARNING: /* Warning */
1880 add_warning_header (tree, header_buff, headerLen,
1881 value_buff, valueType, valueLen);
1884 case FN_ACCEPT_APPLICATION: /* Accept-Application */
1885 add_accept_application_header (tree, header_buff, headerLen,
1886 value_buff, valueType, valueLen);
1889 case FN_BEARER_INDICATION: /* Bearer-Indication */
1890 add_integer_value_header (tree, header_buff, headerLen,
1891 value_buff, valueType, valueLen,
1892 hf_wsp_header_bearer_indication, headerType);
1895 case FN_PROFILE: /* Profile */
1896 add_string_value_header (tree, header_buff, headerLen,
1897 value_buff, valueType, valueLen,
1898 hf_wsp_header_profile, headerType);
1901 case FN_X_WAP_APPLICATION_ID: /* X-Wap-Application-Id */
1902 add_wap_application_id_header (tree, header_buff, headerLen,
1903 value_buff, valueType, valueLen);
1906 case FN_CONTENT_ID: /* Content-ID */
1907 add_quoted_string_value_header (tree, header_buff, headerLen,
1908 value_buff, valueType, valueLen,
1909 hf_wsp_header_content_ID, headerType);
1912 case FN_AUTHORIZATION: /* Authorization */
1913 add_credentials_value_header (tree, header_buff, headerLen,
1914 value_buff, valueType, valueLen,
1915 hf_wsp_header_authorization,
1916 hf_wsp_header_authorization_scheme,
1917 hf_wsp_header_authorization_user_id,
1918 hf_wsp_header_authorization_password);
1921 case FN_PROXY_AUTHORIZATION: /* Proxy-Authorization */
1922 add_credentials_value_header (tree, header_buff, headerLen,
1923 value_buff, valueType, valueLen,
1924 hf_wsp_header_proxy_authorization,
1925 hf_wsp_header_proxy_authorization_scheme,
1926 hf_wsp_header_proxy_authorization_user_id,
1927 hf_wsp_header_proxy_authorization_password);
1930 case FN_WWW_AUTHENTICATE: /* WWW-Authenticate */
1931 case FN_PROXY_AUTHENTICATE: /* Proxy-Authenticate */
1935 proto_tree_add_text (tree, header_buff, 0, headerLen,
1936 "Undecoded Header: %s",
1937 val_to_str (headerType, vals_field_names, "Unknown (0x%02X)"));
1945 add_well_known_openwave_header (proto_tree *tree, tvbuff_t *tvb, int offset,
1949 value_type_t valueType;
1953 tvbuff_t *header_buff;
1954 tvbuff_t *value_buff;
1957 fprintf (stderr, "dissect_wsp: Got Openwave header 0x%02x\n", headerType);
1959 headerStart = offset;
1962 * Skip the Short-Integer header type.
1967 * Get the value type and length (or, if the type is VALUE_IN_LEN,
1968 * meaning the value is a Short-integer, get the value type
1969 * and the value itself).
1971 valueType = get_value_type_len (tvb, offset, &valueLen,
1972 &valueStart, &offset);
1973 headerLen = offset - headerStart;
1976 * Get a tvbuff for the entire header.
1977 * XXX - cut the actual length short so that it doesn't run
1978 * past the actual length of tvb.
1980 header_buff = tvb_new_subset (tvb, headerStart, headerLen,
1984 * If the value wasn't in the length, get a tvbuff for the value.
1985 * XXX - can valueLen be 0?
1986 * XXX - cut the actual length short so that it doesn't run
1987 * past the actual length of tvb.
1989 if (valueType != VALUE_IN_LEN) {
1990 value_buff = tvb_new_subset (tvb, valueStart, valueLen,
1994 * XXX - when the last dissector is tvbuffified,
1995 * so that NULL is no longer a valid tvb pointer
1996 * value in "proto_tree_add" calls, just
1997 * set "value_buff" to NULL.
1999 * XXX - can we already do that? I.e., will that
2000 * cause us always to crash if we mistakenly try
2001 * to fetch the value of a VALUE_IN_LEN item?
2003 value_buff = tvb_new_subset (tvb, headerStart, 0, 0);
2006 switch (headerType) {
2008 /* case FN_OPENWAVE_PROXY_PUSH_ADDR: / x-up-proxy-push-addr */
2009 /* add_openwave_push_address_header (tree, header_buff, headerLen, */
2010 /* value_buff, valueType, valueLen); */
2013 case FN_OPENWAVE_PROXY_PUSH_ACCEPT: /* x-up-proxy-push-accept */
2014 add_accept_header (tree, header_buff, headerLen,
2015 value_buff, valueType, valueLen);
2018 case FN_OPENWAVE_PROXY_PUSH_SEQ: /* x-up-proxy-push-seq */
2019 add_openwave_integer_value_header (tree, header_buff, headerLen,
2020 value_buff, valueType, valueLen, hf_wsp_header_openwave_proxy_push_seq,
2024 case FN_OPENWAVE_PROXY_NOTIFY: /* x-up-proxy-notify */
2025 add_openwave_integer_value_header (tree, header_buff, headerLen,
2026 value_buff, valueType, valueLen, hf_wsp_header_openwave_proxy_notify,
2030 case FN_OPENWAVE_PROXY_OPERATOR_DOMAIN: /* x-up-proxy-operator-domain */
2031 add_openwave_string_value_header (tree, header_buff, headerLen,
2032 value_buff, valueType, valueLen,
2033 hf_wsp_header_openwave_proxy_operator_domain, headerType);
2036 case FN_OPENWAVE_PROXY_HOME_PAGE: /* x-up-proxy-home-page */
2037 add_openwave_string_value_header (tree, header_buff, headerLen,
2038 value_buff, valueType, valueLen,
2039 hf_wsp_header_openwave_proxy_home_page, headerType);
2042 case FN_OPENWAVE_DEVCAP_HAS_COLOR: /* x-up-devcap-has-color */
2043 add_openwave_integer_value_header (tree, header_buff, headerLen,
2044 value_buff, valueType, valueLen, hf_wsp_header_openwave_devcap_has_color,
2048 case FN_OPENWAVE_DEVCAP_NUM_SOFTKEYS: /* x-up-devcap-num-softkeys */
2049 add_openwave_integer_value_header (tree, header_buff, headerLen,
2050 value_buff, valueType, valueLen, hf_wsp_header_openwave_devcap_num_softkeys,
2054 case FN_OPENWAVE_DEVCAP_SOFTKEY_SIZE: /* x-up-devcap-softkey-size */
2055 add_openwave_integer_value_header (tree, header_buff, headerLen,
2056 value_buff, valueType, valueLen, hf_wsp_header_openwave_devcap_softkey_size,
2060 /* case FN_OPENWAVE_DEVCAP_SCREEN_CHARS: / x-up-devcap-screen-chars */
2061 /* add_openwave_integer_value_header (tree, header_buff, headerLen, */
2062 /* value_buff, valueType, valueLen, hf_wsp_header_openwave_devcap_screen_chars, */
2066 /* case FN_OPENWAVE_DEVCAP_SCREEN_PIXELS: / x-up-devcap-screen-pixels */
2067 /* add_openwave_integer_value_header (tree, header_buff, headerLen, */
2068 /* value_buff, valueType, valueLen, hf_wsp_header_openwave_devcap_screen_pixels, */
2072 /* case FN_OPENWAVE_DEVCAP_EM_SIZE: / x-up-devcap-em-size */
2073 /* add_openwave_integer_value_header (tree, header_buff, headerLen, */
2074 /* value_buff, valueType, valueLen, hf_wsp_header_openwave_devcap_em_size, */
2078 case FN_OPENWAVE_DEVCAP_SCREEN_DEPTH: /* x-up-devcap-screen-depth */
2079 add_openwave_integer_value_header (tree, header_buff, headerLen,
2080 value_buff, valueType, valueLen, hf_wsp_header_openwave_devcap_screen_depth,
2084 case FN_OPENWAVE_DEVCAP_IMMED_ALERT: /* x-up-devcap-immed-alert */
2085 add_openwave_integer_value_header (tree, header_buff, headerLen,
2086 value_buff, valueType, valueLen, hf_wsp_header_openwave_devcap_immed_alert,
2090 case FN_OPENWAVE_PROXY_NET_ASK: /* x-up-proxy-net-ask */
2091 add_openwave_integer_value_header (tree, header_buff, headerLen,
2092 value_buff, valueType, valueLen, hf_wsp_header_openwave_proxy_net_ask,
2096 case FN_OPENWAVE_PROXY_UPLINK_VERSION: /* x-up-proxy-uplink-version */
2097 add_openwave_string_value_header (tree, header_buff, headerLen,
2098 value_buff, valueType, valueLen,
2099 hf_wsp_header_openwave_proxy_uplink_version, headerType);
2102 case FN_OPENWAVE_PROXY_TOD: /* x-up-proxy-tod */
2103 add_openwave_integer_value_header (tree, header_buff, headerLen,
2104 value_buff, valueType, valueLen,
2105 hf_wsp_header_openwave_proxy_tod, headerType);
2108 case FN_OPENWAVE_PROXY_BA_ENABLE: /* x-up-proxy-ba-enable */
2109 add_openwave_integer_value_header (tree, header_buff, headerLen,
2110 value_buff, valueType, valueLen,
2111 hf_wsp_header_openwave_proxy_ba_enable, headerType);
2114 case FN_OPENWAVE_PROXY_BA_REALM: /* x-up-proxy-ba-realm */
2115 add_openwave_string_value_header (tree, header_buff, headerLen,
2116 value_buff, valueType, valueLen,
2117 hf_wsp_header_openwave_proxy_ba_realm, headerType);
2120 case FN_OPENWAVE_PROXY_REDIRECT_ENABLE: /* x-up-proxy-redirect-enable */
2121 add_openwave_integer_value_header (tree, header_buff, headerLen,
2122 value_buff, valueType, valueLen,
2123 hf_wsp_header_openwave_proxy_redirect_enable, headerType);
2126 case FN_OPENWAVE_PROXY_REQUEST_URI: /* x-up-proxy-request-uri */
2127 add_openwave_string_value_header (tree, header_buff, headerLen,
2128 value_buff, valueType, valueLen,
2129 hf_wsp_header_openwave_proxy_request_uri, headerType);
2132 /* case FN_OPENWAVE_PROXY_REDIRECT_STATUS: / x-up-proxy-redirect-status */
2133 /* add_openwave_integer_value_header (tree, header_buff, headerLen, */
2134 /* value_buff, valueType, valueLen, hf_wsp_header_openwave_proxy_redirect_status, */
2138 case FN_OPENWAVE_PROXY_TRANS_CHARSET: /* x-up-proxy-trans-charset */
2139 add_accept_xxx_header (tree, header_buff, headerLen,
2140 value_buff, valueType, valueLen,
2141 hf_wsp_header_openwave_proxy_trans_charset,
2142 hf_wsp_header_openwave_proxy_trans_charset_str,
2143 vals_character_sets, "Unknown charset (%u)");
2146 case FN_OPENWAVE_PROXY_LINGER: /* x-up-proxy-linger */
2147 add_openwave_integer_value_header (tree, header_buff, headerLen,
2148 value_buff, valueType, valueLen, hf_wsp_header_openwave_proxy_linger,
2152 /* case FN_OPENWAVE_PROXY_CLIENT_ID: / x-up-proxy-client-id */
2153 /* add_openwave_string_value_header (tree, header_buff, headerLen, */
2154 /* value_buff, valueType, valueLen, */
2155 /* hf_wsp_header_openwave_proxy_client_id, headerType); */
2158 case FN_OPENWAVE_PROXY_ENABLE_TRUST: /* x-up-proxy-enable-trust */
2159 add_openwave_integer_value_header (tree, header_buff, headerLen,
2160 value_buff, valueType, valueLen, hf_wsp_header_openwave_proxy_enable_trust,
2164 case FN_OPENWAVE_PROXY_TRUST_OLD: /* x-up-proxy-trust old value */
2165 add_openwave_integer_value_header (tree, header_buff, headerLen,
2166 value_buff, valueType, valueLen, hf_wsp_header_openwave_proxy_trust_old,
2170 case FN_OPENWAVE_PROXY_TRUST: /* x-up-proxy-trust */
2171 add_openwave_integer_value_header (tree, header_buff, headerLen,
2172 value_buff, valueType, valueLen, hf_wsp_header_openwave_proxy_trust,
2176 case FN_OPENWAVE_PROXY_BOOKMARK: /* x-up-proxy-bookmark */
2177 add_openwave_string_value_header (tree, header_buff, headerLen,
2178 value_buff, valueType, valueLen,
2179 hf_wsp_header_openwave_proxy_bookmark, headerType);
2182 case FN_OPENWAVE_DEVCAP_GUI: /* x-up-devcap-gui */
2183 add_openwave_integer_value_header (tree, header_buff, headerLen,
2184 value_buff, valueType, valueLen, hf_wsp_header_openwave_devcap_gui,
2189 proto_tree_add_text (tree, header_buff, 0, headerLen,
2190 "Undecoded Openwave Header: %s",
2191 val_to_str (headerType, vals_openwave_field_names, "Unknown (0x%02X)"));
2199 add_openwave_push_address_header (proto_tree *tree, tvbuff_t *header_buff,
2200 int headerLen, tvbuff_t *value_buff, value_type_t valueType,
2210 add_unknown_header (proto_tree *tree, tvbuff_t *tvb, int offset,
2215 value_type_t valueType;
2220 headerStart = offset;
2223 * Skip the Short-Integer header type.
2227 valueStart = offset;
2230 * Get the value type and length (or, if the type is VALUE_IN_LEN,
2231 * meaning the value is a Short-integer, get the value type
2232 * and the value itself).
2234 valueType = get_value_type_len (tvb, valueStart, &valueLen,
2235 &valueOffset, &offset);
2236 headerLen = offset - headerStart;
2238 proto_tree_add_text (tree, tvb, headerStart, headerLen,
2239 "Undecoded Header (0x%02X)", headerType);
2244 add_application_header (proto_tree *tree, tvbuff_t *tvb, int offset)
2248 const guint8 *token;
2249 value_type_t valueType;
2257 startOffset = offset;
2258 tokenSize = tvb_strsize (tvb, startOffset);
2259 token = tvb_get_ptr (tvb, startOffset, tokenSize);
2260 offset += tokenSize;
2263 * Special case header "X-WAP.TOD" that is sometimes followed
2264 * by a 4-byte date value.
2266 * XXX - according to the 4-May-2000 WSP spec, X-Wap-Tod is
2267 * encoded as a well known header, with a code of 0x3F.
2269 if (tokenSize == 10 && strncasecmp ("x-wap.tod", token, 9) == 0)
2271 valueType = get_value_type_len (tvb, offset,
2272 &subvalueLen, &subvalueOffset, &offset);
2273 if (get_integer (tvb, subvalueOffset, subvalueLen,
2274 valueType, &secs) == 0)
2277 * Fill in the "struct timeval", and add it to the
2279 * Note: this will succeed even if it's a Short-integer.
2280 * A Short-integer would work, but, as the time values
2281 * are UNIX seconds-since-the-Epoch value, and as
2282 * there weren't WAP phones or Web servers back in
2283 * late 1969/early 1970, they're unlikely to be used.
2285 timeValue.secs = secs;
2286 timeValue.nsecs = 0;
2287 proto_tree_add_time (tree, hf_wsp_header_x_wap_tod,
2288 tvb, startOffset, offset - startOffset, &timeValue);
2292 proto_tree_add_text (tree, tvb, startOffset,
2293 offset - startOffset,
2294 "%s: invalid date value", token);
2300 stringSize = tvb_strsize (tvb, asvOffset);
2301 offset += stringSize;
2302 proto_tree_add_text (tree, tvb, startOffset,
2303 offset - startOffset,
2305 tvb_get_ptr (tvb, asvOffset, stringSize));
2311 add_accept_header (proto_tree *tree, tvbuff_t *header_buff,
2312 int headerLen, tvbuff_t *value_buff, value_type_t valueType,
2316 const char *contentTypeStr;
2318 add_content_type_value (tree, header_buff, 0, headerLen, value_buff,
2319 valueType, valueLen, hf_wsp_header_accept,
2320 hf_wsp_header_accept_str, &contentType, &contentTypeStr);
2324 add_accept_xxx_header (proto_tree *tree, tvbuff_t *header_buff,
2325 int headerLen, tvbuff_t *value_buff, value_type_t valueType,
2326 int valueLen, int hf_numeric, int hf_string,
2327 const value_string *vals, const char *unknown_tag)
2333 char valString[100];
2334 const char *valMatch;
2336 double q_value = 1.0;
2338 if (valueType == VALUE_IN_LEN)
2341 * Constrained-{charset,language} (Short-Integer).
2343 proto_tree_add_uint (tree, hf_numeric,
2344 header_buff, 0, headerLen,
2345 valueLen); /* valueLen is the value */
2348 if (valueType == VALUE_IS_TEXT_STRING)
2351 * Constrained-{charset,language} (text, i.e.
2354 proto_tree_add_string (tree, hf_string,
2355 header_buff, 0, headerLen,
2356 tvb_get_ptr (value_buff, 0, valueLen));
2361 * First byte had the 8th bit set.
2363 if (valueLen == 0) {
2365 * Any-{charset,language}.
2367 proto_tree_add_string (tree, hf_string,
2368 header_buff, 0, headerLen,
2374 * Accept-{charset,language}-general-form; Value-length, followed
2375 * by Well-known-{charset,language} or {Token-text,Text-string},
2376 * possibly followed by a Q-value.
2380 valueType = get_value_type_len (value_buff, 0, &subvalueLen,
2381 &subvalueOffset, &offset);
2382 if (valueType == VALUE_IS_TEXT_STRING)
2385 * {Token-text,Text-string}.
2388 tvb_get_ptr (value_buff, subvalueOffset, subvalueLen);
2389 proto_tree_add_string (tree, hf_string,
2390 value_buff, 0, valueLen, valMatch);
2393 * Well-known-{charset,langugage}; starts with an
2396 if (get_integer (value_buff, subvalueOffset, subvalueLen,
2397 valueType, &value) < 0)
2399 valMatch = "Invalid integer";
2403 valMatch = val_to_str(value, vals, unknown_tag);
2407 /* Any remaining data relates to Q-value */
2408 if (offset < valueLen)
2410 peek = tvb_get_guintvar (value_buff, offset, NULL);
2412 peek = (peek - 1) * 10;
2417 q_value = peek/1000.0;
2420 /* Build string including Q-value if present */
2421 if (q_value == 1.0) /* Default */
2423 snprintf (valString, 100, "%s", valMatch);
2427 snprintf (valString, 100, "%s; Q=%5.3f", valMatch, q_value);
2429 /* Add string to tree */
2430 proto_tree_add_string (tree, hf_string,
2431 header_buff, 0, headerLen, valString);
2435 add_accept_ranges_header (proto_tree *tree, tvbuff_t *header_buff,
2436 int headerLen, tvbuff_t *value_buff, value_type_t valueType,
2439 if (valueType == VALUE_IN_LEN)
2442 * Must be 0 (None) or 1 (Bytes) (the 8th bit was stripped
2445 proto_tree_add_uint (tree, hf_wsp_header_accept_ranges,
2446 header_buff, 0, headerLen,
2447 valueLen); /* valueLen is the value */
2450 if (valueType == VALUE_IS_TEXT_STRING)
2455 proto_tree_add_string (tree, hf_wsp_header_accept_ranges_str,
2456 header_buff, 0, headerLen,
2457 tvb_get_ptr (value_buff, 0, valueLen));
2464 fprintf(stderr, "dissect_wsp: Accept-Ranges is neither None, Bytes, nor Token-text\n");
2469 add_cache_control_header (proto_tree *tree, tvbuff_t *header_buff,
2470 int headerLen, tvbuff_t *value_buff, value_type_t valueType,
2478 proto_tree *parameter_tree;
2479 proto_tree *field_names_tree;
2482 if (valueType == VALUE_IN_LEN)
2485 * No-cache, No-store, Max-age, Max-stale, Min-fresh,
2486 * Only-if-cached, Public, Private, No-transform,
2487 * Must-revalidate, Proxy-revalidate, or S-maxage.
2489 proto_tree_add_uint (tree, hf_wsp_header_cache_control,
2490 header_buff, 0, headerLen,
2491 valueLen); /* valueLen is the value */
2494 if (valueType == VALUE_IS_TEXT_STRING)
2499 proto_tree_add_string (tree, hf_wsp_header_cache_control_str,
2500 header_buff, 0, headerLen,
2501 tvb_get_ptr (value_buff, 0, valueLen));
2506 * Value-length Cache-directive.
2507 * Get first field of Cache-directive.
2509 valueType = get_value_type_len (value_buff, offset, &subvalueLen,
2510 &subvalueOffset, &offset);
2511 if (valueType == VALUE_IS_TEXT_STRING)
2514 * Cache-extension Parameter.
2516 ti = proto_tree_add_string (tree, hf_wsp_header_cache_control_str,
2517 header_buff, 0, headerLen,
2518 tvb_get_ptr (value_buff, 0, valueLen));
2519 parameter_tree = proto_item_add_subtree (ti,
2520 ett_header_cache_control_parameters);
2523 * Process the rest of the value as parameters.
2525 while (tvb_reported_length_remaining (value_buff, offset) > 0) {
2526 offset = add_parameter (parameter_tree, value_buff,
2531 if (get_integer (value_buff, subvalueOffset, subvalueLen, valueType,
2534 proto_tree_add_text (tree, header_buff, 0, headerLen,
2535 "Invalid Cache-Control Cache-directive value");
2544 * Loop, processing Field-names.
2546 ti = proto_tree_add_uint (tree,
2547 hf_wsp_header_cache_control,
2548 header_buff, 0, headerLen,
2550 field_names_tree = proto_item_add_subtree (ti,
2551 ett_header_cache_control_field_names);
2552 while (tvb_reported_length_remaining (value_buff, offset)
2554 offset = add_cache_control_field_name (tree,
2555 value_buff, offset, value);
2564 * Get Delta-second-value.
2566 valueType = get_value_type_len (value_buff, offset,
2567 &subvalueLen, &subvalueOffset, &offset);
2568 if (get_integer (value_buff, subvalueOffset,
2569 subvalueLen, valueType, &delta_secs) < 0)
2571 proto_tree_add_text (tree,
2572 header_buff, 0, headerLen,
2573 "Invalid Cache-Control %s Delta-second-value",
2574 match_strval (value, vals_cache_control));
2578 proto_tree_add_uint_format (tree,
2579 hf_wsp_header_cache_control,
2580 header_buff, 0, headerLen,
2582 "Cache-Control: %s %u secs",
2583 match_strval (value, vals_cache_control),
2590 * This should not happen, but handle it anyway.
2592 proto_tree_add_uint (tree,
2593 hf_wsp_header_cache_control,
2594 header_buff, 0, headerLen,
2602 add_cache_control_field_name (proto_tree *tree, tvbuff_t *value_buff,
2603 int offset, guint cache_control_value)
2605 value_type_t valueType;
2610 startOffset = offset;
2611 valueType = get_value_type_len (value_buff, offset,
2612 &subvalueLen, &subvalueOffset, &offset);
2613 if (valueType == VALUE_IS_TEXT_STRING)
2618 proto_tree_add_item (tree,
2619 hf_wsp_header_cache_control_field_name_str,
2620 value_buff, startOffset, offset - startOffset,
2623 else if (valueType == VALUE_IN_LEN)
2626 * Short-integer Field-name.
2628 proto_tree_add_uint (tree,
2629 hf_wsp_header_cache_control_field_name,
2630 value_buff, startOffset, offset - startOffset,
2636 * Long-integer - illegal.
2638 proto_tree_add_text (tree,
2639 value_buff, startOffset, offset - startOffset,
2640 "Invalid Cache-Control %s Field-name",
2641 match_strval (cache_control_value, vals_cache_control));
2647 add_connection_header (proto_tree *tree, tvbuff_t *header_buff,
2648 int headerLen, tvbuff_t *value_buff, value_type_t valueType,
2653 if (valueType == VALUE_LEN_SUPPLIED)
2658 proto_tree_add_text (tree, header_buff, 0, headerLen,
2659 "Invalid Connection value");
2662 if (valueType == VALUE_IS_TEXT_STRING)
2667 proto_tree_add_string (tree,
2668 hf_wsp_header_connection_str,
2669 header_buff, 0, headerLen,
2670 tvb_get_ptr (value_buff, 0, valueLen));
2675 * First byte had the 8th bit set.
2677 if (valueLen == 0) {
2681 proto_tree_add_uint (tree, hf_wsp_header_connection,
2682 header_buff, offset, headerLen, valueLen);
2689 proto_tree_add_text (tree, header_buff, 0, headerLen,
2690 "Invalid Connection value");
2694 add_pragma_header (proto_tree *tree, tvbuff_t *header_buff,
2695 int headerLen, tvbuff_t *value_buff, value_type_t valueType,
2702 if (valueType == VALUE_IN_LEN)
2707 proto_tree_add_text (tree, header_buff, 0, headerLen,
2711 if (valueType == VALUE_IS_TEXT_STRING)
2716 proto_tree_add_text (tree, header_buff, 0, headerLen,
2722 * First byte had the 8th bit set.
2724 if (valueLen == 0) {
2728 proto_tree_add_string (tree, hf_wsp_header_pragma,
2729 header_buff, 0, headerLen, "No-cache");
2734 * Value-length, followed by Parameter.
2738 valueType = get_value_type_len (value_buff, 0, &subvalueLen,
2739 &subvalueOffset, &offset);
2740 if (valueType == VALUE_IS_TEXT_STRING)
2743 * Parameter - a text string.
2745 proto_tree_add_string (tree, hf_wsp_header_pragma,
2746 header_buff, 0, headerLen,
2747 tvb_get_ptr (value_buff, subvalueOffset, subvalueLen));
2750 * Parameter - numeric; illegal?
2752 proto_tree_add_text (tree, header_buff, 0, headerLen,
2758 add_transfer_encoding_header (proto_tree *tree, tvbuff_t *header_buff,
2759 int headerLen, tvbuff_t *value_buff, value_type_t valueType,
2764 if (valueType == VALUE_LEN_SUPPLIED)
2769 proto_tree_add_text (tree, header_buff, 0, headerLen,
2770 "Invalid Transfer-Encoding value");
2773 if (valueType == VALUE_IS_TEXT_STRING)
2778 proto_tree_add_string (tree,
2779 hf_wsp_header_transfer_encoding_str,
2780 header_buff, 0, headerLen,
2781 tvb_get_ptr (value_buff, 0, valueLen));
2786 * First byte had the 8th bit set.
2788 if (valueLen == 0) {
2792 proto_tree_add_uint (tree, hf_wsp_header_transfer_encoding,
2793 header_buff, offset, headerLen, valueLen);
2800 proto_tree_add_text (tree, header_buff, 0, headerLen,
2801 "Invalid Transfer Encoding value");
2805 add_warning_header (proto_tree *tree, tvbuff_t *header_buff,
2806 int headerLen, tvbuff_t *value_buff, value_type_t valueType,
2811 proto_tree *warning_tree;
2817 * Put the items under a header.
2818 * XXX - make the text of the item summarize the elements.
2820 ti = proto_tree_add_item (tree, hf_wsp_header_warning,
2821 header_buff, 0, headerLen, bo_little_endian);
2822 warning_tree = proto_item_add_subtree(ti, ett_header_warning);
2824 if (valueType == VALUE_IN_LEN)
2827 * Warn-code (Short-integer).
2829 proto_tree_add_uint (warning_tree, hf_wsp_header_warning_code,
2830 header_buff, 0, headerLen,
2831 valueLen); /* valueLen is the value */
2832 proto_item_append_text (ti, ": %s", match_strval(valueLen, vals_wsp_warning_code));
2835 if (valueType == VALUE_IS_TEXT_STRING)
2840 proto_tree_add_text (warning_tree, header_buff, 0, headerLen,
2841 "Invalid Warning (all text)");
2846 * Warning-value; Warn-code, followed by Warn-agent, followed by
2850 * Get Short-integer Warn-code.
2852 valueType = get_value_type_len (value_buff, offset, &subvalueLen,
2853 &subvalueOffset, &offset);
2854 if (valueType != VALUE_IN_LEN)
2857 * Not a Short-integer.
2859 proto_tree_add_text (warning_tree, value_buff, subvalueOffset,
2860 subvalueLen, "Invalid Warn-code (not a Short-integer)");
2864 proto_tree_add_uint (warning_tree, hf_wsp_header_warning_code,
2865 value_buff, subvalueOffset, 1,
2866 subvalueLen); /* subvalueLen is the value */
2869 * Warn-agent; must be text.
2871 valueType = get_value_type_len (value_buff, offset, &subvalueLen,
2872 &subvalueOffset, &offset);
2873 if (valueType != VALUE_IS_TEXT_STRING)
2878 proto_tree_add_text (warning_tree, value_buff, subvalueOffset,
2879 subvalueLen, "Invalid Warn-agent (not a text string)");
2882 proto_tree_add_item (warning_tree,
2883 hf_wsp_header_warning_agent,
2884 value_buff, subvalueOffset, subvalueLen, bo_little_endian);
2887 * Warn-text; must be text.
2889 valueType = get_value_type_len (value_buff, offset, &subvalueLen,
2890 &subvalueOffset, &offset);
2891 if (valueType != VALUE_IS_TEXT_STRING)
2896 proto_tree_add_text (warning_tree, value_buff, subvalueOffset,
2897 subvalueLen, "Invalid Warn-text (not a text string)");
2900 proto_tree_add_item (warning_tree,
2901 hf_wsp_header_warning_text,
2902 value_buff, subvalueOffset, subvalueLen, bo_little_endian);
2903 /* Now create the summary warning header */
2904 proto_item_append_text (ti, ": %s %s",
2905 val_to_str (code, vals_wsp_warning_code_short, "%u"),
2906 tvb_get_ptr (value_buff, subvalueOffset, subvalueLen));
2910 add_accept_application_header (proto_tree *tree, tvbuff_t *header_buff,
2911 int headerLen, tvbuff_t *value_buff, value_type_t valueType,
2916 if (valueType == VALUE_IN_LEN)
2919 * Application-id-value; numeric, so it's App-assigned-code.
2921 proto_tree_add_uint (tree, hf_wsp_header_accept_application,
2922 header_buff, 0, headerLen,
2923 valueLen); /* valueLen is the value */
2926 if (valueType == VALUE_IS_TEXT_STRING)
2931 proto_tree_add_string (tree, hf_wsp_header_accept_application_str,
2932 header_buff, 0, headerLen,
2933 tvb_get_ptr (value_buff, 0, valueLen));
2938 * First byte had the 8th bit set.
2940 if (valueLen == 0) {
2944 proto_tree_add_string (tree, hf_wsp_header_accept_application_str,
2945 header_buff, 0, headerLen,
2951 * Integer-value, hence App-assigned-code.
2953 if (get_integer (value_buff, 0, valueLen, valueType, &value) < 0)
2955 proto_tree_add_text (tree, header_buff, 0, headerLen,
2956 "Invalid Accept-Application App-assigned-code");
2960 proto_tree_add_uint (tree, hf_wsp_header_accept_application,
2961 header_buff, 0, headerLen, value);
2966 add_wap_application_id_header (proto_tree *tree, tvbuff_t *header_buff,
2967 int headerLen, tvbuff_t *value_buff, value_type_t valueType,
2970 if (valueType == VALUE_IN_LEN)
2973 * Must application-id (the 8th bit was stripped off).
2975 proto_tree_add_uint (tree, hf_wsp_header_wap_application_id,
2976 header_buff, 0, headerLen,
2977 valueLen); /* valueLen is the value */
2980 if (valueType == VALUE_IS_TEXT_STRING)
2985 proto_tree_add_string (tree, hf_wsp_header_wap_application_id_str,
2986 header_buff, 0, headerLen,
2987 tvb_get_ptr (value_buff, 0, valueLen));
2994 fprintf(stderr, "dissect_wsp: Suprising format of X-Wap-Application-Id\n");
2999 add_credentials_value_header (proto_tree *tree, tvbuff_t *header_buff,
3000 int headerLen, tvbuff_t *value_buff, value_type_t valueType,
3002 int hf_main, int hf_scheme,
3003 int hf_basic_user_id, int hf_basic_password)
3008 proto_tree *basic_tree;
3010 ti = proto_tree_add_item (tree, hf_main, header_buff, 0, headerLen,
3012 if (valueType == VALUE_LEN_SUPPLIED)
3014 if (tvb_get_guint8 (value_buff, 0) == 0x80)
3016 basic_tree = proto_item_add_subtree(ti, ett_header_credentials);
3017 proto_tree_add_string (basic_tree, hf_scheme,
3018 value_buff, 0, 1, "Basic" );
3019 proto_item_append_text (ti, ": Basic");
3020 /* Now process the Basic Cookie consisting of User-Id and Password */
3022 while (tvb_get_guint8(value_buff, i))
3023 i++; /* Count length of 1st string */
3024 /* We reached End of String at offset = i.
3025 * Get the user id including trailing '\0' (end - start + 1) */
3026 s = (char *) tvb_get_ptr(value_buff, 1, i - 1 + 1);
3027 proto_tree_add_string (basic_tree, hf_basic_user_id,
3028 value_buff, 1, i - 1 + 1, s );
3029 proto_item_append_text (ti, "; user-id='%s'", s);
3030 sLen = ++i; /* Move to 1st byte of password string */
3032 while (tvb_get_guint8(value_buff, i))
3033 i++; /* Count length of 2nd string */
3034 /* We reached End of String at offset = i.
3035 * Get the password including trailing '\0' (end - start + 1) */
3036 s = (char *) tvb_get_ptr(value_buff, sLen, i - sLen + 1);
3037 proto_tree_add_string (basic_tree, hf_basic_password,
3038 value_buff, sLen, i - sLen + 1, s );
3039 proto_item_append_text (ti, "; password='%s'", s);
3042 { /* TODO: Authentication-scheme *Auth-param */
3043 proto_item_append_text (ti, ": (General format not yet decoded)");
3048 proto_item_append_text (ti, ": (Invalid header value format)");
3054 add_capabilities (proto_tree *tree, tvbuff_t *tvb, int type)
3057 proto_tree *wsp_capabilities;
3059 guint offsetStr = 0;
3060 guint capabilitiesLen = tvb_reported_length (tvb);
3061 guint capabilitiesStart = 0;
3067 char valString[200];
3070 fprintf (stderr, "dissect_wsp: Offset is %d, size is %d\n", offset, capabilitiesLen);
3074 if (capabilitiesLen <= 0)
3076 fprintf (stderr, "dissect_wsp: Capabilities = 0\n");
3081 fprintf (stderr, "dissect_wsp: capabilities to process\n");
3084 ti = proto_tree_add_item (tree, hf_wsp_capabilities_section,tvb,offset,capabilitiesLen,bo_little_endian);
3085 wsp_capabilities = proto_item_add_subtree( ti, ett_capabilities );
3089 while (offset < capabilitiesLen)
3091 /* Loop round each header */
3092 capabilitiesStart = offset;
3093 length = tvb_get_guint8 (tvb, capabilitiesStart);
3095 if (length >= 127) /* length */
3098 fprintf (stderr, "dissect_wsp: capabilities length invalid %d\n",length);
3104 peek = tvb_get_guint8 (tvb, offset);
3106 switch (peek & 0x7f)
3108 case 0x00 : /* Client-SDU-Size */
3109 value = get_uintvar (tvb, offset, length+capabilitiesStart+1);
3110 proto_tree_add_uint (wsp_capabilities, hf_wsp_capabilities_client_SDU, tvb, capabilitiesStart, length+1, value);
3112 case 0x01 : /* Server-SDU-Size */
3113 value = get_uintvar (tvb, offset, length+capabilitiesStart+1);
3114 proto_tree_add_uint (wsp_capabilities, hf_wsp_capabilities_server_SDU, tvb, capabilitiesStart, length+1, value);
3116 case 0x02 : /* Protocol Options */
3117 value = get_uintvar (tvb, offset, length+capabilitiesStart+1);
3122 ret = snprintf(valString+i,200-i,"%s","(Confirmed push facility) ");
3125 * Some versions of snprintf
3126 * return -1 if they'd
3127 * truncate the output.
3139 ret = snprintf(valString+i,200-i,"%s","(Push facility) ");
3142 * Some versions of snprintf
3143 * return -1 if they'd
3144 * truncate the output.
3156 ret = snprintf(valString+i,200-i,"%s","(Session resume facility) ");
3159 * Some versions of snprintf
3160 * return -1 if they'd
3161 * truncate the output.
3173 ret = snprintf(valString+i,200-i,"%s","(Acknowledgement headers) ");
3176 * Some versions of snprintf
3177 * return -1 if they'd
3178 * truncate the output.
3185 proto_tree_add_string(wsp_capabilities, hf_wsp_capabilities_protocol_opt, tvb, capabilitiesStart, length+1, valString);
3187 case 0x03 : /* Method-MOR */
3188 value = tvb_get_guint8(tvb, offset);
3189 proto_tree_add_uint (wsp_capabilities, hf_wsp_capabilities_method_MOR, tvb, capabilitiesStart, length+1, value);
3191 case 0x04 : /* Push-MOR */
3192 value = tvb_get_guint8(tvb, offset);
3193 proto_tree_add_uint (wsp_capabilities, hf_wsp_capabilities_push_MOR, tvb, capabilitiesStart, length+1, value);
3196 case 0x05 : /* Extended Methods */
3199 add_capability_vals(tvb, (type == CONNECT),
3200 offsetStr, length, capabilitiesStart,
3201 valString, sizeof valString);
3202 proto_tree_add_string(wsp_capabilities, hf_wsp_capabilities_extended_methods, tvb, capabilitiesStart, length+1, valString);
3204 case 0x06 : /* Header Code Pages */
3207 add_capability_vals(tvb, (type == CONNECT),
3208 offsetStr, length, capabilitiesStart,
3209 valString, sizeof valString);
3210 proto_tree_add_string(wsp_capabilities, hf_wsp_capabilities_header_code_pages, tvb, capabilitiesStart, length+1, valString);
3212 case 0x07 : /* Aliases */
3215 proto_tree_add_text (wsp_capabilities, tvb , capabilitiesStart, length+1,
3216 "Undecoded Header (0x%02X)", peek & 0x7F);
3219 offset=capabilitiesStart+length+1;
3224 add_capability_vals(tvbuff_t *tvb, gboolean add_string, int offsetStr,
3225 guint length, guint capabilitiesStart, char *valString,
3226 size_t valStringSize)
3234 while ((offsetStr-capabilitiesStart) <= length)
3236 value = tvb_get_guint8(tvb, offsetStr);
3237 if (i >= valStringSize) {
3243 ret = snprintf(valString+i,valStringSize-i,
3244 "(0x%02x - ",value);
3248 ret = snprintf(valString+i,valStringSize-i,"(0x%02x) ",
3253 * Some versions of snprintf return -1
3254 * if they'd truncate the output.
3262 for (;(c = tvb_get_guint8(tvb, offsetStr))
3263 && i < valStringSize - 1; i++,offsetStr++)
3266 if (i < valStringSize - 2) {
3267 valString[i++] = ')';
3268 valString[i++] = ' ';
3272 valString[i] = '\0';
3276 get_value_type_len (tvbuff_t *tvb, int offset, guint *valueLen,
3277 int *valueOffset, int *nextOffset)
3283 /* Get value part of header */
3284 peek = tvb_get_guint8 (tvb, offset);
3288 * The value follows "peek", and is "peek" octets long.
3291 fprintf (stderr, "dissect_wsp: Looking for %d octets\n", peek);
3294 *valueLen = len; /* Length of value */
3295 offset++; /* Skip the length */
3296 *valueOffset = offset; /* Offset of value */
3297 offset += len; /* Skip the value */
3298 *nextOffset = offset; /* Offset after value */
3299 return VALUE_LEN_SUPPLIED;
3301 else if (peek == 31)
3304 * A uintvar giving the length of the value follows
3305 * "peek", and the value follows that.
3308 fprintf (stderr, "dissect_wsp: Looking for uintvar octets\n");
3310 offset++; /* Skip the uintvar indicator */
3311 count = 0; /* Initialise count */
3312 len = tvb_get_guintvar (tvb, offset, &count);
3313 *valueLen = len; /* Length of value */
3314 offset += count; /* Skip the length */
3315 *valueOffset = offset; /* Offset of value */
3316 offset += len; /* Skip the value */
3317 *nextOffset = offset; /* Offset after value */
3318 return VALUE_LEN_SUPPLIED;
3320 else if (peek <= 127)
3323 * The value is a NUL-terminated string, and "peek"
3324 * is the first octet of the string.
3327 fprintf (stderr, "dissect_wsp: Looking for NUL-terminated string\n");
3329 len = tvb_strsize (tvb, offset);
3330 *valueLen = len; /* Length of value */
3331 *valueOffset = offset; /* Offset of value */
3332 offset += len; /* Skip the value */
3333 *nextOffset = offset; /* Offset after value */
3334 return VALUE_IS_TEXT_STRING;
3339 * "peek", with the 8th bit stripped off, is the value.
3342 fprintf (stderr, "dissect_wsp: Value is %d\n", (peek & 0x7F));
3344 *valueLen = peek & 0x7F; /* Return the value itself */
3345 *valueOffset = offset; /* Offset of value */
3346 offset++; /* Skip the value */
3347 *nextOffset = offset; /* Offset after value */
3348 return VALUE_IN_LEN;
3353 get_uintvar (tvbuff_t *tvb, guint offset, guint offsetEnd)
3360 octet = tvb_get_guint8 (tvb, offset);
3363 value += octet & 0x7f;
3365 while ((offsetEnd > offset) && (octet & 0x80));
3370 add_content_type_value (proto_tree *tree, tvbuff_t *header_buff,
3371 int headerOffset, int headerLen, tvbuff_t *value_buff,
3372 value_type_t valueType, int valueLen, int hf_numeric, int hf_string,
3373 guint *contentTypep, const char **contentTypeStrp)
3376 proto_tree *parameter_tree;
3377 const char *contentTypeStr;
3383 if (valueType == VALUE_IN_LEN)
3386 * Constrained-media (Short-Integer).
3388 proto_tree_add_uint (tree, hf_numeric,
3389 header_buff, headerOffset, headerLen,
3390 valueLen); /* valueLen is the value */
3393 * Return the numerical value, and a null string value
3394 * indicating that the value is numerical.
3396 *contentTypep = valueLen;
3397 *contentTypeStrp = NULL;
3400 if (valueType == VALUE_IS_TEXT_STRING)
3403 * Constrained-media (text, i.e. Extension-Media).
3405 contentTypeStr = tvb_get_ptr (value_buff, 0, valueLen);
3406 proto_tree_add_string (tree, hf_string,
3407 header_buff, headerOffset, headerLen,
3411 * Return the string value, and set the numerical value
3412 * to 0 (as it shouldn't be used).
3415 *contentTypeStrp = contentTypeStr;
3420 * Content-general-form; Value-length, followed by Media-range,
3421 * followed by optional Accept-parameters.
3425 valueType = get_value_type_len (value_buff, 0, &subvalueLen,
3426 &subvalueOffset, &offset);
3427 if (valueType == VALUE_IS_TEXT_STRING)
3430 * Extension-Media; value is a string.
3433 tvb_get_ptr (value_buff, subvalueOffset, subvalueLen);
3434 ti = proto_tree_add_string (tree, hf_string, header_buff,
3435 headerOffset, headerLen, contentTypeStr);
3438 * Return the string value, and set the numerical value
3439 * to 0 (as it shouldn't be used).
3442 *contentTypeStrp = contentTypeStr;
3447 * Well-known-media; value is an Integer.
3449 if (get_integer (value_buff, subvalueOffset, subvalueLen,
3450 valueType, &value) < 0)
3452 proto_tree_add_text (tree, header_buff,
3453 headerOffset, headerLen,
3454 "Invalid integer for Well-known-media");
3457 * Content type is invalid.
3458 * Don't try to parse the rest of the value.
3461 *contentTypeStrp = NULL;
3464 ti = proto_tree_add_uint (tree, hf_numeric,
3465 header_buff, headerOffset, headerLen, value);
3468 * Return the numerical value, and a null string value
3469 * indicating that the value is numerical.
3471 *contentTypep = value;
3472 *contentTypeStrp = NULL;
3476 * Process the rest of the value as parameters.
3478 parameter_tree = proto_item_add_subtree(ti,
3479 ett_content_type_parameters);
3480 while (tvb_reported_length_remaining (value_buff, offset) > 0)
3481 offset = add_parameter (parameter_tree, value_buff, offset);
3485 add_content_type (proto_tree *tree, tvbuff_t *tvb, guint offset,
3486 guint *contentTypep, const char **contentTypeStrp)
3489 value_type_t valueType;
3493 tvbuff_t *value_buff;
3495 valueStart = offset;
3498 * Get the value type and length (or, if the type is VALUE_IN_LEN,
3499 * meaning the value is a Short-integer, get the value type
3500 * and the value itself).
3502 valueType = get_value_type_len (tvb, valueStart, &valueLen,
3503 &valueOffset, &offset);
3504 valueTypeLen = offset - valueStart;
3507 * Get a tvbuff for the value.
3508 * XXX - can valueLen be 0?
3509 * XXX - cut the actual length short so that it doesn't run
3510 * past the actual length of tvb.
3512 if (valueType != VALUE_IN_LEN) {
3513 value_buff = tvb_new_subset (tvb, valueOffset, valueLen,
3517 * XXX - when the last dissector is tvbuffified,
3518 * so that NULL is no longer a valid tvb pointer
3519 * value in "proto_tree_add" calls, just
3520 * set "value_buff" to NULL.
3522 * XXX - can we already do that? I.e., will that
3523 * cause us always to crash if we mistakenly try
3524 * to fetch the value of a VALUE_IN_LEN item?
3526 value_buff = tvb_new_subset (tvb, valueStart, 0, 0);
3529 add_content_type_value (tree, tvb, valueStart, valueTypeLen, value_buff,
3530 valueType, valueLen, hf_wsp_content_type,
3531 hf_wsp_content_type_str, contentTypep, contentTypeStrp);
3537 add_integer_value_header (proto_tree *tree, tvbuff_t *header_buff,
3538 int headerLen, tvbuff_t *value_buff, value_type_t valueType,
3539 int valueLen, int hf_numeric, guint8 headerType)
3541 add_integer_value_header_common (tree, header_buff, headerLen,
3542 value_buff, valueType, valueLen, hf_numeric, headerType,
3547 add_openwave_integer_value_header (proto_tree *tree, tvbuff_t *header_buff,
3548 int headerLen, tvbuff_t *value_buff, value_type_t valueType,
3549 int valueLen, int hf_numeric, guint8 headerType)
3551 add_integer_value_header_common (tree, header_buff, headerLen,
3552 value_buff, valueType, valueLen, hf_numeric, headerType,
3553 vals_openwave_field_names);
3557 add_integer_value_header_common (proto_tree *tree, tvbuff_t *header_buff,
3558 int headerLen, tvbuff_t *value_buff, value_type_t valueType,
3559 int valueLen, int hf_numeric, guint8 headerType,
3560 const value_string *vals)
3564 if (get_integer (value_buff, 0, valueLen, valueType, &value) < 0)
3566 proto_tree_add_text (tree, header_buff, 0, headerLen,
3567 "Invalid %s integer value",
3568 match_strval (headerType, vals));
3572 proto_tree_add_uint (tree, hf_numeric,
3573 header_buff, 0, headerLen, value);
3578 add_string_value_header (proto_tree *tree, tvbuff_t *header_buff,
3579 int headerLen, tvbuff_t *value_buff, value_type_t valueType,
3580 int valueLen, int hf_string, guint8 headerType)
3582 add_string_value_header_common (tree, header_buff, headerLen,
3583 value_buff, valueType, valueLen, hf_string, headerType,
3588 add_openwave_string_value_header (proto_tree *tree, tvbuff_t *header_buff,
3589 int headerLen, tvbuff_t *value_buff, value_type_t valueType,
3590 int valueLen, int hf_string, guint8 headerType)
3592 add_string_value_header_common (tree, header_buff, headerLen,
3593 value_buff, valueType, valueLen, hf_string, headerType,
3594 vals_openwave_field_names);
3598 add_string_value_header_common (proto_tree *tree, tvbuff_t *header_buff,
3599 int headerLen, tvbuff_t *value_buff, value_type_t valueType,
3600 int valueLen, int hf_string, guint8 headerType,
3601 const value_string *vals)
3603 if (valueType != VALUE_IS_TEXT_STRING)
3605 proto_tree_add_text (tree, header_buff, 0, headerLen,
3606 "Invalid %s string value",
3607 match_strval (headerType, vals));
3611 proto_tree_add_string (tree, hf_string, header_buff,
3612 0, headerLen, tvb_get_ptr (value_buff, 0, valueLen));
3617 add_quoted_string_value_header (proto_tree *tree, tvbuff_t *header_buff,
3618 int headerLen, tvbuff_t *value_buff, value_type_t valueType,
3619 int valueLen, int hf_string, guint8 headerType)
3621 if (valueType != VALUE_IS_TEXT_STRING)
3623 proto_tree_add_text (tree, header_buff, 0, headerLen,
3624 "Invalid %s quoted string value",
3625 match_strval (headerType, vals_field_names));
3629 proto_tree_add_string (tree, hf_string, header_buff,
3630 0, headerLen, tvb_get_ptr (value_buff, 1, valueLen - 1));
3634 /* Utility function to add a date value to the protocol tree */
3636 add_date_value_header (proto_tree *tree, tvbuff_t *header_buff,
3637 int headerLen, tvbuff_t *value_buff, value_type_t valueType,
3638 int valueLen, int hf_time, guint8 headerType)
3643 /* Attempt to get the date value from the buffer */
3644 if (get_integer (value_buff, 0, valueLen, valueType, &secs) == 0)
3647 * Fill in the "struct timeval", and add it to the
3649 * Note: this will succeed even if it's a Short-integer.
3650 * A Short-integer would work, but, as the time values
3651 * are UNIX seconds-since-the-Epoch value, and as
3652 * there weren't WAP phones or Web servers back in
3653 * late 1969/early 1970, they're unlikely to be used.
3655 timeValue.secs = secs;
3656 timeValue.nsecs = 0;
3657 proto_tree_add_time (tree, hf_time, header_buff, 0,
3658 headerLen, &timeValue);
3662 proto_tree_add_text (tree, header_buff, 0, headerLen,
3663 "Invalid %s date value",
3664 match_strval (headerType, vals_field_names));
3669 add_parameter (proto_tree *tree, tvbuff_t *value_buff, int offset)
3672 value_type_t valueType;
3677 startOffset = offset;
3678 valueType = get_value_type_len (value_buff, offset,
3679 &subvalueLen, &subvalueOffset, &offset);
3680 if (valueType == VALUE_IS_TEXT_STRING)
3683 * Untyped-parameter.
3685 offset = add_untyped_parameter (tree, value_buff, startOffset, offset);
3690 * Well-known-parameter-token.
3692 if (get_integer (value_buff, subvalueOffset,
3693 subvalueLen, valueType, &value) < 0)
3695 proto_tree_add_text (tree, value_buff, startOffset,
3696 offset - startOffset,
3697 "Invalid Well-known-parameter-token");
3703 case 0x01: /* WSP 1.1 encoding - Charset: Well-known-charset */
3704 offset = add_parameter_charset (tree, value_buff, startOffset, offset);
3707 case 0x03: /* WSP 1.1 encoding - Type: Integer-value */
3708 offset = add_parameter_type (tree, value_buff, startOffset, offset);
3711 case 0x05: /* WSP 1.1 encoding - Name: Text-string */
3712 case 0x17: /* WSP 1.4 encoding - Name: Text-value */
3713 offset = add_parameter_text (tree, value_buff, startOffset, offset,
3714 hf_wsp_parameter_name, "Name");
3717 case 0x06: /* WSP 1.1 encoding - Filename: Text-string */
3718 case 0x18: /* WSP 1.4 encoding - Filename: Text-value */
3719 offset = add_parameter_text (tree, value_buff, startOffset, offset,
3720 hf_wsp_parameter_filename, "Filename");
3723 case 0x09: /* WSP 1.2 encoding - Type (special): Constrained-encoding */
3724 offset = add_constrained_encoding(tree, value_buff, startOffset, offset);
3727 case 0x0A: /* WSP 1.2 encoding - Start: Text-string */
3728 case 0x19: /* WSP 1.4 encoding - Start (with multipart/related): Text-value */
3729 offset = add_parameter_text (tree, value_buff, startOffset, offset,
3730 hf_wsp_parameter_start, "Start");
3733 case 0x0B: /* WSP 1.2 encoding - Start-info: Text-string */
3734 case 0x1A: /* WSP 1.4 encoding - Start-info (with multipart/related): Text-value */
3735 offset = add_parameter_text (tree, value_buff, startOffset, offset,
3736 hf_wsp_parameter_start_info, "Start-info");
3739 case 0x0C: /* WSP 1.3 encoding - Comment: Text-string */
3740 case 0x1B: /* WSP 1.4 encoding - Comment: Text-value */
3741 offset = add_parameter_text (tree, value_buff, startOffset, offset,
3742 hf_wsp_parameter_comment, "Comment");
3745 case 0x0D: /* WSP 1.3 encoding - Domain: Text-string */
3746 case 0x1C: /* WSP 1.4 encoding - Domain: Text-value */
3747 offset = add_parameter_text (tree, value_buff, startOffset, offset,
3748 hf_wsp_parameter_domain, "Domain");
3751 case 0x0F: /* WSP 1.3 encoding - Path: Text-string */
3752 case 0x1D: /* WSP 1.4 encoding - Path: Text-value */
3753 offset = add_parameter_text (tree, value_buff, startOffset, offset,
3754 hf_wsp_parameter_path, "Path");
3757 case 0x11: /* WSP 1.4 encoding - SEC: Short-integer (OCTET) */
3758 proto_tree_add_uint (tree, hf_wsp_parameter_sec, value_buff, startOffset, 2,
3759 tvb_get_guint8 (value_buff, startOffset+1) & 0x7F);
3763 case 0x12: /* WSP 1.4 encoding - MAC: Text-value */
3764 offset = add_parameter_text (tree, value_buff, startOffset, offset,
3765 hf_wsp_parameter_mac, "MAC");
3768 case 0x00: /* WSP 1.1 encoding - Q: Q-value */
3769 case 0x02: /* WSP 1.1 encoding - Level: Version-value */
3770 case 0x07: /* WSP 1.1 encoding - Differences: Field-name */
3771 case 0x08: /* WSP 1.1 encoding - Padding: Short-integer */
3772 case 0x0E: /* WSP 1.3 encoding - Max-Age: Delta-seconds-value */
3773 case 0x10: /* WSP 1.3 encoding - Secure: No-value */
3774 case 0x13: /* WSP 1.4 encoding - Creation-date: Date-value */
3775 case 0x14: /* WSP 1.4 encoding - Modification-date: Date-value */
3776 case 0x15: /* WSP 1.4 encoding - Read-date: Date-value */
3777 case 0x16: /* WSP 1.4 encoding - Size: Integer-value */
3786 add_untyped_parameter (proto_tree *tree, tvbuff_t *value_buff, int startOffset,
3789 const guint8 *token;
3790 value_type_t valueType;
3794 int vOffset = offset;
3796 token = tvb_get_ptr (value_buff, startOffset, offset - startOffset);
3798 * Now an Untyped-value; either an Integer-value or a Text-value.
3800 valueType = get_value_type_len (value_buff, offset,
3801 &subvalueLen, &subvalueOffset, &offset);
3802 if (valueType == VALUE_IS_TEXT_STRING)
3807 if ((offset - vOffset) == 1) {
3809 * No-value. (stringSize includes the terminating
3810 * null byte, so an empty string has a size of 1.)
3812 proto_tree_add_text (tree, value_buff, startOffset,
3813 offset - startOffset,
3817 proto_tree_add_text (tree, value_buff, startOffset,
3818 offset - startOffset,
3820 tvb_get_ptr (value_buff, vOffset, offset - vOffset));
3827 if (get_integer (value_buff, subvalueOffset, subvalueLen,
3828 valueType, &value) == 0)
3830 proto_tree_add_text (tree, value_buff, startOffset,
3831 offset - startOffset,
3832 "%s: %u", token, value);
3836 proto_tree_add_text (tree, value_buff, startOffset,
3837 offset - startOffset,
3838 "%s: Invalid Integer-value", token);
3845 add_parameter_charset (proto_tree *tree, tvbuff_t *value_buff, int startOffset,
3848 value_type_t valueType;
3853 valueType = get_value_type_len (value_buff, offset,
3854 &subvalueLen, &subvalueOffset, &offset);
3855 if (valueType == VALUE_IN_LEN)
3860 proto_tree_add_uint (tree, hf_wsp_parameter_well_known_charset,
3861 value_buff, startOffset, offset - startOffset,
3862 subvalueLen); /* subvalueLen is the value */
3865 if (valueType == VALUE_IS_TEXT_STRING)
3870 proto_tree_add_text (tree, value_buff, startOffset,
3871 offset - startOffset, "Invalid Well-known charset");
3876 * First byte had the 8th bit set.
3878 if (subvalueLen == 0) {
3881 * XXX - add this as a field?
3883 proto_tree_add_text (tree, value_buff, startOffset,
3884 offset- startOffset, "*");
3888 if (get_integer(value_buff, subvalueOffset, subvalueLen,
3889 valueType, &value) == -1) {
3890 proto_tree_add_text (tree, value_buff, startOffset,
3891 offset - startOffset, "Length %u not handled in Well-known charset",
3894 proto_tree_add_uint (tree, hf_wsp_parameter_well_known_charset,
3895 value_buff, startOffset, offset - startOffset, value);
3901 add_constrained_encoding (proto_tree *tree, tvbuff_t *value_buff, int startOffset,
3904 value_type_t valueType;
3909 valueType = get_value_type_len (value_buff, offset,
3910 &subvalueLen, &subvalueOffset, &offset);
3911 if (valueType == VALUE_IN_LEN)
3914 * Integer-value, invalid
3916 proto_tree_add_text (tree, value_buff, startOffset,
3917 offset - startOffset, "Invalid multipart type parameter");
3920 if (valueType == VALUE_IS_TEXT_STRING)
3925 proto_tree_add_string (tree, hf_wsp_parameter_upart_type,
3926 value_buff, startOffset, offset - startOffset,
3927 tvb_get_ptr (value_buff, subvalueOffset, subvalueLen));
3931 * First byte had the 8th bit set.
3933 get_integer(value_buff, subvalueOffset, subvalueLen, valueType, &value);
3934 proto_tree_add_uint (tree, hf_wsp_parameter_upart_type_value,
3935 value_buff, startOffset, offset - startOffset, value);
3940 add_parameter_type (proto_tree *tree, tvbuff_t *value_buff, int startOffset,
3943 value_type_t valueType;
3948 valueType = get_value_type_len (value_buff, offset,
3949 &subvalueLen, &subvalueOffset, &offset);
3950 if (get_integer(value_buff, subvalueOffset, subvalueLen,
3951 valueType, &value) == -1) {
3952 proto_tree_add_text (tree, value_buff, startOffset,
3953 offset - startOffset, "Invalid type");
3955 proto_tree_add_uint (tree, hf_wsp_parameter_type, value_buff,
3956 startOffset, offset - startOffset, value);
3962 add_parameter_text (proto_tree *tree, tvbuff_t *value_buff, int startOffset,
3963 int offset, int hf_string, const char *paramName)
3965 value_type_t valueType;
3969 valueType = get_value_type_len (value_buff, offset,
3970 &subvalueLen, &subvalueOffset, &offset);
3971 if (valueType != VALUE_IS_TEXT_STRING) {
3972 proto_tree_add_text (tree, value_buff, startOffset,
3973 offset - startOffset, "Invalid %s", paramName);
3975 proto_tree_add_string (tree, hf_string, value_buff,
3976 startOffset, offset - startOffset,
3977 tvb_get_ptr (value_buff, subvalueOffset, subvalueLen));
3983 add_post_data (proto_tree *tree, tvbuff_t *tvb, guint contentType,
3984 const char *contentTypeStr)
3987 guint variableStart = 0;
3988 guint variableEnd = 0;
3989 guint valueStart = 0;
3993 proto_tree *sub_tree;
3995 /* VERIFY ti = proto_tree_add_item (tree, hf_wsp_post_data,tvb,offset,-1,bo_little_endian); */
3996 ti = proto_tree_add_item (tree, hf_wsp_post_data,tvb,offset,-1,bo_little_endian);
3997 sub_tree = proto_item_add_subtree(ti, ett_post);
3999 if (contentTypeStr == NULL && contentType == 0x12)
4003 * Iterate through post data.
4005 for (offset = 0; offset < tvb_reported_length (tvb); offset++)
4007 peek = tvb_get_guint8 (tvb, offset);
4010 variableEnd = offset;
4011 valueStart = offset+1;
4013 else if (peek == '&')
4015 if (variableEnd > 0)
4017 add_post_variable (sub_tree, tvb, variableStart, variableEnd, valueStart, offset);
4019 variableStart = offset+1;
4026 /* See if there's outstanding data */
4027 if (variableEnd > 0)
4029 add_post_variable (sub_tree, tvb, variableStart, variableEnd, valueStart, offset);
4032 else if ((contentType == 0x22) || (contentType == 0x23) || (contentType == 0x23) || (contentType == 0x24) ||
4033 (contentType == 0x25) || (contentType == 0x26) || (contentType == 0x33))
4035 add_multipart_data(sub_tree, tvb);
4040 add_post_variable (proto_tree *tree, tvbuff_t *tvb, guint variableStart, guint variableEnd, guint valueStart, guint valueEnd)
4042 int variableLength = variableEnd-variableStart;
4043 int valueLength = 0;
4044 char *variableBuffer;
4047 variableBuffer = g_malloc (variableLength+1);
4048 strncpy (variableBuffer, tvb_get_ptr (tvb, variableStart, variableLength), variableLength);
4049 variableBuffer[variableLength] = 0;
4051 if (valueEnd < valueStart)
4053 valueBuffer = g_malloc (1);
4055 valueEnd = valueStart;
4059 valueLength = valueEnd-valueStart;
4060 valueBuffer = g_malloc (valueLength+1);
4061 strncpy (valueBuffer, tvb_get_ptr (tvb, valueStart, valueLength), valueLength);
4062 valueBuffer[valueLength] = 0;
4065 /* Check for variables with no value */
4066 if (valueStart >= tvb_reported_length (tvb))
4068 valueStart = tvb_reported_length (tvb);
4069 valueEnd = valueStart;
4071 valueLength = valueEnd-valueStart;
4073 proto_tree_add_text (tree, tvb, variableStart, valueEnd-variableStart, "%s: %s", variableBuffer, valueBuffer);
4075 g_free (variableBuffer);
4076 g_free (valueBuffer);
4080 add_multipart_data (proto_tree *tree, tvbuff_t *tvb)
4088 guint contentType = 0;
4089 const char *contentTypeStr;
4094 proto_item *sub_tree = NULL,
4096 proto_tree *mpart_tree;
4098 nEntries = tvb_get_guintvar (tvb, offset, &count);
4102 sub_tree = proto_tree_add_text(tree, tvb, offset - count, 0,
4104 proto_item_add_subtree(sub_tree, ett_mpartlist);
4108 part_start = offset;
4109 HeadersLen = tvb_get_guintvar (tvb, offset, &count);
4111 DataLen = tvb_get_guintvar (tvb, offset, &count);
4113 ti = proto_tree_add_uint(sub_tree, hf_wsp_mpart, tvb, part_start,
4114 HeadersLen + DataLen + (offset - part_start), partnr);
4115 mpart_tree = proto_item_add_subtree(ti, ett_multiparts);
4116 nextOffset = add_content_type (mpart_tree, tvb, offset, &contentType, &contentTypeStr);
4117 HeadersLen -= (nextOffset - offset);
4120 tmp_tvb = tvb_new_subset (tvb, nextOffset, HeadersLen, HeadersLen);
4121 add_headers (mpart_tree, tmp_tvb);
4123 offset = nextOffset + HeadersLen;
4124 proto_tree_add_item (mpart_tree, hf_wsp_multipart_data, tvb, offset, DataLen, bo_little_endian);
4131 get_integer (tvbuff_t *tvb, guint offset, guint valueLength,
4132 value_type_t valueType, guint *value)
4134 if (valueType == VALUE_IS_TEXT_STRING) {
4141 if (valueType == VALUE_IN_LEN) {
4145 *value = valueLength;
4152 switch (valueLength)
4155 *value = tvb_get_guint8(tvb, offset);
4158 *value = tvb_get_ntohs(tvb, offset);
4161 *value = tvb_get_ntoh24(tvb, offset);
4164 *value = tvb_get_ntohl(tvb, offset);
4167 /* TODO: Need to read peek octets */
4169 fprintf (stderr, "dissect_wsp: get_integer size %u NYI\n", valueLength);
4175 /* Register the protocol with Ethereal */
4177 proto_register_wsp(void)
4180 /* Setup list of header fields */
4181 static hf_register_info hf[] = {
4182 { &hf_wsp_header_tid,
4185 FT_UINT8, BASE_HEX, NULL, 0x00,
4186 "Transaction ID", HFILL
4189 { &hf_wsp_header_pdu_type,
4192 FT_UINT8, BASE_HEX, VALS( vals_pdu_type ), 0x00,
4196 { &hf_wsp_version_major,
4197 { "Version (Major)",
4198 "wsp.version.major",
4199 FT_UINT8, BASE_DEC, NULL, 0xF0,
4200 "Version (Major)", HFILL
4203 { &hf_wsp_version_minor,
4204 { "Version (Minor)",
4205 "wsp.version.minor",
4206 FT_UINT8, BASE_DEC, NULL, 0x0F,
4207 "Version (Minor)", HFILL
4210 { &hf_wsp_capability_length,
4211 { "Capability Length",
4212 "wsp.capability.length",
4213 FT_UINT32, BASE_DEC, NULL, 0x00,
4214 "Capability Length", HFILL
4217 { &hf_wsp_header_length,
4219 "wsp.headers_length",
4220 FT_UINT32, BASE_DEC, NULL, 0x00,
4221 "Headers Length", HFILL
4224 { &hf_wsp_capabilities_section,
4227 FT_NONE, BASE_DEC, NULL, 0x00,
4228 "Capabilities", HFILL
4231 { &hf_wsp_headers_section,
4234 FT_NONE, BASE_DEC, NULL, 0x00,
4240 "wsp.headers.header",
4241 FT_NONE, BASE_DEC, NULL, 0x00,
4245 { &hf_wsp_header_uri_len,
4248 FT_UINT32, BASE_DEC, NULL, 0x00,
4252 { &hf_wsp_header_uri,
4255 FT_STRING, BASE_NONE, NULL, 0x00,
4259 { &hf_wsp_server_session_id,
4260 { "Server Session ID",
4261 "wsp.server.session_id",
4262 FT_UINT32, BASE_DEC, NULL, 0x00,
4263 "Server Session ID", HFILL
4266 { &hf_wsp_header_status,
4269 FT_UINT8, BASE_HEX, VALS( vals_status ), 0x00,
4273 { &hf_wsp_content_type,
4275 "wsp.content_type.type",
4276 FT_UINT8, BASE_HEX, VALS ( vals_content_types ), 0x00,
4277 "Content Type", HFILL
4280 { &hf_wsp_content_type_str,
4282 "wsp.content_type.type.string",
4283 FT_STRING, BASE_NONE, NULL, 0x00,
4284 "Content Type", HFILL
4287 { &hf_wsp_parameter_well_known_charset,
4289 "wsp.content_type.parameter.charset",
4290 FT_UINT16, BASE_HEX, VALS ( vals_character_sets ), 0x00,
4294 { &hf_wsp_parameter_type,
4296 "wsp.content_type.parameter.type",
4297 FT_UINT32, BASE_DEC, NULL, 0x00,
4301 { &hf_wsp_parameter_name,
4303 "wsp.content_type.parameter.name",
4304 FT_STRING, BASE_NONE, NULL, 0x00,
4308 { &hf_wsp_parameter_filename,
4310 "wsp.content_type.parameter.filename",
4311 FT_STRING, BASE_NONE, NULL, 0x00,
4315 { &hf_wsp_parameter_start,
4317 "wsp.content_type.parameter.start",
4318 FT_STRING, BASE_NONE, NULL, 0x00,
4322 { &hf_wsp_parameter_start_info,
4324 "wsp.content_type.parameter.start_info",
4325 FT_STRING, BASE_NONE, NULL, 0x00,
4329 { &hf_wsp_parameter_comment,
4331 "wsp.content_type.parameter.comment",
4332 FT_STRING, BASE_NONE, NULL, 0x00,
4336 { &hf_wsp_parameter_domain,
4338 "wsp.content_type.parameter.domain",
4339 FT_STRING, BASE_NONE, NULL, 0x00,
4343 { &hf_wsp_parameter_path,
4345 "wsp.content_type.parameter.path",
4346 FT_STRING, BASE_NONE, NULL, 0x00,
4350 { &hf_wsp_parameter_sec,
4352 "wsp.content_type.parameter.sec",
4353 FT_UINT8, BASE_HEX, VALS (vals_wsp_parameter_sec), 0x00,
4354 "SEC parameter (Content-Type: application/vnd.wap.connectivity-wbxml)", HFILL
4357 { &hf_wsp_parameter_mac,
4359 "wsp.content_type.parameter.mac",
4360 FT_STRING, BASE_NONE, NULL, 0x00,
4361 "MAC parameter (Content-Type: application/vnd.wap.connectivity-wbxml)", HFILL
4364 { &hf_wsp_parameter_upart_type,
4366 "wsp.content_type.parameter.upart.type",
4367 FT_STRING, BASE_NONE, NULL, 0x00,
4368 "Multipart type", HFILL
4371 { &hf_wsp_parameter_upart_type_value,
4373 "wsp.content_type.parameter.upart.type.int",
4374 FT_UINT8, BASE_DEC, NULL, 0x00,
4375 "Multipart type (int value)", HFILL
4378 { &hf_wsp_reply_data,
4381 FT_NONE, BASE_NONE, NULL, 0x00,
4385 { &hf_wsp_header_shift_code,
4388 /*FT_NONE, BASE_DEC, NULL, 0x00,*/
4389 FT_UINT8, BASE_HEX, NULL, 0x00,
4390 "Header code page shift code", HFILL
4393 { &hf_wsp_header_accept,
4395 "wsp.header.accept",
4396 /*FT_NONE, BASE_DEC, NULL, 0x00,*/
4397 FT_UINT8, BASE_HEX, VALS ( vals_content_types ), 0x00,
4401 { &hf_wsp_header_accept_str,
4403 "wsp.header.accept.string",
4404 FT_STRING, BASE_NONE, NULL, 0x00,
4408 { &hf_wsp_header_accept_application,
4409 { "Accept-Application",
4410 "wsp.header.accept_application",
4411 FT_UINT32, BASE_HEX, NULL, 0x00,
4412 "Accept-Application", HFILL
4415 { &hf_wsp_header_accept_application_str,
4416 { "Accept-Application",
4417 "wsp.header.accept_application.string",
4418 FT_STRING, BASE_NONE, NULL, 0x00,
4419 "Accept-Application", HFILL
4422 { &hf_wsp_header_accept_charset,
4424 "wsp.header.accept_charset",
4425 FT_UINT16, BASE_HEX, VALS ( vals_character_sets ), 0x00,
4426 "Accept-Charset", HFILL
4429 { &hf_wsp_header_accept_charset_str,
4431 "wsp.header.accept_charset.string",
4432 FT_STRING, BASE_NONE, NULL, 0x00,
4433 "Accept-Charset", HFILL
4436 { &hf_wsp_header_accept_language,
4437 { "Accept-Language",
4438 "wsp.header.accept_language",
4439 FT_UINT8, BASE_HEX, VALS ( vals_languages ), 0x00,
4440 "Accept-Language", HFILL
4443 { &hf_wsp_header_accept_language_str,
4444 { "Accept-Language",
4445 "wsp.header.accept_language.string",
4446 FT_STRING, BASE_NONE, NULL, 0x00,
4447 "Accept-Language", HFILL
4450 { &hf_wsp_header_accept_ranges,
4452 "wsp.header.accept_ranges",
4453 FT_UINT8, BASE_HEX, VALS ( vals_accept_ranges ), 0x00,
4454 "Accept-Ranges", HFILL
4457 { &hf_wsp_header_accept_ranges_str,
4459 "wsp.header.accept_ranges.string",
4460 FT_STRING, BASE_NONE, NULL, 0x00,
4461 "Accept-Ranges", HFILL
4464 { &hf_wsp_header_age,
4467 FT_UINT32, BASE_DEC, NULL, 0x00,
4471 { &hf_wsp_header_openwave_proxy_push_addr,
4472 { "x-up-proxy-push-addr",
4473 "wsp.header.x-up-proxy-push-addr",
4474 FT_BYTES, BASE_HEX, NULL, 0x00,
4475 "The network address and port number that the handset can receive UPNOTIFY pushes on.", HFILL
4478 { &hf_wsp_header_openwave_proxy_push_accept,
4479 { "x-up-proxy-push-accept",
4480 "wsp.header.x-up-proxy-push-accept",
4481 FT_STRING, BASE_NONE, NULL, 0x00,
4482 "The content types that the handset can handle when sent via UPNOTIFY pushes.", HFILL
4485 { &hf_wsp_header_openwave_proxy_push_seq,
4486 { "x-up-proxy-push-seq",
4487 "wsp.header.x-up-proxy-push-seq",
4488 FT_UINT16, BASE_DEC, NULL, 0x00,
4489 "Specifies the sequence number of the last UPNOTIFY push sent.", HFILL
4492 { &hf_wsp_header_openwave_proxy_notify,
4493 { "x-up-proxy-notify",
4494 "wsp.header.x-up-proxy-notify",
4495 FT_UINT8, BASE_DEC, NULL, 0x00,
4496 "Indicates to the handset that there are pending UPNOTIFY pushes waiting.", HFILL
4499 { &hf_wsp_header_openwave_proxy_operator_domain,
4500 { "x-up-proxy-operator-domain",
4501 "wsp.header.x-up-proxy-operator-domain",
4502 FT_STRING, BASE_NONE, NULL, 0x00,
4503 "Indicates the Trusted Provisioning Domain.", HFILL
4506 { &hf_wsp_header_openwave_proxy_home_page,
4507 { "x-up-proxy-home-page",
4508 "wsp.header.x-up-proxy-home-page",
4509 FT_STRING, BASE_NONE, NULL, 0x00,
4510 "Specifies the server-assigned home page URL.", HFILL
4513 { &hf_wsp_header_openwave_devcap_has_color,
4514 { "x-up-devcap-has-color",
4515 "wsp.header.x-up-devcap-has-color",
4516 FT_UINT8, BASE_DEC, NULL, 0x00,
4517 "Indicates if the handset supports colour.", HFILL
4520 { &hf_wsp_header_openwave_devcap_num_softkeys,
4521 { "x-up-devcap-num-softkeys",
4522 "wsp.header.x-up-devcap-num-softkeys",
4523 FT_UINT8, BASE_DEC, NULL, 0x00,
4524 "The number of softkeys that can be displayed on the handset.", HFILL
4527 { &hf_wsp_header_openwave_devcap_softkey_size,
4528 { "x-up-devcap-softkey-size",
4529 "wsp.header.x-up-devcap-softkey-size",
4530 FT_UINT8, BASE_DEC, NULL, 0x00,
4531 "The number of chars that can be displayed on a softkey label.", HFILL
4534 { &hf_wsp_header_openwave_devcap_screen_chars,
4535 { "x-up-devcap-screen-chars",
4536 "wsp.header.x-up-devcap-screen-chars",
4537 FT_UINT8, BASE_DEC, NULL, 0x00,
4538 "The height and width of the handset's display in characters.", HFILL
4541 { &hf_wsp_header_openwave_devcap_screen_pixels,
4542 { "x-up-devcap-screen-pixels",
4543 "wsp.header.x-up-devcap-screen-pixels",
4544 FT_UINT32, BASE_DEC, NULL, 0x00,
4545 "The height and width of the handset's display in pixels.", HFILL
4548 { &hf_wsp_header_openwave_devcap_em_size,
4549 { "x-up-devcap-em-size",
4550 "wsp.header.x-up-devcap-em-size",
4551 FT_UINT32, BASE_DEC, NULL, 0x00,
4552 "The height and width of an uppercase M in pixels in a handset.", HFILL
4555 { &hf_wsp_header_openwave_devcap_screen_depth,
4556 { "x-up-devcap-screen-depth",
4557 "wsp.header.x-up-devcap-screen-depth",
4558 FT_UINT8, BASE_DEC, NULL, 0x00,
4559 "The colour/gray depth of the display in bits.", HFILL
4562 { &hf_wsp_header_openwave_devcap_immed_alert,
4563 { "x-up-devcap-immed-alert",
4564 "wsp.header.x-up-devcap-immed-alert",
4565 FT_UINT8, BASE_DEC, NULL, 0x00,
4566 "Indicates if the handset has support for immediate UPNOTIFY alerts.", HFILL
4569 { &hf_wsp_header_openwave_proxy_net_ask,
4570 { "x-up-proxy-net-ask",
4571 "wsp.header.x-up-proxy-net-ask",
4572 FT_UINT8, BASE_DEC, NULL, 0x00,
4573 "Indicates to browser if circuit switched call is allowed without user interaction", HFILL
4576 { &hf_wsp_header_openwave_proxy_uplink_version,
4577 { "x-up-proxy-uplink-version",
4578 "wsp.header.x-up-proxy-uplink-version",
4579 FT_STRING, BASE_NONE, NULL, 0x00,
4580 "Version of the MAG WAP gateway", HFILL
4583 { &hf_wsp_header_openwave_proxy_tod,
4585 "wsp.header.x-up-proxy-tod",
4586 FT_UINT8, BASE_DEC, NULL, 0x00,
4587 "Time of day", HFILL
4590 { &hf_wsp_header_openwave_proxy_ba_enable,
4591 { "x-up-proxy-ba-enable",
4592 "wsp.header.x-up-proxy-ba-enable",
4593 FT_UINT8, BASE_DEC, NULL, 0x00,
4594 "Indicates if the WAP gateway should cache basic authentication details on behalf of the handset", HFILL
4597 { &hf_wsp_header_openwave_proxy_ba_realm,
4598 { "x-up-proxy-ba-realm",
4599 "wsp.header.x-up-proxy-ba-realm",
4600 FT_STRING, BASE_NONE, NULL, 0x00,
4601 "Indicates the realm within which basic authentication credentials apply", HFILL
4604 { &hf_wsp_header_openwave_proxy_redirect_enable,
4605 { "x-up-proxy-redirect-enable",
4606 "wsp.header.x-up-proxy-redirect-enable",
4607 FT_UINT8, BASE_DEC, NULL, 0x00,
4608 "Indicates if the handset wants the WAP gateway to handle HTTP redirects on its behalf", HFILL
4611 { &hf_wsp_header_openwave_proxy_request_uri,
4612 { "x-up-proxy-request-uri",
4613 "wsp.header.x-up-proxy-request-uri",
4614 FT_STRING, BASE_NONE, NULL, 0x00,
4615 "Indicates to the handset that the previous request was redirected to the specified URI", HFILL
4618 { &hf_wsp_header_openwave_proxy_redirect_status,
4619 { "x-up-proxy-redirect-status",
4620 "wsp.header.x-up-proxy-redirect-status",
4621 FT_UINT32, BASE_DEC, NULL, 0x00,
4622 "Indicates the status of a redirect performed on behalf of a handset", HFILL
4625 { &hf_wsp_header_openwave_proxy_trans_charset,
4626 { "x-up-proxy-trans-charset",
4627 "wsp.header.x-up-proxy-trans-charset",
4628 FT_UINT16, BASE_HEX, VALS ( vals_character_sets ), 0x00,
4629 "For POSTs indicates the charset encoding of a document", HFILL
4632 { &hf_wsp_header_openwave_proxy_trans_charset_str,
4633 { "x-up-proxy-trans-charset",
4634 "wsp.header.x-up-proxy-trans-charset.string",
4635 FT_STRING, BASE_NONE, NULL, 0x00,
4636 "For POSTs indicates the charset encoding of a document", HFILL
4639 { &hf_wsp_header_openwave_proxy_linger,
4640 { "x-up-proxy-linger",
4641 "wsp.header.x-up-proxy-linger",
4642 FT_UINT8, BASE_DEC, NULL, 0x00,
4643 "Indicates the circuit linger time in seconds", HFILL
4646 { &hf_wsp_header_openwave_proxy_client_id,
4647 { "x-up-proxy-client-id",
4648 "wsp.header.x-up-proxy-client-id",
4649 FT_BYTES, BASE_DEC, NULL, 0x00,
4650 "The ClientId of the handset", HFILL
4653 { &hf_wsp_header_openwave_proxy_enable_trust,
4654 { "x-up-proxy-enable-trust",
4655 "wsp.header.x-up-proxy-enable-trust",
4656 FT_UINT8, BASE_DEC, NULL, 0x00,
4657 "Indicates whether to enable Trusted Provisioning Domain", HFILL
4660 { &hf_wsp_header_openwave_proxy_trust_old,
4661 { "x-up-proxy-trust-old",
4662 "wsp.header.x-up-proxy-trust-old",
4663 FT_UINT8, BASE_DEC, NULL, 0x00,
4664 "Indicates if the content being returned was received from within the Trusted Provisioning Domain", HFILL
4667 { &hf_wsp_header_openwave_proxy_trust,
4668 { "x-up-proxy-trust",
4669 "wsp.header.x-up-proxy-trust",
4670 FT_UINT8, BASE_DEC, NULL, 0x00,
4671 "Indicates if the content being returned was received from within the Trusted Provisioning Domain", HFILL
4674 { &hf_wsp_header_openwave_proxy_bookmark,
4675 { "x-up-proxy-bookmark",
4676 "wsp.header.x-up-proxy-bookmark",
4677 FT_STRING, BASE_NONE, NULL, 0x00,
4678 "Specifies the URL to use for server-side bookmarks", HFILL
4681 { &hf_wsp_header_openwave_devcap_gui,
4682 { "x-up-devcap-gui",
4683 "wsp.header.x-up-devcap-gui",
4684 FT_UINT8, BASE_DEC, NULL, 0x00,
4685 "Indicates if the handset has a GUI", HFILL
4688 { &hf_wsp_header_bearer_indication,
4690 * XXX - I'm assuming that the bearer indication is
4691 * just a bearer type.
4693 { "Bearer-indication",
4694 "wsp.header.bearer_indication",
4695 FT_UINT32, BASE_HEX, VALS(vals_bearer_types), 0x00,
4696 "Bearer-indication", HFILL
4699 { &hf_wsp_header_cache_control,
4701 "wsp.header.cache_control",
4702 FT_UINT8, BASE_HEX, VALS ( vals_cache_control ), 0x00,
4703 "Cache-Control", HFILL
4706 { &hf_wsp_header_cache_control_str,
4708 "wsp.header.cache_control.string",
4709 FT_STRING, BASE_NONE, NULL, 0x00,
4710 "Cache-Control", HFILL
4713 { &hf_wsp_header_cache_control_field_name,
4715 "wsp.header.cache_control.field_name",
4716 FT_UINT8, BASE_HEX, VALS ( vals_field_names ), 0x00,
4717 "Cache-Control field name", HFILL
4720 { &hf_wsp_header_cache_control_field_name_str,
4722 "wsp.header.cache_control.field_name.str",
4723 FT_STRING, BASE_NONE, NULL, 0x00,
4724 "Cache-Control field name", HFILL
4727 { &hf_wsp_header_connection,
4729 "wsp.header.connection",
4730 FT_UINT8, BASE_HEX, VALS ( vals_connection ), 0x00,
4734 { &hf_wsp_header_connection_str,
4736 "wsp.header.connection_str",
4737 FT_STRING, BASE_NONE, NULL, 0x00,
4741 { &hf_wsp_header_content_length,
4743 "wsp.header.content_length",
4744 FT_UINT32, BASE_DEC, NULL, 0x00,
4745 "Content-Length", HFILL
4748 { &hf_wsp_header_date,
4751 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
4755 { &hf_wsp_header_etag,
4758 /*FT_NONE, BASE_DEC, NULL, 0x00,*/
4759 FT_STRING, BASE_NONE, NULL, 0x00,
4763 { &hf_wsp_header_expires,
4765 "wsp.header.expires",
4766 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
4770 { &hf_wsp_header_last_modified,
4772 "wsp.header.last_modified",
4773 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
4774 "Last-Modified", HFILL
4777 { &hf_wsp_header_location,
4779 "wsp.header.location",
4780 FT_STRING, BASE_NONE, NULL, 0x00,
4784 { &hf_wsp_header_if_modified_since,
4785 { "If-Modified-Since",
4786 "wsp.header.if_modified_since",
4787 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
4788 "If-Modified-Since", HFILL
4791 { &hf_wsp_header_pragma,
4793 "wsp.header.pragma",
4794 /*FT_NONE, BASE_DEC, NULL, 0x00,*/
4795 FT_STRING, BASE_NONE, NULL, 0x00,
4799 { &hf_wsp_header_authorization,
4801 "wsp.header.authorization",
4802 FT_NONE, BASE_NONE, NULL, 0x00,
4803 "Authorization", HFILL
4806 { &hf_wsp_header_authorization_scheme,
4807 { "Authentication scheme",
4808 "wsp.header.authorization.scheme",
4809 FT_STRING, BASE_NONE, NULL, 0x00,
4810 "Authorization: Authentication Scheme", HFILL
4813 { &hf_wsp_header_authorization_user_id,
4815 "wsp.header.authorization.user_id",
4816 FT_STRING, BASE_NONE, NULL, 0x00,
4817 "Authorization: Basic: User-ID", HFILL
4820 { &hf_wsp_header_authorization_password,
4822 "wsp.header.authorization.password",
4823 FT_STRING, BASE_NONE, NULL, 0x00,
4824 "Authorization: Basic: Password", HFILL
4827 { &hf_wsp_header_proxy_authorization,
4828 { "Proxy-Authorization",
4829 "wsp.header.proxy_authorization",
4830 FT_NONE, BASE_NONE, NULL, 0x00,
4831 "Proxy-Authorization", HFILL
4834 { &hf_wsp_header_proxy_authorization_scheme,
4835 { "Authentication scheme",
4836 "wsp.header.proxy_authorization.scheme",
4837 FT_STRING, BASE_NONE, NULL, 0x00,
4838 "Proxy-Authorization: Authentication Scheme", HFILL
4841 { &hf_wsp_header_proxy_authorization_user_id,
4843 "wsp.header.proxy_authorization.user_id",
4844 FT_STRING, BASE_NONE, NULL, 0x00,
4845 "Proxy-Authorization: Basic: User-ID", HFILL
4848 { &hf_wsp_header_proxy_authorization_password,
4850 "wsp.header.proxy_authorization.password",
4851 FT_STRING, BASE_NONE, NULL, 0x00,
4852 "Proxy-Authorization: Basic: Password", HFILL
4855 { &hf_wsp_header_www_authenticate,
4856 { "WWW-Authenticate",
4857 "wsp.header.www-authenticate",
4858 FT_STRING, BASE_NONE, NULL, 0x00,
4859 "Authenticate", HFILL
4862 { &hf_wsp_header_proxy_authenticate,
4863 { "Proxy-Authenticate",
4864 "wsp.header.proxy_authenticate",
4865 FT_STRING, BASE_NONE, NULL, 0x00,
4866 "Proxy-Authenticate", HFILL
4869 { &hf_wsp_header_profile,
4871 "wsp.header.profile",
4872 /*FT_NONE, BASE_DEC, NULL, 0x00,*/
4873 FT_STRING, BASE_NONE, NULL, 0x00,
4877 { &hf_wsp_header_server,
4879 "wsp.header.server",
4880 /*FT_NONE, BASE_DEC, NULL, 0x00,*/
4881 FT_STRING, BASE_NONE, NULL, 0x00,
4885 { &hf_wsp_header_transfer_encoding,
4886 { "Transfer Encoding",
4887 "wsp.header.transfer_enc",
4888 /*FT_NONE, BASE_DEC, NULL, 0x00,*/
4889 FT_UINT8, BASE_HEX, VALS ( vals_transfer_encoding ), 0x00,
4890 "Transfer Encoding", HFILL
4893 { &hf_wsp_header_transfer_encoding_str,
4894 { "Transfer Encoding",
4895 "wsp.header.transfer_enc_str",
4896 FT_STRING, BASE_NONE, NULL, 0x00,
4897 "Transfer Encoding", HFILL
4900 { &hf_wsp_header_user_agent,
4902 "wsp.header.user_agent",
4903 /*FT_NONE, BASE_DEC, NULL, 0x00,*/
4904 FT_STRING, BASE_NONE, NULL, 0x00,
4908 { &hf_wsp_header_via,
4911 FT_STRING, BASE_NONE, NULL, 0x00,
4915 { &hf_wsp_header_wap_application_id,
4916 { "X-Wap-Application-Id",
4917 "wsp.header.wap_application_id",
4918 FT_UINT8, BASE_HEX, NULL, 0x00,
4919 "WAP application id", HFILL
4922 { &hf_wsp_header_wap_application_id_str,
4923 { "X-Wap-Application-Id",
4924 "wsp.header.wap_application_id.string",
4925 FT_STRING, BASE_NONE, NULL, 0x00,
4926 "WAP application id", HFILL
4929 { &hf_wsp_header_warning,
4931 "wsp.header.warning",
4932 FT_NONE, BASE_NONE, NULL, 0x00,
4936 { &hf_wsp_header_warning_code,
4938 "wsp.header.warning.code",
4939 FT_UINT8, BASE_DEC, VALS (vals_wsp_warning_code), 0x00,
4940 "Warning Code", HFILL
4943 { &hf_wsp_header_warning_agent,
4945 "wsp.header.warning.agent",
4946 FT_STRING, BASE_NONE, NULL, 0x00,
4947 "Warning Agent", HFILL
4950 { &hf_wsp_header_warning_text,
4952 "wsp.header.warning.text",
4953 FT_STRING, BASE_NONE, NULL, 0x00,
4954 "Warning Text", HFILL
4957 { &hf_wsp_header_application_header,
4958 { "Application Header",
4959 "wsp.header.application_header",
4960 FT_STRING, BASE_NONE, NULL, 0x00,
4961 "Application Header", HFILL
4964 { &hf_wsp_header_application_value,
4965 { "Application Header Value",
4966 "wsp.header.application_header.value",
4967 FT_STRING, BASE_NONE, NULL, 0x00,
4968 "Application Header Value", HFILL
4971 { &hf_wsp_header_content_ID,
4973 "wsp.header.content-id",
4974 FT_STRING, BASE_NONE, NULL, 0x00,
4978 { &hf_wsp_header_x_wap_tod,
4980 "wsp.header.x_wap_tod",
4981 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
4985 { &hf_wsp_capabilities_client_SDU,
4987 "wsp.capabilities.client_SDU",
4988 FT_UINT8, BASE_DEC, NULL, 0x00,
4992 { &hf_wsp_capabilities_server_SDU,
4994 "wsp.capabilities.server_SDU",
4995 FT_UINT8, BASE_DEC, NULL, 0x00,
4999 { &hf_wsp_capabilities_protocol_opt,
5000 { "Protocol Options",
5001 "wsp.capabilities.protocol_opt",
5002 FT_STRING, BASE_HEX, NULL, 0x00,
5003 "Protocol Options", HFILL
5006 { &hf_wsp_capabilities_method_MOR,
5008 "wsp.capabilities.method_mor",
5009 FT_UINT8, BASE_DEC, NULL, 0x00,
5013 { &hf_wsp_capabilities_push_MOR,
5015 "wsp.capabilities.push_mor",
5016 FT_UINT8, BASE_DEC, NULL, 0x00,
5020 { &hf_wsp_capabilities_extended_methods,
5021 { "Extended Methods",
5022 "wsp.capabilities.extend_methods",
5023 FT_STRING, BASE_HEX, NULL, 0x00,
5024 "Extended Methods", HFILL
5027 { &hf_wsp_capabilities_header_code_pages,
5028 { "Header Code Pages",
5029 "wsp.capabilities.code_pages",
5030 FT_STRING, BASE_HEX, NULL, 0x00,
5031 "Header Code Pages", HFILL
5034 { &hf_wsp_capabilities_aliases,
5036 "wsp.capabilities.aliases",
5037 FT_UINT8, BASE_HEX, NULL, 0x00,
5041 { &hf_wsp_post_data,
5044 FT_NONE, BASE_NONE, NULL, 0x00,
5048 { &hf_wsp_push_data,
5051 FT_NONE, BASE_NONE, NULL, 0x00,
5055 { &hf_wsp_multipart_data,
5056 { "Data in this part",
5057 "wsp.multipart.data",
5058 FT_NONE, BASE_NONE, NULL, 0x00,
5059 "The data of 1 MIME-multipart part.", HFILL
5065 FT_UINT32, BASE_DEC, NULL, 0x00,
5066 "MIME part of multipart data.", HFILL
5069 { &hf_wsp_redirect_flags,
5071 "wsp.redirect_flags",
5072 FT_UINT8, BASE_HEX, NULL, 0x00,
5073 "Redirect Flags", HFILL
5076 { &hf_wsp_redirect_permanent,
5077 { "Permanent Redirect",
5078 "wsp.redirect_flags.permanent",
5079 FT_BOOLEAN, 8, TFS(&yes_no_truth), PERMANENT_REDIRECT,
5080 "Permanent Redirect", HFILL
5083 { &hf_wsp_redirect_reuse_security_session,
5084 { "Reuse Security Session",
5085 "wsp.redirect_flags.reuse_security_session",
5086 FT_BOOLEAN, 8, TFS(&yes_no_truth), REUSE_SECURITY_SESSION,
5087 "Permanent Redirect", HFILL
5090 { &hf_wsp_redirect_afl,
5093 FT_UINT8, BASE_HEX, NULL, 0x00,
5094 "Redirect Address Flags/Length", HFILL
5097 { &hf_wsp_redirect_afl_bearer_type_included,
5098 { "Bearer Type Included",
5099 "wsp.redirect_afl.bearer_type_included",
5100 FT_BOOLEAN, 8, TFS(&yes_no_truth), BEARER_TYPE_INCLUDED,
5101 "Redirect Address bearer type included", HFILL
5104 { &hf_wsp_redirect_afl_port_number_included,
5105 { "Port Number Included",
5106 "wsp.redirect_afl.port_number_included",
5107 FT_BOOLEAN, 8, TFS(&yes_no_truth), PORT_NUMBER_INCLUDED,
5108 "Redirect Address port number included", HFILL
5111 { &hf_wsp_redirect_afl_address_len,
5113 "wsp.redirect_afl.address_len",
5114 FT_UINT8, BASE_DEC, NULL, ADDRESS_LEN,
5115 "Redirect Address Length", HFILL
5118 { &hf_wsp_redirect_bearer_type,
5120 "wsp.redirect_bearer_type",
5121 FT_UINT8, BASE_HEX, VALS(vals_bearer_types), 0x0,
5122 "Redirect Bearer Type", HFILL
5125 { &hf_wsp_redirect_port_num,
5127 "wsp.redirect_port_num",
5128 FT_UINT16, BASE_DEC, NULL, 0x0,
5129 "Redirect Port Number", HFILL
5132 { &hf_wsp_redirect_ipv4_addr,
5134 "wsp.redirect_ipv4_addr",
5135 FT_IPv4, BASE_NONE, NULL, 0x0,
5136 "Redirect Address (IP)", HFILL
5139 { &hf_wsp_redirect_ipv6_addr,
5141 "wsp.redirect_ipv6_addr",
5142 FT_IPv6, BASE_NONE, NULL, 0x0,
5143 "Redirect Address (IPv6)", HFILL
5146 { &hf_wsp_redirect_addr,
5148 "wsp.redirect_addr",
5149 FT_BYTES, BASE_NONE, NULL, 0x0,
5150 "Redirect Address", HFILL
5155 /* Setup protocol subtree array */
5156 static gint *ett[] = {
5158 &ett_content_type_parameters,
5161 &ett_header_warning,
5162 &ett_header_cache_control_parameters,
5163 &ett_header_cache_control_field_names,
5167 &ett_redirect_flags,
5171 &ett_header_credentials,
5174 /* Register the protocol name and description */
5175 proto_wsp = proto_register_protocol(
5176 "Wireless Session Protocol", /* protocol name for use by ethereal */
5177 "WSP", /* short version of name */
5178 "wap-wsp" /* Abbreviated protocol name, should Match IANA
5179 < URL:http://www.isi.edu/in-notes/iana/assignments/port-numbers/ >
5183 /* Required function calls to register the header fields and subtrees used */
5184 proto_register_field_array(proto_wsp, hf, array_length(hf));
5185 proto_register_subtree_array(ett, array_length(ett));
5187 register_dissector("wsp-co", dissect_wsp_fromwap_co, proto_wsp);
5188 register_dissector("wsp-cl", dissect_wsp_fromwap_cl, proto_wsp);
5189 wsp_dissector_table = register_dissector_table("wsp.content_type.type",
5190 "WSP content type", FT_UINT8, BASE_HEX);
5191 register_heur_dissector_list("wsp", &heur_subdissector_list);
5193 wsp_fromudp_handle = create_dissector_handle(dissect_wsp_fromudp,
5198 proto_reg_handoff_wsp(void)
5201 * Get a handle for the WBXML dissector.
5203 wbxml_handle = find_dissector("wbxml");
5206 * And get a handle for the WTP-over-UDP dissector.
5208 wtp_fromudp_handle = find_dissector("wtp-udp");
5210 /* Only connection-less WSP has no previous handler */
5211 dissector_add("udp.port", UDP_PORT_WSP, wsp_fromudp_handle);
5212 dissector_add("udp.port", UDP_PORT_WSP_PUSH, wsp_fromudp_handle);
5214 /* This dissector is also called from the WTP and WTLS dissectors */