3 * Routines to dissect WSP component of WAP traffic.
7 * Refer to the AUTHORS file or the AUTHORS section in the man page
8 * for contacting the author(s) of this file.
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1998 Gerald Combs
14 * WAP dissector based on original work by Ben Fowler
15 * Updated by Neil Hunter.
17 * WTLS support by Alexandre P. Ferreira (Splice IP).
19 * Openwave header support by Dermot Bradley (Openwave).
21 * Code optimizations, header value dissection simplification with parse error
22 * notification and macros, extra missing headers, WBXML registration,
23 * summary line of WSP PDUs,
24 * Session Initiation Request dissection
27 * TODO - Move parts of dissection before and other parts after "if (tree)",
28 * for example skip almost all but content type in replies if tree is closed.
30 * This program is free software; you can redistribute it and/or
31 * modify it under the terms of the GNU General Public License
32 * as published by the Free Software Foundation; either version 2
33 * of the License, or (at your option) any later version.
35 * This program is distributed in the hope that it will be useful,
36 * but WITHOUT ANY WARRANTY; without even the implied warranty of
37 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38 * GNU General Public License for more details.
40 * You should have received a copy of the GNU General Public License
41 * along with this program; if not, write to the Free Software
42 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
48 #include <epan/packet.h>
49 #include <epan/to_str.h>
50 #include <epan/wmem/wmem.h>
51 #include <epan/conversation.h>
53 #include "packet-wap.h"
54 #include "packet-wsp.h"
56 /* General-purpose debug logger.
57 * Requires double parentheses because of variable arguments of printf().
59 * Enable debug logging for WSP by defining AM_CFLAGS
60 * so that it contains "-DDEBUG_wsp"
64 g_print("%s:%u: ", __FILE__, __LINE__); \
70 /* Statistics (see doc/README.tapping) */
72 static int wsp_tap
= -1;
75 /* File scoped variables for the protocol and registered fields */
76 static int proto_wsp
= HF_EMPTY
;
77 static int proto_sir
= HF_EMPTY
;
80 * Initialize the header field pointers
83 /* WSP header fields and their subfields if available */
84 static int hf_hdr_name
= HF_EMPTY
;
85 static int hf_hdr_accept
= HF_EMPTY
;
86 static int hf_hdr_accept_charset
= HF_EMPTY
;
87 static int hf_hdr_accept_encoding
= HF_EMPTY
;
88 static int hf_hdr_accept_language
= HF_EMPTY
;
89 static int hf_hdr_accept_ranges
= HF_EMPTY
;
90 static int hf_hdr_age
= HF_EMPTY
;
91 static int hf_hdr_allow
= HF_EMPTY
;
92 static int hf_hdr_authorization
= HF_EMPTY
;
93 static int hf_hdr_authorization_scheme
= HF_EMPTY
; /* Subfield */
94 static int hf_hdr_authorization_user_id
= HF_EMPTY
; /* Subfield */
95 static int hf_hdr_authorization_password
= HF_EMPTY
; /* Subfield */
96 static int hf_hdr_cache_control
= HF_EMPTY
;
97 static int hf_hdr_connection
= HF_EMPTY
;
98 static int hf_hdr_content_base
= HF_EMPTY
;
99 static int hf_hdr_content_encoding
= HF_EMPTY
;
100 static int hf_hdr_content_language
= HF_EMPTY
;
101 static int hf_hdr_content_length
= HF_EMPTY
;
102 static int hf_hdr_content_location
= HF_EMPTY
;
103 static int hf_hdr_content_md5
= HF_EMPTY
;
104 static int hf_hdr_content_range
= HF_EMPTY
;
105 static int hf_hdr_content_range_first_byte_pos
= HF_EMPTY
; /* Subfield */
106 static int hf_hdr_content_range_entity_length
= HF_EMPTY
; /* Subfield */
107 static int hf_hdr_content_type
= HF_EMPTY
;
108 static int hf_hdr_date
= HF_EMPTY
;
109 static int hf_hdr_etag
= HF_EMPTY
;
110 static int hf_hdr_expires
= HF_EMPTY
;
111 static int hf_hdr_from
= HF_EMPTY
;
112 static int hf_hdr_host
= HF_EMPTY
;
113 static int hf_hdr_if_modified_since
= HF_EMPTY
;
114 static int hf_hdr_if_match
= HF_EMPTY
;
115 static int hf_hdr_if_none_match
= HF_EMPTY
;
116 static int hf_hdr_if_range
= HF_EMPTY
;
117 static int hf_hdr_if_unmodified_since
= HF_EMPTY
;
118 static int hf_hdr_last_modified
= HF_EMPTY
;
119 static int hf_hdr_location
= HF_EMPTY
;
120 static int hf_hdr_max_forwards
= HF_EMPTY
;
121 static int hf_hdr_pragma
= HF_EMPTY
;
122 static int hf_hdr_proxy_authenticate
= HF_EMPTY
;
123 static int hf_hdr_proxy_authenticate_scheme
= HF_EMPTY
; /* Subfield */
124 static int hf_hdr_proxy_authenticate_realm
= HF_EMPTY
; /* Subfield */
125 static int hf_hdr_proxy_authorization
= HF_EMPTY
;
126 static int hf_hdr_proxy_authorization_scheme
= HF_EMPTY
; /* Subfield */
127 static int hf_hdr_proxy_authorization_user_id
= HF_EMPTY
; /* Subfield */
128 static int hf_hdr_proxy_authorization_password
= HF_EMPTY
; /* Subfield */
129 static int hf_hdr_public
= HF_EMPTY
;
130 static int hf_hdr_range
= HF_EMPTY
;
131 static int hf_hdr_range_first_byte_pos
= HF_EMPTY
; /* Subfield */
132 static int hf_hdr_range_last_byte_pos
= HF_EMPTY
; /* Subfield */
133 static int hf_hdr_range_suffix_length
= HF_EMPTY
; /* Subfield */
134 static int hf_hdr_referer
= HF_EMPTY
;
135 static int hf_hdr_retry_after
= HF_EMPTY
;
136 static int hf_hdr_server
= HF_EMPTY
;
137 static int hf_hdr_transfer_encoding
= HF_EMPTY
;
138 static int hf_hdr_upgrade
= HF_EMPTY
;
139 static int hf_hdr_user_agent
= HF_EMPTY
;
140 static int hf_hdr_vary
= HF_EMPTY
;
141 static int hf_hdr_via
= HF_EMPTY
;
142 static int hf_hdr_warning
= HF_EMPTY
;
143 static int hf_hdr_warning_code
= HF_EMPTY
; /* Subfield */
144 static int hf_hdr_warning_agent
= HF_EMPTY
; /* Subfield */
145 static int hf_hdr_warning_text
= HF_EMPTY
; /* Subfield */
146 static int hf_hdr_www_authenticate
= HF_EMPTY
;
147 static int hf_hdr_www_authenticate_scheme
= HF_EMPTY
; /* Subfield */
148 static int hf_hdr_www_authenticate_realm
= HF_EMPTY
; /* Subfield */
149 static int hf_hdr_content_disposition
= HF_EMPTY
;
150 static int hf_hdr_application_id
= HF_EMPTY
;
151 static int hf_hdr_content_uri
= HF_EMPTY
;
152 static int hf_hdr_initiator_uri
= HF_EMPTY
;
153 static int hf_hdr_bearer_indication
= HF_EMPTY
;
154 static int hf_hdr_push_flag
= HF_EMPTY
;
155 static int hf_hdr_push_flag_auth
= HF_EMPTY
; /* Subfield */
156 static int hf_hdr_push_flag_trust
= HF_EMPTY
; /* Subfield */
157 static int hf_hdr_push_flag_last
= HF_EMPTY
; /* Subfield */
158 static int hf_hdr_profile
= HF_EMPTY
;
159 static int hf_hdr_profile_diff
= HF_EMPTY
;
160 static int hf_hdr_profile_warning
= HF_EMPTY
;
161 static int hf_hdr_expect
= HF_EMPTY
;
162 static int hf_hdr_te
= HF_EMPTY
;
163 static int hf_hdr_trailer
= HF_EMPTY
;
164 static int hf_hdr_x_wap_tod
= HF_EMPTY
;
165 static int hf_hdr_content_id
= HF_EMPTY
;
166 static int hf_hdr_set_cookie
= HF_EMPTY
;
167 static int hf_hdr_cookie
= HF_EMPTY
;
168 static int hf_hdr_encoding_version
= HF_EMPTY
;
169 static int hf_hdr_x_wap_security
= HF_EMPTY
;
170 static int hf_hdr_x_wap_application_id
= HF_EMPTY
;
171 static int hf_hdr_accept_application
= HF_EMPTY
;
174 /* Openwave headers */
175 static int hf_hdr_openwave_x_up_proxy_operator_domain
= HF_EMPTY
;
176 static int hf_hdr_openwave_x_up_proxy_home_page
= HF_EMPTY
;
177 static int hf_hdr_openwave_x_up_proxy_uplink_version
= HF_EMPTY
;
178 static int hf_hdr_openwave_x_up_proxy_ba_realm
= HF_EMPTY
;
179 static int hf_hdr_openwave_x_up_proxy_request_uri
= HF_EMPTY
;
181 static int hf_hdr_openwave_x_up_proxy_client_id
= HF_EMPTY
;
183 static int hf_hdr_openwave_x_up_proxy_bookmark
= HF_EMPTY
;
184 static int hf_hdr_openwave_x_up_proxy_push_seq
= HF_EMPTY
;
185 static int hf_hdr_openwave_x_up_proxy_notify
= HF_EMPTY
;
186 static int hf_hdr_openwave_x_up_proxy_net_ask
= HF_EMPTY
;
187 static int hf_hdr_openwave_x_up_proxy_tod
= HF_EMPTY
;
188 static int hf_hdr_openwave_x_up_proxy_ba_enable
= HF_EMPTY
;
189 static int hf_hdr_openwave_x_up_proxy_redirect_enable
= HF_EMPTY
;
190 static int hf_hdr_openwave_x_up_proxy_redirect_status
= HF_EMPTY
;
191 static int hf_hdr_openwave_x_up_proxy_linger
= HF_EMPTY
;
192 static int hf_hdr_openwave_x_up_proxy_enable_trust
= HF_EMPTY
;
193 static int hf_hdr_openwave_x_up_proxy_trust
= HF_EMPTY
;
194 static int hf_hdr_openwave_x_up_devcap_has_color
= HF_EMPTY
;
195 static int hf_hdr_openwave_x_up_devcap_num_softkeys
= HF_EMPTY
;
196 static int hf_hdr_openwave_x_up_devcap_softkey_size
= HF_EMPTY
;
197 static int hf_hdr_openwave_x_up_devcap_screen_chars
= HF_EMPTY
;
198 static int hf_hdr_openwave_x_up_devcap_screen_pixels
= HF_EMPTY
;
199 static int hf_hdr_openwave_x_up_devcap_em_size
= HF_EMPTY
;
200 static int hf_hdr_openwave_x_up_devcap_screen_depth
= HF_EMPTY
;
201 static int hf_hdr_openwave_x_up_devcap_immed_alert
= HF_EMPTY
;
202 static int hf_hdr_openwave_x_up_devcap_gui
= HF_EMPTY
;
203 static int hf_hdr_openwave_x_up_proxy_trans_charset
= HF_EMPTY
;
204 static int hf_hdr_openwave_x_up_proxy_push_accept
= HF_EMPTY
;
207 /* WSP parameter fields */
208 static int hf_parameter_q
= HF_EMPTY
;
209 static int hf_parameter_charset
= HF_EMPTY
;
211 static int hf_parameter_textual
= HF_EMPTY
;
212 static int hf_parameter_type
= HF_EMPTY
;
213 static int hf_parameter_name
= HF_EMPTY
;
214 static int hf_parameter_filename
= HF_EMPTY
;
215 static int hf_parameter_start
= HF_EMPTY
;
216 static int hf_parameter_start_info
= HF_EMPTY
;
217 static int hf_parameter_comment
= HF_EMPTY
;
218 static int hf_parameter_domain
= HF_EMPTY
;
219 static int hf_parameter_path
= HF_EMPTY
;
220 static int hf_parameter_sec
= HF_EMPTY
;
221 static int hf_parameter_mac
= HF_EMPTY
;
222 static int hf_parameter_upart_type
= HF_EMPTY
;
223 static int hf_parameter_upart_type_value
= HF_EMPTY
;
224 static int hf_parameter_level
= HF_EMPTY
;
227 /* Old header fields */
229 static int hf_wsp_header_tid
= HF_EMPTY
;
230 static int hf_wsp_header_pdu_type
= HF_EMPTY
;
231 static int hf_wsp_version_major
= HF_EMPTY
;
232 static int hf_wsp_version_minor
= HF_EMPTY
;
233 /* Session capabilities (CO-WSP) */
234 static int hf_capabilities_length
= HF_EMPTY
;
235 static int hf_capabilities_section
= HF_EMPTY
;
236 static int hf_capa_client_sdu_size
= HF_EMPTY
;
237 static int hf_capa_server_sdu_size
= HF_EMPTY
;
238 static int hf_capa_protocol_options
= HF_EMPTY
;
239 static int hf_capa_protocol_option_confirmed_push
= HF_EMPTY
; /* Subfield */
240 static int hf_capa_protocol_option_push
= HF_EMPTY
; /* Subfield */
241 static int hf_capa_protocol_option_session_resume
= HF_EMPTY
; /* Subfield */
242 static int hf_capa_protocol_option_ack_headers
= HF_EMPTY
; /* Subfield */
243 static int hf_capa_protocol_option_large_data_transfer
= HF_EMPTY
; /* Subfield */
244 static int hf_capa_method_mor
= HF_EMPTY
;
245 static int hf_capa_push_mor
= HF_EMPTY
;
246 static int hf_capa_extended_methods
= HF_EMPTY
;
247 static int hf_capa_header_code_pages
= HF_EMPTY
;
248 static int hf_capa_aliases
= HF_EMPTY
;
249 static int hf_capa_client_message_size
= HF_EMPTY
;
250 static int hf_capa_server_message_size
= HF_EMPTY
;
252 static int hf_wsp_header_uri_len
= HF_EMPTY
;
253 static int hf_wsp_header_uri
= HF_EMPTY
;
254 static int hf_wsp_server_session_id
= HF_EMPTY
;
255 static int hf_wsp_header_status
= HF_EMPTY
;
256 static int hf_wsp_header_length
= HF_EMPTY
;
257 static int hf_wsp_headers_section
= HF_EMPTY
;
258 static int hf_wsp_parameter_type
= HF_EMPTY
;
259 static int hf_wsp_parameter_name
= HF_EMPTY
;
260 static int hf_wsp_parameter_filename
= HF_EMPTY
;
261 static int hf_wsp_parameter_start
= HF_EMPTY
;
262 static int hf_wsp_parameter_start_info
= HF_EMPTY
;
263 static int hf_wsp_parameter_comment
= HF_EMPTY
;
264 static int hf_wsp_parameter_domain
= HF_EMPTY
;
265 static int hf_wsp_parameter_path
= HF_EMPTY
;
266 static int hf_wsp_parameter_sec
= HF_EMPTY
;
267 static int hf_wsp_parameter_mac
= HF_EMPTY
;
268 static int hf_wsp_parameter_upart_type
= HF_EMPTY
;
269 static int hf_wsp_parameter_level
= HF_EMPTY
;
270 static int hf_wsp_parameter_size
= HF_EMPTY
;
272 static int hf_wsp_reply_data
= HF_EMPTY
;
274 static int hf_wsp_post_data
= HF_EMPTY
;
276 static int hf_wsp_push_data
= HF_EMPTY
;
277 static int hf_wsp_multipart_data
= HF_EMPTY
;
279 static int hf_wsp_mpart
= HF_EMPTY
;
281 /* Header code page shift sequence */
282 static int hf_wsp_header_shift_code
= HF_EMPTY
;
284 /* WSP Redirect fields */
285 static int hf_wsp_redirect_flags
= HF_EMPTY
;
286 static int hf_wsp_redirect_permanent
= HF_EMPTY
;
287 static int hf_wsp_redirect_reuse_security_session
= HF_EMPTY
;
288 static int hf_redirect_addresses
= HF_EMPTY
;
291 static int hf_address_entry
= HF_EMPTY
;
292 static int hf_address_flags_length
= HF_EMPTY
;
293 static int hf_address_flags_length_bearer_type_included
= HF_EMPTY
; /* Subfield */
294 static int hf_address_flags_length_port_number_included
= HF_EMPTY
; /* Subfield */
295 static int hf_address_flags_length_address_len
= HF_EMPTY
; /* Subfield */
296 static int hf_address_bearer_type
= HF_EMPTY
;
297 static int hf_address_port_num
= HF_EMPTY
;
298 static int hf_address_ipv4_addr
= HF_EMPTY
;
299 static int hf_address_ipv6_addr
= HF_EMPTY
;
300 static int hf_address_addr
= HF_EMPTY
;
302 /* Session Initiation Request fields */
303 static int hf_sir_section
= HF_EMPTY
;
304 static int hf_sir_version
= HF_EMPTY
;
305 static int hf_sir_app_id_list_len
= HF_EMPTY
;
306 static int hf_sir_app_id_list
= HF_EMPTY
;
307 static int hf_sir_wsp_contact_points_len
= HF_EMPTY
;
308 static int hf_sir_wsp_contact_points
= HF_EMPTY
;
309 static int hf_sir_contact_points_len
= HF_EMPTY
;
310 static int hf_sir_contact_points
= HF_EMPTY
;
311 static int hf_sir_protocol_options_len
= HF_EMPTY
;
312 static int hf_sir_protocol_options
= HF_EMPTY
;
313 static int hf_sir_prov_url_len
= HF_EMPTY
;
314 static int hf_sir_prov_url
= HF_EMPTY
;
315 static int hf_sir_cpi_tag_len
= HF_EMPTY
;
316 static int hf_sir_cpi_tag
= HF_EMPTY
;
319 * Initialize the subtree pointers
323 static int ett_wsp
= ETT_EMPTY
;
324 /* WSP headers tree */
325 static int ett_header
= ETT_EMPTY
;
326 /* WSP header subtree */
327 static int ett_headers
= ETT_EMPTY
;
328 /* CO-WSP session capabilities */
329 static int ett_capabilities
= ETT_EMPTY
;
330 static int ett_capability
= ETT_EMPTY
;
331 static int ett_post
= ETT_EMPTY
;
332 static int ett_redirect_flags
= ETT_EMPTY
;
333 static int ett_address_flags
= ETT_EMPTY
;
334 static int ett_multiparts
= ETT_EMPTY
;
335 static int ett_mpartlist
= ETT_EMPTY
;
336 /* Session Initiation Request tree */
337 static int ett_sir
= ETT_EMPTY
;
338 static int ett_addresses
= ETT_EMPTY
;
339 static int ett_address
= ETT_EMPTY
;
343 /* Handle for WSP-over-UDP dissector */
344 static dissector_handle_t wsp_fromudp_handle
;
346 /* Handle for WTP-over-UDP dissector */
347 static dissector_handle_t wtp_fromudp_handle
;
349 /* Handle for generic media dissector */
350 static dissector_handle_t media_handle
;
352 /* Handle for WBXML-encoded UAPROF dissector */
353 static dissector_handle_t wbxml_uaprof_handle
;
355 static const value_string wsp_vals_pdu_type
[] = {
356 { 0x00, "Reserved" },
358 { 0x02, "ConnectReply" },
359 { 0x03, "Redirect" },
361 { 0x05, "Disconnect" },
363 { 0x07, "ConfirmedPush" },
367 /* 0x10 - 0x3F Unassigned */
375 /* 0x45 - 0x4F Unassigned (Get PDU) */
376 /* 0x50 - 0x5F Extended method (Get PDU) */
377 { 0x50, "Extended Get Method 0"},
378 { 0x51, "Extended Get Method 1"},
379 { 0x52, "Extended Get Method 2"},
380 { 0x53, "Extended Get Method 3"},
381 { 0x54, "Extended Get Method 4"},
382 { 0x55, "Extended Get Method 5"},
383 { 0x56, "Extended Get Method 6"},
384 { 0x57, "Extended Get Method 7"},
385 { 0x58, "Extended Get Method 8"},
386 { 0x59, "Extended Get Method 9"},
387 { 0x5A, "Extended Get Method 10"},
388 { 0x5B, "Extended Get Method 11"},
389 { 0x5C, "Extended Get Method 12"},
390 { 0x5D, "Extended Get Method 13"},
391 { 0x5E, "Extended Get Method 14"},
392 { 0x5F, "Extended Get Method 15"},
397 /* 0x62 - 0x6F Unassigned (Post PDU) */
398 /* 0x70 - 0x7F Extended method (Post PDU) */
399 { 0x70, "Extended Post Method 0"},
400 { 0x71, "Extended Post Method 1"},
401 { 0x72, "Extended Post Method 2"},
402 { 0x73, "Extended Post Method 3"},
403 { 0x74, "Extended Post Method 4"},
404 { 0x75, "Extended Post Method 5"},
405 { 0x76, "Extended Post Method 6"},
406 { 0x77, "Extended Post Method 7"},
407 { 0x78, "Extended Post Method 8"},
408 { 0x79, "Extended Post Method 9"},
409 { 0x7A, "Extended Post Method 10"},
410 { 0x7B, "Extended Post Method 11"},
411 { 0x7C, "Extended Post Method 12"},
412 { 0x7D, "Extended Post Method 13"},
413 { 0x7E, "Extended Post Method 14"},
414 { 0x7F, "Extended Post Method 15"},
416 /* 0x80 - 0xFF Reserved */
421 value_string_ext wsp_vals_pdu_type_ext
= VALUE_STRING_EXT_INIT(wsp_vals_pdu_type
);
423 /* The WSP status codes are inherited from the HTTP status codes */
424 static const value_string wsp_vals_status
[] = {
425 /* 0x00 - 0x0F Reserved */
427 { 0x10, "100 Continue" },
428 { 0x11, "101 Switching Protocols" },
431 { 0x21, "201 Created" },
432 { 0x22, "202 Accepted" },
433 { 0x23, "203 Non-Authoritative Information" },
434 { 0x24, "204 No Content" },
435 { 0x25, "205 Reset Content" },
436 { 0x26, "206 Partial Content" },
438 { 0x30, "300 Multiple Choices" },
439 { 0x31, "301 Moved Permanently" },
440 { 0x32, "302 Moved Temporarily" },
441 { 0x33, "303 See Other" },
442 { 0x34, "304 Not Modified" },
443 { 0x35, "305 Use Proxy" },
444 { 0x37, "307 Temporary Redirect" },
446 { 0x40, "400 Bad Request" },
447 { 0x41, "401 Unauthorised" },
448 { 0x42, "402 Payment Required" },
449 { 0x43, "403 Forbidden" },
450 { 0x44, "404 Not Found" },
451 { 0x45, "405 Method Not Allowed" },
452 { 0x46, "406 Not Acceptable" },
453 { 0x47, "407 Proxy Authentication Required" },
454 { 0x48, "408 Request Timeout" },
455 { 0x49, "409 Conflict" },
456 { 0x4A, "410 Gone" },
457 { 0x4B, "411 Length Required" },
458 { 0x4C, "412 Precondition Failed" },
459 { 0x4D, "413 Request Entity Too Large" },
460 { 0x4E, "414 Request-URI Too Large" },
461 { 0x4F, "415 Unsupported Media Type" },
462 { 0x50, "416 Requested Range Not Satisfiable" },
463 { 0x51, "417 Expectation Failed" },
465 { 0x60, "500 Internal Server Error" },
466 { 0x61, "501 Not Implemented" },
467 { 0x62, "502 Bad Gateway" },
468 { 0x63, "503 Service Unavailable" },
469 { 0x64, "504 Gateway Timeout" },
470 { 0x65, "505 WSP/HTTP Version Not Supported" },
474 value_string_ext wsp_vals_status_ext
= VALUE_STRING_EXT_INIT(wsp_vals_status
);
476 static const value_string vals_wsp_reason_codes
[] = {
477 { 0xE0, "Protocol Error (Illegal PDU)" },
478 { 0xE1, "Session disconnected" },
479 { 0xE2, "Session suspended" },
480 { 0xE3, "Session resumed" },
481 { 0xE4, "Peer congested" },
482 { 0xE5, "Session connect failed" },
483 { 0xE6, "Maximum receive unit size exceeded" },
484 { 0xE7, "Maximum outstanding requests exceeded" },
485 { 0xE8, "Peer request" },
486 { 0xE9, "Network error" },
487 { 0xEA, "User request" },
488 { 0xEB, "No specific cause, no retries" },
489 { 0xEC, "Push message cannot be delivered" },
490 { 0xED, "Push message discarded" },
491 { 0xEE, "Content type cannot be processed" },
495 value_string_ext vals_wsp_reason_codes_ext
= VALUE_STRING_EXT_INIT(vals_wsp_reason_codes
);
500 #define FN_ACCEPT 0x00
501 #define FN_ACCEPT_CHARSET_DEP 0x01 /* encoding version 1.1, deprecated */
502 #define FN_ACCEPT_ENCODING_DEP 0x02 /* encoding version 1.1, deprecated */
503 #define FN_ACCEPT_LANGUAGE 0x03
504 #define FN_ACCEPT_RANGES 0x04
506 #define FN_ALLOW 0x06
507 #define FN_AUTHORIZATION 0x07
508 #define FN_CACHE_CONTROL_DEP 0x08 /* encoding version 1.1, deprecated */
509 #define FN_CONNECTION 0x09
510 #define FN_CONTENT_BASE 0x0A
511 #define FN_CONTENT_ENCODING 0x0B
512 #define FN_CONTENT_LANGUAGE 0x0C
513 #define FN_CONTENT_LENGTH 0x0D
514 #define FN_CONTENT_LOCATION 0x0E
515 #define FN_CONTENT_MD5 0x0F
516 #define FN_CONTENT_RANGE_DEP 0x10 /* encoding version 1.1, deprecated */
517 #define FN_CONTENT_TYPE 0x11
520 #define FN_EXPIRES 0x14
523 #define FN_IF_MODIFIED_SINCE 0x17
524 #define FN_IF_MATCH 0x18
525 #define FN_IF_NONE_MATCH 0x19
526 #define FN_IF_RANGE 0x1A
527 #define FN_IF_UNMODIFIED_SINCE 0x1B
528 #define FN_LOCATION 0x1C
529 #define FN_LAST_MODIFIED 0x1D
530 #define FN_MAX_FORWARDS 0x1E
531 #define FN_PRAGMA 0x1F
532 #define FN_PROXY_AUTHENTICATE 0x20
533 #define FN_PROXY_AUTHORIZATION 0x21
534 #define FN_PUBLIC 0x22
535 #define FN_RANGE 0x23
536 #define FN_REFERER 0x24
537 #define FN_RETRY_AFTER 0x25
538 #define FN_SERVER 0x26
539 #define FN_TRANSFER_ENCODING 0x27
540 #define FN_UPGRADE 0x28
541 #define FN_USER_AGENT 0x29
544 #define FN_WARNING 0x2C
545 #define FN_WWW_AUTHENTICATE 0x2D
546 #define FN_CONTENT_DISPOSITION 0x2E
547 #define FN_X_WAP_APPLICATION_ID 0x2F
548 #define FN_X_WAP_CONTENT_URI 0x30
549 #define FN_X_WAP_INITIATOR_URI 0x31
550 #define FN_ACCEPT_APPLICATION 0x32
551 #define FN_BEARER_INDICATION 0x33
552 #define FN_PUSH_FLAG 0x34
553 #define FN_PROFILE 0x35
554 #define FN_PROFILE_DIFF 0x36
555 #define FN_PROFILE_WARNING 0x37
556 #define FN_EXPECT 0x38
558 #define FN_TRAILER 0x3A
559 #define FN_ACCEPT_CHARSET 0x3B /* encoding version 1.3 */
560 #define FN_ACCEPT_ENCODING 0x3C /* encoding version 1.3 */
561 #define FN_CACHE_CONTROL 0x3D /* encoding version 1.3 */
562 #define FN_CONTENT_RANGE 0x3E /* encoding version 1.3 */
563 #define FN_X_WAP_TOD 0x3F
564 #define FN_CONTENT_ID 0x40
565 #define FN_SET_COOKIE 0x41
566 #define FN_COOKIE 0x42
567 #define FN_ENCODING_VERSION 0x43
568 #define FN_PROFILE_WARNING14 0x44 /* encoding version 1.4 */
569 #define FN_CONTENT_DISPOSITION14 0x45 /* encoding version 1.4 */
570 #define FN_X_WAP_SECURITY 0x46
571 #define FN_CACHE_CONTROL14 0x47 /* encoding version 1.4 */
572 #define FN_EXPECT15 0x48 /* encoding version 1.5 */
573 #define FN_X_WAP_LOC_INVOCATION 0x49
574 #define FN_X_WAP_LOC_DELIVERY 0x4A
578 * Openwave field names.
580 #define FN_OPENWAVE_PROXY_PUSH_ADDR 0x00
581 #define FN_OPENWAVE_PROXY_PUSH_ACCEPT 0x01
582 #define FN_OPENWAVE_PROXY_PUSH_SEQ 0x02
583 #define FN_OPENWAVE_PROXY_NOTIFY 0x03
584 #define FN_OPENWAVE_PROXY_OPERATOR_DOMAIN 0x04
585 #define FN_OPENWAVE_PROXY_HOME_PAGE 0x05
586 #define FN_OPENWAVE_DEVCAP_HAS_COLOR 0x06
587 #define FN_OPENWAVE_DEVCAP_NUM_SOFTKEYS 0x07
588 #define FN_OPENWAVE_DEVCAP_SOFTKEY_SIZE 0x08
589 #define FN_OPENWAVE_DEVCAP_SCREEN_CHARS 0x09
590 #define FN_OPENWAVE_DEVCAP_SCREEN_PIXELS 0x0A
591 #define FN_OPENWAVE_DEVCAP_EM_SIZE 0x0B
592 #define FN_OPENWAVE_DEVCAP_SCREEN_DEPTH 0x0C
593 #define FN_OPENWAVE_DEVCAP_IMMED_ALERT 0x0D
594 #define FN_OPENWAVE_PROXY_NET_ASK 0x0E
595 #define FN_OPENWAVE_PROXY_UPLINK_VERSION 0x0F
596 #define FN_OPENWAVE_PROXY_TOD 0x10
597 #define FN_OPENWAVE_PROXY_BA_ENABLE 0x11
598 #define FN_OPENWAVE_PROXY_BA_REALM 0x12
599 #define FN_OPENWAVE_PROXY_REDIRECT_ENABLE 0x13
600 #define FN_OPENWAVE_PROXY_REQUEST_URI 0x14
601 #define FN_OPENWAVE_PROXY_REDIRECT_STATUS 0x15
602 #define FN_OPENWAVE_PROXY_TRANS_CHARSET 0x16
603 #define FN_OPENWAVE_PROXY_LINGER 0x17
604 #define FN_OPENWAVE_PROXY_CLIENT_ID 0x18
605 #define FN_OPENWAVE_PROXY_ENABLE_TRUST 0x19
606 #define FN_OPENWAVE_PROXY_TRUST_OLD 0x1A
607 #define FN_OPENWAVE_PROXY_TRUST 0x20
608 #define FN_OPENWAVE_PROXY_BOOKMARK 0x21
609 #define FN_OPENWAVE_DEVCAP_GUI 0x22
611 static const value_string vals_openwave_field_names
[] = {
612 { FN_OPENWAVE_PROXY_PUSH_ADDR
, "x-up-proxy-push-addr" },
613 { FN_OPENWAVE_PROXY_PUSH_ACCEPT
, "x-up-proxy-push-accept" },
614 { FN_OPENWAVE_PROXY_PUSH_SEQ
, "x-up-proxy-seq" },
615 { FN_OPENWAVE_PROXY_NOTIFY
, "x-up-proxy-notify" },
616 { FN_OPENWAVE_PROXY_OPERATOR_DOMAIN
, "x-up-proxy-operator-domain" },
617 { FN_OPENWAVE_PROXY_HOME_PAGE
, "x-up-proxy-home-page" },
618 { FN_OPENWAVE_DEVCAP_HAS_COLOR
, "x-up-devcap-has-color" },
619 { FN_OPENWAVE_DEVCAP_NUM_SOFTKEYS
, "x-up-devcap-num-softkeys" },
620 { FN_OPENWAVE_DEVCAP_SOFTKEY_SIZE
, "x-up-devcap-softkey-size" },
621 { FN_OPENWAVE_DEVCAP_SCREEN_CHARS
, "x-up-devcap-screen-chars" },
622 { FN_OPENWAVE_DEVCAP_SCREEN_PIXELS
, "x-up-devcap-screen-pixels" },
623 { FN_OPENWAVE_DEVCAP_EM_SIZE
, "x-up-devcap-em-size" },
624 { FN_OPENWAVE_DEVCAP_SCREEN_DEPTH
, "x-up-devcap-screen-depth" },
625 { FN_OPENWAVE_DEVCAP_IMMED_ALERT
, "x-up-devcap-immed-alert" },
626 { FN_OPENWAVE_PROXY_NET_ASK
, "x-up-proxy-net-ask" },
627 { FN_OPENWAVE_PROXY_UPLINK_VERSION
, "x-up-proxy-uplink-version" },
628 { FN_OPENWAVE_PROXY_TOD
, "x-up-proxy-tod" },
629 { FN_OPENWAVE_PROXY_BA_ENABLE
, "x-up-proxy-ba-enable" },
630 { FN_OPENWAVE_PROXY_BA_REALM
, "x-up-proxy-ba-realm" },
631 { FN_OPENWAVE_PROXY_REDIRECT_ENABLE
, "x-up-proxy-redirect-enable" },
632 { FN_OPENWAVE_PROXY_REQUEST_URI
, "x-up-proxy-request-uri" },
633 { FN_OPENWAVE_PROXY_REDIRECT_STATUS
, "x-up-proxy-redirect-status" },
634 { FN_OPENWAVE_PROXY_TRANS_CHARSET
, "x-up-proxy-trans-charset" },
635 { FN_OPENWAVE_PROXY_LINGER
, "x-up-proxy-linger" },
636 { FN_OPENWAVE_PROXY_CLIENT_ID
, "x-up-proxy-client-id" },
637 { FN_OPENWAVE_PROXY_ENABLE_TRUST
, "x-up-proxy-enable-trust" },
638 { FN_OPENWAVE_PROXY_TRUST_OLD
, "x-up-proxy-trust-old" },
639 { FN_OPENWAVE_PROXY_TRUST
, "x-up-proxy-trust" },
640 { FN_OPENWAVE_PROXY_BOOKMARK
, "x-up-proxy-bookmark" },
641 { FN_OPENWAVE_DEVCAP_GUI
, "x-up-devcap-gui" },
644 static value_string_ext vals_openwave_field_names_ext
= VALUE_STRING_EXT_INIT(vals_openwave_field_names
);
646 static const value_string vals_field_names
[] = {
647 { FN_ACCEPT
, "Accept" },
648 { FN_ACCEPT_CHARSET_DEP
, "Accept-Charset (encoding 1.1)" },
649 { FN_ACCEPT_ENCODING_DEP
, "Accept-Encoding (encoding 1.1)" },
650 { FN_ACCEPT_LANGUAGE
, "Accept-Language" },
651 { FN_ACCEPT_RANGES
, "Accept-Ranges" },
653 { FN_ALLOW
, "Allow" },
654 { FN_AUTHORIZATION
, "Authorization" },
655 { FN_CACHE_CONTROL_DEP
, "Cache-Control (encoding 1.1)" },
656 { FN_CONNECTION
, "Connection" },
657 { FN_CONTENT_BASE
, "Content-Base" },
658 { FN_CONTENT_ENCODING
, "Content-Encoding" },
659 { FN_CONTENT_LANGUAGE
, "Content-Language" },
660 { FN_CONTENT_LENGTH
, "Content-Length" },
661 { FN_CONTENT_LOCATION
, "Content-Location" },
662 { FN_CONTENT_MD5
, "Content-MD5" },
663 { FN_CONTENT_RANGE_DEP
, "Content-Range (encoding 1.1)" },
664 { FN_CONTENT_TYPE
, "Content-Type" },
667 { FN_EXPIRES
, "Expires" },
670 { FN_IF_MODIFIED_SINCE
, "If-Modified-Since" },
671 { FN_IF_MATCH
, "If-Match" },
672 { FN_IF_NONE_MATCH
, "If-None-Match" },
673 { FN_IF_RANGE
, "If-Range" },
674 { FN_IF_UNMODIFIED_SINCE
, "If-Unmodified-Since" },
675 { FN_LOCATION
, "Location" },
676 { FN_LAST_MODIFIED
, "Last-Modified" },
677 { FN_MAX_FORWARDS
, "Max-Forwards" },
678 { FN_PRAGMA
, "Pragma" },
679 { FN_PROXY_AUTHENTICATE
, "Proxy-Authenticate" },
680 { FN_PROXY_AUTHORIZATION
, "Proxy-Authorization" },
681 { FN_PUBLIC
, "Public" },
682 { FN_RANGE
, "Range" },
683 { FN_REFERER
, "Referer" },
684 { FN_RETRY_AFTER
, "Retry-After" },
685 { FN_SERVER
, "Server" },
686 { FN_TRANSFER_ENCODING
, "Transfer-Encoding" },
687 { FN_UPGRADE
, "Upgrade" },
688 { FN_USER_AGENT
, "User-Agent" },
691 { FN_WARNING
, "Warning" },
692 { FN_WWW_AUTHENTICATE
, "WWW-Authenticate" },
693 { FN_CONTENT_DISPOSITION
, "Content-Disposition" },
694 { FN_X_WAP_APPLICATION_ID
, "X-Wap-Application-ID" },
695 { FN_X_WAP_CONTENT_URI
, "X-Wap-Content-URI" },
696 { FN_X_WAP_INITIATOR_URI
, "X-Wap-Initiator-URI" },
697 { FN_ACCEPT_APPLICATION
, "Accept-Application" },
698 { FN_BEARER_INDICATION
, "Bearer-Indication" },
699 { FN_PUSH_FLAG
, "Push-Flag" },
700 { FN_PROFILE
, "Profile" },
701 { FN_PROFILE_DIFF
, "Profile-Diff" },
702 { FN_PROFILE_WARNING
, "Profile-Warning" },
703 { FN_EXPECT
, "Expect" },
705 { FN_TRAILER
, "Trailer" },
706 { FN_ACCEPT_CHARSET
, "Accept-Charset" },
707 { FN_ACCEPT_ENCODING
, "Accept-Encoding" },
708 { FN_CACHE_CONTROL
, "Cache-Control" },
709 { FN_CONTENT_RANGE
, "Content-Range" },
710 { FN_X_WAP_TOD
, "X-Wap-Tod" },
711 { FN_CONTENT_ID
, "Content-ID" },
712 { FN_SET_COOKIE
, "Set-Cookie" },
713 { FN_COOKIE
, "Cookie" },
714 { FN_ENCODING_VERSION
, "Encoding-Version" },
715 { FN_PROFILE_WARNING14
, "Profile-Warning (encoding 1.4)" },
716 { FN_CONTENT_DISPOSITION14
,"Content-Disposition (encoding 1.4)" },
717 { FN_X_WAP_SECURITY
, "X-WAP-Security" },
718 { FN_CACHE_CONTROL14
, "Cache-Control (encoding 1.4)" },
719 /* encoding-version 1.5 */
720 { FN_EXPECT15
, "Expect (encoding 1.5)" },
721 { FN_X_WAP_LOC_INVOCATION
, "X-Wap-Loc-Invocation" },
722 { FN_X_WAP_LOC_DELIVERY
, "X-Wap-Loc-Delivery" },
725 static value_string_ext vals_field_names_ext
= VALUE_STRING_EXT_INIT(vals_field_names
);
728 * Bearer types (from the WDP specification).
732 #define BT_GSM_USSD 0x02
733 #define BT_GSM_SMS 0x03
734 #define BT_ANSI_136_GUTS 0x04
735 #define BT_IS_95_SMS 0x05
736 #define BT_IS_95_CSD 0x06
737 #define BT_IS_95_PACKET_DATA 0x07
738 #define BT_ANSI_136_CSD 0x08
739 #define BT_ANSI_136_PACKET_DATA 0x09
740 #define BT_GSM_CSD 0x0A
741 #define BT_GSM_GPRS 0x0B
742 #define BT_GSM_USSD_IPv4 0x0C
743 #define BT_AMPS_CDPD 0x0D
744 #define BT_PDC_CSD 0x0E
745 #define BT_PDC_PACKET_DATA 0x0F
746 #define BT_IDEN_SMS 0x10
747 #define BT_IDEN_CSD 0x11
748 #define BT_IDEN_PACKET_DATA 0x12
749 #define BT_PAGING_FLEX 0x13
750 #define BT_PHS_SMS 0x14
751 #define BT_PHS_CSD 0x15
752 #define BT_GSM_USSD_GSM_SC 0x16
753 #define BT_TETRA_SDS_ITSI 0x17
754 #define BT_TETRA_SDS_MSISDN 0x18
755 #define BT_TETRA_PACKET_DATA 0x19
756 #define BT_PAGING_REFLEX 0x1A
757 #define BT_GSM_USSD_MSISDN 0x1B
758 #define BT_MOBITEX_MPAK 0x1C
759 #define BT_ANSI_136_GHOST 0x1D
761 static const value_string vals_bearer_types
[] = {
764 { BT_GSM_USSD
, "GSM USSD" },
765 { BT_GSM_SMS
, "GSM SMS" },
766 { BT_ANSI_136_GUTS
, "ANSI-136 GUTS/R-Data" },
767 { BT_IS_95_SMS
, "IS-95 CDMA SMS" },
768 { BT_IS_95_CSD
, "IS-95 CDMA CSD" },
769 { BT_IS_95_PACKET_DATA
, "IS-95 CDMA Packet data" },
770 { BT_ANSI_136_CSD
, "ANSI-136 CSD" },
771 { BT_ANSI_136_PACKET_DATA
, "ANSI-136 Packet data" },
772 { BT_GSM_CSD
, "GSM CSD" },
773 { BT_GSM_GPRS
, "GSM GPRS" },
774 { BT_GSM_USSD_IPv4
, "GSM USSD (IPv4 addresses)" },
775 { BT_AMPS_CDPD
, "AMPS CDPD" },
776 { BT_PDC_CSD
, "PDC CSD" },
777 { BT_PDC_PACKET_DATA
, "PDC Packet data" },
778 { BT_IDEN_SMS
, "IDEN SMS" },
779 { BT_IDEN_CSD
, "IDEN CSD" },
780 { BT_IDEN_PACKET_DATA
, "IDEN Packet data" },
781 { BT_PAGING_FLEX
, "Paging network FLEX(TM)" },
782 { BT_PHS_SMS
, "PHS SMS" },
783 { BT_PHS_CSD
, "PHS CSD" },
784 { BT_GSM_USSD_GSM_SC
, "GSM USSD (GSM Service Code addresses)" },
785 { BT_TETRA_SDS_ITSI
, "TETRA SDS (ITSI addresses)" },
786 { BT_TETRA_SDS_MSISDN
, "TETRA SDS (MSISDN addresses)" },
787 { BT_TETRA_PACKET_DATA
, "TETRA Packet data" },
788 { BT_PAGING_REFLEX
, "Paging network ReFLEX(TM)" },
789 { BT_GSM_USSD_MSISDN
, "GSM USSD (MSISDN addresses)" },
790 { BT_MOBITEX_MPAK
, "Mobitex MPAK" },
791 { BT_ANSI_136_GHOST
, "ANSI-136 GHOST/R-Data" },
794 static value_string_ext vals_bearer_types_ext
= VALUE_STRING_EXT_INIT(vals_bearer_types
);
796 static const value_string vals_content_types
[] = {
797 /* Well-known media types */
798 /* XXX: hack: "..." "..." used to define several strings so that checkAPIs & etc won't see a 'start of comment' */
799 { 0x00, "*" "/" "*" },
800 { 0x01, "text/" "*" },
801 { 0x02, "text/html" },
802 { 0x03, "text/plain" },
803 { 0x04, "text/x-hdml" },
804 { 0x05, "text/x-ttml" },
805 { 0x06, "text/x-vCalendar" },
806 { 0x07, "text/x-vCard" },
807 { 0x08, "text/vnd.wap.wml" },
808 { 0x09, "text/vnd.wap.wmlscript" },
809 { 0x0A, "text/vnd.wap.channel" },
810 { 0x0B, "multipart/" "*" },
811 { 0x0C, "multipart/mixed" },
812 { 0x0D, "multipart/form-data" },
813 { 0x0E, "multipart/byteranges" },
814 { 0x0F, "multipart/alternative" },
815 { 0x10, "application/" "*" },
816 { 0x11, "application/java-vm" },
817 { 0x12, "application/x-www-form-urlencoded" },
818 { 0x13, "application/x-hdmlc" },
819 { 0x14, "application/vnd.wap.wmlc" },
820 { 0x15, "application/vnd.wap.wmlscriptc" },
821 { 0x16, "application/vnd.wap.channelc" },
822 { 0x17, "application/vnd.wap.uaprof" },
823 { 0x18, "application/vnd.wap.wtls-ca-certificate" },
824 { 0x19, "application/vnd.wap.wtls-user-certificate" },
825 { 0x1A, "application/x-x509-ca-cert" },
826 { 0x1B, "application/x-x509-user-cert" },
827 { 0x1C, "image/" "*" },
828 { 0x1D, "image/gif" },
829 { 0x1E, "image/jpeg" },
830 { 0x1F, "image/tiff" },
831 { 0x20, "image/png" },
832 { 0x21, "image/vnd.wap.wbmp" },
833 { 0x22, "application/vnd.wap.multipart.*" },
834 { 0x23, "application/vnd.wap.multipart.mixed" },
835 { 0x24, "application/vnd.wap.multipart.form-data" },
836 { 0x25, "application/vnd.wap.multipart.byteranges" },
837 { 0x26, "application/vnd.wap.multipart.alternative" },
838 { 0x27, "application/xml" },
839 { 0x28, "text/xml" },
840 { 0x29, "application/vnd.wap.wbxml" },
841 { 0x2A, "application/x-x968-cross-cert" },
842 { 0x2B, "application/x-x968-ca-cert" },
843 { 0x2C, "application/x-x968-user-cert" },
844 { 0x2D, "text/vnd.wap.si" },
845 { 0x2E, "application/vnd.wap.sic" },
846 { 0x2F, "text/vnd.wap.sl" },
847 { 0x30, "application/vnd.wap.slc" },
848 { 0x31, "text/vnd.wap.co" },
849 { 0x32, "application/vnd.wap.coc" },
850 { 0x33, "application/vnd.wap.multipart.related" },
851 { 0x34, "application/vnd.wap.sia" },
852 { 0x35, "text/vnd.wap.connectivity-xml" },
853 { 0x36, "application/vnd.wap.connectivity-wbxml" },
854 { 0x37, "application/pkcs7-mime" },
855 { 0x38, "application/vnd.wap.hashed-certificate" },
856 { 0x39, "application/vnd.wap.signed-certificate" },
857 { 0x3A, "application/vnd.wap.cert-response" },
858 { 0x3B, "application/xhtml+xml" },
859 { 0x3C, "application/wml+xml" },
860 { 0x3D, "text/css" },
861 { 0x3E, "application/vnd.wap.mms-message" },
862 { 0x3F, "application/vnd.wap.rollover-certificate" },
863 { 0x40, "application/vnd.wap.locc+wbxml"},
864 { 0x41, "application/vnd.wap.loc+xml"},
865 { 0x42, "application/vnd.syncml.dm+wbxml"},
866 { 0x43, "application/vnd.syncml.dm+xml"},
867 { 0x44, "application/vnd.syncml.notification"},
868 { 0x45, "application/vnd.wap.xhtml+xml"},
869 { 0x46, "application/vnd.wv.csp.cir"},
870 { 0x47, "application/vnd.oma.dd+xml"},
871 { 0x48, "application/vnd.oma.drm.message"},
872 { 0x49, "application/vnd.oma.drm.content"},
873 { 0x4A, "application/vnd.oma.drm.rights+xml"},
874 { 0x4B, "application/vnd.oma.drm.rights+wbxml"},
875 { 0x4C, "application/vnd.wv.csp+xml"},
876 { 0x4D, "application/vnd.wv.csp+wbxml"},
877 /* The following media types are registered by 3rd parties */
878 { 0x0201, "application/vnd.uplanet.cachop-wbxml" },
879 { 0x0202, "application/vnd.uplanet.signal" },
880 { 0x0203, "application/vnd.uplanet.alert-wbxml" },
881 { 0x0204, "application/vnd.uplanet.list-wbxml" },
882 { 0x0205, "application/vnd.uplanet.listcmd-wbxml" },
883 { 0x0206, "application/vnd.uplanet.channel-wbxml" },
884 { 0x0207, "application/vnd.uplanet.provisioning-status-uri" },
885 { 0x0208, "x-wap.multipart/vnd.uplanet.header-set" },
886 { 0x0209, "application/vnd.uplanet.bearer-choice-wbxml" },
887 { 0x020A, "application/vnd.phonecom.mmc-wbxml" },
888 { 0x020B, "application/vnd.nokia.syncset+wbxml" },
889 { 0x020C, "image/x-up-wpng"},
890 { 0x0300, "application/iota.mmc-wbxml"},
891 { 0x0301, "application/iota.mmc-xml"},
894 static value_string_ext vals_content_types_ext
= VALUE_STRING_EXT_INIT(vals_content_types
);
896 static const value_string vals_languages
[] = {
898 { 0x01, "Afar (aa)" },
899 { 0x02, "Abkhazian (ab)" },
900 { 0x03, "Afrikaans (af)" },
901 { 0x04, "Amharic (am)" },
902 { 0x05, "Arabic (ar)" },
903 { 0x06, "Assamese (as)" },
904 { 0x07, "Aymara (ay)" },
905 { 0x08, "Azerbaijani (az)" },
906 { 0x09, "Bashkir (ba)" },
907 { 0x0A, "Byelorussian (be)" },
908 { 0x0B, "Bulgarian (bg)" },
909 { 0x0C, "Bihari (bh)" },
910 { 0x0D, "Bislama (bi)" },
911 { 0x0E, "Bengali; Bangla (bn)" },
912 { 0x0F, "Tibetan (bo)" },
913 { 0x10, "Breton (br)" },
914 { 0x11, "Catalan (ca)" },
915 { 0x12, "Corsican (co)" },
916 { 0x13, "Czech (cs)" },
917 { 0x14, "Welsh (cy)" },
918 { 0x15, "Danish (da)" },
919 { 0x16, "German (de)" },
920 { 0x17, "Bhutani (dz)" },
921 { 0x18, "Greek (el)" },
922 { 0x19, "English (en)" },
923 { 0x1A, "Esperanto (eo)" },
924 { 0x1B, "Spanish (es)" },
925 { 0x1C, "Estonian (et)" },
926 { 0x1D, "Basque (eu)" },
927 { 0x1E, "Persian (fa)" },
928 { 0x1F, "Finnish (fi)" },
929 { 0x20, "Fiji (fj)" },
930 { 0x21, "Urdu (ur)" },
931 { 0x22, "French (fr)" },
932 { 0x23, "Uzbek (uz)" },
933 { 0x24, "Irish (ga)" },
934 { 0x25, "Scots Gaelic (gd)" },
935 { 0x26, "Galician (gl)" },
936 { 0x27, "Guarani (gn)" },
937 { 0x28, "Gujarati (gu)" },
938 { 0x29, "Hausa (ha)" },
939 { 0x2A, "Hebrew (formerly iw) (he)" },
940 { 0x2B, "Hindi (hi)" },
941 { 0x2C, "Croatian (hr)" },
942 { 0x2D, "Hungarian (hu)" },
943 { 0x2E, "Armenian (hy)" },
944 { 0x2F, "Vietnamese (vi)" },
945 { 0x30, "Indonesian (formerly in) (id)" },
946 { 0x31, "Wolof (wo)" },
947 { 0x32, "Xhosa (xh)" },
948 { 0x33, "Icelandic (is)" },
949 { 0x34, "Italian (it)" },
950 { 0x35, "Yoruba (yo)" },
951 { 0x36, "Japanese (ja)" },
952 { 0x37, "Javanese (jw)" },
953 { 0x38, "Georgian (ka)" },
954 { 0x39, "Kazakh (kk)" },
955 { 0x3A, "Zhuang (za)" },
956 { 0x3B, "Cambodian (km)" },
957 { 0x3C, "Kannada (kn)" },
958 { 0x3D, "Korean (ko)" },
959 { 0x3E, "Kashmiri (ks)" },
960 { 0x3F, "Kurdish (ku)" },
961 { 0x40, "Kirghiz (ky)" },
962 { 0x41, "Chinese (zh)" },
963 { 0x42, "Lingala (ln)" },
964 { 0x43, "Laothian (lo)" },
965 { 0x44, "Lithuanian (lt)" },
966 { 0x45, "Latvian, Lettish (lv)" },
967 { 0x46, "Malagasy (mg)" },
968 { 0x47, "Maori (mi)" },
969 { 0x48, "Macedonian (mk)" },
970 { 0x49, "Malayalam (ml)" },
971 { 0x4A, "Mongolian (mn)" },
972 { 0x4B, "Moldavian (mo)" },
973 { 0x4C, "Marathi (mr)" },
974 { 0x4D, "Malay (ms)" },
975 { 0x4E, "Maltese (mt)" },
976 { 0x4F, "Burmese (my)" },
977 { 0x50, "Ukrainian (uk)" },
978 { 0x51, "Nepali (ne)" },
979 { 0x52, "Dutch (nl)" },
980 { 0x53, "Norwegian (no)" },
981 { 0x54, "Occitan (oc)" },
982 { 0x55, "(Afan) Oromo (om)" },
983 { 0x56, "Oriya (or)" },
984 { 0x57, "Punjabi (pa)" },
985 { 0x58, "Polish (po)" },
986 { 0x59, "Pashto, Pushto (ps)" },
987 { 0x5A, "Portuguese (pt)" },
988 { 0x5B, "Quechua (qu)" },
989 { 0x5C, "Zulu (zu)" },
990 { 0x5D, "Kirundi (rn)" },
991 { 0x5E, "Romanian (ro)" },
992 { 0x5F, "Russian (ru)" },
993 { 0x60, "Kinyarwanda (rw)" },
994 { 0x61, "Sanskrit (sa)" },
995 { 0x62, "Sindhi (sd)" },
996 { 0x63, "Sangho (sg)" },
997 { 0x64, "Serbo-Croatian (sh)" },
998 { 0x65, "Sinhalese (si)" },
999 { 0x66, "Slovak (sk)" },
1000 { 0x67, "Slovenian (sl)" },
1001 { 0x68, "Samoan (sm)" },
1002 { 0x69, "Shona (sn)" },
1003 { 0x6A, "Somali (so)" },
1004 { 0x6B, "Albanian (sq)" },
1005 { 0x6C, "Serbian (sr)" },
1006 { 0x6D, "Siswati (ss)" },
1007 { 0x6E, "Sesotho (st)" },
1008 { 0x6F, "Sundanese (su)" },
1009 { 0x70, "Swedish (sv)" },
1010 { 0x71, "Swahili (sw)" },
1011 { 0x72, "Tamil (ta)" },
1012 { 0x73, "Telugu (te)" },
1013 { 0x74, "Tajik (tg)" },
1014 { 0x75, "Thai (th)" },
1015 { 0x76, "Tigrinya (ti)" },
1016 { 0x77, "Turkmen (tk)" },
1017 { 0x78, "Tagalog (tl)" },
1018 { 0x79, "Setswana (tn)" },
1019 { 0x7A, "Tonga (to)" },
1020 { 0x7B, "Turkish (tr)" },
1021 { 0x7C, "Tsonga (ts)" },
1022 { 0x7D, "Tatar (tt)" },
1023 { 0x7E, "Twi (tw)" },
1024 { 0x7F, "Uighur (ug)" },
1025 { 0x81, "Nauru (na)" },
1026 { 0x82, "Faeroese (fo)" },
1027 { 0x83, "Frisian (fy)" },
1028 { 0x84, "Interlingua (ia)" },
1029 { 0x85, "Volapuk (vo)" },
1030 { 0x86, "Interlingue (ie)" },
1031 { 0x87, "Inupiak (ik)" },
1032 { 0x88, "Yiddish (formerly ji) (yi)" },
1033 { 0x89, "Inuktitut (iu)" },
1034 { 0x8A, "Greenlandic (kl)" },
1035 { 0x8B, "Latin (la)" },
1036 { 0x8C, "Rhaeto-Romance (rm)" },
1039 static value_string_ext vals_languages_ext
= VALUE_STRING_EXT_INIT(vals_languages
);
1042 #define CACHE_CONTROL_NO_CACHE 0x00
1043 #define CACHE_CONTROL_NO_STORE 0x01
1044 #define CACHE_CONTROL_MAX_AGE 0x02
1045 #define CACHE_CONTROL_MAX_STALE 0x03
1046 #define CACHE_CONTROL_MIN_FRESH 0x04
1047 #define CACHE_CONTROL_ONLY_IF_CACHED 0x05
1048 #define CACHE_CONTROL_PUBLIC 0x06
1049 #define CACHE_CONTROL_PRIVATE 0x07
1050 #define CACHE_CONTROL_NO_TRANSFORM 0x08
1051 #define CACHE_CONTROL_MUST_REVALIDATE 0x09
1052 #define CACHE_CONTROL_PROXY_REVALIDATE 0x0A
1053 #define CACHE_CONTROL_S_MAXAGE 0x0B
1055 static const value_string vals_cache_control
[] = {
1056 { CACHE_CONTROL_NO_CACHE
, "no-cache" },
1057 { CACHE_CONTROL_NO_STORE
, "no-store" },
1058 { CACHE_CONTROL_MAX_AGE
, "max-age" },
1059 { CACHE_CONTROL_MAX_STALE
, "max-stale" },
1060 { CACHE_CONTROL_MIN_FRESH
, "min-fresh" },
1061 { CACHE_CONTROL_ONLY_IF_CACHED
, "only-if-cached" },
1062 { CACHE_CONTROL_PUBLIC
, "public" },
1063 { CACHE_CONTROL_PRIVATE
, "private" },
1064 { CACHE_CONTROL_NO_TRANSFORM
, "no-transform" },
1065 { CACHE_CONTROL_MUST_REVALIDATE
, "must-revalidate" },
1066 { CACHE_CONTROL_PROXY_REVALIDATE
, "proxy-revalidate" },
1067 { CACHE_CONTROL_S_MAXAGE
, "s-max-age" },
1071 static value_string_ext vals_cache_control_ext
= VALUE_STRING_EXT_INIT(vals_cache_control
);
1073 static const value_string vals_wap_application_ids
[] = {
1074 /* Well-known WAP applications */
1075 { 0x0000, "x-wap-application:*"},
1076 { 0x0001, "x-wap-application:push.sia"},
1077 { 0x0002, "x-wap-application:wml.ua"},
1078 { 0x0003, "x-wap-application:wta.ua"},
1079 { 0x0004, "x-wap-application:mms.ua"},
1080 { 0x0005, "x-wap-application:push.syncml"},
1081 { 0x0006, "x-wap-application:loc.ua"},
1082 { 0x0007, "x-wap-application:syncml.dm"},
1083 { 0x0008, "x-wap-application:drm.ua"},
1084 { 0x0009, "x-wap-application:emn.ua"},
1085 { 0x000A, "x-wap-application:wv.ua"},
1086 /* Registered by 3rd parties */
1087 { 0x8000, "x-wap-microsoft:localcontent.ua"},
1088 { 0x8001, "x-wap-microsoft:IMclient.ua"},
1089 { 0x8002, "x-wap-docomo:imode.mail.ua"},
1090 { 0x8003, "x-wap-docomo:imode.mr.ua"},
1091 { 0x8004, "x-wap-docomo:imode.mf.ua"},
1092 { 0x8005, "x-motorola:location.ua"},
1093 { 0x8006, "x-motorola:now.ua"},
1094 { 0x8007, "x-motorola:otaprov.ua"},
1095 { 0x8008, "x-motorola:browser.ua"},
1096 { 0x8009, "x-motorola:splash.ua"},
1097 /* 0x800A: unassigned */
1098 { 0x800B, "x-wap-nai:mvsw.command"},
1099 /* 0x800C -- 0x800F: unassigned */
1100 { 0x8010, "x-wap-openwave:iota.ua"},
1101 /* 0x8011 -- 0x8FFF: unassigned */
1102 { 0x9000, "x-wap-docomo:imode.mail2.ua"},
1103 { 0x9001, "x-oma-nec:otaprov.ua"},
1104 { 0x9002, "x-oma-nokia:call.ua"},
1105 { 0x9003, "x-oma-coremobility:sqa.ua"},
1109 static value_string_ext vals_wap_application_ids_ext
= VALUE_STRING_EXT_INIT(vals_wap_application_ids
);
1112 /* Parameters and well-known encodings */
1113 static const value_string vals_wsp_parameter_sec
[] = {
1114 { 0x00, "NETWPIN" },
1115 { 0x01, "USERPIN" },
1116 { 0x02, "USERNETWPIN" },
1117 { 0x03, "USERPINMAC" },
1121 static value_string_ext vals_wsp_parameter_sec_ext
= VALUE_STRING_EXT_INIT(vals_wsp_parameter_sec
);
1123 /* Warning codes and mappings */
1124 static const value_string vals_wsp_warning_code
[] = {
1125 { 10, "110 Response is stale" },
1126 { 11, "111 Revalidation failed" },
1127 { 12, "112 Disconnected operation" },
1128 { 13, "113 Heuristic expiration" },
1129 { 14, "214 Transformation applied" },
1130 { 99, "199/299 Miscellaneous warning" },
1134 static value_string_ext vals_wsp_warning_code_ext
= VALUE_STRING_EXT_INIT(vals_wsp_warning_code
);
1136 static const value_string vals_wsp_warning_code_short
[] = {
1146 static value_string_ext vals_wsp_warning_code_short_ext
= VALUE_STRING_EXT_INIT(vals_wsp_warning_code_short
);
1148 /* Profile-Warning codes - see http://www.w3.org/TR/NOTE-CCPPexchange */
1149 static const value_string vals_wsp_profile_warning_code
[] = {
1151 { 0x11, "101 Used stale profile" },
1152 { 0x12, "102 Not used profile" },
1153 { 0x20, "200 Not applied" },
1154 { 0x21, "101 Content selection applied" },
1155 { 0x22, "202 Content generation applied" },
1156 { 0x23, "203 Transformation applied" },
1160 static value_string_ext vals_wsp_profile_warning_code_ext
= VALUE_STRING_EXT_INIT(vals_wsp_profile_warning_code
);
1162 /* Well-known TE values */
1163 static const value_string vals_well_known_te
[] = {
1164 { 0x82, "chunked" },
1165 { 0x83, "identity" },
1167 { 0x85, "compress" },
1168 { 0x86, "deflate" },
1172 static value_string_ext vals_well_known_te_ext
= VALUE_STRING_EXT_INIT(vals_well_known_te
);
1178 #define PERMANENT_REDIRECT 0x80
1179 #define REUSE_SECURITY_SESSION 0x40
1182 * Redirect address flags and length.
1184 #define BEARER_TYPE_INCLUDED 0x80
1185 #define PORT_NUMBER_INCLUDED 0x40
1186 #define ADDRESS_LEN 0x3f
1188 static const value_string vals_false_true
[] = {
1195 WSP_PDU_RESERVED
= 0x00,
1196 WSP_PDU_CONNECT
= 0x01,
1197 WSP_PDU_CONNECTREPLY
= 0x02,
1198 WSP_PDU_REDIRECT
= 0x03, /* No sample data */
1199 WSP_PDU_REPLY
= 0x04,
1200 WSP_PDU_DISCONNECT
= 0x05,
1201 WSP_PDU_PUSH
= 0x06, /* No sample data */
1202 WSP_PDU_CONFIRMEDPUSH
= 0x07, /* No sample data */
1203 WSP_PDU_SUSPEND
= 0x08, /* No sample data */
1204 WSP_PDU_RESUME
= 0x09, /* No sample data */
1207 WSP_PDU_OPTIONS
= 0x41, /* No sample data */
1208 WSP_PDU_HEAD
= 0x42, /* No sample data */
1209 WSP_PDU_DELETE
= 0x43, /* No sample data */
1210 WSP_PDU_TRACE
= 0x44, /* No sample data */
1212 WSP_PDU_POST
= 0x60,
1213 WSP_PDU_PUT
= 0x61 /* No sample data */
1217 /* Dissector tables for handoff */
1218 static dissector_table_t media_type_table
;
1219 static heur_dissector_list_t heur_subdissector_list
;
1221 static void add_uri (proto_tree
*, packet_info
*, tvbuff_t
*, guint
, guint
, proto_item
*);
1223 static void add_post_variable (proto_tree
*, tvbuff_t
*, guint
, guint
, guint
, guint
);
1224 static void add_multipart_data (proto_tree
*, tvbuff_t
*, packet_info
*pinfo
);
1226 static void add_capabilities (proto_tree
*tree
, tvbuff_t
*tvb
, guint8 pdu_type
);
1230 * Dissect the WSP header part.
1231 * This function calls wkh_XXX functions that dissect well-known headers.
1233 static void add_headers (proto_tree
*tree
, tvbuff_t
*tvb
, int hf
, packet_info
*pinfo
);
1235 /* The following macros define WSP basic data structures as found
1236 * in the ABNF notation of WSP headers.
1237 * Currently all text data types are mapped to text_string.
1239 #define is_short_integer(x) ( (x) & 0x80 )
1240 #define is_long_integer(x) ( (x) <= 30 )
1241 #define is_date_value(x) is_long_integer(x)
1242 #define is_integer_value(x) (is_short_integer(x) || is_long_integer(x))
1243 #define is_delta_seconds_value(x) is_integer_value(x)
1244 /* Text string == *TEXT 0x00, thus also an empty string matches the rule! */
1245 #define is_text_string(x) ( ((x) == 0) || ( ((x) >= 32) && ((x) <= 127)) )
1246 #define is_quoted_string(x) ( (x) == 0x22 ) /* " */
1247 #define is_token_text(x) is_text_string(x)
1248 #define is_text_value(x) is_text_string(x)
1249 #define is_uri_value(x) is_text_string(x)
1251 #define get_uintvar_integer(val,tvb,start,len,ok) \
1252 val = tvb_get_guintvar(tvb,start,&len); \
1253 if (len>5) ok = FALSE; else ok = TRUE;
1254 #define get_short_integer(val,tvb,start,len,ok) \
1255 val = tvb_get_guint8(tvb,start); \
1256 if (val & 0x80) ok = TRUE; else ok=FALSE; \
1257 val &= 0x7F; len = 1;
1258 #define get_long_integer(val,tvb,start,len,ok) \
1259 len = tvb_get_guint8(tvb,start); \
1260 ok = TRUE; /* Valid lengths for us are 1-4 */ \
1261 if (len==1) { val = tvb_get_guint8(tvb,start+1); } \
1262 else if (len==2) { val = tvb_get_ntohs(tvb,start+1); } \
1263 else if (len==3) { val = tvb_get_ntoh24(tvb,start+1); } \
1264 else if (len==4) { val = tvb_get_ntohl(tvb,start+1); } \
1266 len++; /* Add the 1st octet to the length */
1267 #define get_integer_value(val,tvb,start,len,ok) \
1268 len = tvb_get_guint8(tvb,start); \
1270 if (len & 0x80) { val = len & 0x7F; len = 0; } \
1271 else if (len==1) { val = tvb_get_guint8(tvb,start+1); } \
1272 else if (len==2) { val = tvb_get_ntohs(tvb,start+1); } \
1273 else if (len==3) { val = tvb_get_ntoh24(tvb,start+1); } \
1274 else if (len==4) { val = tvb_get_ntohl(tvb,start+1); } \
1276 len++; /* Add the 1st octet to the length */
1277 #define get_date_value(val,tvb,start,len,ok) \
1278 get_long_integer(val,tvb,start,len,ok)
1279 #define get_delta_seconds_value(val,tvb,start,len,ok) \
1280 get_integer_value(val,tvb,start,len,ok)
1282 /* NOTE - Do NOT call g_free() for the str returned after using it because the
1283 * get_text_string() macro now returns wmem_alloc'd memory. */
1284 #define get_text_string(str,tvb,start,len,ok) \
1285 if (is_text_string(tvb_get_guint8(tvb,start))) { \
1286 str = (gchar *)tvb_get_stringz(wmem_packet_scope(), tvb,start,(gint *)&len); \
1288 } else { len = 0; str = NULL; ok = FALSE; }
1289 #define get_token_text(str,tvb,start,len,ok) \
1290 get_text_string(str,tvb,start,len,ok)
1291 #define get_extension_media(str,tvb,start,len,ok) \
1292 get_text_string(str,tvb,start,len,ok)
1293 #define get_text_value(str,tvb,start,len,ok) \
1294 get_text_string(str,tvb,start,len,ok)
1295 #define get_quoted_string(str,tvb,start,len,ok) \
1296 get_text_string(str,tvb,start,len,ok)
1297 #define get_uri_value(str,tvb,start,len,ok) \
1298 get_text_string(str,tvb,start,len,ok)
1300 #define get_version_value(val,str,tvb,start,len,ok) \
1301 val = tvb_get_guint8(tvb,start); \
1303 if (val & 0x80) { /* High nibble "." Low nibble */ \
1306 str = wmem_strdup_printf(wmem_packet_scope(), "%u.%u", val >> 4, val & 0x0F); \
1307 } else { get_text_string(str,tvb,start,len,ok); }
1309 /* Parameter parser */
1311 parameter (proto_tree
*tree
, proto_item
*ti
, tvbuff_t
*tvb
, int start
, int len
);
1313 parameter_value_q (proto_tree
*tree
, proto_item
*ti
, tvbuff_t
*tvb
, int start
);
1315 #define InvalidValueForHeader(hdr) \
1316 "<Error: Invalid value for the '" hdr "' header>"
1317 #define InvalidTextualHeader \
1318 "<Error: Invalid zero-length textual header>"
1319 #define TrailingQuoteWarning \
1320 " <Warning: Quoted-string value has been encoded with a trailing quote>"
1322 /* WSP well-known header parsing function prototypes;
1323 * will be listed in the function lookup table WellKnownHeader[] */
1324 static guint32
wkh_default (proto_tree
*tree
, tvbuff_t
*tvb
,
1325 guint32 hdr_start
, packet_info
*pinfo _U_
);
1326 static guint32
wkh_accept (proto_tree
*tree
, tvbuff_t
*tvb
,
1327 guint32 hdr_start
, packet_info
*pinfo _U_
);
1328 static guint32
wkh_content_type (proto_tree
*tree
, tvbuff_t
*tvb
,
1329 guint32 hdr_start
, packet_info
*pinfo _U_
);
1330 static guint32
wkh_accept_charset (proto_tree
*tree
, tvbuff_t
*tvb
,
1331 guint32 hdr_start
, packet_info
*pinfo _U_
);
1332 static guint32
wkh_accept_language (proto_tree
*tree
, tvbuff_t
*tvb
,
1333 guint32 hdr_start
, packet_info
*pinfo _U_
);
1334 static guint32
wkh_connection (proto_tree
*tree
, tvbuff_t
*tvb
,
1335 guint32 hdr_start
, packet_info
*pinfo _U_
);
1336 static guint32
wkh_push_flag (proto_tree
*tree
, tvbuff_t
*tvb
,
1337 guint32 header_start
, packet_info
*pinfo _U_
);
1338 static guint32
wkh_vary (proto_tree
*tree
, tvbuff_t
*tvb
,
1339 guint32 hdr_start
, packet_info
*pinfo _U_
);
1340 static guint32
wkh_accept_ranges (proto_tree
*tree
, tvbuff_t
*tvb
,
1341 guint32 hdr_start
, packet_info
*pinfo _U_
);
1342 static guint32
wkh_content_disposition (proto_tree
*tree
, tvbuff_t
*tvb
,
1343 guint32 hdr_start
, packet_info
*pinfo _U_
);
1344 static guint32
wkh_accept_encoding (proto_tree
*tree
, tvbuff_t
*tvb
,
1345 guint32 hdr_start
, packet_info
*pinfo _U_
);
1346 static guint32
wkh_content_encoding (proto_tree
*tree
, tvbuff_t
*tvb
,
1347 guint32 hdr_start
, packet_info
*pinfo _U_
);
1348 static guint32
wkh_transfer_encoding (proto_tree
*tree
, tvbuff_t
*tvb
,
1349 guint32 hdr_start
, packet_info
*pinfo _U_
);
1350 static guint32
wkh_pragma (proto_tree
*tree
, tvbuff_t
*tvb
,
1351 guint32 hdr_start
, packet_info
*pinfo _U_
);
1352 /* Single short-integer value */
1353 static guint32
wkh_x_wap_security (proto_tree
*tree
, tvbuff_t
*tvb
,
1354 guint32 hdr_start
, packet_info
*pinfo _U_
);
1356 static guint32
wkh_content_base (proto_tree
*tree
, tvbuff_t
*tvb
,
1357 guint32 hdr_start
, packet_info
*pinfo _U_
);
1358 static guint32
wkh_content_location (proto_tree
*tree
, tvbuff_t
*tvb
,
1359 guint32 hdr_start
, packet_info
*pinfo _U_
);
1360 static guint32
wkh_etag (proto_tree
*tree
, tvbuff_t
*tvb
,
1361 guint32 hdr_start
, packet_info
*pinfo _U_
);
1362 static guint32
wkh_from (proto_tree
*tree
, tvbuff_t
*tvb
,
1363 guint32 hdr_start
, packet_info
*pinfo _U_
);
1364 static guint32
wkh_host (proto_tree
*tree
, tvbuff_t
*tvb
,
1365 guint32 hdr_start
, packet_info
*pinfo _U_
);
1366 static guint32
wkh_if_match (proto_tree
*tree
, tvbuff_t
*tvb
,
1367 guint32 hdr_start
, packet_info
*pinfo _U_
);
1368 static guint32
wkh_if_none_match (proto_tree
*tree
, tvbuff_t
*tvb
,
1369 guint32 hdr_start
, packet_info
*pinfo _U_
);
1370 static guint32
wkh_location (proto_tree
*tree
, tvbuff_t
*tvb
,
1371 guint32 hdr_start
, packet_info
*pinfo _U_
);
1372 static guint32
wkh_referer (proto_tree
*tree
, tvbuff_t
*tvb
,
1373 guint32 hdr_start
, packet_info
*pinfo _U_
);
1374 static guint32
wkh_server (proto_tree
*tree
, tvbuff_t
*tvb
,
1375 guint32 hdr_start
, packet_info
*pinfo _U_
);
1376 static guint32
wkh_user_agent (proto_tree
*tree
, tvbuff_t
*tvb
,
1377 guint32 hdr_start
, packet_info
*pinfo _U_
);
1378 static guint32
wkh_upgrade (proto_tree
*tree
, tvbuff_t
*tvb
,
1379 guint32 hdr_start
, packet_info
*pinfo _U_
);
1380 static guint32
wkh_via (proto_tree
*tree
, tvbuff_t
*tvb
,
1381 guint32 hdr_start
, packet_info
*pinfo _U_
);
1382 static guint32
wkh_content_uri (proto_tree
*tree
, tvbuff_t
*tvb
,
1383 guint32 hdr_start
, packet_info
*pinfo _U_
);
1384 static guint32
wkh_initiator_uri (proto_tree
*tree
, tvbuff_t
*tvb
,
1385 guint32 hdr_start
, packet_info
*pinfo _U_
);
1386 static guint32
wkh_profile (proto_tree
*tree
, tvbuff_t
*tvb
,
1387 guint32 hdr_start
, packet_info
*pinfo _U_
);
1388 static guint32
wkh_content_id (proto_tree
*tree
, tvbuff_t
*tvb
,
1389 guint32 hdr_start
, packet_info
*pinfo _U_
);
1390 /* Date-value or text */
1391 static guint32
wkh_if_range (proto_tree
*tree
, tvbuff_t
*tvb
,
1392 guint32 hdr_start
, packet_info
*pinfo _U_
);
1394 static guint32
wkh_date (proto_tree
*tree
, tvbuff_t
*tvb
,
1395 guint32 hdr_start
, packet_info
*pinfo _U_
);
1396 static guint32
wkh_expires (proto_tree
*tree
, tvbuff_t
*tvb
,
1397 guint32 hdr_start
, packet_info
*pinfo _U_
);
1398 static guint32
wkh_if_modified_since (proto_tree
*tree
, tvbuff_t
*tvb
,
1399 guint32 hdr_start
, packet_info
*pinfo _U_
);
1400 static guint32
wkh_if_unmodified_since (proto_tree
*tree
, tvbuff_t
*tvb
,
1401 guint32 hdr_start
, packet_info
*pinfo _U_
);
1402 static guint32
wkh_last_modified (proto_tree
*tree
, tvbuff_t
*tvb
,
1403 guint32 hdr_start
, packet_info
*pinfo _U_
);
1404 /* Date-value with special meaning */
1405 static guint32
wkh_x_wap_tod (proto_tree
*tree
, tvbuff_t
*tvb
,
1406 guint32 hdr_start
, packet_info
*pinfo _U_
);
1407 /* Delta-seconds-value */
1408 static guint32
wkh_age (proto_tree
*tree
, tvbuff_t
*tvb
,
1409 guint32 hdr_start
, packet_info
*pinfo _U_
);
1411 static guint32
wkh_proxy_authenticate (proto_tree
*tree
, tvbuff_t
*tvb
,
1412 guint32 hdr_start
, packet_info
*pinfo _U_
);
1413 static guint32
wkh_www_authenticate (proto_tree
*tree
, tvbuff_t
*tvb
,
1414 guint32 hdr_start
, packet_info
*pinfo _U_
);
1416 static guint32
wkh_authorization (proto_tree
*tree
, tvbuff_t
*tvb
,
1417 guint32 hdr_start
, packet_info
*pinfo _U_
);
1418 static guint32
wkh_proxy_authorization (proto_tree
*tree
, tvbuff_t
*tvb
,
1419 guint32 hdr_start
, packet_info
*pinfo _U_
);
1421 static guint32
wkh_content_length (proto_tree
*tree
, tvbuff_t
*tvb
,
1422 guint32 hdr_start
, packet_info
*pinfo _U_
);
1423 static guint32
wkh_max_forwards (proto_tree
*tree
, tvbuff_t
*tvb
,
1424 guint32 hdr_start
, packet_info
*pinfo _U_
);
1426 /* Integer lookup value */
1427 static guint32
wkh_bearer_indication (proto_tree
*tree
, tvbuff_t
*tvb
,
1428 guint32 hdr_start
, packet_info
*pinfo _U_
);
1430 /* WAP application ID value */
1431 static guint32
wkh_x_wap_application_id (proto_tree
*tree
, tvbuff_t
*tvb
,
1432 guint32 hdr_start
, packet_info
*pinfo _U_
);
1433 static guint32
wkh_accept_application (proto_tree
*tree
, tvbuff_t
*tvb
,
1434 guint32 hdr_start
, packet_info
*pinfo _U_
);
1435 static guint32
wkh_content_language (proto_tree
*tree
, tvbuff_t
*tvb
,
1436 guint32 hdr_start
, packet_info
*pinfo _U_
);
1438 /* Allow and Public */
1439 static guint32
wkh_allow(proto_tree
*tree
, tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1440 static guint32
wkh_public(proto_tree
*tree
, tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1443 static guint32
wkh_cache_control (proto_tree
*tree
, tvbuff_t
*tvb
,
1444 guint32 hdr_start
, packet_info
*pinfo _U_
);
1446 static guint32
wkh_warning (proto_tree
*tree
, tvbuff_t
*tvb
,
1447 guint32 hdr_start
, packet_info
*pinfo _U_
);
1448 /* Profile-warning */
1449 static guint32
wkh_profile_warning (proto_tree
*tree
, tvbuff_t
*tvb
,
1450 guint32 hdr_start
, packet_info
*pinfo _U_
);
1453 static guint32
wkh_content_md5 (proto_tree
*tree
, tvbuff_t
*tvb
,
1454 guint32 hdr_start
, packet_info
*pinfo _U_
);
1456 /* WSP encoding version */
1457 static guint32
wkh_encoding_version (proto_tree
*tree
, tvbuff_t
*tvb
,
1458 guint32 hdr_start
, packet_info
*pinfo _U_
);
1460 /* Content-Range and Range */
1461 static guint32
wkh_content_range (proto_tree
*tree
, tvbuff_t
*tvb
,
1462 guint32 hdr_start
, packet_info
*pinfo _U_
);
1463 static guint32
wkh_range (proto_tree
*tree
, tvbuff_t
*tvb
,
1464 guint32 hdr_start
, packet_info
*pinfo _U_
);
1467 static guint32
wkh_te (proto_tree
*tree
, tvbuff_t
*tvb
,
1468 guint32 hdr_start
, packet_info
*pinfo _U_
);
1471 static guint32
wkh_trailer (proto_tree
*tree
, tvbuff_t
*tvb
,
1472 guint32 hdr_start
, packet_info
*pinfo _U_
);
1474 /* Profile-Diff with WBXML UAPROF document */
1475 static guint32
wkh_profile_diff_wbxml (proto_tree
*tree
, tvbuff_t
*tvb
,
1476 guint32 hdr_start
, packet_info
*pinfo
);
1478 /* TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO
1479 static guint32 wkh_retry_after (proto_tree *tree, tvbuff_t *tvb,
1480 guint32 hdr_start, packet_info *pinfo _U_);
1481 static guint32 wkh_expect (proto_tree *tree, tvbuff_t *tvb,
1482 guint32 hdr_start, packet_info *pinfo _U_);
1483 static guint32 wkh_set_cookie (proto_tree *tree, tvbuff_t *tvb,
1484 guint32 hdr_start, packet_info *pinfo _U_);
1485 static guint32 wkh_cookie (proto_tree *tree, tvbuff_t *tvb,
1486 guint32 hdr_start, packet_info *pinfo _U_);
1490 /* WSP well-known Openwave header parsing function prototypes;
1491 * will be listed in the function lookup table WellKnownOpenwaveHeaders[] */
1492 static guint32
wkh_openwave_default (proto_tree
*tree
, tvbuff_t
*tvb
,
1493 guint32 hdr_start
, packet_info
*pinfo _U_
);
1494 /* Textual headers */
1495 static guint32
wkh_openwave_x_up_proxy_operator_domain(proto_tree
*tree
,
1496 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1497 static guint32
wkh_openwave_x_up_proxy_home_page(proto_tree
*tree
,
1498 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1499 static guint32
wkh_openwave_x_up_proxy_uplink_version(proto_tree
*tree
,
1500 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1501 static guint32
wkh_openwave_x_up_proxy_ba_realm(proto_tree
*tree
,
1502 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1503 static guint32
wkh_openwave_x_up_proxy_request_uri(proto_tree
*tree
,
1504 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1505 static guint32
wkh_openwave_x_up_proxy_bookmark(proto_tree
*tree
,
1506 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1507 /* Integer headers */
1508 static guint32
wkh_openwave_x_up_proxy_push_seq(proto_tree
*tree
,
1509 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1510 static guint32
wkh_openwave_x_up_proxy_notify(proto_tree
*tree
,
1511 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1512 static guint32
wkh_openwave_x_up_proxy_net_ask(proto_tree
*tree
,
1513 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1514 static guint32
wkh_openwave_x_up_proxy_tod (proto_tree
*tree
,
1515 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1516 static guint32
wkh_openwave_x_up_proxy_ba_enable(proto_tree
*tree
,
1517 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1518 static guint32
wkh_openwave_x_up_proxy_redirect_enable(proto_tree
*tree
,
1519 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1520 static guint32
wkh_openwave_x_up_proxy_redirect_status(proto_tree
*tree
,
1521 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1522 static guint32
wkh_openwave_x_up_proxy_linger(proto_tree
*tree
,
1523 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1524 static guint32
wkh_openwave_x_up_proxy_enable_trust(proto_tree
*tree
,
1525 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1526 static guint32
wkh_openwave_x_up_proxy_trust(proto_tree
*tree
,
1527 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1528 static guint32
wkh_openwave_x_up_devcap_has_color(proto_tree
*tree
,
1529 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1530 static guint32
wkh_openwave_x_up_devcap_num_softkeys(proto_tree
*tree
,
1531 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1532 static guint32
wkh_openwave_x_up_devcap_softkey_size(proto_tree
*tree
,
1533 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1534 static guint32
wkh_openwave_x_up_devcap_screen_chars(proto_tree
*tree
,
1535 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1536 static guint32
wkh_openwave_x_up_devcap_screen_pixels(proto_tree
*tree
,
1537 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1538 static guint32
wkh_openwave_x_up_devcap_em_size(proto_tree
*tree
,
1539 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1540 static guint32
wkh_openwave_x_up_devcap_screen_depth(proto_tree
*tree
,
1541 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1542 static guint32
wkh_openwave_x_up_devcap_immed_alert(proto_tree
*tree
,
1543 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1544 static guint32
wkh_openwave_x_up_devcap_gui(proto_tree
*tree
,
1545 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1547 static guint32
wkh_openwave_x_up_proxy_trans_charset(proto_tree
*tree
,
1548 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1549 static guint32
wkh_openwave_x_up_proxy_push_accept(proto_tree
*tree
,
1550 tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
);
1553 /* Define a pointer to function data type for the well-known header
1554 * lookup table below */
1555 typedef guint32 (*hdr_parse_func_ptr
) (proto_tree
*, tvbuff_t
*, guint32
, packet_info
*);
1557 /* Lookup table for well-known header parsing functions */
1558 static const hdr_parse_func_ptr WellKnownHeader
[128] = {
1559 /* 0x00 */ wkh_accept
, /* 0x01 */ wkh_accept_charset
,
1560 /* 0x02 */ wkh_accept_encoding
, /* 0x03 */ wkh_accept_language
,
1561 /* 0x04 */ wkh_accept_ranges
, /* 0x05 */ wkh_age
,
1562 /* 0x06 */ wkh_allow
, /* 0x07 */ wkh_authorization
,
1563 /* 0x08 */ wkh_cache_control
, /* 0x09 */ wkh_connection
,
1564 /* 0x0A */ wkh_content_base
, /* 0x0B */ wkh_content_encoding
,
1565 /* 0x0C */ wkh_content_language
, /* 0x0D */ wkh_content_length
,
1566 /* 0x0E */ wkh_content_location
, /* 0x0F */ wkh_content_md5
,
1567 /* 0x10 */ wkh_content_range
, /* 0x11 */ wkh_content_type
,
1568 /* 0x12 */ wkh_date
, /* 0x13 */ wkh_etag
,
1569 /* 0x14 */ wkh_expires
, /* 0x15 */ wkh_from
,
1570 /* 0x16 */ wkh_host
, /* 0x17 */ wkh_if_modified_since
,
1571 /* 0x18 */ wkh_if_match
, /* 0x19 */ wkh_if_none_match
,
1572 /* 0x1A */ wkh_if_range
, /* 0x1B */ wkh_if_unmodified_since
,
1573 /* 0x1C */ wkh_location
, /* 0x1D */ wkh_last_modified
,
1574 /* 0x1E */ wkh_max_forwards
, /* 0x1F */ wkh_pragma
,
1575 /* 0x20 */ wkh_proxy_authenticate
, /* 0x21 */ wkh_proxy_authorization
,
1576 /* 0x22 */ wkh_public
, /* 0x23 */ wkh_range
,
1577 /* 0x24 */ wkh_referer
, /* 0x25 */ wkh_default
,
1578 /* 0x26 */ wkh_server
, /* 0x27 */ wkh_transfer_encoding
,
1579 /* 0x28 */ wkh_upgrade
, /* 0x29 */ wkh_user_agent
,
1580 /* 0x2A */ wkh_vary
, /* 0x2B */ wkh_via
,
1581 /* 0x2C */ wkh_warning
, /* 0x2D */ wkh_www_authenticate
,
1582 /* 0x2E */ wkh_content_disposition
,/* 0x2F */ wkh_x_wap_application_id
,
1583 /* 0x30 */ wkh_content_uri
, /* 0x31 */ wkh_initiator_uri
,
1584 /* 0x32 */ wkh_accept_application
, /* 0x33 */ wkh_bearer_indication
,
1585 /* 0x34 */ wkh_push_flag
, /* 0x35 */ wkh_profile
,
1586 /* 0x36 */ wkh_profile_diff_wbxml
, /* 0x37 */ wkh_profile_warning
,
1587 /* 0x38 */ wkh_default
, /* 0x39 */ wkh_te
,
1588 /* 0x3A */ wkh_trailer
, /* 0x3B */ wkh_accept_charset
,
1589 /* 0x3C */ wkh_accept_encoding
, /* 0x3D */ wkh_cache_control
,
1590 /* 0x3E */ wkh_content_range
, /* 0x3F */ wkh_x_wap_tod
,
1591 /* 0x40 */ wkh_content_id
, /* 0x41 */ wkh_default
,
1592 /* 0x42 */ wkh_default
, /* 0x43 */ wkh_encoding_version
,
1593 /* 0x44 */ wkh_profile_warning
, /* 0x45 */ wkh_content_disposition
,
1594 /* 0x46 */ wkh_x_wap_security
, /* 0x47 */ wkh_cache_control
,
1595 /*******************************************************
1596 *** The following headers are not (yet) registered. ***
1597 *******************************************************/
1598 /* 0x48 */ wkh_default
, /* 0x49 */ wkh_default
,
1599 /* 0x4A */ wkh_default
, /* 0x4B */ wkh_default
,
1600 /* 0x4C */ wkh_default
, /* 0x4D */ wkh_default
,
1601 /* 0x4E */ wkh_default
, /* 0x4F */ wkh_default
,
1602 /* 0x50 */ wkh_default
, /* 0x51 */ wkh_default
,
1603 /* 0x52 */ wkh_default
, /* 0x53 */ wkh_default
,
1604 /* 0x54 */ wkh_default
, /* 0x55 */ wkh_default
,
1605 /* 0x56 */ wkh_default
, /* 0x57 */ wkh_default
,
1606 /* 0x58 */ wkh_default
, /* 0x59 */ wkh_default
,
1607 /* 0x5A */ wkh_default
, /* 0x5B */ wkh_default
,
1608 /* 0x5C */ wkh_default
, /* 0x5D */ wkh_default
,
1609 /* 0x5E */ wkh_default
, /* 0x5F */ wkh_default
,
1610 /* 0x60 */ wkh_default
, /* 0x61 */ wkh_default
,
1611 /* 0x62 */ wkh_default
, /* 0x63 */ wkh_default
,
1612 /* 0x64 */ wkh_default
, /* 0x65 */ wkh_default
,
1613 /* 0x66 */ wkh_default
, /* 0x67 */ wkh_default
,
1614 /* 0x68 */ wkh_default
, /* 0x69 */ wkh_default
,
1615 /* 0x6A */ wkh_default
, /* 0x6B */ wkh_default
,
1616 /* 0x6C */ wkh_default
, /* 0x6D */ wkh_default
,
1617 /* 0x6E */ wkh_default
, /* 0x6F */ wkh_default
,
1618 /* 0x70 */ wkh_default
, /* 0x71 */ wkh_default
,
1619 /* 0x72 */ wkh_default
, /* 0x73 */ wkh_default
,
1620 /* 0x74 */ wkh_default
, /* 0x75 */ wkh_default
,
1621 /* 0x76 */ wkh_default
, /* 0x77 */ wkh_default
,
1622 /* 0x78 */ wkh_default
, /* 0x79 */ wkh_default
,
1623 /* 0x7A */ wkh_default
, /* 0x7B */ wkh_default
,
1624 /* 0x7C */ wkh_default
, /* 0x7D */ wkh_default
,
1625 /* 0x7E */ wkh_default
, /* 0x7F */ wkh_default
,
1628 /* Lookup table for well-known header parsing functions */
1629 static const hdr_parse_func_ptr WellKnownOpenwaveHeader
[128] = {
1630 /* 0x00 */ wkh_openwave_default
,
1631 /* 0x01 */ wkh_openwave_x_up_proxy_push_accept
,
1632 /* 0x02 */ wkh_openwave_x_up_proxy_push_seq
,
1633 /* 0x03 */ wkh_openwave_x_up_proxy_notify
,
1634 /* 0x04 */ wkh_openwave_x_up_proxy_operator_domain
,
1635 /* 0x05 */ wkh_openwave_x_up_proxy_home_page
,
1636 /* 0x06 */ wkh_openwave_x_up_devcap_has_color
,
1637 /* 0x07 */ wkh_openwave_x_up_devcap_num_softkeys
,
1638 /* 0x08 */ wkh_openwave_x_up_devcap_softkey_size
,
1639 /* 0x09 */ wkh_openwave_x_up_devcap_screen_chars
,
1640 /* 0x0A */ wkh_openwave_x_up_devcap_screen_pixels
,
1641 /* 0x0B */ wkh_openwave_x_up_devcap_em_size
,
1642 /* 0x0C */ wkh_openwave_x_up_devcap_screen_depth
,
1643 /* 0x0D */ wkh_openwave_x_up_devcap_immed_alert
,
1644 /* 0x0E */ wkh_openwave_x_up_proxy_net_ask
,
1645 /* 0x0F */ wkh_openwave_x_up_proxy_uplink_version
,
1646 /* 0x10 */ wkh_openwave_x_up_proxy_tod
,
1647 /* 0x11 */ wkh_openwave_x_up_proxy_ba_enable
,
1648 /* 0x12 */ wkh_openwave_x_up_proxy_ba_realm
,
1649 /* 0x13 */ wkh_openwave_x_up_proxy_redirect_enable
,
1650 /* 0x14 */ wkh_openwave_x_up_proxy_request_uri
,
1651 /* 0x15 */ wkh_openwave_x_up_proxy_redirect_status
,
1652 /* 0x16 */ wkh_openwave_x_up_proxy_trans_charset
,
1653 /* 0x17 */ wkh_openwave_x_up_proxy_linger
,
1654 /* 0x18 */ wkh_openwave_default
,
1655 /* 0x19 */ wkh_openwave_x_up_proxy_enable_trust
,
1656 /* 0x1A */ wkh_openwave_x_up_proxy_trust
,
1657 /* 0x1B */ wkh_openwave_default
,
1658 /* 0x1C */ wkh_openwave_default
,
1659 /* 0x1D */ wkh_openwave_default
,
1660 /* 0x1E */ wkh_openwave_default
,
1661 /* 0x1F */ wkh_openwave_default
,
1662 /* 0x20 */ wkh_openwave_x_up_proxy_trust
,
1663 /* 0x21 */ wkh_openwave_x_up_proxy_bookmark
,
1664 /* 0x22 */ wkh_openwave_x_up_devcap_gui
,
1665 /*******************************************************
1666 *** The following headers are not (yet) registered. ***
1667 *******************************************************/
1668 /* 0x23 */ wkh_openwave_default
,
1669 /* 0x24 */ wkh_openwave_default
, /* 0x25 */ wkh_openwave_default
,
1670 /* 0x26 */ wkh_openwave_default
, /* 0x27 */ wkh_openwave_default
,
1671 /* 0x28 */ wkh_openwave_default
, /* 0x29 */ wkh_openwave_default
,
1672 /* 0x2A */ wkh_openwave_default
, /* 0x2B */ wkh_openwave_default
,
1673 /* 0x2C */ wkh_openwave_default
, /* 0x2D */ wkh_openwave_default
,
1674 /* 0x2E */ wkh_openwave_default
, /* 0x2F */ wkh_openwave_default
,
1675 /* 0x30 */ wkh_openwave_default
, /* 0x31 */ wkh_openwave_default
,
1676 /* 0x32 */ wkh_openwave_default
, /* 0x33 */ wkh_openwave_default
,
1677 /* 0x34 */ wkh_openwave_default
, /* 0x35 */ wkh_openwave_default
,
1678 /* 0x36 */ wkh_openwave_default
, /* 0x37 */ wkh_openwave_default
,
1679 /* 0x38 */ wkh_openwave_default
, /* 0x39 */ wkh_openwave_default
,
1680 /* 0x3A */ wkh_openwave_default
, /* 0x3B */ wkh_openwave_default
,
1681 /* 0x3C */ wkh_openwave_default
, /* 0x3D */ wkh_openwave_default
,
1682 /* 0x3E */ wkh_openwave_default
, /* 0x3F */ wkh_openwave_default
,
1683 /* 0x40 */ wkh_openwave_default
, /* 0x41 */ wkh_openwave_default
,
1684 /* 0x42 */ wkh_openwave_default
, /* 0x43 */ wkh_openwave_default
,
1685 /* 0x44 */ wkh_openwave_default
, /* 0x45 */ wkh_openwave_default
,
1686 /* 0x46 */ wkh_openwave_default
, /* 0x47 */ wkh_openwave_default
,
1687 /* 0x48 */ wkh_openwave_default
, /* 0x49 */ wkh_openwave_default
,
1688 /* 0x4A */ wkh_openwave_default
, /* 0x4B */ wkh_openwave_default
,
1689 /* 0x4C */ wkh_openwave_default
, /* 0x4D */ wkh_openwave_default
,
1690 /* 0x4E */ wkh_openwave_default
, /* 0x4F */ wkh_openwave_default
,
1691 /* 0x50 */ wkh_openwave_default
, /* 0x51 */ wkh_openwave_default
,
1692 /* 0x52 */ wkh_openwave_default
, /* 0x53 */ wkh_openwave_default
,
1693 /* 0x54 */ wkh_openwave_default
, /* 0x55 */ wkh_openwave_default
,
1694 /* 0x56 */ wkh_openwave_default
, /* 0x57 */ wkh_openwave_default
,
1695 /* 0x58 */ wkh_openwave_default
, /* 0x59 */ wkh_openwave_default
,
1696 /* 0x5A */ wkh_openwave_default
, /* 0x5B */ wkh_openwave_default
,
1697 /* 0x5C */ wkh_openwave_default
, /* 0x5D */ wkh_openwave_default
,
1698 /* 0x5E */ wkh_openwave_default
, /* 0x5F */ wkh_openwave_default
,
1699 /* 0x60 */ wkh_openwave_default
, /* 0x61 */ wkh_openwave_default
,
1700 /* 0x62 */ wkh_openwave_default
, /* 0x63 */ wkh_openwave_default
,
1701 /* 0x64 */ wkh_openwave_default
, /* 0x65 */ wkh_openwave_default
,
1702 /* 0x66 */ wkh_openwave_default
, /* 0x67 */ wkh_openwave_default
,
1703 /* 0x68 */ wkh_openwave_default
, /* 0x69 */ wkh_openwave_default
,
1704 /* 0x6A */ wkh_openwave_default
, /* 0x6B */ wkh_openwave_default
,
1705 /* 0x6C */ wkh_openwave_default
, /* 0x6D */ wkh_openwave_default
,
1706 /* 0x6E */ wkh_openwave_default
, /* 0x6F */ wkh_openwave_default
,
1707 /* 0x70 */ wkh_openwave_default
, /* 0x71 */ wkh_openwave_default
,
1708 /* 0x72 */ wkh_openwave_default
, /* 0x73 */ wkh_openwave_default
,
1709 /* 0x74 */ wkh_openwave_default
, /* 0x75 */ wkh_openwave_default
,
1710 /* 0x76 */ wkh_openwave_default
, /* 0x77 */ wkh_openwave_default
,
1711 /* 0x78 */ wkh_openwave_default
, /* 0x79 */ wkh_openwave_default
,
1712 /* 0x7A */ wkh_openwave_default
, /* 0x7B */ wkh_openwave_default
,
1713 /* 0x7C */ wkh_openwave_default
, /* 0x7D */ wkh_openwave_default
,
1714 /* 0x7E */ wkh_openwave_default
, /* 0x7F */ wkh_openwave_default
1719 /* WSP header format
1720 * 1st byte: 0x00 : <Not allowed>
1721 * 1st byte: 0x01 -- 0x1F: <Shorthand Header Code Page switch>
1722 * 1st byte: 0x20 -- 0x7E: <Textual header (C string)>
1723 * Followed with: <Textual header value (C string)>
1724 * 1st byte: 0x7F : <Header Code Page switch>
1725 * Followed with: 2nd byte: <Header Code Page>
1726 * 1st byte: 0x80 -- 0xFF: <Binary header (7-bit encoded ID)>
1728 * 2nd byte: 0x00 -- 0x1E: <Value Length (bytes)>
1729 * Followed with: <Len> bytes of data
1730 * 2nd byte: 0x1F : <Value Length is a guintvar>
1731 * Followed with: <guintvar Len>
1732 * Followed with: <Len> bytes of data
1733 * 2nd byte: 0x20 -- 0x7F: <Textual header value (C string)>
1734 * 2nd byte: 0x80 -- 0xFF: <Binary value (7-bit encoded ID)>
1737 add_headers (proto_tree
*tree
, tvbuff_t
*tvb
, int hf
, packet_info
*pinfo
)
1739 guint8 hdr_id
, val_id
, codepage
= 1;
1740 gint32 tvb_len
= tvb_length(tvb
);
1742 gint32 hdr_len
, hdr_start
;
1743 gint32 val_len
, val_start
;
1744 gchar
*hdr_str
, *val_str
;
1745 proto_tree
*wsp_headers
;
1746 proto_item
*ti
, *hidden_item
;
1752 if (offset
>= tvb_len
)
1753 return; /* No headers! */
1755 /* XXX: the field pointed to by hf has a type of FT_NONE */
1756 ti
= proto_tree_add_item(tree
, hf
,
1757 tvb
, offset
, tvb_len
, ENC_NA
);
1758 wsp_headers
= proto_item_add_subtree(ti
, ett_headers
);
1760 while (offset
< tvb_len
) {
1762 hdr_id
= tvb_get_guint8(tvb
, offset
);
1763 if (hdr_id
& 0x80) { /* Well-known header */
1765 /* Call header value dissector for given header */
1766 if (codepage
== 1) { /* Default header code page */
1767 DebugLog(("add_headers(code page 0): %s\n",
1768 val_to_str_ext_const (hdr_id
& 0x7f, &vals_field_names_ext
, "Undefined")));
1769 offset
= WellKnownHeader
[hdr_id
& 0x7F](wsp_headers
, tvb
,
1771 } else { /* Openwave header code page */
1772 /* Here I'm delibarately assuming that Openwave is the only
1773 * company that defines a WSP header code page. */
1774 DebugLog(("add_headers(code page 0x%02x - assumed to be x-up-1): %s\n",
1775 codepage
, val_to_str_ext_const (hdr_id
& 0x7f, &vals_openwave_field_names_ext
, "Undefined")));
1776 offset
= WellKnownOpenwaveHeader
[hdr_id
& 0x7F](wsp_headers
,
1777 tvb
, hdr_start
, pinfo
);
1779 } else if (hdr_id
== 0x7F) { /* HCP shift sequence */
1780 codepage
= tvb_get_guint8(tvb
, offset
+1);
1781 proto_tree_add_uint(wsp_headers
, hf_wsp_header_shift_code
,
1782 tvb
, offset
, 2, codepage
);
1784 } else if (hdr_id
>= 0x20) { /* Textual header */
1785 /* Header name MUST be NUL-ended string ==> tvb_get_stringz() */
1786 hdr_str
= (gchar
*)tvb_get_stringz(wmem_packet_scope(), tvb
, hdr_start
, (gint
*)&hdr_len
);
1787 val_start
= hdr_start
+ hdr_len
;
1788 val_id
= tvb_get_guint8(tvb
, val_start
);
1789 /* Call header value dissector for given header */
1790 if (val_id
>= 0x20 && val_id
<=0x7E) { /* OK! */
1791 val_str
= (gchar
*)tvb_get_stringz(wmem_packet_scope(), tvb
, val_start
, (gint
*)&val_len
);
1792 offset
= val_start
+ val_len
;
1793 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
-hdr_start
);
1794 proto_tree_add_text(wsp_headers
,tvb
,hdr_start
,offset
-hdr_start
,
1795 "%s: %s", hdr_str
, val_str
);
1797 /* Old-style X-WAP-TOD uses a non-textual value
1798 * after a textual header. */
1799 if (g_ascii_strcasecmp(hdr_str
, "x-wap.tod") == 0) {
1800 get_delta_seconds_value(val
, tvb
, val_start
, val_len
, ok
);
1803 ti
= proto_tree_add_string (wsp_headers
,
1805 tvb
, hdr_start
, hdr_len
+ val_len
,
1806 "Requesting Time Of Day");
1808 val_str
= abs_time_secs_to_str(val
, ABSOLUTE_TIME_LOCAL
, TRUE
);
1809 ti
= proto_tree_add_string (wsp_headers
,
1811 tvb
, hdr_start
, hdr_len
+ val_len
, val_str
);
1813 proto_item_append_text(ti
, " <Warning: "
1814 "should be encoded as a textual value>");
1816 /* I prefer using X-Wap-Tod to the real hdr_str */
1817 proto_tree_add_string (wsp_headers
, hf_hdr_x_wap_tod
,
1818 tvb
, hdr_start
, hdr_len
+ val_len
,
1819 InvalidValueForHeader("X-Wap-Tod"));
1822 proto_tree_add_text (wsp_headers
, tvb
, hdr_start
, hdr_len
,
1823 "<Error: Invalid value for the textual '%s' header"
1824 " (should be a textual value)>",
1829 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
1830 hidden_item
= proto_tree_add_string(wsp_headers
, hf_hdr_name
,
1831 tvb
, hdr_start
, offset
- hdr_start
, hdr_str
);
1832 PROTO_ITEM_SET_HIDDEN(hidden_item
);
1833 } else if (hdr_id
> 0) { /* Shorthand HCP switch */
1835 proto_tree_add_uint (wsp_headers
, hf_wsp_header_shift_code
,
1836 tvb
, offset
, 1, codepage
);
1839 proto_tree_add_text (wsp_headers
, tvb
, hdr_start
, 1,
1840 InvalidTextualHeader
);
1847 /* The following macros hide common processing for all well-known headers
1848 * and shortens the code to be written in a wkh_XXX() function.
1849 * Even declarations are hidden by a macro.
1851 * Define a wkh_XXX() function as follows:
1854 * wkh_XXX (proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _U_)
1856 * wkh_0_Declarations;
1857 * << add other required declarations here >>
1859 * wkh_1_WellKnownValue;
1860 * << add well-known value proto item here; don't forget to set the
1861 * ok variable to TRUE if parsing was correct >>
1862 * wkh_2_TextualValue;
1863 * << add textual value proto item here; don't forget to set the
1864 * ok variable to TRUE if parsing was correct >>
1865 * wkh_3_ValueWithLength;
1866 * << add custom code for value processing and value proto item here >>
1869 * << This macro takes care of parse errors within the header value;
1870 * it requires the header field index if the header has not yet been
1871 * written to the protocol tree (ti == NULL). >>
1874 * NOTE: You only need to write parsing code for the successful case,
1875 * Errors are automatically reported through the wkh_4_End() macro
1879 /* The following code is the generic template with which the value of a
1880 * well-known header can be processed. Not all sections yield a semantically
1881 * correct result, so appropriate error information must be provided.
1885 #define wkh_0a_Declarations /* Declarations for Parsing */ \
1886 gboolean ok = FALSE; /* Triggers error notification code at end */ \
1887 proto_item *ti = NULL; /* Needed for error notification at end */ \
1888 proto_item *hidden_item = NULL; \
1889 guint32 val_start = hdr_start + 1; \
1890 guint8 hdr_id = tvb_get_guint8 (tvb, hdr_start) & 0x7F; \
1891 guint8 val_id = tvb_get_guint8 (tvb, val_start); \
1892 guint32 offset = val_start; /* Offset to one past this header */ \
1893 guint32 val_len; /* length for value with length field */ \
1894 guint32 val_len_len /* length of length field */
1896 #define wkh_0_Declarations \
1897 wkh_0a_Declarations; \
1898 const gchar *val_str = NULL
1900 #define wkh_1_WellKnownValue /* Parse Well Known Value */ \
1901 hidden_item = proto_tree_add_string(tree, hf_hdr_name, \
1902 tvb, hdr_start, offset - hdr_start, \
1903 val_to_str_ext (hdr_id, &vals_field_names_ext, \
1904 "<Unknown WSP header field 0x%02X>")); \
1905 PROTO_ITEM_SET_HIDDEN(hidden_item); \
1906 if (val_id & 0x80) { /* Well-known value */ \
1908 /* Well-known value processing starts HERE \
1912 #define wkh_2_TextualValue /* Parse Textual Value */ \
1914 } else if ((val_id == 0) || (val_id >= 0x20)) { /* Textual value */ \
1915 val_str = (gchar *)tvb_get_stringz (wmem_packet_scope(), tvb, val_start, (gint *)&val_len); \
1916 offset = val_start + val_len; \
1917 /* Textual value processing starts HERE \
1921 #define wkh_2_TextualValueInv /* Parse Textual Value */ \
1923 } else if ((val_id == 0) || (val_id >= 0x20)) { /* Textual value */ \
1924 /*val_str = (gchar *)*/tvb_get_stringz (wmem_packet_scope(), tvb, val_start, (gint *)&val_len); \
1925 offset = val_start + val_len; \
1926 /* Textual value processing starts HERE \
1930 #define wkh_3_ValueWithLength /* Parse Value With Length */ \
1932 } else { /* val_start points to 1st byte of length field */ \
1933 if (val_id == 0x1F) { /* Value Length = guintvar */ \
1934 val_len = tvb_get_guintvar(tvb, val_start + 1, &val_len_len); \
1935 val_len_len++; /* 0x1F length indicator byte */ \
1936 } else { /* Short length followed by Len data octets */ \
1937 val_len = tvb_get_guint8(tvb, offset); \
1940 offset += val_len_len + val_len; \
1941 /* Value with length processing starts HERE \
1942 * The value lies between val_start and offset: \
1943 * - Value Length: Start = val_start \
1944 * Length = val_len_len \
1945 * - Value Data : Start = val_start + val_len_len \
1946 * Length = val_len \
1947 * End = offset - 1 \
1950 #define wkh_4_End(hf) /* End of value parsing */ \
1953 /* Check for errors */ \
1955 if (ti) { /* Append to protocol tree item label */ \
1956 proto_item_append_text(ti, \
1957 " <Error: Invalid header value>"); \
1958 } else if (hf > 0) { /* Create protocol tree item */ \
1959 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
1960 proto_tree_add_string(tree, hf, \
1961 tvb, hdr_start, offset - hdr_start, \
1962 " <Error: Invalid header value>"); \
1963 } else { /* Create anonymous header field entry */ \
1964 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
1965 proto_tree_add_text(tree, tvb, hdr_start, offset - hdr_start, \
1966 "%s: <Error: Invalid header value>", \
1967 val_to_str_ext (hdr_id, &vals_field_names_ext, \
1968 "<Unknown WSP header field 0x%02X>")); \
1975 * This yields the following default header value parser function body
1978 wkh_default(proto_tree
*tree
, tvbuff_t
*tvb
,
1979 guint32 hdr_start
, packet_info
*pinfo _U_
)
1983 ok
= TRUE
; /* Bypass error checking as we don't parse the values! */
1985 wkh_1_WellKnownValue
;
1986 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
1987 ti
= proto_tree_add_text (tree
, tvb
, hdr_start
, offset
- hdr_start
,
1988 "%s: (Undecoded well-known value 0x%02x)",
1989 val_to_str_ext (hdr_id
, &vals_field_names_ext
,
1990 "<Unknown WSP header field 0x%02X>"), val_id
& 0x7F);
1992 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
1993 ti
= proto_tree_add_text(tree
, tvb
, hdr_start
, offset
- hdr_start
,
1995 val_to_str_ext (hdr_id
, &vals_field_names_ext
,
1996 "<Unknown WSP header field 0x%02X>"), val_str
);
1997 wkh_3_ValueWithLength
;
1998 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
1999 ti
= proto_tree_add_text (tree
, tvb
, hdr_start
, offset
- hdr_start
,
2000 "%s: (Undecoded value in general form with length indicator)",
2001 val_to_str_ext (hdr_id
, &vals_field_names_ext
,
2002 "<Unknown WSP header field 0x%02X>"));
2004 wkh_4_End(HF_EMPTY
); /* The default parser has no associated hf_index;
2005 additionally the error code is always bypassed */
2009 /* Content-type processing uses the following common core: */
2010 #define wkh_content_type_header(underscored,Text) \
2012 wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _U_) \
2014 wkh_0_Declarations; \
2015 guint32 off, val = 0, len; \
2017 proto_tree *parameter_tree = NULL; \
2019 wkh_1_WellKnownValue; \
2020 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
2021 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
2022 tvb, hdr_start, offset - hdr_start, \
2023 val_to_str_ext(val_id & 0x7F, &vals_content_types_ext, \
2024 "(Unknown content type identifier 0x%X)")); \
2026 wkh_2_TextualValue; \
2027 /* Sometimes with a No-Content response, a NULL content type \
2028 * is reported. Process this correctly! */ \
2030 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
2031 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
2032 tvb, hdr_start, offset - hdr_start, \
2035 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
2036 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
2037 tvb, hdr_start, offset - hdr_start, \
2038 "<no content type has been specified>"); \
2041 wkh_3_ValueWithLength; \
2042 off = val_start + val_len_len; \
2043 peek = tvb_get_guint8(tvb, off); \
2044 if (is_text_string(peek)) { \
2045 get_extension_media(val_str, tvb, off, len, ok); \
2047 off += len; /* off now points to 1st byte after string */ \
2048 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
2049 ti = proto_tree_add_string (tree, hf_hdr_ ## underscored, \
2050 tvb, hdr_start, offset - hdr_start, val_str); \
2052 } else if (is_integer_value(peek)) { \
2053 get_integer_value(val, tvb, off, len, ok); \
2055 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
2056 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
2057 tvb, hdr_start, offset - hdr_start, \
2058 val_to_str_ext(val, &vals_content_types_ext, \
2059 "(Unknown content type identifier 0x%X)")); \
2063 /* Remember: offset == val_start + val_len + val_len_len */ \
2064 if (ok && (off < offset)) { /* Add parameters if any */ \
2065 parameter_tree = proto_item_add_subtree (ti, ett_header); \
2066 while (off < offset) { \
2067 off = parameter (parameter_tree, ti, tvb, off, offset - off); \
2071 wkh_4_End(hf_hdr_ ## underscored); \
2079 * | ( Value-length ( Extension-media | Integer-value ) *( Parameter ) )
2081 wkh_content_type_header(accept
, "Accept")
2085 * Content-type-value =
2088 * | ( Value-length ( Extension-media | Integer-value ) *( Parameter ) )
2090 * Beware: this header should not appear as such; it is dissected elsewhere
2091 * and at the same time the content type is used for subdissectors.
2092 * It is here for the sake of completeness.
2094 wkh_content_type_header(content_type
, "Content-Type")
2098 * Content-type-value =
2101 * | ( Value-length ( Extension-media | Integer-value ) *( Parameter ) )
2103 * This function adds the content type value to the protocol tree,
2104 * and computes either the numeric or textual media type in return,
2105 * which will be used for further subdissection (e.g., MMS, WBXML).
2108 add_content_type(proto_tree
*tree
, tvbuff_t
*tvb
, guint32 val_start
,
2109 guint32
*well_known_content
, const char **textual_content
)
2111 /* Replace wkh_0_Declarations with slightly modified declarations
2112 * so we can still make use of the wkh_[1-4]_XXX macros! */
2113 guint32 hdr_start
= val_start
; /* No header name, only value! */
2114 guint8 hdr_id
= FN_CONTENT_TYPE
; /* Same remark */
2115 guint8 val_id
= tvb_get_guint8 (tvb
, val_start
);
2116 guint32 offset
= val_start
; /* Offset to one past this header */
2117 guint32 val_len
; /* length for value with length field */
2118 guint32 val_len_len
; /* length of length field */
2119 gchar
*val_str
= NULL
;
2120 guint32 off
, val
= 0, len
;
2122 gboolean ok
= FALSE
;
2123 proto_item
*ti
= NULL
;
2124 proto_item
*hidden_item
= NULL
;
2125 proto_tree
*parameter_tree
= NULL
;
2127 *textual_content
= NULL
;
2128 *well_known_content
= 0;
2130 DebugLog(("add_content_type() - START\n"));
2132 wkh_1_WellKnownValue
;
2133 DebugLog(("add_content_type() - Well-known - Start\n"));
2134 *textual_content
= val_to_str_ext(val_id
& 0x7F, &vals_content_types_ext
,
2135 "<Unknown media type identifier 0x%X>");
2136 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2137 ti
= proto_tree_add_string(tree
, hf_hdr_content_type
,
2138 tvb
, hdr_start
, offset
- hdr_start
,
2140 *well_known_content
= val_id
& 0x7F;
2142 DebugLog(("add_content_type() - Well-known - End\n"));
2144 DebugLog(("add_content_type() - Textual - Start\n"));
2145 /* Sometimes with a No-Content response, a NULL content type
2146 * is reported. Process this correctly! */
2148 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2149 ti
= proto_tree_add_string(tree
, hf_hdr_content_type
,
2150 tvb
, hdr_start
, offset
- hdr_start
,
2152 *textual_content
= g_strdup(val_str
);
2153 *well_known_content
= 0;
2155 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2156 ti
= proto_tree_add_string(tree
, hf_hdr_content_type
,
2157 tvb
, hdr_start
, offset
- hdr_start
,
2158 "<no media type has been specified>");
2159 *textual_content
= NULL
;
2160 *well_known_content
= 0;
2163 DebugLog(("add_content_type() - Textual - End\n"));
2164 wkh_3_ValueWithLength
;
2165 DebugLog(("add_content_type() - General form - Start\n"));
2166 off
= val_start
+ val_len_len
;
2167 peek
= tvb_get_guint8(tvb
, off
);
2168 if (is_text_string(peek
)) {
2169 DebugLog(("add_content_type() - General form - extension-media\n"));
2170 get_extension_media(val_str
, tvb
, off
, len
, ok
);
2172 off
+= len
; /* off now points to 1st byte after string */
2173 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2174 ti
= proto_tree_add_string (tree
, hf_hdr_content_type
,
2175 tvb
, hdr_start
, offset
- hdr_start
, val_str
);
2177 /* Following statement: required? */
2178 *textual_content
= g_strdup(val_str
);
2179 *well_known_content
= 0;
2180 } else if (is_integer_value(peek
)) {
2181 DebugLog(("add_content_type() - General form - integer_value\n"));
2182 get_integer_value(val
, tvb
, off
, len
, ok
);
2184 *textual_content
= val_to_str_ext(val
, &vals_content_types_ext
,
2185 "<Unknown media type identifier 0x%X>");
2186 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2187 ti
= proto_tree_add_string(tree
, hf_hdr_content_type
,
2188 tvb
, hdr_start
, offset
- hdr_start
,
2190 *well_known_content
= val
;
2193 } /* else ok = FALSE */
2194 /* Remember: offset == val_start + val_len_len + val_len */
2195 if (ok
&& (off
< offset
)) { /* Add parameters if any */
2196 DebugLog(("add_content_type() - General form - parameters\n"));
2197 parameter_tree
= proto_item_add_subtree (ti
, ett_header
);
2198 while (off
< offset
) {
2199 DebugLog(("add_content_type() - General form - parameter start "
2200 "(off = %u)\n", off
));
2201 off
= parameter (parameter_tree
, ti
, tvb
, off
, offset
- off
);
2202 DebugLog(("add_content_type() - General form - parameter end "
2203 "(off = %u)\n", off
));
2206 DebugLog(("add_content_type() - General form - End\n"));
2208 wkh_4_End(hf_hdr_content_type
);
2213 * Template for accept_X headers with optional Q parameter value
2215 #define wkh_accept_x_q_header(underscored,Text,valueStringExtAddr,valueName) \
2217 wkh_ ## underscored (proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _U_) \
2219 wkh_0_Declarations; \
2220 guint32 off, val = 0, len; \
2222 proto_tree *parameter_tree = NULL; \
2224 wkh_1_WellKnownValue; \
2225 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
2226 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
2227 tvb, hdr_start, offset - hdr_start, \
2228 val_to_str_ext(val_id & 0x7F, valueStringExtAddr, \
2229 "<Unknown " valueName " identifier 0x%X>")); \
2231 wkh_2_TextualValue; \
2232 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
2233 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
2234 tvb, hdr_start, offset - hdr_start, val_str); \
2236 wkh_3_ValueWithLength; \
2237 off = val_start + val_len_len; \
2238 peek = tvb_get_guint8(tvb, off); \
2239 if (is_text_string(peek)) { \
2240 get_token_text(val_str, tvb, off, len, ok); \
2242 off += len; /* off now points to 1st byte after string */ \
2243 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
2244 ti = proto_tree_add_string (tree, hf_hdr_ ## underscored, \
2245 tvb, hdr_start, offset - hdr_start, val_str); \
2247 } else if (is_integer_value(peek)) { \
2248 get_integer_value(val, tvb, off, len, ok); \
2250 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
2251 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
2252 tvb, hdr_start, offset - hdr_start, \
2253 val_to_str_ext(val, valueStringExtAddr, \
2254 "<Unknown " valueName " identifier 0x%X>")); \
2257 } /* else ok = FALSE */ \
2258 /* Remember: offset == val_start + val_len */ \
2259 if (ok && (off < offset)) { /* Add Q-value if available */ \
2260 parameter_tree = proto_item_add_subtree (ti, ett_header); \
2261 off = parameter_value_q (parameter_tree, ti, tvb, off); \
2264 wkh_4_End(hf_hdr_ ## underscored); \
2268 * Accept-charset-value =
2271 * | ( Value-length ( Token-text | Integer-value ) [ Q-value ] )
2273 wkh_accept_x_q_header(accept_charset
, "Accept-Charset",
2274 &wap_mib_enum_vals_character_sets_ext
, "character set")
2276 * Accept-language-value =
2279 * | ( Value-length ( Text-string | Integer-value ) [ Q-value ] )
2281 wkh_accept_x_q_header(accept_language
, "Accept-Language",
2282 &vals_languages_ext
, "language")
2286 * Push-flag-value = Short-integer
2289 wkh_push_flag(proto_tree
*tree
, tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
)
2291 wkh_0a_Declarations
;
2292 proto_tree
*subtree
= NULL
;
2294 wkh_1_WellKnownValue
;
2295 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2296 ti
= proto_tree_add_string(tree
, hf_hdr_push_flag
,
2297 tvb
, hdr_start
, offset
- hdr_start
, "");
2298 subtree
= proto_item_add_subtree(ti
, ett_header
);
2299 proto_tree_add_uint(subtree
, hf_hdr_push_flag_auth
,
2300 tvb
, val_start
, 1, val_id
);
2301 proto_tree_add_uint(subtree
, hf_hdr_push_flag_trust
,
2302 tvb
, val_start
, 1, val_id
);
2303 proto_tree_add_uint(subtree
, hf_hdr_push_flag_last
,
2304 tvb
, val_start
, 1, val_id
);
2306 proto_item_append_string(ti
, " (Initiator URI authenticated)");
2308 proto_item_append_string(ti
, " (Content trusted)");
2310 proto_item_append_string(ti
, " (Last push message)");
2312 proto_item_append_text(ti
, " <Warning: Reserved flags set>");
2315 wkh_2_TextualValueInv
;
2317 wkh_3_ValueWithLength
;
2319 wkh_4_End(hf_hdr_push_flag
);
2324 * Profile-Diff (with WBXML): Profile-diff-value =
2325 * Value-length <WBXML-Content>
2327 static guint32
wkh_profile_diff_wbxml (proto_tree
*tree
, tvbuff_t
*tvb
,
2328 guint32 hdr_start
, packet_info
*pinfo
)
2330 wkh_0a_Declarations
;
2332 proto_tree
*subtree
;
2334 ok
= TRUE
; /* Bypass error checking as we don't parse the values! */
2336 wkh_1_WellKnownValue
;
2338 wkh_2_TextualValueInv
;
2340 wkh_3_ValueWithLength
;
2341 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2342 ti
= proto_tree_add_string(tree
, hf_hdr_profile_diff
, tvb
, hdr_start
, offset
- hdr_start
,
2343 "(Profile-Diff value as WBXML)");
2344 subtree
= proto_item_add_subtree(ti
, ett_header
);
2345 tmp_tvb
= tvb_new_subset(tvb
, val_start
+ val_len_len
, val_len
, val_len
); /* TODO: fix 2nd length */
2346 call_dissector(wbxml_uaprof_handle
, tmp_tvb
, pinfo
, subtree
);
2348 wkh_4_End(hf_hdr_profile_diff
);
2357 wkh_allow(proto_tree
*tree
, tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*apinfo _U_
)
2359 wkh_0a_Declarations
;
2361 wkh_1_WellKnownValue
;
2363 if (val_id
>= 0x40) { /* Valid WSP method */
2364 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2365 ti
= proto_tree_add_string(tree
, hf_hdr_allow
,
2366 tvb
, hdr_start
, offset
- hdr_start
,
2367 val_to_str_ext(val_id
& 0x7F, &wsp_vals_pdu_type_ext
,
2368 "<Unknown WSP method 0x%02X>"));
2371 wkh_2_TextualValueInv
;
2373 wkh_3_ValueWithLength
;
2375 wkh_4_End(hf_hdr_allow
);
2381 * Token-text | Short-integer
2384 wkh_public(proto_tree
*tree
, tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*apinfo _U_
)
2388 wkh_1_WellKnownValue
;
2390 if (val_id
>= 0x40) { /* Valid WSP method */
2391 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2392 ti
= proto_tree_add_string(tree
, hf_hdr_public
,
2393 tvb
, hdr_start
, offset
- hdr_start
,
2394 val_to_str_ext(val_id
& 0x7F, &wsp_vals_pdu_type_ext
,
2395 "<Unknown WSP method 0x%02X>"));
2399 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2400 ti
= proto_tree_add_string(tree
, hf_hdr_public
,
2401 tvb
, hdr_start
, offset
- hdr_start
, val_str
);
2403 wkh_3_ValueWithLength
;
2405 wkh_4_End(hf_hdr_public
);
2411 * Token-text | Short-integer
2414 wkh_vary(proto_tree
*tree
, tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
)
2418 wkh_1_WellKnownValue
;
2419 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2420 ti
= proto_tree_add_string(tree
, hf_hdr_vary
,
2421 tvb
, hdr_start
, offset
- hdr_start
,
2422 val_to_str_ext(val_id
& 0x7F, &vals_field_names_ext
,
2423 "<Unknown WSP header field 0x%02X>"));
2426 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2427 ti
= proto_tree_add_string(tree
, hf_hdr_vary
,
2428 tvb
, hdr_start
, offset
- hdr_start
,
2431 wkh_3_ValueWithLength
;
2433 wkh_4_End(hf_hdr_vary
);
2438 * X-wap-security-value = 0x80
2441 wkh_x_wap_security(proto_tree
*tree
, tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
)
2443 wkh_0a_Declarations
;
2445 wkh_1_WellKnownValue
;
2446 if (val_id
== 0x80) {
2447 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2448 ti
= proto_tree_add_string(tree
, hf_hdr_x_wap_security
,
2449 tvb
, hdr_start
, offset
- hdr_start
, "close-subordinate");
2452 wkh_2_TextualValueInv
;
2454 wkh_3_ValueWithLength
;
2456 wkh_4_End(hf_hdr_x_wap_security
);
2461 * Connection-value = 0x80 | Token-text
2464 wkh_connection(proto_tree
*tree
, tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*apinfo _U_
)
2468 wkh_1_WellKnownValue
;
2469 if (val_id
== 0x80) {
2470 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2471 ti
= proto_tree_add_string(tree
, hf_hdr_connection
,
2472 tvb
, hdr_start
, offset
- hdr_start
, "close");
2476 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2477 ti
= proto_tree_add_string(tree
, hf_hdr_connection
,
2478 tvb
, hdr_start
, offset
- hdr_start
, val_str
);
2480 wkh_3_ValueWithLength
;
2482 wkh_4_End(hf_hdr_connection
);
2487 * Transfer-encoding-value = 0x80 | Token-text
2490 wkh_transfer_encoding(proto_tree
*tree
, tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
)
2494 wkh_1_WellKnownValue
;
2495 if (val_id
== 0x80) {
2496 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2497 ti
= proto_tree_add_string(tree
, hf_hdr_transfer_encoding
,
2498 tvb
, hdr_start
, offset
- hdr_start
, "chunked");
2502 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2503 ti
= proto_tree_add_string(tree
, hf_hdr_transfer_encoding
,
2504 tvb
, hdr_start
, offset
- hdr_start
, val_str
);
2506 wkh_3_ValueWithLength
;
2508 wkh_4_End(hf_hdr_transfer_encoding
);
2513 * Accept-range-value = 0x80 | 0x81 | Token-text
2516 wkh_accept_ranges(proto_tree
*tree
, tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
)
2520 wkh_1_WellKnownValue
;
2522 case 0x80: /* none */
2523 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2524 ti
= proto_tree_add_string(tree
, hf_hdr_accept_ranges
,
2525 tvb
, hdr_start
, offset
- hdr_start
, "none");
2528 case 0x81: /* bytes */
2529 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2530 ti
= proto_tree_add_string(tree
, hf_hdr_accept_ranges
,
2531 tvb
, hdr_start
, offset
- hdr_start
, "bytes");
2536 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2537 ti
= proto_tree_add_string(tree
, hf_hdr_accept_ranges
,
2538 tvb
, hdr_start
, offset
- hdr_start
, val_str
);
2540 wkh_3_ValueWithLength
;
2542 wkh_4_End(hf_hdr_accept_ranges
);
2547 * Content-encoding-value = 0x80 | 0x81 | 0x82 | Token-text
2550 wkh_content_encoding(proto_tree
*tree
, tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
)
2554 wkh_1_WellKnownValue
;
2556 case 0x80: /* gzip */
2557 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2558 ti
= proto_tree_add_string(tree
, hf_hdr_content_encoding
,
2559 tvb
, hdr_start
, offset
- hdr_start
, "gzip");
2562 case 0x81: /* compress */
2563 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2564 ti
= proto_tree_add_string(tree
, hf_hdr_content_encoding
,
2565 tvb
, hdr_start
, offset
- hdr_start
, "compress");
2568 case 0x82: /* deflate */
2569 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2570 ti
= proto_tree_add_string(tree
, hf_hdr_content_encoding
,
2571 tvb
, hdr_start
, offset
- hdr_start
, "deflate");
2576 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2577 ti
= proto_tree_add_string(tree
, hf_hdr_content_encoding
,
2578 tvb
, hdr_start
, offset
- hdr_start
, val_str
);
2580 wkh_3_ValueWithLength
;
2582 wkh_4_End(hf_hdr_content_encoding
);
2587 * Accept-encoding-value =
2590 * | ( Value-length ( Short-integer | Text-string ) [ Q-value ] )
2593 wkh_accept_encoding(proto_tree
*tree
, tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
)
2599 proto_tree
*parameter_tree
= NULL
;
2601 wkh_1_WellKnownValue
;
2603 case 0x80: /* gzip */
2604 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2605 ti
= proto_tree_add_string(tree
, hf_hdr_accept_encoding
,
2606 tvb
, hdr_start
, offset
- hdr_start
, "gzip");
2609 case 0x81: /* compress */
2610 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2611 ti
= proto_tree_add_string(tree
, hf_hdr_accept_encoding
,
2612 tvb
, hdr_start
, offset
- hdr_start
, "compress");
2615 case 0x82: /* deflate */
2616 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2617 ti
= proto_tree_add_string(tree
, hf_hdr_accept_encoding
,
2618 tvb
, hdr_start
, offset
- hdr_start
, "deflate");
2622 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2623 ti
= proto_tree_add_string(tree
, hf_hdr_accept_encoding
,
2624 tvb
, hdr_start
, offset
- hdr_start
, "*");
2629 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2630 proto_tree_add_string(tree
, hf_hdr_accept_encoding
,
2631 tvb
, hdr_start
, offset
- hdr_start
, val_str
);
2633 wkh_3_ValueWithLength
;
2634 off
= val_start
+ val_len_len
;
2635 peek
= tvb_get_guint8(tvb
, off
);
2636 if (is_short_integer(peek
)) {
2638 case 0x80: /* gzip */
2639 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2640 ti
= proto_tree_add_string(tree
, hf_hdr_accept_encoding
,
2641 tvb
, hdr_start
, offset
- hdr_start
, "gzip");
2644 case 0x81: /* compress */
2645 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2646 ti
= proto_tree_add_string(tree
, hf_hdr_accept_encoding
,
2647 tvb
, hdr_start
, offset
- hdr_start
, "compress");
2650 case 0x82: /* deflate */
2651 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2652 ti
= proto_tree_add_string(tree
, hf_hdr_accept_encoding
,
2653 tvb
, hdr_start
, offset
- hdr_start
, "deflate");
2656 case 0x83: /* any */
2657 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2658 ti
= proto_tree_add_string(tree
, hf_hdr_accept_encoding
,
2659 tvb
, hdr_start
, offset
- hdr_start
, "*");
2665 get_token_text(str
, tvb
, off
, len
, ok
);
2667 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2668 ti
= proto_tree_add_string(tree
, hf_hdr_accept_encoding
,
2669 tvb
, hdr_start
, offset
- hdr_start
, str
);
2674 /* Remember: offset == val_start + val_len_len + val_len */
2675 if (off
< offset
) { /* Add Q-value if available */
2676 parameter_tree
= proto_item_add_subtree(ti
, ett_header
);
2677 parameter_value_q(parameter_tree
, ti
, tvb
, off
);
2680 wkh_4_End(hf_hdr_accept_encoding
);
2685 * Content-disposition-value = Value-length ( Disposition ) *( Parameter )
2686 * Disposition = Form-data | Attachment | Inline | Token-text
2690 * We handle this as:
2691 * Value-length ( Short-integer | Text-string ) *( Parameter )
2694 wkh_content_disposition(proto_tree
*tree
, tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
)
2696 wkh_0a_Declarations
;
2700 proto_tree
*parameter_tree
= NULL
;
2702 wkh_1_WellKnownValue
;
2704 wkh_2_TextualValueInv
;
2706 wkh_3_ValueWithLength
;
2707 off
= val_start
+ val_len_len
;
2708 peek
= tvb_get_guint8(tvb
, off
);
2709 if (is_short_integer(peek
)) {
2711 case 0x80: /* form-data */
2712 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2713 ti
= proto_tree_add_string(tree
, hf_hdr_content_disposition
,
2714 tvb
, hdr_start
, offset
- hdr_start
, "form-data");
2717 case 0x81: /* attachment */
2718 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2719 ti
= proto_tree_add_string(tree
, hf_hdr_content_disposition
,
2720 tvb
, hdr_start
, offset
- hdr_start
, "attachment");
2723 case 0x82: /* inline */
2724 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2725 ti
= proto_tree_add_string(tree
, hf_hdr_content_disposition
,
2726 tvb
, hdr_start
, offset
- hdr_start
, "inline");
2732 get_token_text(str
, tvb
, off
, len
, ok
);
2734 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2735 ti
= proto_tree_add_string(tree
, hf_hdr_content_disposition
,
2736 tvb
, hdr_start
, offset
- hdr_start
, str
);
2740 if ((ok
) && (off
< offset
)) {
2741 /* Remember: offset == val_start + val_len_len + val_len */
2742 parameter_tree
= proto_item_add_subtree(ti
, ett_header
);
2743 while (off
< offset
) { /* Add parameters if available */
2744 off
= parameter(parameter_tree
, ti
, tvb
, off
, offset
- off
);
2747 wkh_4_End(hf_hdr_content_disposition
);
2752 * Common code for headers with only a textual value
2753 * is written in the macro below:
2755 #define wkh_text_header(underscored,Text) \
2757 wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _U_) \
2759 wkh_0_Declarations; \
2761 wkh_1_WellKnownValue; \
2763 wkh_2_TextualValue; \
2764 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
2765 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
2766 tvb, hdr_start, offset - hdr_start, val_str); \
2768 wkh_3_ValueWithLength; \
2770 wkh_4_End(hf_hdr_ ## underscored); \
2773 /* Text-only headers: */
2774 wkh_text_header(content_base
, "Content-Base")
2775 wkh_text_header(content_location
, "Content-Location")
2776 wkh_text_header(etag
, "ETag")
2777 wkh_text_header(from
, "From")
2778 wkh_text_header(host
, "Host")
2779 wkh_text_header(if_match
, "If-Match")
2780 wkh_text_header(if_none_match
, "If-None-Match")
2781 wkh_text_header(location
, "Location")
2782 wkh_text_header(referer
, "Referer")
2783 wkh_text_header(server
, "Server")
2784 wkh_text_header(user_agent
, "User-Agent")
2785 wkh_text_header(upgrade
, "Upgrade")
2786 wkh_text_header(via
, "Via")
2787 wkh_text_header(content_uri
, "Content-Uri")
2788 wkh_text_header(initiator_uri
, "Initiator-Uri")
2789 wkh_text_header(profile
, "Profile")
2792 * Same for quoted-string value
2794 #define wkh_quoted_string_header(underscored,Text) \
2796 wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _U_) \
2798 wkh_0_Declarations; \
2801 wkh_1_WellKnownValue; \
2803 wkh_2_TextualValue; \
2804 if (is_quoted_string(val_str[0])) { \
2805 if (is_quoted_string(val_str[val_len-2])) { \
2806 /* Trailing quote - issue a warning */ \
2807 str = wmem_strdup_printf(wmem_packet_scope(), "%s" TrailingQuoteWarning, val_str); \
2808 } else { /* OK (no trailing quote) */ \
2809 str = wmem_strdup_printf(wmem_packet_scope(), "%s\"", val_str); \
2811 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
2812 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
2813 tvb, hdr_start, offset - hdr_start, str); \
2815 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
2816 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
2817 tvb, hdr_start, offset - hdr_start, val_str); \
2818 proto_item_append_text(ti, \
2819 " <Warning: should be encoded as a Quoted-string>"); \
2822 wkh_3_ValueWithLength; \
2824 wkh_4_End(hf_hdr_ ## underscored); \
2827 wkh_quoted_string_header(content_id
, "Content-ID")
2831 * Common code for headers with only a textual or a date value
2832 * is written in the macro below:
2834 #define wkh_text_or_date_value_header(underscored,Text) \
2836 wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _U_) \
2838 wkh_0_Declarations; \
2839 guint32 val = 0, off = val_start, len; \
2840 gchar *str; /* may not be freed! */ \
2842 wkh_1_WellKnownValue; \
2844 wkh_2_TextualValue; \
2845 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
2846 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
2847 tvb, hdr_start, offset - hdr_start, val_str); \
2849 wkh_3_ValueWithLength; \
2850 if (val_id <= 4) { /* Length field already parsed by macro! */ \
2851 get_date_value(val, tvb, off, len, ok); \
2853 str = abs_time_secs_to_str(val, ABSOLUTE_TIME_LOCAL, TRUE); \
2854 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
2855 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
2856 tvb, hdr_start, offset - hdr_start, str); \
2857 /* BEHOLD: do NOT try to free str, as \
2858 * abs_time_secs_to_str() returns wmem_allocated data */ \
2861 wkh_4_End(hf_hdr_ ## underscored); \
2865 wkh_text_or_date_value_header(if_range
,"If-Range")
2869 * Common code for headers with only a date value
2870 * is written in the macro below:
2872 #define wkh_date_value_header(underscored,Text) \
2874 wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _U_) \
2876 wkh_0a_Declarations; \
2877 guint32 val = 0, off = val_start, len; \
2878 gchar *str; /* may not be freed! */ \
2880 wkh_1_WellKnownValue; \
2882 wkh_2_TextualValueInv; \
2884 wkh_3_ValueWithLength; \
2885 if (val_id <= 4) { /* Length field already parsed by macro! */ \
2886 get_date_value(val, tvb, off, len, ok); \
2888 str = abs_time_secs_to_str(val, ABSOLUTE_TIME_LOCAL, TRUE); \
2889 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
2890 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
2891 tvb, hdr_start, offset - hdr_start, str); \
2892 /* BEHOLD: do NOT try to free str, as \
2893 * abs_time_secs_to_str() returns wmem_allocated data */ \
2896 wkh_4_End(hf_hdr_ ## underscored); \
2899 /* Date-value only headers: */
2900 wkh_date_value_header(date
, "Date")
2901 wkh_date_value_header(expires
, "Expires")
2902 wkh_date_value_header(if_modified_since
, "If-Modified-Since")
2903 wkh_date_value_header(if_unmodified_since
, "If-Unmodified-Since")
2904 wkh_date_value_header(last_modified
, "Last-Modified")
2907 /* Date-value with special interpretation of zero value */
2908 #define wkh_tod_value_header(underscored,Text) \
2910 wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _U_) \
2912 wkh_0a_Declarations; \
2913 guint32 val = 0, off = val_start, len; \
2914 gchar *str; /* may not be freed! */ \
2916 wkh_1_WellKnownValue; \
2917 if (val_id == 0x80) { /* Openwave TOD header uses this format */ \
2918 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
2919 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
2920 tvb, hdr_start, offset - hdr_start, \
2921 "Requesting Time Of Day"); \
2922 proto_item_append_text(ti, \
2923 " <Warning: should be encoded as long-integer>"); \
2926 /* It seems VERY unlikely that we'll see date values within the first \
2927 * 127 seconds of the UNIX 1-1-1970 00:00:00 start of the date clocks \
2928 * so I assume such a value is a genuine error */ \
2929 wkh_2_TextualValueInv; \
2931 wkh_3_ValueWithLength; \
2932 if (val_id <= 4) { /* Length field already parsed by macro! */ \
2933 get_date_value(val, tvb, off, len, ok); \
2936 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
2937 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
2938 tvb, hdr_start, offset - hdr_start, \
2939 "Requesting Time Of Day"); \
2941 str = abs_time_secs_to_str(val, ABSOLUTE_TIME_LOCAL, TRUE); \
2942 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
2943 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
2944 tvb, hdr_start, offset - hdr_start, str); \
2948 wkh_4_End(hf_hdr_ ## underscored); \
2951 wkh_tod_value_header(x_wap_tod
, "X-Wap-Tod")
2955 * Age-value: Delta-seconds-value
2958 wkh_age(proto_tree
*tree
, tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
)
2961 guint32 val
= 0, off
= val_start
, len
;
2963 wkh_1_WellKnownValue
;
2964 val
= val_id
& 0x7F;
2965 val_str
= wmem_strdup_printf(wmem_packet_scope(), "%u second%s", val
, plurality(val
, "", "s"));
2966 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2967 ti
= proto_tree_add_string(tree
, hf_hdr_age
,
2968 tvb
, hdr_start
, offset
- hdr_start
, val_str
);
2970 wkh_2_TextualValueInv
;
2972 wkh_3_ValueWithLength
;
2973 if (val_id
<= 4) { /* Length field already parsed by macro! */
2974 get_long_integer(val
, tvb
, off
, len
, ok
);
2976 val_str
= wmem_strdup_printf(wmem_packet_scope(), "%u second%s", val
, plurality(val
, "", "s"));
2977 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
2978 ti
= proto_tree_add_string(tree
, hf_hdr_age
,
2979 tvb
, hdr_start
, offset
- hdr_start
, val_str
);
2982 wkh_4_End(hf_hdr_age
);
2987 * Template for Integer lookup or text value headers:
2989 #define wkh_integer_lookup_or_text_value(underscored,Text,valueStringExtAddr,valueName) \
2991 wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _U_) \
2993 wkh_0_Declarations; \
2994 guint32 off = val_start, len; \
2996 wkh_1_WellKnownValue; \
2997 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
2998 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
2999 tvb, hdr_start, offset - hdr_start, \
3000 val_to_str_ext(val_id & 0x7F, valueStringExtAddr, \
3001 "(Unknown " valueName " identifier 0x%X)")); \
3003 wkh_2_TextualValue; \
3004 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
3005 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
3006 tvb, hdr_start, offset - hdr_start, val_str); \
3008 wkh_3_ValueWithLength; \
3009 if (val_id <= 4) { /* Length field already parsed by macro! */ \
3010 len = tvb_get_guint8(tvb,off); \
3011 ok = (len >= 1 && len <= 4); /* Valid lengths for us are 1-4 */ \
3013 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
3014 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
3015 tvb, hdr_start, offset - hdr_start, \
3016 val_to_str_ext(val_id & 0x7F, valueStringExtAddr, \
3017 "(Unknown " valueName " identifier 0x%X)")); \
3020 wkh_4_End(hf_hdr_ ## underscored); \
3024 * Wap-application-value: Uri-value | Integer-value
3026 wkh_integer_lookup_or_text_value(x_wap_application_id
, "X-Wap-Application-Id",
3027 &vals_wap_application_ids_ext
, "WAP application")
3028 wkh_integer_lookup_or_text_value(accept_application
, "Accept-Application",
3029 &vals_wap_application_ids_ext
, "WAP application")
3030 wkh_integer_lookup_or_text_value(content_language
, "Content-Language",
3031 &vals_languages_ext
, "language")
3032 /* NOTE - Although the WSP spec says this is an integer-value, the WSP headers
3033 * are encoded as a 7-bit entity! */
3034 wkh_integer_lookup_or_text_value(trailer
, "Trailer",
3035 &vals_field_names_ext
, "well-known-header")
3043 * Common code for headers with only a challenge value
3044 * is written in the macro below:
3046 #define wkh_challenge_value_header(underscored,Text) \
3048 wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, \
3049 guint32 hdr_start, packet_info *pinfo _U_) \
3051 wkh_0_Declarations; \
3054 proto_tree *subtree; \
3057 wkh_1_WellKnownValue; \
3059 wkh_2_TextualValueInv; \
3061 wkh_3_ValueWithLength; \
3062 off = val_start + val_len_len; \
3063 peek = tvb_get_guint8(tvb, off); \
3064 if (peek == 0x80) { /* Basic */ \
3065 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
3066 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
3067 tvb, hdr_start, offset - hdr_start, "basic"); \
3068 subtree = proto_item_add_subtree(ti, ett_header); \
3069 proto_tree_add_string(subtree, hf_hdr_ ## underscored ## _scheme, \
3070 tvb, off, 1, "basic"); \
3072 /* Realm: text-string */ \
3073 get_text_string(str,tvb,off,len,ok); \
3075 proto_tree_add_string(subtree, \
3076 hf_hdr_ ## underscored ## _realm, \
3077 tvb, off, len, str); \
3078 val_str = wmem_strdup_printf(wmem_packet_scope(), "; realm=%s", str); \
3079 proto_item_append_string(ti, val_str); \
3082 } else { /* Authentication-scheme: token-text */ \
3083 get_token_text(str, tvb, off, len, ok); \
3085 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
3086 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
3087 tvb, hdr_start, off - hdr_start, str); \
3088 subtree = proto_item_add_subtree(ti, ett_header); \
3089 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
3090 proto_tree_add_string(subtree, \
3091 hf_hdr_ ## underscored ## _scheme, \
3092 tvb, hdr_start, off - hdr_start, str); \
3094 /* Realm: text-string */ \
3095 get_text_string(str,tvb,off,len,ok); \
3097 proto_tree_add_string(subtree, \
3098 hf_hdr_ ## underscored ## _realm, \
3099 tvb, off, len, str); \
3100 val_str = wmem_strdup_printf(wmem_packet_scope(), "; realm=%s", str); \
3101 proto_item_append_string(ti, val_str); \
3103 /* Auth-params: parameter - TODO */ \
3104 while (off < offset) /* Parse parameters */ \
3105 off = parameter(subtree, ti, tvb, off, offset - off); \
3109 wkh_4_End(hf_hdr_ ## underscored); \
3112 /* Challenge-value only headers: */
3113 wkh_challenge_value_header(www_authenticate
, "WWW-Authenticate")
3114 wkh_challenge_value_header(proxy_authenticate
, "Proxy-Authenticate")
3122 * Common code for headers with only a credentials value
3123 * is written in the macro below:
3125 #define wkh_credentials_value_header(underscored,Text) \
3127 wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, \
3128 guint32 hdr_start, packet_info *pinfo _U_) \
3130 wkh_0_Declarations; \
3133 proto_tree *subtree; \
3136 wkh_1_WellKnownValue; \
3138 wkh_2_TextualValueInv; \
3140 wkh_3_ValueWithLength; \
3141 off = val_start + val_len_len; \
3142 peek = tvb_get_guint8(tvb, off); \
3143 if (peek == 0x80) { /* Basic */ \
3144 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
3145 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
3146 tvb, hdr_start, offset - hdr_start, "basic"); \
3147 subtree = proto_item_add_subtree(ti, ett_header); \
3148 proto_tree_add_string(subtree, hf_hdr_ ## underscored ## _scheme, \
3149 tvb, off, 1, "basic"); \
3151 /* User-id: text-string */ \
3152 get_text_string(str,tvb,off,len,ok); \
3154 proto_tree_add_string(subtree, \
3155 hf_hdr_ ## underscored ## _user_id, \
3156 tvb, off, len, str); \
3157 val_str = wmem_strdup_printf(wmem_packet_scope(), "; user-id=%s", str); \
3158 proto_item_append_string(ti, val_str); \
3160 /* Password: text-string */ \
3161 get_text_string(str,tvb,off,len,ok); \
3163 proto_tree_add_string(subtree, \
3164 hf_hdr_ ## underscored ## _password, \
3165 tvb, off, len, str); \
3166 val_str = wmem_strdup_printf(wmem_packet_scope(), "; password=%s", str); \
3167 proto_item_append_string(ti, val_str); \
3171 } else { /* Authentication-scheme: token-text */ \
3172 get_token_text(str, tvb, off, len, ok); \
3174 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
3175 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
3176 tvb, hdr_start, off - hdr_start, str); \
3177 subtree = proto_item_add_subtree(ti, ett_header); \
3178 proto_tree_add_string(subtree, \
3179 hf_hdr_ ## underscored ## _scheme, \
3180 tvb, hdr_start, off - hdr_start, str); \
3182 /* Auth-params: parameter - TODO */ \
3183 while (off < offset) /* Parse parameters */ \
3184 off = parameter(subtree, ti, tvb, off, offset - off); \
3187 wkh_4_End(hf_hdr_ ## underscored); \
3190 /* Credentials-value only headers: */
3191 wkh_credentials_value_header(authorization
, "Authorization")
3192 wkh_credentials_value_header(proxy_authorization
, "Proxy-Authorization")
3196 * Content-md5-value = 16*16 OCTET
3199 wkh_content_md5 (proto_tree
*tree
, tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
)
3204 wkh_1_WellKnownValue
;
3206 wkh_2_TextualValueInv
;
3208 wkh_3_ValueWithLength
;
3209 off
= val_start
+ val_len_len
;
3210 if (val_len
== 16) {
3211 val_str
= wmem_strdup_printf(wmem_packet_scope(),
3212 "%02x%02x%02x%02x%02x%02x%02x%02x"
3213 "%02x%02x%02x%02x%02x%02x%02x%02x",
3214 tvb_get_guint8(tvb
, off
),
3215 tvb_get_guint8(tvb
, off
+ 1),
3216 tvb_get_guint8(tvb
, off
+ 2),
3217 tvb_get_guint8(tvb
, off
+ 3),
3218 tvb_get_guint8(tvb
, off
+ 4),
3219 tvb_get_guint8(tvb
, off
+ 5),
3220 tvb_get_guint8(tvb
, off
+ 6),
3221 tvb_get_guint8(tvb
, off
+ 7),
3222 tvb_get_guint8(tvb
, off
+ 8),
3223 tvb_get_guint8(tvb
, off
+ 9),
3224 tvb_get_guint8(tvb
, off
+ 10),
3225 tvb_get_guint8(tvb
, off
+ 11),
3226 tvb_get_guint8(tvb
, off
+ 12),
3227 tvb_get_guint8(tvb
, off
+ 13),
3228 tvb_get_guint8(tvb
, off
+ 14),
3229 tvb_get_guint8(tvb
, off
+ 15)
3231 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3232 ti
= proto_tree_add_string(tree
, hf_hdr_content_md5
,
3233 tvb
, hdr_start
, offset
- hdr_start
, val_str
);
3236 wkh_4_End(hf_hdr_content_md5
);
3241 * Pragma-value = 0x80 | Length Parameter
3244 wkh_pragma(proto_tree
*tree
, tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
)
3246 wkh_0a_Declarations
;
3249 wkh_1_WellKnownValue
;
3250 if (val_id
== 0x80) {
3251 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3252 ti
= proto_tree_add_string(tree
, hf_hdr_pragma
,
3253 tvb
, hdr_start
, offset
- hdr_start
, "no-cache");
3256 wkh_2_TextualValueInv
;
3258 wkh_3_ValueWithLength
;
3259 off
= val_start
+ val_len_len
;
3260 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3261 ti
= proto_tree_add_string(tree
, hf_hdr_pragma
,
3262 tvb
, hdr_start
, off
- hdr_start
, "");
3263 /* NULL subtree for parameter() results in no subtree
3264 * TODO - provide a single parameter dissector that appends data
3265 * to the header field data. */
3266 parameter(NULL
, ti
, tvb
, off
, offset
- off
);
3268 wkh_4_End(hf_hdr_pragma
);
3275 #define wkh_integer_value_header(underscored,Text) \
3277 wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _U_) \
3279 wkh_0a_Declarations; \
3280 guint32 val = 0, off = val_start, len; \
3281 gchar *str; /* may not be freed! */ \
3283 wkh_1_WellKnownValue; \
3284 str = wmem_strdup_printf(wmem_packet_scope(), "%u", val_id & 0x7F); \
3285 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
3286 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
3287 tvb, hdr_start, offset - hdr_start, str); \
3289 wkh_2_TextualValueInv; \
3291 wkh_3_ValueWithLength; \
3292 if (val_id <= 4) { /* Length field already parsed by macro! */ \
3293 get_long_integer(val, tvb, off, len, ok); \
3295 str = wmem_strdup_printf(wmem_packet_scope(), "%u", val); \
3296 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
3297 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
3298 tvb, hdr_start, offset - hdr_start, str); \
3301 wkh_4_End(hf_hdr_ ## underscored); \
3304 wkh_integer_value_header(content_length
, "Content-Length")
3305 wkh_integer_value_header(max_forwards
, "Max-Forwards")
3308 #define wkh_integer_lookup_value_header(underscored,Text,valueStringExtAddr,valueName) \
3310 wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _U_) \
3312 wkh_0_Declarations; \
3313 guint32 off = val_start, len; \
3315 wkh_1_WellKnownValue; \
3316 val_str = try_val_to_str_ext(val_id & 0x7F, valueStringExtAddr); \
3318 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
3319 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
3320 tvb, hdr_start, offset - hdr_start, val_str); \
3323 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
3324 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
3325 tvb, hdr_start, offset - hdr_start, \
3326 "<Unknown " valueName ">"); \
3328 wkh_2_TextualValueInv; \
3330 wkh_3_ValueWithLength; \
3331 if (val_id <= 4) { /* Length field already parsed by macro! */ \
3332 len = tvb_get_guint8(tvb,off); \
3333 ok = (len >= 1 && len <= 4); /* Valid lengths for us are 1-4 */ \
3335 val_str = try_val_to_str_ext(val_id & 0x7F, valueStringExtAddr); \
3337 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
3338 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
3339 tvb, hdr_start, offset - hdr_start, val_str); \
3342 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
3343 ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \
3344 tvb, hdr_start, offset - hdr_start, \
3345 "<Unknown " valueName ">"); \
3349 wkh_4_End(hf_hdr_ ## underscored); \
3352 wkh_integer_lookup_value_header(bearer_indication
, "Bearer-Indication",
3353 &vals_bearer_types_ext
, "bearer type")
3357 * Cache-control-value
3360 wkh_cache_control(proto_tree
*tree
, tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
)
3363 guint32 off
, len
, val
= 0;
3364 guint8 peek
, cache_control_directive
;
3367 wkh_1_WellKnownValue
;
3368 val
= val_id
& 0x7F;
3369 val_str
= try_val_to_str_ext(val
, &vals_cache_control_ext
);
3371 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3372 ti
= proto_tree_add_string(tree
, hf_hdr_cache_control
,
3373 tvb
, hdr_start
, offset
- hdr_start
, val_str
);
3377 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3378 ti
= proto_tree_add_string(tree
, hf_hdr_cache_control
,
3379 tvb
, hdr_start
, offset
- hdr_start
, val_str
);
3381 wkh_3_ValueWithLength
;
3383 * ( no-cache | private ) 1*( Field-name )
3384 * | ( max-age | max-stale | min-fresh | s-maxage) Delta-seconds-value
3385 * | Token-text ( Integer-value | Text-value )
3387 * Field-name = Short-integer | Token-text
3389 off
= val_start
+ val_len_len
;
3390 cache_control_directive
= tvb_get_guint8(tvb
, off
++);
3391 if (cache_control_directive
& 0x80) { /* Well known cache directive */
3392 switch (cache_control_directive
& 0x7F) {
3393 case CACHE_CONTROL_NO_CACHE
:
3394 case CACHE_CONTROL_PRIVATE
:
3395 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3396 ti
= proto_tree_add_string(tree
, hf_hdr_cache_control
,
3397 tvb
, hdr_start
, offset
- hdr_start
,
3398 val_to_str_ext (cache_control_directive
& 0x7F, &vals_cache_control_ext
,
3399 "<Unknown cache control directive 0x%02X>"));
3400 /* TODO: split multiple entries */
3402 while (ok
&& (off
< offset
)) { /* 1*( Field-name ) */
3403 peek
= tvb_get_guint8(tvb
, off
);
3404 if (peek
& 0x80) { /* Well-known-field-name */
3405 proto_item_append_string(ti
,
3406 val_to_str (peek
, vals_field_names
,
3407 "<Unknown WSP header field 0x%02X>"));
3409 } else { /* Token-text */
3410 get_token_text(val_str
, tvb
, off
, len
, ok
);
3412 proto_item_append_string(ti
, val_str
);
3419 case CACHE_CONTROL_MAX_AGE
:
3420 case CACHE_CONTROL_MAX_STALE
:
3421 case CACHE_CONTROL_MIN_FRESH
:
3422 case CACHE_CONTROL_S_MAXAGE
:
3423 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3424 ti
= proto_tree_add_string(tree
, hf_hdr_cache_control
,
3425 tvb
, hdr_start
, offset
- hdr_start
,
3426 val_to_str_ext (cache_control_directive
& 0x7F, &vals_cache_control_ext
,
3427 "<Unknown cache control directive 0x%02X>"));
3428 get_delta_seconds_value(val
, tvb
, off
, len
, ok
);
3430 val_str
= wmem_strdup_printf(wmem_packet_scope(), "=%u second%s",
3431 val
, plurality(val
, "", "s"));
3432 proto_item_append_string(ti
, val_str
);
3440 } else if (is_token_text(cache_control_directive
)) {
3441 get_token_text(val_str
, tvb
, off
, len
, ok
);
3443 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3444 ti
= proto_tree_add_string(tree
, hf_hdr_cache_control
,
3445 tvb
, hdr_start
, offset
- hdr_start
, val_str
);
3446 get_integer_value(val
, tvb
, off
, len
, ok
);
3447 if (ok
) { /* Integer-value */
3448 val_str
= wmem_strdup_printf(wmem_packet_scope(), "=%u", val
);
3449 proto_item_append_string(ti
, val_str
);
3450 } else { /* Text-value */
3451 get_text_string(val_str
, tvb
, off
, len
, ok
);
3453 if (is_quoted_string(val_str
[0])) {
3454 if (is_quoted_string(val_str
[len
-2])) {
3455 /* Trailing quote - issue a warning */
3456 str
= wmem_strdup_printf(wmem_packet_scope(), "%s" TrailingQuoteWarning
,
3458 } else { /* OK (no trailing quote) */
3459 str
= wmem_strdup_printf(wmem_packet_scope(), "%s\"", val_str
);
3461 proto_item_append_string(ti
, str
);
3462 } else { /* Token-text | 0x00 */
3463 /* TODO - check that we have Token-text or 0x00 */
3464 proto_item_append_string(ti
, val_str
);
3470 wkh_4_End(hf_hdr_cache_control
);
3477 * | ( Value-length Short-integer Text-string Text-string )
3480 wkh_warning(proto_tree
*tree
, tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
)
3483 guint32 off
, len
, val
;
3486 proto_tree
*subtree
;
3488 /* TODO - subtree with values */
3490 wkh_1_WellKnownValue
;
3491 val
= val_id
& 0x7F;
3492 val_str
= try_val_to_str_ext(val
, &vals_wsp_warning_code_ext
);
3494 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3495 ti
= proto_tree_add_string(tree
, hf_hdr_warning
,
3496 tvb
, hdr_start
, offset
- hdr_start
, val_str
);
3497 subtree
= proto_item_add_subtree(ti
, ett_header
);
3498 proto_tree_add_uint(subtree
, hf_hdr_warning_code
,
3499 tvb
, val_start
, 1, val
);
3502 wkh_2_TextualValueInv
;
3504 wkh_3_ValueWithLength
;
3505 /* TODO - subtree with individual values */
3506 off
= val_start
+ val_len_len
;
3507 warn_code
= tvb_get_guint8(tvb
, off
);
3508 if (warn_code
& 0x80) { /* Well known warn code */
3509 val
= warn_code
& 0x7f;
3510 val_str
= try_val_to_str_ext(val
, &vals_wsp_warning_code_short_ext
);
3511 if (val_str
) { /* OK */
3512 str
= wmem_strdup_printf(wmem_packet_scope(), "code=%s", val_str
);
3513 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3514 ti
= proto_tree_add_string(tree
, hf_hdr_warning
,
3515 tvb
, hdr_start
, offset
- hdr_start
, str
);
3516 subtree
= proto_item_add_subtree(ti
, ett_header
);
3517 proto_tree_add_uint(subtree
, hf_hdr_warning_code
,
3519 off
++; /* Now skip to the warn-agent subfield */
3520 get_text_string(str
, tvb
, off
, len
, ok
);
3521 if (ok
) { /* Valid warn-agent string */
3522 proto_tree_add_string(subtree
, hf_hdr_warning_agent
,
3523 tvb
, off
, len
, str
);
3524 val_str
= wmem_strdup_printf(wmem_packet_scope(), "; agent=%s", str
);
3525 proto_item_append_string(ti
, val_str
);
3527 get_text_string(str
, tvb
, off
, len
, ok
);
3528 if (ok
) { /* Valid warn-text string */
3529 proto_tree_add_string(subtree
,
3530 hf_hdr_warning_text
,
3531 tvb
, off
, len
, str
);
3532 val_str
= wmem_strdup_printf(wmem_packet_scope(), "; text=%s", str
);
3533 proto_item_append_string(ti
, val_str
);
3539 wkh_4_End(hf_hdr_warning
);
3544 * Profile-warning-value =
3546 * | ( Value-length Short-integer Text-string *( Date-value ) )
3549 wkh_profile_warning(proto_tree
*tree
, tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
)
3552 guint32 off
, len
, val
= 0;
3556 wkh_1_WellKnownValue
;
3557 val
= val_id
& 0x7F;
3558 val_str
= try_val_to_str_ext(val
, &vals_wsp_profile_warning_code_ext
);
3560 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3561 ti
= proto_tree_add_string(tree
, hf_hdr_profile_warning
,
3562 tvb
, hdr_start
, offset
- hdr_start
, val_str
);
3565 wkh_2_TextualValueInv
;
3567 wkh_3_ValueWithLength
;
3568 off
= val_start
+ val_len_len
;
3569 warn_code
= tvb_get_guint8(tvb
, off
++);
3570 if (warn_code
& 0x80) { /* Well known warn code */
3571 val_str
= try_val_to_str_ext(val
, &vals_wsp_profile_warning_code_ext
);
3572 if (val_str
) { /* OK */
3573 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3574 ti
= proto_tree_add_string(tree
, hf_hdr_profile_warning
,
3575 tvb
, hdr_start
, offset
- hdr_start
, val_str
);
3576 get_uri_value(str
, tvb
, off
, len
, ok
);
3577 if (ok
) { /* Valid warn-target string */
3578 /* TODO: Why did we just call get_uri_value() and not use
3579 * the str, since the pointer to it is immediately
3580 * forgotten with the call to g_strdup_printf()? */
3582 str
= wmem_strdup_printf(wmem_packet_scope(), "; target=%s", val_str
);
3583 proto_item_append_string(ti
, str
);
3584 /* Add zero or more dates */
3585 while (ok
&& (off
< offset
)) {
3586 get_date_value(val
, tvb
, off
, len
, ok
);
3587 if (ok
) { /* Valid warn-text string */
3589 val_str
= abs_time_secs_to_str(val
, ABSOLUTE_TIME_LOCAL
, TRUE
);
3590 str
= wmem_strdup_printf(wmem_packet_scope(), "; date=%s", val_str
);
3591 proto_item_append_string(ti
, str
);
3592 /* BEHOLD: do NOT try to free str, as \
3593 * abs_time_secs_to_str() returns wmem_allocated data */ \
3599 wkh_4_End(hf_hdr_profile_warning
);
3603 /* Encoding-version-value =
3606 * | Length Short-integer [ Short-integer | text-string ]
3608 static guint32
wkh_encoding_version (proto_tree
*tree
, tvbuff_t
*tvb
,
3609 guint32 hdr_start
, packet_info
*pinfo _U_
)
3612 guint32 off
, val
, len
;
3615 wkh_1_WellKnownValue
;
3616 val
= val_id
& 0x7F;
3617 val_str
= wmem_strdup_printf(wmem_packet_scope(), "%u.%u", val
>> 4, val
& 0x0F);
3618 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3619 proto_tree_add_string(tree
, hf_hdr_encoding_version
,
3620 tvb
, hdr_start
, offset
- hdr_start
, val_str
);
3623 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3624 proto_tree_add_string(tree
, hf_hdr_encoding_version
,
3625 tvb
, hdr_start
, offset
- hdr_start
, val_str
);
3627 wkh_3_ValueWithLength
;
3628 off
= val_start
+ val_len_len
;
3629 val
= tvb_get_guint8(tvb
, off
);
3630 if (val
& 0x80) { /* Header Code Page */
3631 val_str
= wmem_strdup_printf(wmem_packet_scope(), "code-page=%u", val
& 0x7F);
3632 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3633 ti
= proto_tree_add_string(tree
, hf_hdr_encoding_version
,
3634 tvb
, hdr_start
, offset
- hdr_start
, val_str
);
3637 if (off
< offset
) { /* Extra version-value */
3638 get_version_value(val
,val_str
,tvb
,off
,len
,ok
);
3639 if (ok
) { /* Always creates a string if OK */
3640 str
= wmem_strdup_printf(wmem_packet_scope(), ": %s", val_str
);
3641 proto_item_append_string(ti
, str
);
3646 wkh_4_End(hf_hdr_encoding_version
);
3650 /* Content-range-value =
3651 * Length Uintvar-integer ( 0x80 | Uintvar-integer )
3654 wkh_content_range(proto_tree
*tree
, tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
)
3657 guint32 off
, val
, len
;
3658 proto_tree
*subtree
= NULL
;
3660 wkh_1_WellKnownValue
;
3662 wkh_2_TextualValueInv
;
3664 wkh_3_ValueWithLength
;
3665 off
= val_start
+ val_len_len
;
3666 get_uintvar_integer (val
, tvb
, off
, len
, ok
); /* Uintvar start */
3668 val_str
= wmem_strdup_printf(wmem_packet_scope(), "first-byte-pos=%u", val
);
3669 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3670 ti
= proto_tree_add_string(tree
, hf_hdr_content_range
,
3671 tvb
, hdr_start
, offset
- hdr_start
, val_str
);
3672 subtree
= proto_item_add_subtree(ti
, ett_header
);
3673 proto_tree_add_uint(subtree
, hf_hdr_content_range_first_byte_pos
,
3674 tvb
, off
, len
, val
);
3676 /* Now check next value */
3677 val
= tvb_get_guint8(tvb
, off
);
3678 if (val
== 0x80) { /* Unknown length */
3679 proto_item_append_string(ti
, "; entity-length=unknown");
3680 } else { /* Uintvar entity length */
3681 get_uintvar_integer (val
, tvb
, off
, len
, ok
);
3683 val_str
= wmem_strdup_printf(wmem_packet_scope(), "; entity-length=%u", val
);
3684 proto_item_append_string(ti
, val_str
);
3685 proto_tree_add_uint(subtree
,
3686 hf_hdr_content_range_entity_length
,
3687 tvb
, off
, len
, val
);
3692 wkh_4_End(hf_hdr_content_range
);
3698 * 0x80 Uintvar-integer [ Uintvar-integer ]
3699 * | 0x81 Uintvar-integer
3702 wkh_range(proto_tree
*tree
, tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
)
3705 guint32 off
, val
, len
;
3706 proto_tree
*subtree
= NULL
;
3708 wkh_1_WellKnownValue
;
3710 wkh_2_TextualValueInv
;
3712 wkh_3_ValueWithLength
;
3713 off
= val_start
+ val_len_len
;
3714 val
= tvb_get_guint8(tvb
, off
);
3715 if (val
== 0x80) { /* Byte-range */
3716 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3717 ti
= proto_tree_add_string(tree
, hf_hdr_range
,
3718 tvb
, hdr_start
, offset
- hdr_start
, "byte-range");
3719 subtree
= proto_item_add_subtree(ti
, ett_header
);
3720 /* Get the First-byte-pos (Uintvar-integer) */
3721 get_uintvar_integer (val
, tvb
, off
, len
, ok
);
3723 val_str
= wmem_strdup_printf(wmem_packet_scope(), "; first-byte-pos=%u", val
);
3724 proto_item_append_string(ti
, val_str
);
3725 proto_tree_add_uint(subtree
, hf_hdr_range_first_byte_pos
,
3726 tvb
, off
, len
, val
);
3728 /* Get the optional Last-byte-pos (Uintvar-integer) */
3730 get_uintvar_integer (val
, tvb
, off
, len
, ok
);
3732 val_str
= wmem_strdup_printf(wmem_packet_scope(), "; last-byte-pos=%u", val
);
3733 proto_item_append_string(ti
, val_str
);
3734 proto_tree_add_uint(subtree
,
3735 hf_hdr_range_last_byte_pos
,
3736 tvb
, off
, len
, val
);
3740 } else if (val
== 0x81) { /* Suffix-byte-range */
3741 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3742 ti
= proto_tree_add_string(tree
, hf_hdr_range
,
3743 tvb
, hdr_start
, offset
- hdr_start
, "suffix-byte-range");
3744 subtree
= proto_item_add_subtree(ti
, ett_header
);
3745 /* Get the Suffix-length (Uintvar-integer) */
3746 get_uintvar_integer (val
, tvb
, off
, len
, ok
);
3748 val_str
= wmem_strdup_printf(wmem_packet_scope(), "; suffix-length=%u", val
);
3749 proto_item_append_string(ti
, val_str
);
3750 proto_tree_add_uint(subtree
, hf_hdr_range_suffix_length
,
3751 tvb
, off
, len
, val
);
3755 wkh_4_End(hf_hdr_range
);
3761 * | Value-length (0x82--0x86 | Token-text) [ Q-token Q-value ]
3763 static guint32
wkh_te (proto_tree
*tree
, tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
)
3766 guint32 off
, val
, len
;
3768 wkh_1_WellKnownValue
;
3769 if (val_id
== 0x81) {
3770 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3771 proto_tree_add_string(tree
, hf_hdr_encoding_version
,
3772 tvb
, hdr_start
, offset
- hdr_start
, "trailers");
3775 wkh_2_TextualValueInv
;
3777 wkh_3_ValueWithLength
;
3778 off
= val_start
+ val_len_len
;
3779 val
= tvb_get_guint8(tvb
, off
);
3780 if (val
& 0x80) { /* Well-known-TE */
3781 val_str
= try_val_to_str_ext((val
& 0x7F), &vals_well_known_te_ext
);
3783 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3784 ti
= proto_tree_add_string(tree
, hf_hdr_te
,
3785 tvb
, hdr_start
, off
- hdr_start
, val_str
);
3789 } else { /* TE in Token-text format */
3790 get_token_text(val_str
, tvb
, off
, len
, ok
);
3792 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3793 ti
= proto_tree_add_string(tree
, hf_hdr_te
,
3794 tvb
, hdr_start
, off
- hdr_start
, val_str
);
3798 if ((ok
) && (off
< offset
)) { /* Q-token Q-value */
3802 wkh_4_End(hf_hdr_te
);
3806 /****************************************************************************
3807 * O p e n w a v e h e a d e r s
3808 ****************************************************************************/
3814 * Redefine the WellKnownValue parsing so Openwave header field names are used
3815 * are used instead of the default WSP header field names
3817 #undef wkh_1_WellKnownValue
3818 #define wkh_1_WellKnownValue /* Parse Well Known Value */ \
3819 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
3820 hidden_item = proto_tree_add_string(tree, hf_hdr_name, \
3821 tvb, hdr_start, offset - hdr_start, \
3822 val_to_str_ext (hdr_id, &vals_openwave_field_names_ext, \
3823 "<Unknown WSP header field 0x%02X>")); \
3824 PROTO_ITEM_SET_HIDDEN(hidden_item); \
3825 if (val_id & 0x80) { /* Well-known value */ \
3827 /* Well-known value processing starts HERE \
3832 * Redefine the End parsing so Openwave header field names are used
3833 * instead of the default WSP field names
3836 #define wkh_4_End(hf) /* End of value parsing */ \
3839 /* Check for errors */ \
3841 if (ti) { /* Append to protocol tree item label */ \
3842 proto_item_append_text(ti, \
3843 "<Error: Invalid header value>"); \
3844 } else if (hf > 0) { /* Create protocol tree item */ \
3845 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
3846 proto_tree_add_string(tree, hf, \
3847 tvb, hdr_start, offset - hdr_start, \
3848 " <Error: Invalid header value>"); \
3849 } else { /* Create anonymous header field entry */ \
3850 tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \
3851 proto_tree_add_text(tree, tvb, hdr_start, offset - hdr_start, \
3852 "%s: <Error: Invalid header value>", \
3853 val_to_str_ext (hdr_id, &vals_openwave_field_names_ext, \
3854 "<Unknown WSP header field 0x%02X>")); \
3860 /* Dissect the Openwave header value (generic) */
3862 wkh_openwave_default(proto_tree
*tree
, tvbuff_t
*tvb
, guint32 hdr_start
, packet_info
*pinfo _U_
)
3866 ok
= TRUE
; /* Bypass error checking as we don't parse the values! */
3868 wkh_1_WellKnownValue
;
3869 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3870 ti
= proto_tree_add_text(tree
, tvb
, hdr_start
, offset
- hdr_start
,
3871 "%s: (Undecoded well-known value 0x%02x)",
3872 val_to_str_ext (hdr_id
, &vals_openwave_field_names_ext
,
3873 "<Unknown WSP header field 0x%02X>"), val_id
& 0x7F);
3875 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3876 ti
= proto_tree_add_text(tree
,tvb
,hdr_start
, offset
- hdr_start
,
3878 val_to_str_ext (hdr_id
, &vals_openwave_field_names_ext
,
3879 "<Unknown WSP header field 0x%02X>"), val_str
);
3880 wkh_3_ValueWithLength
;
3881 tvb_ensure_bytes_exist(tvb
, hdr_start
, offset
- hdr_start
);
3882 ti
= proto_tree_add_text(tree
, tvb
, hdr_start
, offset
- hdr_start
,
3883 "%s: (Undecoded value in general form with length indicator)",
3884 val_to_str_ext (hdr_id
, &vals_openwave_field_names_ext
,
3885 "<Unknown WSP header field 0x%02X>"));
3887 wkh_4_End(HF_EMPTY
); /* See wkh_default for explanation */
3891 /* Textual Openwave headers */
3892 wkh_text_header(openwave_x_up_proxy_operator_domain
,
3893 "x-up-proxy-operator-domain")
3894 wkh_text_header(openwave_x_up_proxy_home_page
,
3895 "x-up-proxy-home-page")
3896 wkh_text_header(openwave_x_up_proxy_uplink_version
,
3897 "x-up-proxy-uplink-version")
3898 wkh_text_header(openwave_x_up_proxy_ba_realm
,
3899 "x-up-proxy-ba-realm")
3900 wkh_text_header(openwave_x_up_proxy_request_uri
,
3901 "x-up-proxy-request-uri")
3902 wkh_text_header(openwave_x_up_proxy_bookmark
,
3903 "x-up-proxy-bookmark")
3905 /* Integer Openwave headers */
3906 wkh_integer_value_header(openwave_x_up_proxy_push_seq
,
3907 "x-up-proxy-push-seq")
3908 wkh_integer_value_header(openwave_x_up_proxy_notify
,
3909 "x-up-proxy-notify")
3910 wkh_integer_value_header(openwave_x_up_proxy_net_ask
,
3911 "x-up-proxy-net-ask")
3912 wkh_integer_value_header(openwave_x_up_proxy_ba_enable
,
3913 "x-up-proxy-ba-enable")
3914 wkh_integer_value_header(openwave_x_up_proxy_redirect_enable
,
3915 "x-up-proxy-redirect-enable")
3916 wkh_integer_value_header(openwave_x_up_proxy_redirect_status
,
3917 "x-up-proxy-redirect-status")
3918 wkh_integer_value_header(openwave_x_up_proxy_linger
,
3919 "x-up-proxy-linger")
3920 wkh_integer_value_header(openwave_x_up_proxy_enable_trust
,
3921 "x-up-proxy-enable-trust")
3922 wkh_integer_value_header(openwave_x_up_proxy_trust
,
3925 wkh_integer_value_header(openwave_x_up_devcap_has_color
,
3926 "x-up-devcap-has-color")
3927 wkh_integer_value_header(openwave_x_up_devcap_num_softkeys
,
3928 "x-up-devcap-num-softkeys")
3929 wkh_integer_value_header(openwave_x_up_devcap_softkey_size
,
3930 "x-up-devcap-softkey-size")
3931 wkh_integer_value_header(openwave_x_up_devcap_screen_chars
,
3932 "x-up-devcap-screen-chars")
3933 wkh_integer_value_header(openwave_x_up_devcap_screen_pixels
,
3934 "x-up-devcap-screen-pixels")
3935 wkh_integer_value_header(openwave_x_up_devcap_em_size
,
3936 "x-up-devcap-em-size")
3937 wkh_integer_value_header(openwave_x_up_devcap_screen_depth
,
3938 "x-up-devcap-screen-depth")
3939 wkh_integer_value_header(openwave_x_up_devcap_immed_alert
,
3940 "x-up-devcap-immed_alert")
3941 wkh_integer_value_header(openwave_x_up_devcap_gui
,
3944 /* Openwave Time-Of-Day value header */
3945 wkh_tod_value_header(openwave_x_up_proxy_tod
,
3948 /* Openwave accept_x_q header */
3949 wkh_accept_x_q_header(openwave_x_up_proxy_trans_charset
,
3950 "x-up-proxy-trans-charset",
3951 &wap_mib_enum_vals_character_sets_ext
, "character set")
3953 /* Openwave content type header */
3954 wkh_content_type_header(openwave_x_up_proxy_push_accept
,
3955 "x-up-proxy-push-accept")
3958 * Header value parameter parsing
3960 #define InvalidParameterValue(parameter,value) \
3961 "<Error: Invalid " parameter " parameter value: invalid " value ">"
3967 #define parameter_text(hf,lowercase,Uppercase,value) \
3968 DebugLog(("parameter with text_string value: " Uppercase "\n")); \
3969 get_text_string(val_str, tvb, offset, val_len, ok); \
3971 DebugLog(("OK, valid text_string value found!\n")); \
3972 DebugLog(("Adding val_str to the header field in proto tree\n")); \
3973 proto_tree_add_string(tree, hf, \
3974 tvb, start, type_len + val_len, val_str); \
3975 DebugLog(("Creating str to append to ti\n")); \
3976 str = wmem_strdup_printf(wmem_packet_scope(), "; " lowercase "=%s", val_str); \
3977 DebugLog(("Appending str to ti\n")); \
3978 proto_item_append_string(ti, str); \
3979 DebugLog(("\tFreeing str [%s]\n", str)); \
3980 offset += val_len; \
3982 DebugLog(("\tError: invalid parameter value!\n")); \
3983 proto_tree_add_string(tree, hf, tvb, start, len, \
3984 InvalidParameterValue(Uppercase, value)); \
3985 offset = start + len; /* Skip to end of buffer */ \
3987 DebugLog(("parameter with text_string value - END\n"));
3990 #define parameter_text_value(hf,lowercase,Uppercase,value) \
3991 get_text_string(val_str, tvb, offset, val_len, ok); \
3993 if (is_quoted_string(val_str[0])) { \
3994 if (is_quoted_string(val_str[val_len-2])) { \
3995 /* Trailing quote - issue a warning */ \
3996 str = wmem_strdup_printf(wmem_packet_scope(), "%s" TrailingQuoteWarning, val_str); \
3997 proto_tree_add_string(tree, hf, \
3998 tvb, start, type_len + val_len, str); \
3999 str = wmem_strdup_printf(wmem_packet_scope(), "; " lowercase "=%s", val_str); \
4000 } else { /* OK (no trailing quote) */ \
4001 str = wmem_strdup_printf(wmem_packet_scope(), "%s\"", val_str); \
4002 proto_tree_add_string(tree, hf, \
4003 tvb, start, type_len + val_len, str); \
4004 str = wmem_strdup_printf(wmem_packet_scope(), "; " lowercase "=%s\"", val_str); \
4006 } else { /* Token-text | 0x00 */ \
4007 /* TODO - verify that we have either Token-text or 0x00 */ \
4008 proto_tree_add_string(tree, hf, \
4009 tvb, start, type_len + val_len, val_str); \
4010 str = wmem_strdup_printf(wmem_packet_scope(), "; " lowercase "=%s", val_str); \
4012 proto_item_append_string(ti, str); \
4013 offset += val_len; \
4015 proto_tree_add_string(tree, hf, tvb, start, len, \
4016 InvalidParameterValue(Uppercase, value)); \
4017 offset = start + len; /* Skip to end of buffer */ \
4021 /* Parameter = Untyped-parameter | Typed-parameter
4022 * Untyped-parameter = Token-text ( Integer-value | Text-value )
4025 * ( Integer-value | Date-value | Delta-seconds-value
4026 * | Q-value | Version-value | Uri-value )
4030 * Returns: next offset
4032 * TODO - Verify byte highlighting in case of invalid parameter values
4035 parameter (proto_tree
*tree
, proto_item
*ti
, tvbuff_t
*tvb
, int start
, int len
)
4038 guint8 peek
= tvb_get_guint8 (tvb
,start
);
4039 guint32 val
= 0, type
= 0, type_len
, val_len
;
4041 const gchar
*val_str
= NULL
;
4045 DebugLog(("parameter(start = %u, len = %u)\n", start
, len
));
4046 if (is_token_text (peek
)) {
4050 DebugLog(("parameter() - Untyped - Start\n"));
4051 get_token_text (str
,tvb
,start
,val_len
,ok
); /* Should always succeed */
4052 if (ok
) { /* Found a textual parameter name: str */
4054 get_text_value(val_str
, tvb
, offset
, val_len
, ok
);
4055 if (ok
) { /* Also found a textual parameter value: val_str */
4056 DebugLog(("Trying textual parameter value.\n"));
4058 if (is_quoted_string(val_str
[0])) { /* Add trailing quote! */
4059 if (is_quoted_string(val_str
[val_len
-2])) {
4060 /* Trailing quote - issue a warning */
4061 tvb_ensure_bytes_exist(tvb
, start
, offset
- start
);
4062 proto_tree_add_text(tree
, tvb
, start
, offset
- start
,
4063 "%s: %s" TrailingQuoteWarning
, str
, val_str
);
4064 s
= wmem_strdup_printf(wmem_packet_scope(), "; %s=%s", str
, val_str
);
4065 } else { /* OK (no trailing quote) */
4066 tvb_ensure_bytes_exist(tvb
, start
, offset
- start
);
4067 proto_tree_add_text(tree
, tvb
, start
, offset
- start
,
4068 "%s: %s\"", str
, val_str
);
4069 s
= wmem_strdup_printf(wmem_packet_scope(), "; %s=%s\"", str
, val_str
);
4071 } else { /* Token-text | 0x00 */
4072 /* TODO - verify that it is either Token-text or 0x00
4073 * and flag with warning if invalid */
4074 tvb_ensure_bytes_exist(tvb
, start
, offset
- start
);
4075 proto_tree_add_text(tree
, tvb
, start
, offset
- start
,
4076 "%s: %s", str
, val_str
);
4077 s
= wmem_strdup_printf(wmem_packet_scope(), "; %s=%s", str
, val_str
);
4079 /* TODO - check if we can insert a searchable field in the
4080 * protocol tree for the untyped parameter case */
4081 DebugLog(("parameter() - Untyped: %s\n", s
));
4082 proto_item_append_string(ti
, s
);
4083 DebugLog(("Freeing s\n"));
4084 DebugLog(("Done!\n"));
4085 } else { /* Try integer value */
4086 DebugLog(("Trying integer parameter value.\n"));
4087 get_integer_value (val
,tvb
,offset
,val_len
,ok
);
4088 if (ok
) { /* Also found a valid integer parameter value: val */
4090 tvb_ensure_bytes_exist(tvb
, start
, offset
- start
);
4091 proto_tree_add_text(tree
, tvb
, start
, offset
- start
,
4092 "%s: %u", str
, val
);
4093 s
= wmem_strdup_printf(wmem_packet_scope(), "; %s=%u", str
, val
);
4094 proto_item_append_string(ti
, s
);
4095 DebugLog(("parameter() - Untyped: %s\n", s
));
4096 /* TODO - check if we can insert a searchable field in the
4097 * protocol tree for the untyped parameter case */
4098 } else { /* Error: neither token-text not Integer-value */
4099 DebugLog(("Invalid untyped parameter value!\n"));
4100 tvb_ensure_bytes_exist(tvb
, start
, offset
- start
);
4101 proto_tree_add_text (tree
, tvb
, start
, offset
- start
,
4102 "<Error: Invalid untyped parameter definition>");
4103 offset
= start
+ len
; /* Skip to end of buffer */
4107 DebugLog(("parameter() - Untyped - End\n"));
4111 * Else: Typed parameter
4113 DebugLog(("parameter() - Typed - Start\n"));
4114 get_integer_value (type
,tvb
,start
,type_len
,ok
);
4116 tvb_ensure_bytes_exist(tvb
, start
, offset
- start
);
4117 proto_tree_add_text (tree
, tvb
, start
, offset
- start
,
4118 "<Error: Invalid typed parameter definition>");
4119 return (start
+ len
); /* Skip to end of buffer */
4122 /* Now offset points to the parameter value */
4123 DebugLog(("Typed parameter = 0x%02x\n", type
));
4125 case 0x01: /* WSP 1.1 encoding - Charset: Well-known-charset */
4126 get_integer_value(val
, tvb
, offset
, val_len
, ok
);
4128 val_str
= val_to_str_ext(val
, &wap_mib_enum_vals_character_sets_ext
,
4129 "<Unknown character set Identifier 0x%X>");
4130 proto_tree_add_string(tree
, hf_parameter_charset
,
4131 tvb
, start
, type_len
+ val_len
, val_str
);
4132 str
= wmem_strdup_printf(wmem_packet_scope(), "; charset=%s", val_str
);
4133 proto_item_append_string(ti
, str
);
4136 proto_tree_add_text (tree
, tvb
, start
, offset
,
4137 InvalidParameterValue("Charset", "Integer-value"));
4138 offset
= start
+ len
; /* Skip to end of buffer */
4142 case 0x03: /* WSP 1.1 encoding - Type: Integer-value */
4143 get_integer_value (val
,tvb
,offset
,val_len
,ok
);
4145 proto_tree_add_uint (tree
, hf_wsp_parameter_type
,
4146 tvb
, start
, type_len
+ val_len
, val
);
4147 s
= wmem_strdup_printf(wmem_packet_scope(), "; Type=%u", val
);
4148 proto_item_append_string (ti
, s
);
4151 proto_tree_add_text (tree
, tvb
, start
, offset
,
4152 InvalidParameterValue("Type", "Integer-value"));
4153 offset
= start
+ len
; /* Skip to end of buffer */
4157 case 0x05: /* WSP 1.1 encoding - Name: Text-string */
4158 parameter_text(hf_wsp_parameter_name
, "name",
4159 "Name (WSP 1.1 encoding)", "Text-string");
4161 case 0x17: /* WSP 1.4 encoding - Name: Text-value */
4162 parameter_text_value(hf_wsp_parameter_name
, "name",
4163 "Name (WSP 1.4 encoding)", "Text-value");
4166 case 0x06: /* WSP 1.1 encoding - Filename: Text-string */
4167 parameter_text(hf_wsp_parameter_filename
, "filename",
4168 "Filename (WSP 1.1 encoding)", "Text-string");
4170 case 0x18: /* WSP 1.4 encoding - Filename: Text-value */
4171 parameter_text_value(hf_wsp_parameter_filename
, "filename",
4172 "Filename (WSP 1.4 encoding)", "Text-value");
4175 case 0x09: /* WSP 1.2 encoding - Type (special): Constrained-encoding */
4176 /* This is similar to the Content-Type header decoding,
4177 * but it is much simpler:
4178 * Constrained-encoding = Short-integer | Extension-media
4179 * Extension-media = *TEXT <Octet 0>
4181 get_extension_media(val_str
,tvb
,offset
,val_len
,ok
);
4182 if (ok
) { /* Extension-media */
4185 get_short_integer(val
,tvb
,offset
,val_len
,ok
);
4188 val_str
= val_to_str_ext(val
, &vals_content_types_ext
,
4189 "(Unknown content type identifier 0x%X)");
4190 } /* Else: invalid parameter value */
4193 tvb_ensure_bytes_exist(tvb
, start
, offset
- start
);
4194 proto_tree_add_string (tree
, hf_wsp_parameter_upart_type
,
4195 tvb
, start
, offset
- start
, val_str
);
4196 str
= wmem_strdup_printf(wmem_packet_scope(), "; type=%s", val_str
);
4197 proto_item_append_string(ti
, str
);
4198 } else { /* Invalid parameter value */
4199 proto_tree_add_text (tree
, tvb
, start
, len
,
4200 InvalidParameterValue("Type",
4201 "Constrained-encoding"));
4202 offset
= start
+ len
; /* Skip the parameters */
4206 case 0x0A: /* WSP 1.2 encoding - Start: Text-string */
4207 parameter_text(hf_wsp_parameter_start
, "start",
4208 "Start (WSP 1.2 encoding)", "Text-string");
4210 case 0x19: /* WSP 1.4 encoding - Start (with multipart/related): Text-value */
4211 parameter_text_value(hf_wsp_parameter_start
, "start",
4212 "Start (WSP 1.4 encoding)", "Text-value");
4215 case 0x0B: /* WSP 1.2 encoding - Start-info: Text-string */
4216 parameter_text(hf_wsp_parameter_start_info
, "start-info",
4217 "Start-info (WSP 1.2 encoding)", "Text-string");
4219 case 0x1A: /* WSP 1.4 encoding - Start-info (with multipart/related): Text-value */
4220 parameter_text_value(hf_wsp_parameter_start_info
, "start-info",
4221 "Start-info (WSP 1.4 encoding)", "Text-value");
4224 case 0x0C: /* WSP 1.3 encoding - Comment: Text-string */
4225 parameter_text(hf_wsp_parameter_comment
, "comment",
4226 "Comment (WSP 1.3 encoding)", "Text-string");
4228 case 0x1B: /* WSP 1.4 encoding - Comment: Text-value */
4229 parameter_text_value(hf_wsp_parameter_comment
, "comment",
4230 "Comment (WSP 1.4 encoding)", "Text-value");
4233 case 0x0D: /* WSP 1.3 encoding - Domain: Text-string */
4234 parameter_text(hf_wsp_parameter_domain
, "domain",
4235 "Domain (WSP 1.3 encoding)", "Text-string");
4237 case 0x1C: /* WSP 1.4 encoding - Domain: Text-value */
4238 parameter_text_value(hf_wsp_parameter_domain
, "domain",
4239 "Domain (WSP 1.4 encoding)", "Text-value");
4242 case 0x0F: /* WSP 1.3 encoding - Path: Text-string */
4243 parameter_text(hf_wsp_parameter_path
, "path",
4244 "Path (WSP 1.3 encoding)", "Text-string");
4246 case 0x1D: /* WSP 1.4 encoding - Path: Text-value */
4247 parameter_text_value(hf_wsp_parameter_path
, "path",
4248 "Path (WSP 1.4 encoding)", "Text-value");
4251 case 0x11: /* WSP 1.4 encoding - SEC: Short-integer (OCTET) */
4252 peek
= tvb_get_guint8 (tvb
, start
+1);
4253 if (peek
& 0x80) { /* Valid Short-integer */
4255 proto_tree_add_uint (tree
, hf_wsp_parameter_sec
,
4256 tvb
, start
, 2, peek
);
4257 str
= (gchar
*) val_to_str_ext_const(peek
, &vals_wsp_parameter_sec_ext
, "Undefined");
4258 s
= wmem_strdup_printf(wmem_packet_scope(), "; SEC=%s", str
);
4259 proto_item_append_string (ti
, s
);
4261 } else { /* Error */
4262 proto_tree_add_text (tree
, tvb
, start
, len
,
4263 InvalidParameterValue("SEC", "Short-integer"));
4264 offset
= start
+ len
; /* Skip to end of buffer */
4268 case 0x12: /* WSP 1.4 encoding - MAC: Text-value */
4269 parameter_text_value(hf_wsp_parameter_mac
, "MAC",
4270 "MAC", "Text-value");
4273 case 0x02: /* WSP 1.1 encoding - Level: Version-value */
4274 get_version_value(val
,str
,tvb
,offset
,val_len
,ok
);
4276 proto_tree_add_string (tree
, hf_wsp_parameter_level
,
4277 tvb
, start
, type_len
+ val_len
, str
);
4278 s
= wmem_strdup_printf(wmem_packet_scope(), "; level=%s", str
);
4279 proto_item_append_string (ti
, s
);
4282 proto_tree_add_text (tree
, tvb
, start
, len
,
4283 InvalidParameterValue("Level", "Version-value"));
4284 offset
= start
+ len
; /* Skip to end of buffer */
4288 case 0x00: /* WSP 1.1 encoding - Q: Q-value */
4289 offset
= parameter_value_q(tree
, ti
, tvb
, offset
);
4292 case 0x16: /* WSP 1.4 encoding - Size: Integer-value */
4293 get_integer_value (val
,tvb
,offset
,val_len
,ok
);
4295 proto_tree_add_uint (tree
, hf_wsp_parameter_size
,
4296 tvb
, start
, type_len
+ val_len
, val
);
4297 s
= wmem_strdup_printf(wmem_packet_scope(), "; Size=%u", val
);
4298 proto_item_append_string (ti
, s
);
4301 proto_tree_add_text (tree
, tvb
, start
, offset
,
4302 InvalidParameterValue("Size", "Integer-value"));
4303 offset
= start
+ len
; /* Skip to end of buffer */
4311 case 0x07: /* WSP 1.1 encoding - Differences: Field-name */
4312 DebugLog(("Skipping remaining parameters from here\n"));
4313 tvb_ensure_bytes_exist(tvb
, start
, offset
- start
);
4314 proto_tree_add_text(tree
, tvb
, start
, offset
- start
,
4315 "Undecoded parameter Differences - decoding stopped");
4318 case 0x08: /* WSP 1.1 encoding - Padding: Short-integer */
4319 DebugLog(("Skipping remaining parameters from here\n"));
4320 tvb_ensure_bytes_exist(tvb
, start
, offset
- start
);
4321 proto_tree_add_text(tree
, tvb
, start
, offset
- start
,
4322 "Undecoded parameter Padding - decoding stopped");
4325 case 0x0E: /* WSP 1.3 encoding - Max-Age: Delta-seconds-value */
4326 DebugLog(("Skipping remaining parameters from here\n"));
4327 tvb_ensure_bytes_exist(tvb
, start
, offset
- start
);
4328 proto_tree_add_text(tree
, tvb
, start
, offset
- start
,
4329 "Undecoded parameter Max-Age - decoding stopped");
4332 case 0x10: /* WSP 1.3 encoding - Secure: No-value */
4333 DebugLog(("Skipping remaining parameters from here\n"));
4334 tvb_ensure_bytes_exist(tvb
, start
, offset
- start
);
4335 proto_tree_add_text(tree
, tvb
, start
, offset
- start
,
4336 "Undecoded parameter Secure - decoding stopped");
4339 case 0x13: /* WSP 1.4 encoding - Creation-date: Date-value */
4340 DebugLog(("Skipping remaining parameters from here\n"));
4341 tvb_ensure_bytes_exist(tvb
, start
, offset
- start
);
4342 proto_tree_add_text(tree
, tvb
, start
, offset
- start
,
4343 "Undecoded parameter Creation-Date - decoding stopped");
4346 case 0x14: /* WSP 1.4 encoding - Modification-date: Date-value */
4347 DebugLog(("Skipping remaining parameters from here\n"));
4348 tvb_ensure_bytes_exist(tvb
, start
, offset
- start
);
4349 proto_tree_add_text(tree
, tvb
, start
, offset
- start
,
4350 "Undecoded parameter Modification-Date - decoding stopped");
4353 case 0x15: /* WSP 1.4 encoding - Read-date: Date-value */
4354 DebugLog(("Skipping remaining parameters from here\n"));
4355 tvb_ensure_bytes_exist(tvb
, start
, offset
- start
);
4356 proto_tree_add_text(tree
, tvb
, start
, offset
- start
,
4357 "Undecoded parameter Read-Date - decoding stopped");
4361 DebugLog(("Skipping remaining parameters from here\n"));
4362 tvb_ensure_bytes_exist(tvb
, start
, offset
- start
);
4363 proto_tree_add_text(tree
, tvb
, start
, offset
- start
,
4364 "Undecoded parameter type 0x%02x - decoding stopped",
4366 offset
= start
+ len
; /* Skip the parameters */
4369 DebugLog(("parameter() - Typed - End\n"));
4375 * Dissects the Q-value parameter value.
4377 * Returns: next offset
4380 parameter_value_q (proto_tree
*tree
, proto_item
*ti
, tvbuff_t
*tvb
, int start
)
4383 guint32 val
= 0, val_len
;
4384 gchar
*str
= NULL
, *s
= NULL
;
4387 get_uintvar_integer (val
, tvb
, offset
, val_len
, ok
);
4388 if (ok
&& (val
< 1100)) {
4389 if (val
<= 100) { /* Q-value in 0.01 steps */
4390 str
= wmem_strdup_printf(wmem_packet_scope(), "0.%02u", val
- 1);
4391 } else { /* Q-value in 0.001 steps */
4392 str
= wmem_strdup_printf(wmem_packet_scope(), "0.%03u", val
- 100);
4394 s
= wmem_strdup_printf(wmem_packet_scope(), "; q=%s", str
);
4395 proto_item_append_string (ti
, s
);
4396 proto_tree_add_string (tree
, hf_parameter_q
,
4397 tvb
, start
, val_len
, str
);
4400 proto_tree_add_text (tree
, tvb
, start
, offset
,
4401 InvalidParameterValue("Q", "Q-value"));
4408 /* Code to actually dissect the packets */
4414 /* Dissect a WSP redirect PDU.
4415 * Looks up or builds conversations, so parts of the code must always run,
4416 * even if tree is NULL.
4419 dissect_redirect(tvbuff_t
*tvb
, int offset
, packet_info
*pinfo
,
4420 proto_tree
*tree
, dissector_handle_t dissector_handle
)
4424 proto_tree
*addresses_tree
= NULL
;
4425 proto_tree
*addr_tree
= NULL
;
4426 proto_tree
*flags_tree
;
4428 guint8 address_flags_len
;
4430 proto_tree
*address_flags_tree
;
4432 guint32 address_ipv4
;
4433 struct e_in6_addr address_ipv6
;
4434 address redir_address
;
4435 conversation_t
*conv
;
4436 guint32 idx
= 0; /* Address index */
4437 guint32 address_record_len
; /* Length of the entire address record */
4442 flags
= tvb_get_guint8 (tvb
, offset
);
4444 ti
= proto_tree_add_uint (tree
, hf_wsp_redirect_flags
,
4445 tvb
, offset
, 1, flags
);
4446 flags_tree
= proto_item_add_subtree (ti
, ett_redirect_flags
);
4447 proto_tree_add_boolean (flags_tree
, hf_wsp_redirect_permanent
,
4448 tvb
, offset
, 1, flags
);
4449 proto_tree_add_boolean (flags_tree
, hf_wsp_redirect_reuse_security_session
,
4450 tvb
, offset
, 1, flags
);
4455 * Redirect addresses.
4458 ti
= proto_tree_add_item(tree
, hf_redirect_addresses
,
4459 tvb
, 0, -1, ENC_NA
);
4460 addresses_tree
= proto_item_add_subtree(ti
, ett_addresses
);
4463 while (tvb_reported_length_remaining (tvb
, offset
) > 0) {
4466 * Read a single address at a time.
4468 address_flags_len
= tvb_get_guint8 (tvb
, offset
);
4469 address_len
= address_flags_len
& ADDRESS_LEN
;
4470 address_record_len
= address_len
4471 + (address_flags_len
& BEARER_TYPE_INCLUDED
? 1 : 0)
4472 + (address_flags_len
& PORT_NUMBER_INCLUDED
? 2 : 0)
4476 ti
= proto_tree_add_uint(addresses_tree
, hf_address_entry
,
4477 tvb
, offset
, 1 + address_record_len
, idx
);
4478 addr_tree
= proto_item_add_subtree(ti
, ett_address
);
4480 ti
= proto_tree_add_uint (addr_tree
, hf_address_flags_length
,
4481 tvb
, offset
, 1, address_flags_len
);
4482 address_flags_tree
= proto_item_add_subtree (ti
, ett_address_flags
);
4483 proto_tree_add_boolean (address_flags_tree
, hf_address_flags_length_bearer_type_included
,
4484 tvb
, offset
, 1, address_flags_len
);
4485 proto_tree_add_boolean (address_flags_tree
, hf_address_flags_length_port_number_included
,
4486 tvb
, offset
, 1, address_flags_len
);
4487 proto_tree_add_uint (address_flags_tree
, hf_address_flags_length_address_len
,
4488 tvb
, offset
, 1, address_flags_len
);
4491 if (address_flags_len
& BEARER_TYPE_INCLUDED
) {
4492 bearer_type
= tvb_get_guint8 (tvb
, offset
);
4494 proto_tree_add_uint (addr_tree
, hf_address_bearer_type
,
4495 tvb
, offset
, 1, bearer_type
);
4499 bearer_type
= 0x00; /* XXX */
4501 if (address_flags_len
& PORT_NUMBER_INCLUDED
) {
4502 port_num
= tvb_get_ntohs (tvb
, offset
);
4504 proto_tree_add_uint (addr_tree
, hf_address_port_num
,
4505 tvb
, offset
, 2, port_num
);
4510 * Redirecting to the same server port number as was
4511 * being used, i.e. the source port number of this
4514 port_num
= pinfo
->srcport
;
4516 if (!(address_flags_len
& BEARER_TYPE_INCLUDED
)) {
4518 * We don't have the bearer type in the message,
4519 * so we don't know the address type.
4520 * (It's the same bearer type as the original
4523 goto unknown_address_type
;
4527 * We know the bearer type, so we know the address type.
4529 switch (bearer_type
) {
4533 case BT_IS_95_PACKET_DATA
:
4534 case BT_ANSI_136_CSD
:
4535 case BT_ANSI_136_PACKET_DATA
:
4538 case BT_GSM_USSD_IPv4
:
4541 case BT_PDC_PACKET_DATA
:
4543 case BT_IDEN_PACKET_DATA
:
4545 case BT_TETRA_PACKET_DATA
:
4549 if (address_len
!= 4) {
4553 goto unknown_address_type
;
4555 address_ipv4
= tvb_get_ipv4(tvb
, offset
);
4557 proto_tree_add_ipv4 (addr_tree
,
4558 hf_address_ipv4_addr
,
4559 tvb
, offset
, 4, address_ipv4
);
4563 * Create a conversation so that the
4564 * redirected session will be dissected
4567 redir_address
.type
= AT_IPv4
;
4568 redir_address
.len
= 4;
4569 redir_address
.data
= (const guint8
*)&address_ipv4
;
4570 /* Find a conversation based on redir_address and pinfo->dst */
4571 conv
= find_conversation(pinfo
->fd
->num
, &redir_address
, &pinfo
->dst
,
4572 PT_UDP
, port_num
, 0, NO_PORT_B
);
4573 if (conv
== NULL
) { /* This conversation does not exist yet */
4574 conv
= conversation_new(pinfo
->fd
->num
, &redir_address
,
4575 &pinfo
->dst
, PT_UDP
, port_num
, 0, NO_PORT2
);
4577 /* Apply WSP dissection to the conversation */
4578 conversation_set_dissector(conv
, dissector_handle
);
4585 if (address_len
!= 16) {
4589 goto unknown_address_type
;
4591 tvb_get_ipv6(tvb
, offset
, &address_ipv6
);
4593 proto_tree_add_ipv6 (addr_tree
,
4594 hf_address_ipv6_addr
,
4595 tvb
, offset
, 16, (guint8
*)&address_ipv6
);
4599 * Create a conversation so that the
4600 * redirected session will be dissected
4603 redir_address
.type
= AT_IPv6
;
4604 redir_address
.len
= 16;
4605 redir_address
.data
= (const guint8
*)&address_ipv6
;
4606 /* Find a conversation based on redir_address and pinfo->dst */
4607 conv
= find_conversation(pinfo
->fd
->num
, &redir_address
, &pinfo
->dst
,
4608 PT_UDP
, port_num
, 0, NO_PORT_B
);
4609 if (conv
== NULL
) { /* This conversation does not exist yet */
4610 conv
= conversation_new(pinfo
->fd
->num
, &redir_address
,
4611 &pinfo
->dst
, PT_UDP
, port_num
, 0, NO_PORT2
);
4613 /* Apply WSP dissection to the conversation */
4614 conversation_set_dissector(conv
, dissector_handle
);
4617 unknown_address_type
:
4619 if (address_len
!= 0) {
4621 proto_tree_add_item (addr_tree
, hf_address_addr
,
4622 tvb
, offset
, address_len
, ENC_NA
);
4627 offset
+= address_len
;
4631 /* Add addresses to the protocol tree.
4632 * This is a display-only function, so return if tree is NULL
4635 add_addresses(proto_tree
*tree
, tvbuff_t
*tvb
, int hf
)
4638 proto_tree
*addresses_tree
;
4639 proto_tree
*addr_tree
;
4641 guint8 address_flags_len
;
4643 proto_tree
*address_flags_tree
;
4644 guint32 tvb_len
= tvb_length(tvb
);
4646 guint32 idx
= 0; /* Address index */
4647 guint32 address_record_len
; /* Length of the entire address record */
4649 /* Skip needless processing */
4652 if (offset
>= tvb_len
)
4658 /* XXX: the field pointed to by hf has a type of FT_NONE */
4659 ti
= proto_tree_add_item(tree
, hf
, tvb
, 0, -1, ENC_NA
);
4660 addresses_tree
= proto_item_add_subtree(ti
, ett_addresses
);
4662 while (offset
< tvb_len
) {
4665 * Read a single address at a time.
4667 address_flags_len
= tvb_get_guint8 (tvb
, offset
);
4668 address_len
= address_flags_len
& ADDRESS_LEN
;
4669 address_record_len
= address_len
4670 + (address_flags_len
& BEARER_TYPE_INCLUDED
? 1 : 0)
4671 + (address_flags_len
& PORT_NUMBER_INCLUDED
? 2 : 0)
4674 ti
= proto_tree_add_uint(addresses_tree
, hf_address_entry
,
4675 tvb
, offset
, 1 + address_record_len
, idx
);
4676 addr_tree
= proto_item_add_subtree(ti
, ett_address
);
4678 ti
= proto_tree_add_uint (addr_tree
, hf_address_flags_length
,
4679 tvb
, offset
, 1, address_flags_len
);
4680 address_flags_tree
= proto_item_add_subtree (ti
, ett_address_flags
);
4681 proto_tree_add_boolean (address_flags_tree
, hf_address_flags_length_bearer_type_included
,
4682 tvb
, offset
, 1, address_flags_len
);
4683 proto_tree_add_boolean (address_flags_tree
, hf_address_flags_length_port_number_included
,
4684 tvb
, offset
, 1, address_flags_len
);
4685 proto_tree_add_uint (address_flags_tree
, hf_address_flags_length_address_len
,
4686 tvb
, offset
, 1, address_flags_len
);
4688 if (address_flags_len
& BEARER_TYPE_INCLUDED
) {
4689 bearer_type
= tvb_get_guint8 (tvb
, offset
);
4690 proto_tree_add_uint (addr_tree
, hf_address_bearer_type
,
4691 tvb
, offset
, 1, bearer_type
);
4694 bearer_type
= 0x00; /* XXX */
4696 if (address_flags_len
& PORT_NUMBER_INCLUDED
) {
4697 proto_tree_add_uint (addr_tree
, hf_address_port_num
,
4698 tvb
, offset
, 2, ENC_BIG_ENDIAN
);
4701 if (!(address_flags_len
& BEARER_TYPE_INCLUDED
)) {
4703 * We don't have the bearer type in the message,
4704 * so we don't know the address type.
4705 * (It's the same bearer type as the original
4708 goto unknown_address_type
;
4712 * We know the bearer type, so we know the address type.
4714 switch (bearer_type
) {
4718 case BT_IS_95_PACKET_DATA
:
4719 case BT_ANSI_136_CSD
:
4720 case BT_ANSI_136_PACKET_DATA
:
4723 case BT_GSM_USSD_IPv4
:
4726 case BT_PDC_PACKET_DATA
:
4728 case BT_IDEN_PACKET_DATA
:
4730 case BT_TETRA_PACKET_DATA
:
4734 if (address_len
!= 4) {
4738 goto unknown_address_type
;
4740 proto_tree_add_ipv4 (addr_tree
, hf_address_ipv4_addr
,
4741 tvb
, offset
, 4, ENC_NA
);
4748 if (address_len
!= 16) {
4752 goto unknown_address_type
;
4754 proto_tree_add_ipv6 (addr_tree
, hf_address_ipv6_addr
,
4755 tvb
, offset
, 16, ENC_NA
);
4758 unknown_address_type
:
4760 if (address_len
!= 0) {
4761 proto_tree_add_item (addr_tree
, hf_address_addr
,
4762 tvb
, offset
, address_len
, ENC_NA
);
4766 offset
+= address_len
;
4770 static const value_string vals_sir_protocol_options
[] = {
4771 { 0, "OTA-HTTP, no CPITag present" },
4772 { 1, "OTA-HTTP, CPITag present" },
4773 /* 2--255 are reserved */
4774 /* 256--16383 are available for private WINA registration */
4779 /* Dissect a Session Initiation Request.
4781 * Arguably this should be a separate dissector, but SIR does not make sense
4782 * outside of WSP anyway.
4785 dissect_sir(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
4789 guint32 val_len_save
;
4794 proto_tree
*subtree
;
4797 /* Append status code to INFO column */
4798 col_append_str(pinfo
->cinfo
, COL_INFO
,
4799 ": WAP Session Initiation Request");
4801 /* The remainder of the code adds items to the protocol tree */
4805 ti
= proto_tree_add_item(tree
, hf_sir_section
,
4806 tvb
, 0, -1, ENC_NA
);
4807 subtree
= proto_item_add_subtree(ti
, ett_sir
);
4810 version
= tvb_get_guint8(tvb
, 0);
4811 proto_tree_add_uint(subtree
, hf_sir_version
,
4812 tvb
, 0, 1, version
);
4814 /* Length of Application-Id headers list */
4815 val_len
= tvb_get_guintvar(tvb
, 1, &len
);
4816 proto_tree_add_uint(subtree
, hf_sir_app_id_list_len
,
4817 tvb
, 1, len
, val_len
);
4819 /* Application-Id headers */
4820 tmp_tvb
= tvb_new_subset(tvb
, offset
, val_len
, val_len
);
4821 add_headers (subtree
, tmp_tvb
, hf_sir_app_id_list
, pinfo
);
4824 /* Length of WSP contact points list */
4825 val_len
= tvb_get_guintvar(tvb
, offset
, &len
);
4826 proto_tree_add_uint(subtree
, hf_sir_wsp_contact_points_len
,
4827 tvb
, offset
, len
, val_len
);
4829 /* WSP contact point list */
4830 tmp_tvb
= tvb_new_subset (tvb
, offset
, val_len
, val_len
);
4831 add_addresses(subtree
, tmp_tvb
, hf_sir_wsp_contact_points
);
4833 /* End of version 0 SIR content */
4839 /* Length of non-WSP contact points list */
4840 val_len
= tvb_get_guintvar(tvb
, offset
, &len
);
4841 proto_tree_add_uint(subtree
, hf_sir_contact_points_len
,
4842 tvb
, offset
, len
, val_len
);
4844 /* Non-WSP contact point list */
4845 tmp_tvb
= tvb_new_subset (tvb
, offset
, val_len
, val_len
);
4846 add_addresses(subtree
, tmp_tvb
, hf_sir_contact_points
);
4850 /* Number of entries in the Protocol Options list */
4851 val_len
= tvb_get_guintvar(tvb
, offset
, &len
);
4852 proto_tree_add_uint(subtree
, hf_sir_protocol_options_len
,
4853 tvb
, offset
, len
, val_len
);
4855 /* Protocol Options list.
4856 * Each protocol option is encoded as a guintvar */
4858 val_len_save
= val_len
;
4859 for (i
= 0; i
< val_len_save
; i
++) {
4860 val_len
= tvb_get_guintvar(tvb
, offset
, &len
);
4861 proto_tree_add_uint(subtree
, hf_sir_protocol_options
,
4862 tvb
, offset
, len
, val_len
);
4866 /* Length of ProvURL */
4867 val_len
= tvb_get_guintvar(tvb
, offset
, &len
);
4868 proto_tree_add_uint(subtree
, hf_sir_prov_url_len
,
4869 tvb
, offset
, len
, val_len
);
4872 tvb_ensure_bytes_exist(tvb
, offset
, val_len
);
4873 proto_tree_add_item (tree
, hf_sir_prov_url
,
4874 tvb
, offset
, val_len
, ENC_ASCII
|ENC_NA
);
4877 /* Number of entries in the CPITag list */
4878 val_len
= tvb_get_guintvar(tvb
, offset
, &len
);
4879 proto_tree_add_uint(subtree
, hf_sir_cpi_tag_len
,
4880 tvb
, offset
, len
, val_len
);
4884 * Each CPITag is encoded as 4 octets of opaque data.
4885 * In OTA-HTTP, it is conveyed in the X-Wap-CPITag header
4886 * but with a Base64 encoding of the 4 bytes. */
4887 for (i
= 0; i
< val_len
; i
++) {
4888 proto_tree_add_item(subtree
, hf_sir_cpi_tag
,
4889 tvb
, offset
, 4, ENC_NA
);
4895 dissect_wsp_common(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
,
4896 dissector_handle_t dissector_handle
, gboolean is_connectionless
)
4903 guint uriLength
= 0;
4905 guint capabilityLength
= 0;
4906 guint headersLength
= 0;
4907 guint headerLength
= 0;
4908 guint headerStart
= 0;
4909 guint nextOffset
= 0;
4910 guint contentTypeStart
= 0;
4911 guint contentType
= 0;
4912 const char *contentTypeStr
;
4914 gboolean found_match
;
4916 /* Set up structures we will need to add the protocol subtree and manage it */
4917 proto_item
*proto_ti
= NULL
; /* for the proto entry */
4918 proto_tree
*wsp_tree
= NULL
;
4920 wsp_info_value_t
*stat_info
;
4921 stat_info
= (wsp_info_value_t
*)wmem_alloc(wmem_packet_scope(), sizeof(wsp_info_value_t
));
4922 stat_info
->status_code
= 0;
4924 /* This field shows up as the "Info" column in the display; you should make
4925 it, if possible, summarize what's in the packet, so that a user looking
4926 at the list of packets can tell what type of packet it is. */
4928 /* Connection-less mode has a TID first */
4929 if (is_connectionless
)
4931 offset
++; /* Skip the 1-byte Transaction ID */
4934 /* Find the PDU type */
4935 pdut
= tvb_get_guint8 (tvb
, offset
);
4937 /* Develop the string to put in the Info column */
4938 col_append_fstr(pinfo
->cinfo
, COL_INFO
, "WSP %s (0x%02x)",
4939 val_to_str_ext (pdut
, &wsp_vals_pdu_type_ext
, "Unknown PDU type (0x%02x)"),
4942 /* In the interest of speed, if "tree" is NULL, don't do any work not
4943 * necessary to generate protocol tree items. */
4946 /* We use proto_item_append_string() in a number of places.
4947 * It does not work with the TRY_TO_FAKE_THIS_ITEM speed
4948 * optimization, so we have to disable that one and become
4949 * "slow" by pretending that the tree is "visible".
4951 * This code must be present for the MMSE dissector which
4952 * calls this function; otherwise, this causes a
4953 * dissector_assert [bug 492] (proto_item_append_string()
4954 * issue), and similar problems occur in other places.
4956 proto_tree_set_visible(tree
, TRUE
);
4958 proto_ti
= proto_tree_add_item(tree
, proto_wsp
,
4959 tvb
, 0, -1, ENC_NA
);
4960 wsp_tree
= proto_item_add_subtree(proto_ti
, ett_wsp
);
4961 proto_item_append_text(proto_ti
, ", Method: %s (0x%02x)",
4962 val_to_str_ext (pdut
, &wsp_vals_pdu_type_ext
, "Unknown (0x%02x)"),
4965 /* Add common items: only TID and PDU Type */
4967 /* If this is connectionless, then the TID Field is always first */
4968 if (is_connectionless
)
4970 proto_tree_add_item (wsp_tree
, hf_wsp_header_tid
,
4971 tvb
, 0, 1, ENC_LITTLE_ENDIAN
);
4973 proto_tree_add_item( wsp_tree
, hf_wsp_header_pdu_type
,
4974 tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
4978 /* Map extended methods to the main method now the Column info has been
4979 * written; this way we can dissect the extended method PDUs. */
4980 if ((pdut
>= 0x50) && (pdut
<= 0x5F)) /* Extended GET --> GET */
4982 else if ((pdut
>= 0x70) && (pdut
<= 0x7F)) /* Extended POST --> POST */
4983 pdut
= WSP_PDU_POST
;
4987 case WSP_PDU_CONNECT
:
4988 case WSP_PDU_CONNECTREPLY
:
4989 case WSP_PDU_RESUME
:
4991 if (pdut
== WSP_PDU_CONNECT
)
4993 proto_tree_add_item (wsp_tree
, hf_wsp_version_major
,
4994 tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
4995 proto_tree_add_item (wsp_tree
, hf_wsp_version_minor
,
4996 tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
4998 guint8 ver
= tvb_get_guint8(tvb
, offset
);
4999 proto_item_append_text(proto_ti
, ", Version: %u.%u",
5000 ver
>> 4, ver
& 0x0F);
5004 count
= 0; /* Initialise count */
5005 value
= tvb_get_guintvar (tvb
, offset
, &count
);
5006 proto_tree_add_uint (wsp_tree
,
5007 hf_wsp_server_session_id
,
5008 tvb
, offset
, count
, value
);
5009 proto_item_append_text(proto_ti
, ", Session ID: %u", value
);
5012 count
= 0; /* Initialise count */
5013 capabilityLength
= tvb_get_guintvar (tvb
, offset
, &count
);
5014 proto_tree_add_uint (wsp_tree
, hf_capabilities_length
,
5015 tvb
, offset
, count
, capabilityLength
);
5018 if (pdut
!= WSP_PDU_RESUME
)
5020 count
= 0; /* Initialise count */
5021 headerLength
= tvb_get_guintvar (tvb
, offset
, &count
);
5022 proto_tree_add_uint (wsp_tree
, hf_wsp_header_length
,
5023 tvb
, offset
, count
, headerLength
);
5027 /* Resume computes the headerlength
5028 * by remaining bytes */
5029 headerStart
= offset
+ capabilityLength
;
5030 headerLength
= tvb_reported_length_remaining (tvb
,
5033 if (capabilityLength
> 0)
5035 tmp_tvb
= tvb_new_subset (tvb
, offset
,
5036 capabilityLength
, capabilityLength
);
5037 add_capabilities (wsp_tree
, tmp_tvb
, pdut
);
5038 offset
+= capabilityLength
;
5041 if (headerLength
> 0)
5043 tmp_tvb
= tvb_new_subset (tvb
, offset
,
5044 headerLength
, headerLength
);
5045 add_headers (wsp_tree
, tmp_tvb
, hf_wsp_headers_section
, pinfo
);
5051 case WSP_PDU_REDIRECT
:
5052 dissect_redirect(tvb
, offset
, pinfo
, wsp_tree
, dissector_handle
);
5055 case WSP_PDU_DISCONNECT
:
5056 case WSP_PDU_SUSPEND
:
5058 count
= 0; /* Initialise count */
5059 value
= tvb_get_guintvar (tvb
, offset
, &count
);
5060 proto_tree_add_uint (wsp_tree
,
5061 hf_wsp_server_session_id
,
5062 tvb
, offset
, count
, value
);
5063 proto_item_append_text(proto_ti
, ", Session ID: %u", value
);
5068 case WSP_PDU_OPTIONS
:
5070 case WSP_PDU_DELETE
:
5072 count
= 0; /* Initialise count */
5073 /* Length of URI and size of URILen field */
5074 value
= tvb_get_guintvar (tvb
, offset
, &count
);
5075 nextOffset
= offset
+ count
;
5076 add_uri (wsp_tree
, pinfo
, tvb
, offset
, nextOffset
, proto_ti
);
5078 offset
+= value
+ count
; /* VERIFY */
5079 tmp_tvb
= tvb_new_subset_remaining (tvb
, offset
);
5080 add_headers (wsp_tree
, tmp_tvb
, hf_wsp_headers_section
, pinfo
);
5087 count
= 0; /* Initialise count */
5088 uriLength
= tvb_get_guintvar (tvb
, offset
, &count
);
5089 headerStart
= uriStart
+count
;
5090 count
= 0; /* Initialise count */
5091 headersLength
= tvb_get_guintvar (tvb
, headerStart
, &count
);
5092 offset
= headerStart
+ count
;
5094 add_uri (wsp_tree
, pinfo
, tvb
, uriStart
, offset
, proto_ti
);
5095 offset
+= uriLength
;
5098 proto_tree_add_uint (wsp_tree
, hf_wsp_header_length
,
5099 tvb
, headerStart
, count
, headersLength
);
5101 /* Stop processing POST PDU if length of headers is zero;
5102 * this should not happen as we expect at least Content-Type. */
5103 if (headersLength
== 0)
5106 contentTypeStart
= offset
;
5107 nextOffset
= add_content_type (wsp_tree
,
5108 tvb
, offset
, &contentType
, &contentTypeStr
);
5111 /* Add content type to protocol summary line */
5112 if (contentTypeStr
) {
5113 proto_item_append_text(proto_ti
, ", Content-Type: %s",
5116 proto_item_append_text(proto_ti
, ", Content-Type: 0x%X",
5120 /* Add headers subtree that will hold the headers fields */
5121 /* Runs from nextOffset for
5122 * headersLength - (length of content-type field) */
5123 headerLength
= headersLength
- (nextOffset
- contentTypeStart
);
5124 if (headerLength
> 0)
5126 tmp_tvb
= tvb_new_subset (tvb
, nextOffset
,
5127 headerLength
, headerLength
);
5128 add_headers (wsp_tree
, tmp_tvb
, hf_wsp_headers_section
, pinfo
);
5130 /* XXX - offset is no longer used after this point */
5131 /* offset = nextOffset+headerLength; */
5133 /* WSP_PDU_POST data - First check whether a subdissector exists
5134 * for the content type */
5135 if (tvb_reported_length_remaining(tvb
,
5136 headerStart
+ count
+ uriLength
+ headersLength
) > 0)
5138 tmp_tvb
= tvb_new_subset_remaining (tvb
,
5139 headerStart
+ count
+ uriLength
+ headersLength
);
5141 * Try finding a dissector for the content
5142 * first, then fallback.
5144 found_match
= FALSE
;
5145 if (contentTypeStr
) {
5147 * Content type is a string.
5149 found_match
= dissector_try_string(media_type_table
,
5150 contentTypeStr
, tmp_tvb
, pinfo
, tree
, NULL
);
5152 if (! found_match
) {
5153 if (! dissector_try_heuristic(heur_subdissector_list
,
5154 tmp_tvb
, pinfo
, tree
, NULL
)) {
5155 guint8
* save_private_data
= (guint8
*)pinfo
->private_data
;
5157 pinfo
->match_string
= contentTypeStr
;
5158 pinfo
->private_data
= NULL
; /* TODO: parameters */
5159 call_dissector(media_handle
, tmp_tvb
, pinfo
, tree
);
5160 pinfo
->private_data
= save_private_data
;
5162 if (tree
) /* Only display if needed */
5163 add_post_data (wsp_tree
, tmp_tvb
,
5164 contentType
, contentTypeStr
, pinfo
);
5172 count
= 0; /* Initialise count */
5173 headersLength
= tvb_get_guintvar (tvb
, offset
+1, &count
);
5174 headerStart
= offset
+ count
+ 1;
5176 guint8 reply_status
= tvb_get_guint8(tvb
, offset
);
5177 const char *reply_status_str
;
5179 reply_status_str
= val_to_str_ext_const (reply_status
, &wsp_vals_status_ext
, "(Unknown response status)");
5181 proto_tree_add_item (wsp_tree
, hf_wsp_header_status
,
5182 tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
5183 proto_item_append_text(proto_ti
, ", Status: %s (0x%02x)",
5184 reply_status_str
, reply_status
);
5186 stat_info
->status_code
= (gint
) reply_status
;
5187 /* Append status code to INFO column */
5188 col_append_fstr(pinfo
->cinfo
, COL_INFO
,
5190 reply_status_str
, reply_status
);
5192 nextOffset
= offset
+ 1 + count
;
5194 proto_tree_add_uint (wsp_tree
, hf_wsp_header_length
,
5195 tvb
, offset
+ 1, count
, headersLength
);
5197 if (headersLength
== 0)
5200 contentTypeStart
= nextOffset
;
5201 nextOffset
= add_content_type (wsp_tree
, tvb
,
5202 nextOffset
, &contentType
, &contentTypeStr
);
5205 /* Add content type to protocol summary line */
5206 if (contentTypeStr
) {
5207 proto_item_append_text(proto_ti
, ", Content-Type: %s",
5210 proto_item_append_text(proto_ti
, ", Content-Type: 0x%X",
5214 /* Add headers subtree that will hold the headers fields */
5215 /* Runs from nextOffset for
5216 * headersLength - (length of Content-Type field) */
5217 headerLength
= headersLength
- (nextOffset
- contentTypeStart
);
5218 if (headerLength
> 0)
5220 tmp_tvb
= tvb_new_subset (tvb
, nextOffset
,
5221 headerLength
, headerLength
);
5222 add_headers (wsp_tree
, tmp_tvb
, hf_wsp_headers_section
, pinfo
);
5224 /* XXX - offset is no longer used after this point */
5225 /* offset += count+headersLength+1;*/
5227 /* WSP_PDU_REPLY data - First check whether a subdissector exists
5228 * for the content type */
5229 if (tvb_reported_length_remaining(tvb
, headerStart
+ headersLength
)
5232 tmp_tvb
= tvb_new_subset_remaining (tvb
, headerStart
+ headersLength
);
5234 * Try finding a dissector for the content
5235 * first, then fallback.
5237 found_match
= FALSE
;
5238 if (contentTypeStr
) {
5240 * Content type is a string.
5242 found_match
= dissector_try_string(media_type_table
,
5243 contentTypeStr
, tmp_tvb
, pinfo
, tree
, NULL
);
5245 if (! found_match
) {
5246 if (! dissector_try_heuristic(heur_subdissector_list
,
5247 tmp_tvb
, pinfo
, tree
, NULL
)) {
5248 guint8
* save_private_data
= (guint8
*)pinfo
->private_data
;
5250 pinfo
->match_string
= contentTypeStr
;
5251 pinfo
->private_data
= NULL
; /* TODO: parameters */
5252 call_dissector(media_handle
, tmp_tvb
, pinfo
, tree
);
5253 pinfo
->private_data
= save_private_data
;
5255 if (tree
) / * Only display
if needed
* /
5256 proto_tree_add_item (wsp_tree
,
5258 tmp_tvb
, 0, -1, ENC_NA
);
5266 case WSP_PDU_CONFIRMEDPUSH
:
5267 count
= 0; /* Initialise count */
5268 headersLength
= tvb_get_guintvar (tvb
, offset
, &count
);
5269 headerStart
= offset
+ count
;
5272 proto_tree_add_uint (wsp_tree
, hf_wsp_header_length
,
5273 tvb
, offset
, count
, headersLength
);
5275 if (headersLength
== 0)
5279 contentTypeStart
= offset
;
5280 nextOffset
= add_content_type (wsp_tree
,
5281 tvb
, offset
, &contentType
, &contentTypeStr
);
5284 /* Add content type to protocol summary line */
5285 if (contentTypeStr
) {
5286 proto_item_append_text(proto_ti
, ", Content-Type: %s",
5289 proto_item_append_text(proto_ti
, ", Content-Type: 0x%X",
5293 /* Add headers subtree that will hold the headers fields */
5294 /* Runs from nextOffset for
5295 * headersLength-(length of Content-Type field) */
5296 headerLength
= headersLength
-(nextOffset
-contentTypeStart
);
5297 if (headerLength
> 0)
5299 tmp_tvb
= tvb_new_subset (tvb
, nextOffset
,
5300 headerLength
, headerLength
);
5301 add_headers (wsp_tree
, tmp_tvb
, hf_wsp_headers_section
, pinfo
);
5303 /* XXX - offset is no longer used after this point */
5304 /*offset += headersLength;*/
5306 /* WSP_PDU_PUSH data - First check whether a subdissector exists
5307 * for the content type */
5308 if (tvb_reported_length_remaining(tvb
, headerStart
+ headersLength
)
5311 tmp_tvb
= tvb_new_subset_remaining (tvb
, headerStart
+ headersLength
);
5313 * Try finding a dissector for the content
5314 * first, then fallback.
5316 found_match
= FALSE
;
5317 if (contentTypeStr
) {
5319 * Content type is a string.
5322 if (g_ascii_strcasecmp(contentTypeStr, "application/vnd.wap.sia") == 0) {
5323 dissect_sir(tree, tmp_tvb);
5326 found_match
= dissector_try_string(media_type_table
,
5327 contentTypeStr
, tmp_tvb
, pinfo
, tree
, NULL
);
5329 if (! found_match
) {
5330 if (! dissector_try_heuristic(heur_subdissector_list
,
5331 tmp_tvb
, pinfo
, tree
, NULL
)) {
5332 guint8
* save_private_data
= (guint8
*)pinfo
->private_data
;
5334 pinfo
->match_string
= contentTypeStr
;
5335 pinfo
->private_data
= NULL
; /* TODO: parameters */
5336 call_dissector(media_handle
, tmp_tvb
, pinfo
, tree
);
5337 pinfo
->private_data
= save_private_data
;
5339 if (tree
) /* Only display if needed */
5340 proto_tree_add_item (wsp_tree
,
5342 tmp_tvb
, 0, -1, ENC_NA
);
5350 stat_info
->pdut
= pdut
;
5351 tap_queue_packet (wsp_tap
, pinfo
, stat_info
);
5356 * Called directly from UDP.
5357 * Put "WSP" into the "Protocol" column.
5360 dissect_wsp_fromudp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
5362 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "WSP");
5363 col_clear(pinfo
->cinfo
, COL_INFO
);
5365 dissect_wsp_common(tvb
, pinfo
, tree
, wsp_fromudp_handle
, TRUE
);
5370 * Called from a higher-level WAP dissector, in connection-oriented mode.
5371 * Leave the "Protocol" column alone - the dissector calling us should
5375 dissect_wsp_fromwap_co(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
5378 * XXX - what about WTLS->WTP->WSP?
5380 dissect_wsp_common(tvb
, pinfo
, tree
, wtp_fromudp_handle
, FALSE
);
5385 * Called from a higher-level WAP dissector, in connectionless mode.
5386 * Leave the "Protocol" column alone - the dissector calling us should
5390 dissect_wsp_fromwap_cl(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
5393 * XXX - what about WTLS->WSP?
5395 col_clear(pinfo
->cinfo
, COL_INFO
);
5396 dissect_wsp_common(tvb
, pinfo
, tree
, wtp_fromudp_handle
, TRUE
);
5401 add_uri (proto_tree
*tree
, packet_info
*pinfo
, tvbuff_t
*tvb
,
5402 guint URILenOffset
, guint URIOffset
, proto_item
*proto_ti
)
5405 guint uriLen
= tvb_get_guintvar (tvb
, URILenOffset
, &count
);
5408 proto_tree_add_uint (tree
, hf_wsp_header_uri_len
,
5409 tvb
, URILenOffset
, count
, uriLen
);
5411 tvb_ensure_bytes_exist(tvb
, URIOffset
, uriLen
);
5412 proto_tree_add_item (tree
, hf_wsp_header_uri
,
5413 tvb
, URIOffset
, uriLen
, ENC_ASCII
|ENC_NA
);
5415 str
= tvb_format_text (tvb
, URIOffset
, uriLen
);
5416 /* XXX - tvb_format_text() returns a pointer to a static text string
5417 * so please DO NOT attempt at g_free()ing it!
5419 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", str
);
5422 proto_item_append_text(proto_ti
, ", URI: %s", str
);
5427 * CO-WSP capability negotiation
5431 WSP_CAPA_CLIENT_SDU_SIZE
= 0x00,
5432 WSP_CAPA_SERVER_SDU_SIZE
,
5433 WSP_CAPA_PROTOCOL_OPTIONS
,
5434 WSP_CAPA_METHOD_MOR
,
5436 WSP_CAPA_EXTENDED_METHODS
,
5437 WSP_CAPA_HEADER_CODE_PAGES
,
5439 WSP_CAPA_CLIENT_MESSAGE_SIZE
,
5440 WSP_CAPA_SERVER_MESSAGE_SIZE
5444 add_capabilities (proto_tree
*tree
, tvbuff_t
*tvb
, guint8 pdu_type
)
5446 proto_tree
*wsp_capabilities
;
5447 proto_tree
*capa_subtree
;
5449 char *capaName
, *str
, *valStr
;
5452 guint32 capaStart
= 0; /* Start offset of the capability */
5453 guint32 capaLen
= 0; /* Length of the entire capability */
5454 guint32 capaValueLen
= 0; /* Length of the capability value & type */
5455 guint32 tvb_len
= tvb_reported_length(tvb
);
5456 gboolean ok
= FALSE
;
5461 DebugLog(("add_capabilities(): Capabilities = 0\n"));
5465 DebugLog(("add_capabilities(): capabilities to process\n"));
5467 ti
= proto_tree_add_item(tree
, hf_capabilities_section
,
5468 tvb
, 0, tvb_len
, ENC_NA
);
5469 wsp_capabilities
= proto_item_add_subtree(ti
, ett_capabilities
);
5471 while (offset
< tvb_len
) {
5473 * WSP capabilities consist of:
5474 * - a guint32 length field,
5475 * - a capability identifier as Token-text or Short-integer,
5476 * - a capability-specific sequence of <length> octets.
5480 * Now Offset points to the 1st byte of a capability field.
5481 * Get the length of the capability field
5483 capaValueLen
= tvb_get_guintvar(tvb
, offset
, &len
);
5484 capaLen
= capaValueLen
+ len
;
5485 tvb_ensure_bytes_exist(tvb
, offset
, capaLen
);
5488 * Now offset points to the 1st byte of the capability type.
5489 * Get the capability identifier.
5491 peek
= tvb_get_guint8(tvb
, offset
);
5492 if (is_token_text(peek
)) { /* Literal capability name */
5493 /* 1. Get the string from the tvb */
5494 get_token_text(capaName
, tvb
, offset
, len
, ok
);
5496 DebugLog(("add_capabilities(): expecting capability name as token_text "
5497 "at offset %u (1st char = 0x%02x)\n", offset
, peek
));
5500 /* 2. Look up the string capability name */
5501 if (g_ascii_strcasecmp(capaName
, "client-sdu-size") == 0) {
5502 peek
= WSP_CAPA_CLIENT_SDU_SIZE
;
5503 } else if (g_ascii_strcasecmp(capaName
, "server-sdu-size") == 0) {
5504 peek
= WSP_CAPA_SERVER_SDU_SIZE
;
5505 } else if (g_ascii_strcasecmp(capaName
, "protocol options") == 0) {
5506 peek
= WSP_CAPA_PROTOCOL_OPTIONS
;
5507 } else if (g_ascii_strcasecmp(capaName
, "method-mor") == 0) {
5508 peek
= WSP_CAPA_METHOD_MOR
;
5509 } else if (g_ascii_strcasecmp(capaName
, "push-mor") == 0) {
5510 peek
= WSP_CAPA_PUSH_MOR
;
5511 } else if (g_ascii_strcasecmp(capaName
, "extended methods") == 0) {
5512 peek
= WSP_CAPA_EXTENDED_METHODS
;
5513 } else if (g_ascii_strcasecmp(capaName
, "header code pages") == 0) {
5514 peek
= WSP_CAPA_HEADER_CODE_PAGES
;
5515 } else if (g_ascii_strcasecmp(capaName
, "aliases") == 0) {
5516 peek
= WSP_CAPA_ALIASES
;
5517 } else if (g_ascii_strcasecmp(capaName
, "client-message-size") == 0) {
5518 peek
= WSP_CAPA_CLIENT_MESSAGE_SIZE
;
5519 } else if (g_ascii_strcasecmp(capaName
, "server-message-size") == 0) {
5520 peek
= WSP_CAPA_SERVER_MESSAGE_SIZE
;
5522 DebugLog(("add_capabilities(): unknown capability '%s' at offset %u\n",
5524 proto_tree_add_text(wsp_capabilities
, tvb
, capaStart
, capaLen
,
5525 "Unknown or invalid textual capability: %s", capaName
);
5526 /* Skip this capability */
5527 offset
= capaStart
+ capaLen
;
5531 /* Now offset points to the 1st value byte of the capability. */
5532 } else if (peek
< 0x80) {
5533 DebugLog(("add_capabilities(): invalid capability type identifier 0x%02X at offset %u.",
5535 proto_tree_add_text(wsp_capabilities
, tvb
, capaStart
, capaLen
,
5536 "Invalid well-known capability: 0x%02X", peek
);
5537 /* Skip further capability parsing */
5540 if (peek
& 0x80) { /* Well-known capability */
5544 /* Now offset points to the 1st value byte of the capability. */
5546 /* Now the capability type is known */
5548 case WSP_CAPA_CLIENT_SDU_SIZE
:
5549 value
= tvb_get_guintvar(tvb
, offset
, &len
);
5550 DebugLog(("add_capabilities(client-sdu-size): "
5551 "guintvar = %u (0x%X) at offset %u (1st byte = 0x%02X) (len = %u)\n",
5552 value
, value
, offset
, tvb_get_guint8(tvb
, offset
), len
));
5553 proto_tree_add_uint(wsp_capabilities
, hf_capa_client_sdu_size
,
5554 tvb
, capaStart
, capaLen
, value
);
5556 case WSP_CAPA_SERVER_SDU_SIZE
:
5557 value
= tvb_get_guintvar(tvb
, offset
, &len
);
5558 DebugLog(("add_capabilities(server-sdu-size): "
5559 "guintvar = %u (0x%X) at offset %u (1st byte = 0x%02X) (len = %u)\n",
5560 value
, value
, offset
, tvb_get_guint8(tvb
, offset
), len
));
5561 proto_tree_add_uint(wsp_capabilities
, hf_capa_server_sdu_size
,
5562 tvb
, capaStart
, capaLen
, value
);
5564 case WSP_CAPA_PROTOCOL_OPTIONS
:
5565 ti
= proto_tree_add_string(wsp_capabilities
, hf_capa_protocol_options
,
5566 tvb
, capaStart
, capaLen
, "");
5567 capa_subtree
= proto_item_add_subtree(ti
, ett_capability
);
5569 * The bits are stored in one or more octets, not an
5570 * uintvar-integer! Note that capability name and value
5571 * have length capaValueLength, and that the capability
5572 * name has length = len. Hence the remaining length is
5573 * given by capaValueLen - len.
5575 switch (capaValueLen
- len
) {
5577 value
= tvb_get_guint8(tvb
, offset
);
5582 * The WSP spec foresees that this bit field can be
5583 * extended in the future. This does not make sense yet.
5585 DebugLog(("add_capabilities(protocol options): "
5586 "bit field too large (%u bytes)\n",
5588 proto_item_append_text(ti
,
5589 " <warning: bit field too large>");
5590 offset
= capaStart
+ capaLen
;
5593 DebugLog(("add_capabilities(protocol options): "
5594 "guintvar = %u (0x%X) at offset %u (1st byte = 0x%02X) (len = %u)\n",
5595 value
, value
, offset
, tvb_get_guint8(tvb
, offset
), len
));
5597 proto_item_append_string(ti
, " (confirmed push facility)");
5599 proto_item_append_string(ti
, " (push facility)");
5601 proto_item_append_string(ti
, " (session resume facility)");
5603 proto_item_append_string(ti
, " (acknowledgement headers)");
5605 proto_item_append_string(ti
, " (large data transfer)");
5606 if (value
& 0xFFFFFF07)
5607 proto_item_append_text(ti
, " <warning: reserved bits have been set>");
5608 proto_tree_add_boolean(capa_subtree
,
5609 hf_capa_protocol_option_confirmed_push
,
5610 tvb
, offset
, len
, value
);
5611 proto_tree_add_boolean(capa_subtree
,
5612 hf_capa_protocol_option_push
,
5613 tvb
, offset
, len
, value
);
5614 proto_tree_add_boolean(capa_subtree
,
5615 hf_capa_protocol_option_session_resume
,
5616 tvb
, offset
, len
, value
);
5617 proto_tree_add_boolean(capa_subtree
,
5618 hf_capa_protocol_option_ack_headers
,
5619 tvb
, offset
, len
, value
);
5620 proto_tree_add_boolean(capa_subtree
,
5621 hf_capa_protocol_option_large_data_transfer
,
5622 tvb
, offset
, len
, value
);
5624 case WSP_CAPA_METHOD_MOR
:
5625 value
= tvb_get_guint8(tvb
, offset
);
5626 proto_tree_add_uint (wsp_capabilities
,
5628 tvb
, capaStart
, capaLen
, value
);
5630 case WSP_CAPA_PUSH_MOR
:
5631 value
= tvb_get_guint8(tvb
, offset
);
5632 proto_tree_add_uint (wsp_capabilities
,
5634 tvb
, capaStart
, capaLen
, value
);
5636 case WSP_CAPA_EXTENDED_METHODS
:
5637 /* Extended Methods capability format:
5638 * Connect PDU: collection of { Method (octet), Method-name (Token-text) }
5639 * ConnectReply PDU: collection of accepted { Method (octet) }
5641 ti
= proto_tree_add_string(wsp_capabilities
,
5642 hf_capa_extended_methods
,
5643 tvb
, capaStart
, capaLen
, "");
5644 if (pdu_type
== WSP_PDU_CONNECT
) {
5645 while (offset
< capaStart
+ capaLen
) {
5646 peek
= tvb_get_guint8(tvb
, offset
++);
5647 get_text_string(str
, tvb
, offset
, len
, ok
);
5649 proto_item_append_text(ti
, " <error: invalid capability encoding>");
5650 DebugLog(("add_capability(extended methods): "
5651 "invalid method name at offset %u "
5652 "(octet = 0x%02X)\n",
5653 offset
, tvb_get_guint8(tvb
, offset
)));
5656 valStr
= wmem_strdup_printf(wmem_packet_scope(), " (0x%02x = %s)", peek
, str
);
5657 DebugLog(("add_capabilities(extended methods):%s\n",
5659 proto_item_append_string(ti
, valStr
);
5663 while (offset
< capaStart
+ capaLen
) {
5664 peek
= tvb_get_guint8(tvb
, offset
++);
5665 valStr
= wmem_strdup_printf(wmem_packet_scope(), " (0x%02x)", peek
);
5666 DebugLog(("add_capabilities(extended methods):%s\n",
5668 proto_item_append_string(ti
, valStr
);
5672 case WSP_CAPA_HEADER_CODE_PAGES
:
5673 /* Header Code Pages capability format:
5674 * Connect PDU: collection of { Page-id (octet), Page-name (Token-text) }
5675 * ConnectReply PDU: collection of accepted { Page-id (octet) }
5677 ti
= proto_tree_add_string(wsp_capabilities
,
5678 hf_capa_header_code_pages
,
5679 tvb
, capaStart
, capaLen
, "");
5680 if (pdu_type
== WSP_PDU_CONNECT
) {
5681 while (offset
< capaStart
+ capaLen
) {
5682 peek
= tvb_get_guint8(tvb
, offset
++);
5683 get_text_string(str
, tvb
, offset
, len
, ok
);
5685 proto_item_append_text(ti
,
5686 " <error: invalid capability encoding>");
5687 DebugLog(("add_capability(header code pages): "
5688 "invalid header code page name at offset %u "
5689 "(octet = 0x%02X)\n",
5690 offset
, tvb_get_guint8(tvb
, offset
)));
5693 valStr
= wmem_strdup_printf(wmem_packet_scope(), " (0x%02x = %s)", peek
, str
);
5694 DebugLog(("add_capabilities(header code pages):%s\n",
5696 proto_item_append_string(ti
, valStr
);
5700 while (offset
< capaStart
+ capaLen
) {
5701 peek
= tvb_get_guint8(tvb
, offset
++);
5702 valStr
= wmem_strdup_printf(wmem_packet_scope(), " (0x%02x)", peek
);
5703 DebugLog(("add_capabilities(header code pages):%s\n",
5705 proto_item_append_string(ti
, valStr
);
5709 case WSP_CAPA_ALIASES
:
5710 /* TODO - same format as redirect addresses */
5711 proto_tree_add_item(wsp_capabilities
, hf_capa_aliases
,
5712 tvb
, capaStart
, capaLen
, ENC_NA
);
5714 case WSP_CAPA_CLIENT_MESSAGE_SIZE
:
5715 value
= tvb_get_guintvar(tvb
, offset
, &len
);
5716 DebugLog(("add_capabilities(client-message-size): "
5717 "guintvar = %u (0x%X) at offset %u (1st byte = 0x%02X) (len = %u)\n",
5718 value
, value
, offset
, tvb_get_guint8(tvb
, offset
), len
));
5719 proto_tree_add_uint(wsp_capabilities
, hf_capa_client_message_size
,
5720 tvb
, capaStart
, capaLen
, value
);
5722 case WSP_CAPA_SERVER_MESSAGE_SIZE
:
5723 value
= tvb_get_guintvar(tvb
, offset
, &len
);
5724 DebugLog(("add_capabilities(server-message-size): "
5725 "guintvar = %u (0x%X) at offset %u (1st byte = 0x%02X) (len = %u)\n",
5726 value
, value
, offset
, tvb_get_guint8(tvb
, offset
), len
));
5727 proto_tree_add_uint(wsp_capabilities
, hf_capa_server_message_size
,
5728 tvb
, capaStart
, capaLen
, value
);
5731 proto_tree_add_text(wsp_capabilities
, tvb
, capaStart
, capaLen
,
5732 "Unknown well-known capability: 0x%02X", peek
);
5735 offset
= capaStart
+ capaLen
;
5740 add_post_data (proto_tree
*tree
, tvbuff_t
*tvb
, guint contentType
,
5741 const char *contentTypeStr
, packet_info
*pinfo
)
5744 guint variableStart
= 0;
5745 guint variableEnd
= 0;
5746 guint valueStart
= 0;
5749 proto_tree
*sub_tree
= NULL
;
5751 DebugLog(("add_post_data() - START\n"));
5753 /* VERIFY ti = proto_tree_add_item (tree, hf_wsp_post_data,tvb,offset,-1,ENC_NA); */
5755 ti
= proto_tree_add_item (tree
, hf_wsp_post_data
,
5756 tvb
, offset
, -1, ENC_NA
);
5757 sub_tree
= proto_item_add_subtree(ti
, ett_post
);
5760 if ( (contentTypeStr
== NULL
&& contentType
== 0x12)
5761 || (contentTypeStr
&& (g_ascii_strcasecmp(contentTypeStr
,
5762 "application/x-www-form-urlencoded") == 0)) )
5767 * Iterate through post data.
5769 for (offset
= 0; offset
< tvb_reported_length (tvb
); offset
++)
5771 peek
= tvb_get_guint8 (tvb
, offset
);
5774 variableEnd
= offset
;
5775 valueStart
= offset
+1;
5777 else if (peek
== '&')
5779 if (variableEnd
> 0)
5781 add_post_variable (sub_tree
, tvb
, variableStart
, variableEnd
, valueStart
, offset
);
5783 variableStart
= offset
+1;
5789 /* See if there's outstanding data */
5790 if (variableEnd
> 0)
5792 add_post_variable (sub_tree
, tvb
, variableStart
, variableEnd
, valueStart
, offset
);
5796 else if ((contentType
== 0x22) || (contentType
== 0x23) || (contentType
== 0x24) ||
5797 (contentType
== 0x25) || (contentType
== 0x26) || (contentType
== 0x33))
5799 /* add_multipart_data takes also care of subdissection */
5800 add_multipart_data(sub_tree
, tvb
, pinfo
);
5802 DebugLog(("add_post_data() - END\n"));
5806 add_post_variable (proto_tree
*tree
, tvbuff_t
*tvb
, guint variableStart
, guint variableEnd
, guint valueStart
, guint valueEnd
)
5808 int variableLength
= variableEnd
-variableStart
;
5809 int valueLength
= 0;
5810 char *variableBuffer
;
5813 variableBuffer
= tvb_get_string(wmem_packet_scope(), tvb
, variableStart
, variableLength
);
5815 if (valueEnd
< valueStart
)
5817 valueBuffer
= (char *)wmem_alloc(wmem_packet_scope(), 1);
5819 valueEnd
= valueStart
;
5823 valueLength
= valueEnd
-valueStart
;
5824 /* XXX - if this throws an exception, "variableBuffer"
5826 valueBuffer
= tvb_get_string(wmem_packet_scope(), tvb
, valueStart
, valueLength
);
5829 /* Check for variables with no value */
5830 if (valueStart
>= tvb_reported_length (tvb
))
5832 valueStart
= tvb_reported_length (tvb
);
5833 valueEnd
= valueStart
;
5835 valueLength
= valueEnd
-valueStart
;
5837 proto_tree_add_text (tree
, tvb
, variableStart
, valueLength
, "%s: %s", variableBuffer
, valueBuffer
);
5842 add_multipart_data (proto_tree
*tree
, tvbuff_t
*tvb
, packet_info
*pinfo
)
5850 guint contentType
= 0;
5851 const char *contentTypeStr
;
5855 gboolean found_match
= FALSE
;
5857 proto_item
*sub_tree
= NULL
;
5858 proto_item
*ti
= NULL
;
5859 proto_tree
*mpart_tree
= NULL
;
5861 DebugLog(("add_multipart_data(): offset = %u, byte = 0x%02x: ",
5862 offset
, tvb_get_guint8(tvb
,offset
)));
5863 nEntries
= tvb_get_guintvar (tvb
, offset
, &count
);
5864 DebugLog(("parts = %u\n", nEntries
));
5868 ti
= proto_tree_add_text(tree
, tvb
, offset
- count
, 0,
5870 sub_tree
= proto_item_add_subtree(ti
, ett_mpartlist
);
5874 DebugLog(("add_multipart_data(): Parts to do after this: %u"
5875 " (offset = %u, 0x%02x): ",
5876 nEntries
, offset
, tvb_get_guint8(tvb
,offset
)));
5877 part_start
= offset
;
5878 HeadersLen
= tvb_get_guintvar (tvb
, offset
, &count
);
5880 DataLen
= tvb_get_guintvar (tvb
, offset
, &count
);
5883 tvb_ensure_bytes_exist(tvb
, part_start
, HeadersLen
+ DataLen
+ (offset
- part_start
));
5884 ti
= proto_tree_add_uint(sub_tree
, hf_wsp_mpart
, tvb
, part_start
,
5885 HeadersLen
+ DataLen
+ (offset
- part_start
), partnr
);
5886 mpart_tree
= proto_item_add_subtree(ti
, ett_multiparts
);
5888 nextOffset
= add_content_type (mpart_tree
, tvb
, offset
,
5889 &contentType
, &contentTypeStr
);
5892 /* Add content type to protocol summary line */
5893 if (contentTypeStr
) {
5894 proto_item_append_text(ti
, ", content-type: %s",
5897 proto_item_append_text(ti
, ", content-type: 0x%X",
5902 HeadersLen
-= (nextOffset
- offset
);
5905 tmp_tvb
= tvb_new_subset (tvb
, nextOffset
, HeadersLen
, HeadersLen
);
5906 add_headers (mpart_tree
, tmp_tvb
, hf_wsp_headers_section
, pinfo
);
5908 offset
= nextOffset
+ HeadersLen
;
5910 * Try the dissectors of the multipart content.
5912 * TODO - handle nested multipart documents.
5914 tmp_tvb
= tvb_new_subset(tvb
, offset
, DataLen
, DataLen
);
5916 * Try finding a dissector for the content
5917 * first, then fallback.
5919 found_match
= FALSE
;
5920 if (contentTypeStr
) {
5922 * Content type is a string.
5924 found_match
= dissector_try_string(media_type_table
,
5925 contentTypeStr
, tmp_tvb
, pinfo
, mpart_tree
, NULL
);
5927 if (! found_match
) {
5928 if (! dissector_try_heuristic(heur_subdissector_list
,
5929 tmp_tvb
, pinfo
, mpart_tree
, NULL
)) {
5930 guint8
* save_private_data
= (guint8
*)pinfo
->private_data
;
5932 pinfo
->match_string
= contentTypeStr
;
5933 pinfo
->private_data
= NULL
; /* TODO: parameters */
5934 call_dissector(media_handle
, tmp_tvb
, pinfo
, mpart_tree
);
5935 pinfo
->private_data
= save_private_data
;
5937 if (tree
) /* Only display if needed */
5938 proto_tree_add_item (mpart_tree
, hf_wsp_multipart_data
,
5939 tvb
, offset
, DataLen
, ENC_NA
);
5950 /* Register the protocol with Wireshark */
5952 proto_register_wsp(void)
5955 /* Setup list of header fields */
5956 static hf_register_info hf
[] = {
5957 { &hf_wsp_header_tid
,
5960 FT_UINT8
, BASE_HEX
, NULL
, 0x00,
5961 "WSP Transaction ID (for connectionless WSP)", HFILL
5964 { &hf_wsp_header_pdu_type
,
5967 FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
, &wsp_vals_pdu_type_ext
, 0x00,
5971 { &hf_wsp_version_major
,
5972 { "Version (Major)",
5973 "wsp.version.major",
5974 FT_UINT8
, BASE_DEC
, NULL
, 0xF0,
5978 { &hf_wsp_version_minor
,
5979 { "Version (Minor)",
5980 "wsp.version.minor",
5981 FT_UINT8
, BASE_DEC
, NULL
, 0x0F,
5985 { &hf_capabilities_length
,
5986 { "Capabilities Length",
5987 "wsp.capabilities.length",
5988 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
5989 "Length of Capabilities field (bytes)", HFILL
5992 { &hf_wsp_header_length
,
5994 "wsp.headers_length",
5995 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
5996 "Length of Headers field (bytes)", HFILL
5999 { &hf_capabilities_section
,
6002 FT_NONE
, BASE_NONE
, NULL
, 0x00,
6006 { &hf_wsp_headers_section
,
6009 FT_NONE
, BASE_NONE
, NULL
, 0x00,
6013 { &hf_wsp_header_uri_len
,
6016 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
6017 "Length of URI field", HFILL
6020 { &hf_wsp_header_uri
,
6023 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6027 { &hf_wsp_server_session_id
,
6028 { "Server Session ID",
6029 "wsp.server.session_id",
6030 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
6034 { &hf_wsp_header_status
,
6037 FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
, &wsp_vals_status_ext
, 0x00,
6038 "Reply Status", HFILL
6041 { &hf_wsp_parameter_type
,
6043 "wsp.parameter.type",
6044 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
6045 "Type parameter", HFILL
6048 { &hf_wsp_parameter_name
,
6050 "wsp.parameter.name",
6051 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6052 "Name parameter", HFILL
6055 { &hf_wsp_parameter_filename
,
6057 "wsp.parameter.filename",
6058 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6059 "Filename parameter", HFILL
6062 { &hf_wsp_parameter_start
,
6064 "wsp.parameter.start",
6065 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6066 "Start parameter", HFILL
6069 { &hf_wsp_parameter_start_info
,
6071 "wsp.parameter.start_info",
6072 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6073 "Start-info parameter", HFILL
6076 { &hf_wsp_parameter_comment
,
6078 "wsp.parameter.comment",
6079 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6080 "Comment parameter", HFILL
6083 { &hf_wsp_parameter_domain
,
6085 "wsp.parameter.domain",
6086 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6087 "Domain parameter", HFILL
6090 { &hf_wsp_parameter_path
,
6092 "wsp.parameter.path",
6093 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6094 "Path parameter", HFILL
6097 { &hf_wsp_parameter_sec
,
6099 "wsp.parameter.sec",
6100 FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
, &vals_wsp_parameter_sec_ext
, 0x00,
6101 "SEC parameter (Content-Type: application/vnd.wap.connectivity-wbxml)", HFILL
6104 { &hf_wsp_parameter_mac
,
6106 "wsp.parameter.mac",
6107 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6108 "MAC parameter (Content-Type: application/vnd.wap.connectivity-wbxml)", HFILL
6111 { &hf_wsp_parameter_upart_type
,
6113 "wsp.parameter.upart.type",
6114 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6115 "Multipart type parameter", HFILL
6118 { &hf_wsp_parameter_level
,
6120 "wsp.parameter.level",
6121 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6122 "Level parameter", HFILL
6125 { &hf_wsp_parameter_size
,
6127 "wsp.parameter.size",
6128 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
6129 "Size parameter", HFILL
6133 { &hf_wsp_reply_data
,
6136 FT_NONE
, BASE_NONE
, NULL
, 0x00,
6141 { &hf_wsp_header_shift_code
,
6142 { "Switching to WSP header code-page",
6144 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
6145 "Header code-page shift code", HFILL
6149 * CO-WSP capability negotiation
6151 { &hf_capa_client_sdu_size
,
6152 { "Client SDU Size",
6153 "wsp.capability.client_sdu_size",
6154 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
6155 "Client Service Data Unit size (bytes)", HFILL
6158 { &hf_capa_server_sdu_size
,
6159 { "Server SDU Size",
6160 "wsp.capability.server_sdu_size",
6161 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
6162 "Server Service Data Unit size (bytes)", HFILL
6165 { &hf_capa_protocol_options
,
6166 { "Protocol Options",
6167 "wsp.capability.protocol_opt",
6168 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6172 { &hf_capa_protocol_option_confirmed_push
,
6173 { "Confirmed Push facility",
6174 "wsp.capability.protocol_option.confirmed_push",
6175 FT_BOOLEAN
, 8, NULL
, 0x80,
6176 "If set, this CO-WSP session supports the Confirmed Push facility", HFILL
6179 { &hf_capa_protocol_option_push
,
6181 "wsp.capability.protocol_option.push",
6182 FT_BOOLEAN
, 8, NULL
, 0x40,
6183 "If set, this CO-WSP session supports the Push facility", HFILL
6186 { &hf_capa_protocol_option_session_resume
,
6187 { "Session Resume facility",
6188 "wsp.capability.protocol_option.session_resume",
6189 FT_BOOLEAN
, 8, NULL
, 0x20,
6190 "If set, this CO-WSP session supports the Session Resume facility", HFILL
6193 { &hf_capa_protocol_option_ack_headers
,
6194 { "Acknowledgement headers",
6195 "wsp.capability.protocol_option.ack_headers",
6196 FT_BOOLEAN
, 8, NULL
, 0x10,
6197 "If set, this CO-WSP session supports Acknowledgement headers", HFILL
6200 { &hf_capa_protocol_option_large_data_transfer
,
6201 { "Large data transfer",
6202 "wsp.capability.protocol_option.large_data_transfer",
6203 FT_BOOLEAN
, 8, NULL
, 0x08,
6204 "If set, this CO-WSP session supports Large data transfer", HFILL
6207 { &hf_capa_method_mor
,
6209 "wsp.capability.method_mor",
6210 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
6214 { &hf_capa_push_mor
,
6216 "wsp.capability.push_mor",
6217 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
6221 { &hf_capa_extended_methods
,
6222 { "Extended Methods",
6223 "wsp.capability.extended_methods",
6224 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6228 { &hf_capa_header_code_pages
,
6229 { "Header Code Pages",
6230 "wsp.capability.code_pages",
6231 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6237 "wsp.capability.aliases",
6238 FT_BYTES
, BASE_NONE
, NULL
, 0x00,
6242 { &hf_capa_client_message_size
,
6243 { "Client Message Size",
6244 "wsp.capability.client_message_size",
6245 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
6246 "Client Message size (bytes)", HFILL
6249 { &hf_capa_server_message_size
,
6250 { "Server Message Size",
6251 "wsp.capability.server_message_size",
6252 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
6253 "Server Message size (bytes)", HFILL
6256 { &hf_wsp_post_data
,
6259 FT_NONE
, BASE_NONE
, NULL
, 0x00,
6264 { &hf_wsp_push_data
,
6267 FT_NONE
, BASE_NONE
, NULL
, 0x00,
6271 { &hf_wsp_multipart_data
,
6272 { "Data in this part",
6273 "wsp.multipart.data",
6274 FT_NONE
, BASE_NONE
, NULL
, 0x00,
6275 "The data of 1 MIME-multipart part.", HFILL
6282 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
6283 "MIME part of multipart data.", HFILL
6286 { &hf_wsp_redirect_flags
,
6288 "wsp.redirect.flags",
6289 FT_UINT8
, BASE_HEX
, NULL
, 0x00,
6290 "Redirect Flags", HFILL
6293 { &hf_wsp_redirect_permanent
,
6294 { "Permanent Redirect",
6295 "wsp.redirect.flags.permanent",
6296 FT_BOOLEAN
, 8, TFS(&tfs_yes_no
), PERMANENT_REDIRECT
,
6300 { &hf_wsp_redirect_reuse_security_session
,
6301 { "Reuse Security Session",
6302 "wsp.redirect.flags.reuse_security_session",
6303 FT_BOOLEAN
, 8, TFS(&tfs_yes_no
), REUSE_SECURITY_SESSION
,
6304 "If set, the existing Security Session may be reused", HFILL
6307 { &hf_redirect_addresses
,
6308 { "Redirect Addresses",
6309 "wsp.redirect.addresses",
6310 FT_NONE
, BASE_NONE
, NULL
, 0x00,
6311 "List of Redirect Addresses", HFILL
6318 { &hf_address_entry
,
6321 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
6325 { &hf_address_flags_length
,
6327 "wsp.address.flags",
6328 FT_UINT8
, BASE_HEX
, NULL
, 0x00,
6329 "Address Flags/Length", HFILL
6332 { &hf_address_flags_length_bearer_type_included
,
6333 { "Bearer Type Included",
6334 "wsp.address.flags.bearer_type_included",
6335 FT_BOOLEAN
, 8, TFS(&tfs_yes_no
), BEARER_TYPE_INCLUDED
,
6336 "Address bearer type included", HFILL
6339 { &hf_address_flags_length_port_number_included
,
6340 { "Port Number Included",
6341 "wsp.address.flags.port_number_included",
6342 FT_BOOLEAN
, 8, TFS(&tfs_yes_no
), PORT_NUMBER_INCLUDED
,
6343 "Address port number included", HFILL
6346 { &hf_address_flags_length_address_len
,
6348 "wsp.address.flags.length",
6349 FT_UINT8
, BASE_DEC
, NULL
, ADDRESS_LEN
,
6353 { &hf_address_bearer_type
,
6355 "wsp.address.bearer_type",
6356 FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
, &vals_bearer_types_ext
, 0x0,
6360 { &hf_address_port_num
,
6363 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
6367 { &hf_address_ipv4_addr
,
6370 FT_IPv4
, BASE_NONE
, NULL
, 0x0,
6371 "Address (IPv4)", HFILL
6374 { &hf_address_ipv6_addr
,
6377 FT_IPv6
, BASE_NONE
, NULL
, 0x0,
6378 "Address (IPv6)", HFILL
6383 "wsp.address.unknown",
6384 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
6385 "Address (unknown)", HFILL
6391 * New WSP header fields
6395 /* WSP header name */
6399 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6400 "Name of the WSP header", HFILL
6403 /* WSP headers start here */
6406 "wsp.header.accept",
6407 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6408 "WSP header Accept", HFILL
6411 { &hf_hdr_accept_charset
,
6413 "wsp.header.accept_charset",
6414 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6415 "WSP header Accept-Charset", HFILL
6418 { &hf_hdr_accept_encoding
,
6419 { "Accept-Encoding",
6420 "wsp.header.accept_encoding",
6421 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6422 "WSP header Accept-Encoding", HFILL
6425 { &hf_hdr_accept_language
,
6426 { "Accept-Language",
6427 "wsp.header.accept_language",
6428 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6429 "WSP header Accept-Language", HFILL
6432 { &hf_hdr_accept_ranges
,
6434 "wsp.header.accept_ranges",
6435 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6436 "WSP header Accept-Ranges", HFILL
6442 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6443 "WSP header Age", HFILL
6449 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6450 "WSP header Allow", HFILL
6453 { &hf_hdr_authorization
,
6455 "wsp.header.authorization",
6456 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6457 "WSP header Authorization", HFILL
6460 { &hf_hdr_authorization_scheme
,
6461 { "Authorization Scheme",
6462 "wsp.header.authorization.scheme",
6463 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6464 "WSP header Authorization: used scheme", HFILL
6467 { &hf_hdr_authorization_user_id
,
6469 "wsp.header.authorization.user_id",
6470 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6471 "WSP header Authorization: user ID for basic authorization", HFILL
6474 { &hf_hdr_authorization_password
,
6476 "wsp.header.authorization.password",
6477 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6478 "WSP header Authorization: password for basic authorization", HFILL
6481 { &hf_hdr_cache_control
,
6483 "wsp.header.cache_control",
6484 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6485 "WSP header Cache-Control", HFILL
6488 { &hf_hdr_connection
,
6490 "wsp.header.connection",
6491 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6492 "WSP header Connection", HFILL
6495 { &hf_hdr_content_base
,
6497 "wsp.header.content_base",
6498 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6499 "WSP header Content-Base", HFILL
6502 { &hf_hdr_content_encoding
,
6503 { "Content-Encoding",
6504 "wsp.header.content_encoding",
6505 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6506 "WSP header Content-Encoding", HFILL
6509 { &hf_hdr_content_language
,
6510 { "Content-Language",
6511 "wsp.header.content_language",
6512 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6513 "WSP header Content-Language", HFILL
6516 { &hf_hdr_content_length
,
6518 "wsp.header.content_length",
6519 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6520 "WSP header Content-Length", HFILL
6523 { &hf_hdr_content_location
,
6524 { "Content-Location",
6525 "wsp.header.content_location",
6526 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6527 "WSP header Content-Location", HFILL
6530 { &hf_hdr_content_md5
,
6532 "wsp.header.content_md5",
6533 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6534 "WSP header Content-Md5", HFILL
6537 { &hf_hdr_content_range
,
6539 "wsp.header.content_range",
6540 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6541 "WSP header Content-Range", HFILL
6544 { &hf_hdr_content_range_first_byte_pos
,
6545 { "First-byte-position",
6546 "wsp.header.content_range.first_byte_pos",
6547 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
6548 "WSP header Content-Range: position of first byte", HFILL
6551 { &hf_hdr_content_range_entity_length
,
6553 "wsp.header.content_range.entity_length",
6554 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
6555 "WSP header Content-Range: length of the entity", HFILL
6558 { &hf_hdr_content_type
,
6560 "wsp.header.content_type",
6561 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6562 "WSP header Content-Type", HFILL
6568 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6569 "WSP header Date", HFILL
6575 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6576 "WSP header ETag", HFILL
6581 "wsp.header.expires",
6582 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6583 "WSP header Expires", HFILL
6589 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6590 "WSP header From", HFILL
6596 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6597 "WSP header Host", HFILL
6600 { &hf_hdr_if_modified_since
,
6601 { "If-Modified-Since",
6602 "wsp.header.if_modified_since",
6603 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6604 "WSP header If-Modified-Since", HFILL
6609 "wsp.header.if_match",
6610 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6611 "WSP header If-Match", HFILL
6614 { &hf_hdr_if_none_match
,
6616 "wsp.header.if_none_match",
6617 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6618 "WSP header If-None-Match", HFILL
6623 "wsp.header.if_range",
6624 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6625 "WSP header If-Range", HFILL
6628 { &hf_hdr_if_unmodified_since
,
6629 { "If-Unmodified-Since",
6630 "wsp.header.if_unmodified_since",
6631 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6632 "WSP header If-Unmodified-Since", HFILL
6635 { &hf_hdr_last_modified
,
6637 "wsp.header.last_modified",
6638 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6639 "WSP header Last-Modified", HFILL
6644 "wsp.header.location",
6645 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6646 "WSP header Location", HFILL
6649 { &hf_hdr_max_forwards
,
6651 "wsp.header.max_forwards",
6652 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6653 "WSP header Max-Forwards", HFILL
6658 "wsp.header.pragma",
6659 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6660 "WSP header Pragma", HFILL
6663 { &hf_hdr_proxy_authenticate
,
6664 { "Proxy-Authenticate",
6665 "wsp.header.proxy_authenticate",
6666 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6667 "WSP header Proxy-Authenticate", HFILL
6670 { &hf_hdr_proxy_authenticate_scheme
,
6671 { "Authentication Scheme",
6672 "wsp.header.proxy_authenticate.scheme",
6673 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6674 "WSP header Proxy-Authenticate: used scheme", HFILL
6677 { &hf_hdr_proxy_authenticate_realm
,
6678 { "Authentication Realm",
6679 "wsp.header.proxy_authenticate.realm",
6680 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6681 "WSP header Proxy-Authenticate: used realm", HFILL
6684 { &hf_hdr_proxy_authorization
,
6685 { "Proxy-Authorization",
6686 "wsp.header.proxy_authorization",
6687 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6688 "WSP header Proxy-Authorization", HFILL
6691 { &hf_hdr_proxy_authorization_scheme
,
6692 { "Authorization Scheme",
6693 "wsp.header.proxy_authorization.scheme",
6694 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6695 "WSP header Proxy-Authorization: used scheme", HFILL
6698 { &hf_hdr_proxy_authorization_user_id
,
6700 "wsp.header.proxy_authorization.user_id",
6701 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6702 "WSP header Proxy-Authorization: user ID for basic authorization", HFILL
6705 { &hf_hdr_proxy_authorization_password
,
6707 "wsp.header.proxy_authorization.password",
6708 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6709 "WSP header Proxy-Authorization: password for basic authorization", HFILL
6714 "wsp.header.public",
6715 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6716 "WSP header Public", HFILL
6722 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6723 "WSP header Range", HFILL
6726 { &hf_hdr_range_first_byte_pos
,
6727 { "First-byte-position",
6728 "wsp.header.range.first_byte_pos",
6729 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
6730 "WSP header Range: position of first byte", HFILL
6733 { &hf_hdr_range_last_byte_pos
,
6734 { "Last-byte-position",
6735 "wsp.header.range.last_byte_pos",
6736 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
6737 "WSP header Range: position of last byte", HFILL
6740 { &hf_hdr_range_suffix_length
,
6742 "wsp.header.range.suffix_length",
6743 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
6744 "WSP header Range: length of the suffix", HFILL
6749 "wsp.header.referer",
6750 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6751 "WSP header Referer", HFILL
6754 { &hf_hdr_retry_after
,
6756 "wsp.header.retry_after",
6757 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6758 "WSP header Retry-After", HFILL
6763 "wsp.header.server",
6764 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6765 "WSP header Server", HFILL
6768 { &hf_hdr_transfer_encoding
,
6769 { "Transfer-Encoding",
6770 "wsp.header.transfer_encoding",
6771 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6772 "WSP header Transfer-Encoding", HFILL
6777 "wsp.header.upgrade",
6778 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6779 "WSP header Upgrade", HFILL
6782 { &hf_hdr_user_agent
,
6784 "wsp.header.user_agent",
6785 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6786 "WSP header User-Agent", HFILL
6792 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6793 "WSP header Vary", HFILL
6799 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6800 "WSP header Via", HFILL
6805 "wsp.header.warning",
6806 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6807 "WSP header Warning", HFILL
6810 { &hf_hdr_warning_code
,
6812 "wsp.header.warning.code",
6813 FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
, &vals_wsp_warning_code_ext
, 0x00,
6814 "WSP header Warning code", HFILL
6817 { &hf_hdr_warning_agent
,
6819 "wsp.header.warning.agent",
6820 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6821 "WSP header Warning agent", HFILL
6824 { &hf_hdr_warning_text
,
6826 "wsp.header.warning.text",
6827 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6828 "WSP header Warning text", HFILL
6831 { &hf_hdr_www_authenticate
,
6832 { "Www-Authenticate",
6833 "wsp.header.www_authenticate",
6834 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6835 "WSP header Www-Authenticate", HFILL
6838 { &hf_hdr_www_authenticate_scheme
,
6839 { "Authentication Scheme",
6840 "wsp.header.www_authenticate.scheme",
6841 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6842 "WSP header WWW-Authenticate: used scheme", HFILL
6845 { &hf_hdr_www_authenticate_realm
,
6846 { "Authentication Realm",
6847 "wsp.header.www_authenticate.realm",
6848 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6849 "WSP header WWW-Authenticate: used realm", HFILL
6852 { &hf_hdr_content_disposition
,
6853 { "Content-Disposition",
6854 "wsp.header.content_disposition",
6855 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6856 "WSP header Content-Disposition", HFILL
6859 { &hf_hdr_application_id
,
6861 "wsp.header.application_id",
6862 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6863 "WSP header Application-Id", HFILL
6866 { &hf_hdr_content_uri
,
6868 "wsp.header.content_uri",
6869 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6870 "WSP header Content-Uri", HFILL
6873 { &hf_hdr_initiator_uri
,
6875 "wsp.header.initiator_uri",
6876 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6877 "WSP header Initiator-Uri", HFILL
6880 { &hf_hdr_bearer_indication
,
6881 { "Bearer-Indication",
6882 "wsp.header.bearer_indication",
6883 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6884 "WSP header Bearer-Indication", HFILL
6887 { &hf_hdr_push_flag
,
6889 "wsp.header.push_flag",
6890 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6891 "WSP header Push-Flag", HFILL
6894 { &hf_hdr_push_flag_auth
,
6895 { "Initiator URI is authenticated",
6896 "wsp.header.push_flag.authenticated",
6897 FT_UINT8
, BASE_DEC
, VALS(vals_false_true
), 0x01,
6898 "The X-Wap-Initiator-URI has been authenticated.", HFILL
6901 { &hf_hdr_push_flag_trust
,
6902 { "Content is trusted",
6903 "wsp.header.push_flag.trusted",
6904 FT_UINT8
, BASE_DEC
, VALS(vals_false_true
), 0x02,
6905 "The push content is trusted.", HFILL
6908 { &hf_hdr_push_flag_last
,
6909 { "Last push message",
6910 "wsp.header.push_flag.last",
6911 FT_UINT8
, BASE_DEC
, VALS(vals_false_true
), 0x04,
6912 "Indicates whether this is the last push message.", HFILL
6917 "wsp.header.profile",
6918 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6919 "WSP header Profile", HFILL
6922 { &hf_hdr_profile_diff
,
6924 "wsp.header.profile_diff",
6925 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6926 "WSP header Profile-Diff", HFILL
6929 { &hf_hdr_profile_warning
,
6930 { "Profile-Warning",
6931 "wsp.header.profile_warning",
6932 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6933 "WSP header Profile-Warning", HFILL
6938 "wsp.header.expect",
6939 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6940 "WSP header Expect", HFILL
6946 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6947 "WSP header Te", HFILL
6952 "wsp.header.trailer",
6953 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6954 "WSP header Trailer", HFILL
6957 { &hf_hdr_x_wap_tod
,
6959 "wsp.header.x_wap_tod",
6960 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6961 "WSP header X-Wap-Tod", HFILL
6964 { &hf_hdr_content_id
,
6966 "wsp.header.content_id",
6967 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6968 "WSP header Content-Id", HFILL
6971 { &hf_hdr_set_cookie
,
6973 "wsp.header.set_cookie",
6974 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6975 "WSP header Set-Cookie", HFILL
6980 "wsp.header.cookie",
6981 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6982 "WSP header Cookie", HFILL
6985 { &hf_hdr_encoding_version
,
6986 { "Encoding-Version",
6987 "wsp.header.encoding_version",
6988 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6989 "WSP header Encoding-Version", HFILL
6992 { &hf_hdr_x_wap_security
,
6994 "wsp.header.x_wap_security",
6995 FT_STRING
, BASE_NONE
, NULL
, 0x00,
6996 "WSP header X-Wap-Security", HFILL
6999 { &hf_hdr_x_wap_application_id
,
7000 { "X-Wap-Application-Id",
7001 "wsp.header.x_wap_application_id",
7002 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7003 "WSP header X-Wap-Application-Id", HFILL
7006 { &hf_hdr_accept_application
,
7007 { "Accept-Application",
7008 "wsp.header.accept_application",
7009 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7010 "WSP header Accept-Application", HFILL
7017 * Header Code Page: x-up-1
7020 /* Textual headers */
7021 { &hf_hdr_openwave_x_up_proxy_operator_domain
,
7022 { "x-up-proxy-operator-domain",
7023 "wsp.header.x_up_1.x_up_proxy_operator_domain",
7024 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7025 "WSP Openwave header x-up-proxy-operator-domain", HFILL
7028 { &hf_hdr_openwave_x_up_proxy_home_page
,
7029 { "x-up-proxy-home-page",
7030 "wsp.header.x_up_1.x_up_proxy_home_page",
7031 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7032 "WSP Openwave header x-up-proxy-home-page", HFILL
7035 { &hf_hdr_openwave_x_up_proxy_uplink_version
,
7036 { "x-up-proxy-uplink-version",
7037 "wsp.header.x_up_1.x_up_proxy_uplink_version",
7038 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7039 "WSP Openwave header x-up-proxy-uplink-version", HFILL
7042 { &hf_hdr_openwave_x_up_proxy_ba_realm
,
7043 { "x-up-proxy-ba-realm",
7044 "wsp.header.x_up_1.x_up_proxy_ba_realm",
7045 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7046 "WSP Openwave header x-up-proxy-ba-realm", HFILL
7049 { &hf_hdr_openwave_x_up_proxy_request_uri
,
7050 { "x-up-proxy-request-uri",
7051 "wsp.header.x_up_1.x_up_proxy_request_uri",
7052 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7053 "WSP Openwave header x-up-proxy-request-uri", HFILL
7056 { &hf_hdr_openwave_x_up_proxy_bookmark
,
7057 { "x-up-proxy-bookmark",
7058 "wsp.header.x_up_1.x_up_proxy_bookmark",
7059 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7060 "WSP Openwave header x-up-proxy-bookmark", HFILL
7063 /* Integer-value headers */
7064 { &hf_hdr_openwave_x_up_proxy_push_seq
,
7065 { "x-up-proxy-push-seq",
7066 "wsp.header.x_up_1.x_up_proxy_push_seq",
7067 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7068 "WSP Openwave header x-up-proxy-push-seq", HFILL
7071 { &hf_hdr_openwave_x_up_proxy_notify
,
7072 { "x-up-proxy-notify",
7073 "wsp.header.x_up_1.x_up_proxy_notify",
7074 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7075 "WSP Openwave header x-up-proxy-notify", HFILL
7078 { &hf_hdr_openwave_x_up_proxy_net_ask
,
7079 { "x-up-proxy-net-ask",
7080 "wsp.header.x_up_1.x_up_proxy_net_ask",
7081 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7082 "WSP Openwave header x-up-proxy-net-ask", HFILL
7085 { &hf_hdr_openwave_x_up_proxy_tod
,
7087 "wsp.header.x_up_1.x_up_proxy_tod",
7088 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7089 "WSP Openwave header x-up-proxy-tod", HFILL
7092 { &hf_hdr_openwave_x_up_proxy_ba_enable
,
7093 { "x-up-proxy-ba-enable",
7094 "wsp.header.x_up_1.x_up_proxy_ba_enable",
7095 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7096 "WSP Openwave header x-up-proxy-ba-enable", HFILL
7099 { &hf_hdr_openwave_x_up_proxy_redirect_enable
,
7100 { "x-up-proxy-redirect-enable",
7101 "wsp.header.x_up_1.x_up_proxy_redirect_enable",
7102 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7103 "WSP Openwave header x-up-proxy-redirect-enable", HFILL
7106 { &hf_hdr_openwave_x_up_proxy_redirect_status
,
7107 { "x-up-proxy-redirect-status",
7108 "wsp.header.x_up_1.x_up_proxy_redirect_status",
7109 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7110 "WSP Openwave header x-up-proxy-redirect-status", HFILL
7113 { &hf_hdr_openwave_x_up_proxy_linger
,
7114 { "x-up-proxy-linger",
7115 "wsp.header.x_up_1.x_up_proxy_linger",
7116 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7117 "WSP Openwave header x-up-proxy-linger", HFILL
7120 { &hf_hdr_openwave_x_up_proxy_enable_trust
,
7121 { "x-up-proxy-enable-trust",
7122 "wsp.header.x_up_1.x_up_proxy_enable_trust",
7123 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7124 "WSP Openwave header x-up-proxy-enable-trust", HFILL
7127 { &hf_hdr_openwave_x_up_proxy_trust
,
7128 { "x-up-proxy-trust",
7129 "wsp.header.x_up_1.x_up_proxy_trust",
7130 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7131 "WSP Openwave header x-up-proxy-trust", HFILL
7134 { &hf_hdr_openwave_x_up_devcap_has_color
,
7135 { "x-up-devcap-has-color",
7136 "wsp.header.x_up_1.x_up_devcap_has_color",
7137 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7138 "WSP Openwave header x-up-devcap-has-color", HFILL
7141 { &hf_hdr_openwave_x_up_devcap_num_softkeys
,
7142 { "x-up-devcap-num-softkeys",
7143 "wsp.header.x_up_1.x_up_devcap_num_softkeys",
7144 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7145 "WSP Openwave header x-up-devcap-num-softkeys", HFILL
7148 { &hf_hdr_openwave_x_up_devcap_softkey_size
,
7149 { "x-up-devcap-softkey-size",
7150 "wsp.header.x_up_1.x_up_devcap_softkey_size",
7151 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7152 "WSP Openwave header x-up-devcap-softkey-size", HFILL
7155 { &hf_hdr_openwave_x_up_devcap_screen_chars
,
7156 { "x-up-devcap-screen-chars",
7157 "wsp.header.x_up_1.x_up_devcap_screen_chars",
7158 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7159 "WSP Openwave header x-up-devcap-screen-chars", HFILL
7162 { &hf_hdr_openwave_x_up_devcap_screen_pixels
,
7163 { "x-up-devcap-screen-pixels",
7164 "wsp.header.x_up_1.x_up_devcap_screen_pixels",
7165 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7166 "WSP Openwave header x-up-devcap-screen-pixels", HFILL
7169 { &hf_hdr_openwave_x_up_devcap_em_size
,
7170 { "x-up-devcap-em-size",
7171 "wsp.header.x_up_1.x_up_devcap_em_size",
7172 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7173 "WSP Openwave header x-up-devcap-em-size", HFILL
7176 { &hf_hdr_openwave_x_up_devcap_screen_depth
,
7177 { "x-up-devcap-screen-depth",
7178 "wsp.header.x_up_1.x_up_devcap_screen_depth",
7179 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7180 "WSP Openwave header x-up-devcap-screen-depth", HFILL
7183 { &hf_hdr_openwave_x_up_devcap_immed_alert
,
7184 { "x-up-devcap-immed-alert",
7185 "wsp.header.x_up_1.x_up_devcap_immed_alert",
7186 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7187 "WSP Openwave header x-up-devcap-immed-alert", HFILL
7190 { &hf_hdr_openwave_x_up_devcap_gui
,
7191 { "x-up-devcap-gui",
7192 "wsp.header.x_up_1.x_up_devcap_gui",
7193 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7194 "WSP Openwave header x-up-devcap-gui", HFILL
7197 { &hf_hdr_openwave_x_up_proxy_trans_charset
,
7198 { "x-up-proxy-trans-charset",
7199 "wsp.header.x_up_1.x_up_proxy_trans_charset",
7200 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7201 "WSP Openwave header x-up-proxy-trans-charset", HFILL
7204 { &hf_hdr_openwave_x_up_proxy_push_accept
,
7205 { "x-up-proxy-push-accept",
7206 "wsp.header.x_up_1.x_up_proxy_push_accept",
7207 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7208 "WSP Openwave header x-up-proxy-push-accept", HFILL
7213 /* Not used for now */
7214 { &hf_hdr_openwave_x_up_proxy_client_id
,
7215 { "x-up-proxy-client-id",
7216 "wsp.header.x_up_1.x_up_proxy_client_id",
7217 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7218 "WSP Openwave header x-up-proxy-client-id", HFILL
7224 * Header value parameters
7230 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7231 "Q parameter", HFILL
7234 { &hf_parameter_charset
,
7236 "wsp.parameter.charset",
7237 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7238 "Charset parameter", HFILL
7243 /* Setup protocol subtree array */
7244 static gint
*ett
[] = {
7246 &ett_header
, /* Header field subtree */
7247 &ett_headers
, /* Subtree for WSP headers */
7248 &ett_capabilities
, /* CO-WSP Session Capabilities */
7249 &ett_capability
, /* CO-WSP Session single Capability */
7251 &ett_redirect_flags
,
7255 &ett_addresses
, /* Addresses */
7256 &ett_address
/* Single address */
7259 /* Register the protocol name and description */
7260 proto_wsp
= proto_register_protocol(
7261 "Wireless Session Protocol", /* protocol name for use by wireshark */
7262 "WSP", /* short version of name */
7263 "wsp" /* Abbreviated protocol name,
7265 < URL:http://www.iana.org/assignments/port-numbers/ >
7268 wsp_tap
= register_tap("wsp");
7269 /* Init the hash table */
7270 /* wsp_sessions = g_hash_table_new(
7271 (GHashFunc) wsp_session_hash,
7272 (GEqualFunc)wsp_session_equal);*/
7274 /* Required function calls to register the header fields and subtrees used */
7275 proto_register_field_array(proto_wsp
, hf
, array_length(hf
));
7276 proto_register_subtree_array(ett
, array_length(ett
));
7278 register_dissector("wsp-co", dissect_wsp_fromwap_co
, proto_wsp
);
7279 register_dissector("wsp-cl", dissect_wsp_fromwap_cl
, proto_wsp
);
7280 register_heur_dissector_list("wsp", &heur_subdissector_list
);
7282 wsp_fromudp_handle
= create_dissector_handle(dissect_wsp_fromudp
,
7287 proto_reg_handoff_wsp(void)
7290 * Get a handle for the WTP-over-UDP and the generic media dissectors.
7292 wtp_fromudp_handle
= find_dissector("wtp-udp");
7293 media_handle
= find_dissector("media");
7294 wbxml_uaprof_handle
= find_dissector("wbxml-uaprof");
7296 /* Only connection-less WSP has no previous handler */
7297 dissector_add_uint("udp.port", UDP_PORT_WSP
, wsp_fromudp_handle
);
7298 dissector_add_uint("udp.port", UDP_PORT_WSP_PUSH
, wsp_fromudp_handle
);
7300 /* GSM SMS UD dissector can also carry WSP */
7301 dissector_add_uint("gsm_sms_ud.udh.port", UDP_PORT_WSP
, wsp_fromudp_handle
);
7302 dissector_add_uint("gsm_sms_ud.udh.port", UDP_PORT_WSP_PUSH
, wsp_fromudp_handle
);
7304 /* GSM SMS dissector can also carry WSP */
7305 dissector_add_uint("gsm_sms.udh.port", UDP_PORT_WSP
, wsp_fromudp_handle
);
7306 dissector_add_uint("gsm_sms.udh.port", UDP_PORT_WSP_PUSH
, wsp_fromudp_handle
);
7308 /* As the media types for WSP and HTTP are the same, the WSP dissector
7309 * uses the same string dissector table as the HTTP protocol. */
7310 media_type_table
= find_dissector_table("media_type");
7312 /* This dissector is also called from the WTP and WTLS dissectors */
7316 * Session Initiation Request
7319 /* Register the protocol with Wireshark */
7321 proto_register_sir(void)
7323 /* Setup list of header fields */
7324 static hf_register_info hf
[] = {
7326 { "Session Initiation Request",
7328 FT_NONE
, BASE_NONE
, NULL
, 0x00,
7329 "Session Initiation Request content", HFILL
7335 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
7336 "Version of the Session Initiation Request document", HFILL
7339 { &hf_sir_app_id_list_len
,
7340 { "Application-ID List Length",
7341 "wap.sir.app_id_list.length",
7342 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
7343 "Length of the Application-ID list (bytes)", HFILL
7346 { &hf_sir_app_id_list
,
7347 { "Application-ID List",
7348 "wap.sir.app_id_list",
7349 FT_NONE
, BASE_NONE
, NULL
, 0x00,
7353 { &hf_sir_wsp_contact_points_len
,
7354 { "WSP Contact Points Length",
7355 "wap.sir.wsp_contact_points.length",
7356 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
7357 "Length of the WSP Contact Points list (bytes)", HFILL
7360 { &hf_sir_wsp_contact_points
,
7361 { "WSP Contact Points",
7362 "wap.sir.wsp_contact_points",
7363 FT_NONE
, BASE_NONE
, NULL
, 0x00,
7364 "WSP Contact Points list", HFILL
7367 { &hf_sir_contact_points_len
,
7368 { "Non-WSP Contact Points Length",
7369 "wap.sir.contact_points.length",
7370 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
7371 "Length of the Non-WSP Contact Points list (bytes)", HFILL
7374 { &hf_sir_contact_points
,
7375 { "Non-WSP Contact Points",
7376 "wap.sir.contact_points",
7377 FT_NONE
, BASE_NONE
, NULL
, 0x00,
7378 "Non-WSP Contact Points list", HFILL
7381 { &hf_sir_protocol_options_len
,
7382 { "Protocol Options List Entries",
7383 "wap.sir.protocol_options.length",
7384 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
7385 "Number of entries in the Protocol Options list", HFILL
7388 { &hf_sir_protocol_options
,
7389 { "Protocol Options",
7390 "wap.sir.protocol_options",
7391 FT_UINT16
, BASE_DEC
, VALS(vals_sir_protocol_options
), 0x00,
7392 "Protocol Options list", HFILL
7395 { &hf_sir_prov_url_len
,
7396 { "X-Wap-ProvURL Length",
7397 "wap.sir.prov_url.length",
7398 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
7399 "Length of the X-Wap-ProvURL (Identifies the WAP Client Provisioning Context)", HFILL
7405 FT_STRING
, BASE_NONE
, NULL
, 0x00,
7406 "X-Wap-ProvURL (Identifies the WAP Client Provisioning Context)", HFILL
7409 { &hf_sir_cpi_tag_len
,
7410 { "CPITag List Entries",
7411 "wap.sir.cpi_tag.length",
7412 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
7413 "Number of entries in the CPITag list", HFILL
7419 FT_BYTES
, BASE_NONE
, NULL
, 0x00,
7420 "CPITag (OTA-HTTP)", HFILL
7425 /* Setup protocol subtree array */
7426 static gint
*ett
[] = {
7427 &ett_sir
/* Session Initiation Request */
7430 /* Register the dissector */
7431 proto_sir
= proto_register_protocol(
7432 "WAP Session Initiation Request", /* protocol name for use by wireshark */
7433 "WAP SIR", /* short version of name */
7434 "wap-sir" /* Abbreviated protocol name,
7436 < URL:http://www.iana.org/assignments/port-numbers/ >
7440 /* Register header fields and protocol subtrees */
7441 proto_register_field_array(proto_sir
, hf
, array_length(hf
));
7442 proto_register_subtree_array(ett
, array_length(ett
));
7446 proto_reg_handoff_sir(void)
7448 dissector_handle_t sir_handle
;
7450 sir_handle
= create_dissector_handle(dissect_sir
, proto_sir
);
7452 /* Add dissector bindings for SIR dissection */
7453 dissector_add_string("media_type", "application/vnd.wap.sia", sir_handle
);
7464 * indent-tabs-mode: nil
7467 * ex: set shiftwidth=4 tabstop=8 expandtab:
7468 * :indentSize=4:tabSize=8:noTabs=true: