HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / epan / dissectors / packet-mrcpv2.c
bloba20fff263f7b59e22dcd90567501fd0b98d56660
1 /* packet-mrcpv2.c
2 * Routines for Media Resource Control Protocol Version 2 (MRCPv2) dissection
3 * Copyright 2012, Zeljko Ancimer <zancimer[AT]gmail.com>
5 * $Id$
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 * Based on RFC 6787
28 * TODO:
29 * - TLS has not been tested
30 * - MRCP conversation (similar to VoIP Calls)
31 * - convert header value into the correct types (numbers, booleans,...);
32 * currently all values are treated as strings so one has to be
33 * careful with the usage of filters; to do this, one has to go through
34 * the mrcp draft and look for the definition of each header (see
35 * chapter titled "15. ABNF Normative Definition")
37 #include "config.h"
39 /* Include only as needed */
40 #include <stdio.h>
41 #include <stdlib.h>
42 #include <string.h>
43 #include <ctype.h>
45 #include <glib.h>
47 #include <epan/prefs.h>
48 #include <epan/dissectors/packet-tcp.h>
50 #include <wsutil/str_util.h>
52 /* mrcp-version SP message-length */
53 /* mrcp-version = "MRCP" "/" 1*2DIGIT "." 1*2DIGIT ==> up to 10 chars */
54 /* SP ==> whitespace, 1 char */
55 /* message-length = 1*19DIGIT ==> up to 19 chars */
56 /* total = 10 + 1 + 19 = 30 */
58 /* min length to determine MRCPv2 version */
59 #define MRCPV2_MIN_LENGTH 10
60 /* min length to determine MRCPv2 PDU length */
61 #define MRCPV2_MIN_PDU_LEN 30
63 /* line type */
64 typedef enum {
65 REQUEST_LINE,
66 RESPONSE_LINE,
67 EVENT_LINE,
68 UNKNOWN_LINE
69 } LINE_TYPE;
71 /* header type */
72 typedef enum {
73 UNKNOWN = 0,
74 ABORT_MODEL = 1,
75 ABORT_PHRASE_ENROLLMENT = 2,
76 ABORT_VERIFICATION = 3,
77 ACCEPT = 4,
78 ACCEPT_CHARSET = 5,
79 ACTIVE_REQUEST_ID_LIST = 6,
80 ADAPT_MODEL = 7,
81 AUDIO_FETCH_HINT = 8,
82 CACHE_CONTROL = 9,
83 CANCEL_IF_QUEUE = 10,
84 CAPTURE_ON_SPEECH = 11,
85 CHANNEL_IDENTIFIER = 12,
86 CLASH_THRESHOLD = 13,
87 CLEAR_DTMF_BUFFER = 14,
88 COMPLETION_CAUSE = 15,
89 COMPLETION_REASON = 16,
90 CONFIDENCE_THRESHOLD = 17,
91 CONFUSABLE_PHRASES_URI = 18,
92 CONSISTENCY_THRESHOLD = 19,
93 CONTENT_BASE = 20,
94 CONTENT_ENCODING = 21,
95 CONTENT_ID = 22,
96 CONTENT_LENGTH = 23,
97 CONTENT_LOCATION = 24,
98 CONTENT_TYPE = 25,
99 DTMF_BUFFER_TIME = 26,
100 DTMF_INTERDIGIT_TIMEOUT = 27,
101 DTMF_TERM_CHAR = 28,
102 DTMF_TERM_TIMEOUT = 29,
103 EARLY_NO_MATCH = 30,
104 ENROLL_UTTERANCE = 31,
105 FAILED_URI = 32,
106 FAILED_URI_CAUSE = 33,
107 FETCH_HINT = 34,
108 FETCH_TIMEOUT = 35,
109 FINAL_SILENCE = 36,
110 HOTWORD_MAX_DURATION = 37,
111 HOTWORD_MIN_DURATION = 38,
112 INPUT_TYPE = 39,
113 INPUT_WAVEFORM_URI = 40,
114 INTERPRET_TEXT = 41,
115 JUMP_SIZE = 42,
116 KILL_ON_BARGE_IN = 43,
117 LEXICON_SEARCH_ORDER = 44,
118 LOAD_LEXICON = 45,
119 LOGGING_TAG = 46,
120 MAX_TIME = 47,
121 MEDIA_TYPE = 48,
122 MIN_VERIFICATION_SCORE = 49,
123 N_BEST_LIST_LENGTH = 50,
124 NEW_AUDIO_CHANNEL = 51,
125 NEW_PHRASE_ID = 52,
126 NO_INPUT_TIMEOUT = 53,
127 NUM_MAX_VERIFICATION_PHRASES = 54,
128 NUM_MIN_CONSISTENT_PRONUNCIATIONS = 55,
129 NUM_MIN_VERIFICATION_PHRASES = 56,
130 PERSONAL_GRAMMAR_URI = 57,
131 PHRASE_ID = 58,
132 PHRASE_NL = 59,
133 PROSODY_PARAMETER = 60,
134 PROXY_SYNC_ID = 61,
135 RECOGNITION_MODE = 62,
136 RECOGNITION_TIMEOUT = 63,
137 RECOGNIZER_CONTEXT_BLOCK = 64,
138 RECORD_URI = 65,
139 REPOSITORY_URI = 66,
140 SAVE_BEST_WAVEFORM = 67,
141 SAVE_WAVEFORM = 68,
142 SENSITIVITY_LEVEL = 69,
143 SET_COOKIE = 70,
144 SPEAK_LENGTH = 71,
145 SPEAK_RESTART = 72,
146 SPEAKER_PROFILE = 73,
147 SPEECH_COMPLETE_TIMEOUT = 74,
148 SPEECH_INCOMPLETE_TIMEOUT = 75,
149 SPEECH_LANGUAGE = 76,
150 SPEECH_MARKER = 77,
151 SPEED_VS_ACCURACY = 78,
152 START_INPUT_TIMERS = 79,
153 TRIM_LENGTH = 80,
154 VENDOR_SPECIFIC_PARAMETERS = 81,
155 VER_BUFFER_UTTERANCE = 82,
156 VERIFICATION_MODE = 83,
157 VOICE_AGE = 84,
158 VOICE_GENDER = 85,
159 VOICE_NAME = 86,
160 VOICE_VARIANT = 87,
161 VOICEPRINT_EXISTS = 88,
162 VOICEPRINT_IDENTIFIER = 89,
163 WAVEFORM_URI = 90,
164 WEIGHT = 91
165 } HEADER_TYPE;
167 static const value_string header_type_vals[] = {
168 { ABORT_MODEL, "abort-model" },
169 { ABORT_PHRASE_ENROLLMENT, "abort-phrase-enrollment" },
170 { ABORT_VERIFICATION, "abort-verification" },
171 { ACCEPT, "accept" },
172 { ACCEPT_CHARSET, "accept-charset" },
173 { ACTIVE_REQUEST_ID_LIST, "active-request-id-list" },
174 { ADAPT_MODEL, "adapt-model" },
175 { AUDIO_FETCH_HINT, "audio-fetch-hint" },
176 { CACHE_CONTROL, "cache-control" },
177 { CANCEL_IF_QUEUE, "cancel-if-queue" },
178 { CAPTURE_ON_SPEECH, "capture-on-speech" },
179 { CHANNEL_IDENTIFIER, "channel-identifier" },
180 { CLASH_THRESHOLD, "clash-threshold" },
181 { CLEAR_DTMF_BUFFER, "clear-dtmf-buffer" },
182 { COMPLETION_CAUSE, "completion-cause" },
183 { COMPLETION_REASON, "completion-reason" },
184 { CONFIDENCE_THRESHOLD, "confidence-threshold" },
185 { CONFUSABLE_PHRASES_URI, "confusable-phrases-uri" },
186 { CONSISTENCY_THRESHOLD, "consistency-threshold" },
187 { CONTENT_BASE, "content-base" },
188 { CONTENT_ENCODING, "content-encoding" },
189 { CONTENT_ID, "content-id" },
190 { CONTENT_LENGTH, "content-length" },
191 { CONTENT_LOCATION, "content-location" },
192 { CONTENT_TYPE, "content-type" },
193 { DTMF_BUFFER_TIME, "dtmf-buffer-time" },
194 { DTMF_INTERDIGIT_TIMEOUT, "dtmf-interdigit-timeout" },
195 { DTMF_TERM_CHAR, "dtmf-term-char" },
196 { DTMF_TERM_TIMEOUT, "dtmf-term-timeout" },
197 { EARLY_NO_MATCH, "early-no-match" },
198 { ENROLL_UTTERANCE, "enroll-utterance" },
199 { FAILED_URI, "failed-uri" },
200 { FAILED_URI_CAUSE, "failed-uri-cause" },
201 { FETCH_HINT, "fetch-hint" },
202 { FETCH_TIMEOUT, "fetch-timeout" },
203 { FINAL_SILENCE, "final-silence" },
204 { HOTWORD_MAX_DURATION, "hotword-max-duration" },
205 { HOTWORD_MIN_DURATION, "hotword-min-duration" },
206 { INPUT_TYPE, "input-type" },
207 { INPUT_WAVEFORM_URI, "input-waveform-uri" },
208 { INTERPRET_TEXT, "interpret-text" },
209 { JUMP_SIZE, "jump-size" },
210 { KILL_ON_BARGE_IN, "kill-on-barge-in" },
211 { LEXICON_SEARCH_ORDER, "lexicon-search-order" },
212 { LOAD_LEXICON, "load-lexicon" },
213 { LOGGING_TAG, "logging-tag" },
214 { MAX_TIME, "max-time" },
215 { MEDIA_TYPE, "media-type" },
216 { MIN_VERIFICATION_SCORE, "min-verification-score" },
217 { N_BEST_LIST_LENGTH, "n-best-list-length" },
218 { NEW_AUDIO_CHANNEL, "new-audio-channel" },
219 { NEW_PHRASE_ID, "new-phrase-id" },
220 { NO_INPUT_TIMEOUT, "no-input-timeout" },
221 { NUM_MAX_VERIFICATION_PHRASES, "num-max-verification-phrases" },
222 { NUM_MIN_CONSISTENT_PRONUNCIATIONS, "num-min-consistent-pronunciations" },
223 { NUM_MIN_VERIFICATION_PHRASES, "num-min-verification-phrases" },
224 { PERSONAL_GRAMMAR_URI, "personal-grammar-uri" },
225 { PHRASE_ID, "phrase-id" },
226 { PHRASE_NL, "phrase-nl" },
227 { PROSODY_PARAMETER, "prosody-" },
228 { PROXY_SYNC_ID, "proxy-sync-id" },
229 { RECOGNITION_MODE, "recognition-mode" },
230 { RECOGNITION_TIMEOUT, "recognition-timeout" },
231 { RECOGNIZER_CONTEXT_BLOCK, "recognizer-context-block" },
232 { RECORD_URI, "record-uri" },
233 { REPOSITORY_URI, "repository-uri" },
234 { SAVE_BEST_WAVEFORM, "save-best-waveform" },
235 { SAVE_WAVEFORM, "save-waveform" },
236 { SENSITIVITY_LEVEL, "sensitivity-level" },
237 { SET_COOKIE, "set-cookie" },
238 { SPEAK_LENGTH, "speak-length" },
239 { SPEAK_RESTART, "speak-restart" },
240 { SPEAKER_PROFILE, "speaker-profile" },
241 { SPEECH_COMPLETE_TIMEOUT, "speech-complete-timeout" },
242 { SPEECH_INCOMPLETE_TIMEOUT, "speech-incomplete-timeout" },
243 { SPEECH_LANGUAGE, "speech-language" },
244 { SPEECH_MARKER, "speech-marker" },
245 { SPEED_VS_ACCURACY, "speed-vs-accuracy" },
246 { START_INPUT_TIMERS, "start-input-timers" },
247 { TRIM_LENGTH, "trim-length" },
248 { VENDOR_SPECIFIC_PARAMETERS, "vendor-specific-parameters" },
249 { VER_BUFFER_UTTERANCE, "ver-buffer-utterance" },
250 { VERIFICATION_MODE, "verification-mode" },
251 { VOICE_AGE, "voice-age" },
252 { VOICE_GENDER, "voice-gender" },
253 { VOICE_NAME, "voice-name" },
254 { VOICE_VARIANT, "voice-variant" },
255 { VOICEPRINT_EXISTS, "voiceprint-exists" },
256 { VOICEPRINT_IDENTIFIER, "voiceprint-identifier" },
257 { WAVEFORM_URI, "waveform-uri" },
258 { WEIGHT, "weight" },
259 { 0, NULL }
262 /* Forward declaration we need below (if using proto_reg_handoff... as a prefs callback) */
263 void proto_reg_handoff_mrcpv2(void);
265 /* Initialize the protocol and registered fields */
266 static int proto_mrcpv2 = -1;
267 static int hf_mrcpv2_Request_Line = -1;
268 static int hf_mrcpv2_Response_Line = -1;
269 static int hf_mrcpv2_Event_Line = -1;
270 static int hf_mrcpv2_Unknown_Message = -1;
271 static int hf_mrcpv2_Unknown_Header = -1;
272 static int hf_mrcpv2_Data = -1;
273 static int hf_mrcpv2_Method = -1;
274 static int hf_mrcpv2_Event = -1;
275 static int hf_mrcpv2_version = -1;
276 static int hf_mrcpv2_message_length = -1;
277 static int hf_mrcpv2_request_id = -1;
278 static int hf_mrcpv2_status_code = -1;
279 static int hf_mrcpv2_request_state = -1;
280 static int hf_mrcpv2_Abort_Model = -1;
281 static int hf_mrcpv2_Abort_Phrase_Enrollment = -1;
282 static int hf_mrcpv2_Abort_Verification = -1;
283 static int hf_mrcpv2_Accept = -1;
284 static int hf_mrcpv2_Accept_Charset = -1;
285 static int hf_mrcpv2_Active_Request_Id_List = -1;
286 static int hf_mrcpv2_Adapt_Model = -1;
287 static int hf_mrcpv2_Audio_Fetch_Hint = -1;
288 static int hf_mrcpv2_Cache_Control = -1;
289 static int hf_mrcpv2_Cancel_If_Queue = -1;
290 static int hf_mrcpv2_Capture_On_Speech = -1;
291 static int hf_mrcpv2_Channel_Identifier = -1;
292 static int hf_mrcpv2_Clash_Threshold = -1;
293 static int hf_mrcpv2_Clear_Dtmf_Buffer = -1;
294 static int hf_mrcpv2_Completion_Cause = -1;
295 static int hf_mrcpv2_Completion_Reason = -1;
296 static int hf_mrcpv2_Confidence_Threshold = -1;
297 static int hf_mrcpv2_Confusable_Phrases_URI = -1;
298 static int hf_mrcpv2_Consistency_Threshold = -1;
299 static int hf_mrcpv2_Content_Base = -1;
300 static int hf_mrcpv2_Content_Encoding = -1;
301 static int hf_mrcpv2_Content_ID = -1;
302 static int hf_mrcpv2_Content_Length = -1;
303 static int hf_mrcpv2_Content_Location = -1;
304 static int hf_mrcpv2_Content_Type = -1;
305 static int hf_mrcpv2_Dtmf_Buffer_Time = -1;
306 static int hf_mrcpv2_Dtmf_Interdigit_Timeout = -1;
307 static int hf_mrcpv2_Dtmf_Term_Char = -1;
308 static int hf_mrcpv2_Dtmf_Term_Timeout = -1;
309 static int hf_mrcpv2_Early_No_Match = -1;
310 static int hf_mrcpv2_Enroll_Utterance = -1;
311 static int hf_mrcpv2_Failed_URI = -1;
312 static int hf_mrcpv2_Failed_URI_Cause = -1;
313 static int hf_mrcpv2_Fetch_Hint = -1;
314 static int hf_mrcpv2_Fetch_Timeout = -1;
315 static int hf_mrcpv2_Final_Silence = -1;
316 static int hf_mrcpv2_Hotword_Max_Duration = -1;
317 static int hf_mrcpv2_Hotword_Min_Duration = -1;
318 static int hf_mrcpv2_Input_Type = -1;
319 static int hf_mrcpv2_Input_Waveform_URI = -1;
320 static int hf_mrcpv2_Interpret_Text = -1;
321 static int hf_mrcpv2_Jump_Size = -1;
322 static int hf_mrcpv2_Kill_On_Barge_In = -1;
323 static int hf_mrcpv2_Lexicon_Search_Order = -1;
324 static int hf_mrcpv2_Load_Lexicon = -1;
325 static int hf_mrcpv2_Logging_Tag = -1;
326 static int hf_mrcpv2_Max_Time = -1;
327 static int hf_mrcpv2_Media_Type = -1;
328 static int hf_mrcpv2_Min_Verification_Score = -1;
329 static int hf_mrcpv2_N_Best_List_Length = -1;
330 static int hf_mrcpv2_New_Audio_Channel = -1;
331 static int hf_mrcpv2_New_Phrase_ID = -1;
332 static int hf_mrcpv2_No_Input_Timeout = -1;
333 static int hf_mrcpv2_Num_Max_Verification_Phrases = -1;
334 static int hf_mrcpv2_Num_Min_Consistent_Pronunciations = -1;
335 static int hf_mrcpv2_Num_Min_Verification_Phrases = -1;
336 static int hf_mrcpv2_Personal_Grammar_URI = -1;
337 static int hf_mrcpv2_Phrase_ID = -1;
338 static int hf_mrcpv2_Phrase_NL = -1;
339 static int hf_mrcpv2_Prosody_Parameter = -1;
340 static int hf_mrcpv2_Proxy_Sync_Id = -1;
341 static int hf_mrcpv2_Recognition_Mode = -1;
342 static int hf_mrcpv2_Recognition_Timeout = -1;
343 static int hf_mrcpv2_Recognizer_Context_Block = -1;
344 static int hf_mrcpv2_Record_URI = -1;
345 static int hf_mrcpv2_Repository_URI = -1;
346 static int hf_mrcpv2_Save_Best_Waveform = -1;
347 static int hf_mrcpv2_Save_Waveform = -1;
348 static int hf_mrcpv2_Sensitivity_Level = -1;
349 static int hf_mrcpv2_Set_Cookie = -1;
350 static int hf_mrcpv2_Speak_Length = -1;
351 static int hf_mrcpv2_Speak_Restart = -1;
352 static int hf_mrcpv2_Speaker_Profile = -1;
353 static int hf_mrcpv2_Speech_Complete_Timeout = -1;
354 static int hf_mrcpv2_Speech_Incomplete_Timeout = -1;
355 static int hf_mrcpv2_Speech_Language = -1;
356 static int hf_mrcpv2_Speech_Marker = -1;
357 static int hf_mrcpv2_Speed_Vs_Accuracy = -1;
358 static int hf_mrcpv2_Start_Input_Timers = -1;
359 static int hf_mrcpv2_Trim_Length = -1;
360 static int hf_mrcpv2_Vendor_Specific_Parameters = -1;
361 static int hf_mrcpv2_Ver_Buffer_Utterance = -1;
362 static int hf_mrcpv2_Verification_Mode = -1;
363 static int hf_mrcpv2_Voice_Age = -1;
364 static int hf_mrcpv2_Voice_Gender = -1;
365 static int hf_mrcpv2_Voice_Name = -1;
366 static int hf_mrcpv2_Voice_Variant = -1;
367 static int hf_mrcpv2_Voiceprint_Exists = -1;
368 static int hf_mrcpv2_Voiceprint_Identifier = -1;
369 static int hf_mrcpv2_Waveform_URI = -1;
370 static int hf_mrcpv2_Weight = -1;
372 /* Global MRCPv2 port pref */
373 static guint global_mrcpv2_tcp_port = 6075;
375 /* Initialize the subtree pointers */
376 static gint ett_mrcpv2 = -1;
377 static gint ett_Request_Line = -1;
378 static gint ett_Response_Line = -1;
379 static gint ett_Event_Line = -1;
380 static gint ett_Status_Code = -1;
382 /* format status code description */
383 static const string_string status_code_vals[] = {
384 { "200", "Success" },
385 { "201", "Success with some optional header fields ignored" },
386 { "401", "Client Failure: Method not allowed" },
387 { "402", "Client Failure: Method not valid in this state" },
388 { "403", "Client Failure: Unsupported header field" },
389 { "404", "Client Failure: Illegal value for header field. This is the error for a syntax violation." },
390 { "405", "Client Failure: Resource not allocated for this session or does not exist" },
391 { "406", "Client Failure: Mandatory Header Field Missing" },
392 { "407", "Client Failure: Method or Operation Failed (e.g., Grammar compilation failed in the recognizer. Detailed cause codes might be available through a resource specific header.)" },
393 { "408", "Client Failure: Unrecognized or unsupported message entity" },
394 { "409", "Client Failure: Unsupported Header Field Value. This is a value that is syntactically legal but exceeds the implementation's capabilities or expectations." },
395 { "410", "Client Failure: Non-Monotonic or Out of order sequence number in request." },
396 { "501", "Server Failure: Server Internal Error" },
397 { "502", "Server Failure: Protocol Version not supported" },
398 { "503", "Server Failure: Reserved for future assignment" },
399 { "504", "Server Failure: Message too large" },
400 { "", NULL }
403 /* Code to actually dissect the packets */
404 static int
405 dissect_mrcpv2_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
407 /* Set up structures needed to add the protocol subtree and manage it */
408 proto_item *ti;
409 proto_tree *mrcpv2_tree;
410 gint next_offset, linelen;
411 gint tvb_len;
412 gint pdu_size;
413 gint offset;
414 gint value_offset;
415 gint str_len;
416 gchar helper_str[256];
417 gchar *header_name;
418 gchar *header_value;
419 LINE_TYPE line_type = UNKNOWN_LINE;
420 HEADER_TYPE header_type;
421 gint colon_offset;
422 gint content_length;
423 const value_string *p = NULL;
424 proto_item *line_item = NULL;
425 proto_item *request_line_item = NULL;
426 proto_item *response_line_item = NULL;
427 proto_item *event_line_item = NULL;
428 proto_item *status_code_item = NULL;
430 gint sp_start;
431 gint sp_end;
432 guint8 *field1;
433 guint8 *field2;
434 guint8 *field3;
435 guint8 *field4;
436 guint8 *field5 = NULL;
438 /* Make entries in Protocol column and Info column on summary display */
439 col_set_str(pinfo->cinfo, COL_PROTOCOL, "MRCPv2");
441 offset = 0;
442 if (tree) {
443 tvb_len = tvb_length(tvb);
445 ti = proto_tree_add_item(tree, proto_mrcpv2, tvb, 0, -1, ENC_UTF_8);
446 mrcpv2_tree = proto_item_add_subtree(ti, ett_mrcpv2);
448 /* get first line */
449 linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE);
451 /* find out MRCP message type:
453 request-line = mrcp-version SP message-length SP method-name SP request-id CRLF
454 response-line = mrcp-version SP message-length SP request-id SP status-code SP request-state CRLF
455 event-line = mrcp-version SP message-length SP event-name SP request-id SP request-state CRLF
457 /* version */
458 sp_end = tvb_find_guint8(tvb, 0, linelen, ' ');
459 if ((sp_end == -1) || (sp_end > tvb_len) || (sp_end > linelen))
460 return -1;
461 field1 = tvb_get_string(wmem_packet_scope(), tvb, 0, sp_end);
462 sp_start = sp_end + 1;
464 /* length */
465 sp_end = tvb_find_guint8(tvb, sp_start, linelen - sp_start, ' ');
466 if ((sp_end == -1) || (sp_end > tvb_len) || (sp_end > linelen))
467 return -1;
468 field2 = tvb_get_string(wmem_packet_scope(), tvb, sp_start, sp_end - sp_start);
469 sp_start = sp_end + 1;
471 /* method, request ID or event */
472 sp_end = tvb_find_guint8(tvb, sp_start, linelen - sp_start, ' ');
473 if ((sp_end == -1) || (sp_end > tvb_len) || (sp_end > linelen))
474 return -1;
475 field3 = tvb_get_string(wmem_packet_scope(), tvb, sp_start, sp_end - sp_start);
476 sp_start = sp_end + 1;
478 /* request ID or status code */
479 sp_end = tvb_find_guint8(tvb, sp_start, linelen - sp_start, ' ');
480 if (sp_end == -1)
482 field4 = tvb_get_string(wmem_packet_scope(), tvb, sp_start, linelen - sp_start);
483 line_type = REQUEST_LINE; /* only request line has 4 parameters */
485 else
487 if ((sp_end > tvb_len) || (sp_end > linelen))
488 return -1;
489 field4 = tvb_get_string(wmem_packet_scope(), tvb, sp_start, sp_end - sp_start);
491 if (isdigit(field3[0])) /* request ID is number, so it has to be response */
492 line_type = RESPONSE_LINE;
493 else
494 line_type = EVENT_LINE;
496 sp_start = sp_end + 1;
497 sp_end = linelen;
498 if ((sp_end > tvb_len) || (sp_end > linelen))
499 return -1;
500 field5 = tvb_get_string(wmem_packet_scope(), tvb, sp_start, sp_end - sp_start);
503 /* check pdu size */
504 pdu_size = atoi(field2);
505 if (pdu_size > tvb_len)
506 return -1;
508 /* process MRCP header line */
509 switch(line_type){
510 case REQUEST_LINE:
512 col_set_str(pinfo->cinfo, COL_INFO, "Request: ");
513 line_item = proto_tree_add_item(mrcpv2_tree, hf_mrcpv2_Request_Line, tvb, offset, linelen, ENC_UTF_8);
514 request_line_item = proto_item_add_subtree(line_item, ett_Request_Line);
515 /* version */
516 str_len = (gint)strlen(field1);
517 proto_tree_add_item(request_line_item, hf_mrcpv2_version, tvb, offset, str_len, ENC_UTF_8);
518 offset += str_len + 1; /* add SP */
519 /* message length */
520 str_len = (gint)strlen(field2);
521 proto_tree_add_item(request_line_item, hf_mrcpv2_message_length, tvb, offset, str_len, ENC_UTF_8);
522 offset += str_len + 1; /* add SP */
523 /* method name */
524 col_append_str(pinfo->cinfo, COL_INFO, field3);
525 str_len = (gint)strlen(field3);
526 proto_tree_add_item(request_line_item, hf_mrcpv2_Method, tvb, offset, str_len, ENC_UTF_8);
527 offset += str_len + 1; /* add SP */
528 /* request ID */
529 str_len = (gint)strlen(field4);
530 proto_tree_add_item(request_line_item, hf_mrcpv2_request_id, tvb, offset, str_len, ENC_UTF_8);
531 /*offset += str_len + 2;*/ /* add CRLF */
533 break;
534 case RESPONSE_LINE:
536 col_set_str(pinfo->cinfo, COL_INFO, "Response: ");
537 line_item = proto_tree_add_item(mrcpv2_tree, hf_mrcpv2_Response_Line, tvb, offset, linelen, ENC_UTF_8);
538 response_line_item = proto_item_add_subtree(line_item, ett_Response_Line);
539 /* version */
540 str_len = (gint)strlen(field1);
541 proto_tree_add_item(response_line_item, hf_mrcpv2_version, tvb, offset, str_len, ENC_UTF_8);
542 offset += str_len + 1; /* add SP */
543 /* message length */
544 str_len = (gint)strlen(field2);
545 proto_tree_add_item(response_line_item, hf_mrcpv2_message_length, tvb, offset, str_len, ENC_UTF_8);
546 offset += str_len + 1; /* add SP */
547 /* request ID */
548 str_len = (gint)strlen(field3);
549 proto_tree_add_item(response_line_item, hf_mrcpv2_request_id, tvb, offset, str_len, ENC_UTF_8);
550 offset += str_len + 1; /* add SP */
551 /* status code */
552 str_len = (gint)strlen(field4);
553 status_code_item = proto_tree_add_item(response_line_item, hf_mrcpv2_status_code, tvb, offset,
554 str_len, ENC_UTF_8);
555 proto_item_append_text(status_code_item, " %s", str_to_str(field4, status_code_vals, "Unknown Status Code"));
556 offset += str_len + 1; /* add SP */
557 /* request state */
558 col_append_fstr(pinfo->cinfo, COL_INFO, "(%s) %s", field4, field5);
559 str_len = (gint)strlen(field5);
560 proto_tree_add_item(response_line_item, hf_mrcpv2_request_state, tvb, offset, str_len, ENC_UTF_8);
561 /*offset += str_len + 2;*/ /* add CRLF */
563 break;
564 case EVENT_LINE:
566 col_set_str(pinfo->cinfo, COL_INFO, "Event: ");
567 line_item = proto_tree_add_item(mrcpv2_tree, hf_mrcpv2_Event_Line, tvb, offset, linelen, ENC_UTF_8);
568 event_line_item = proto_item_add_subtree(line_item, ett_Event_Line);
569 /* version */
570 str_len = (gint)strlen(field1);
571 proto_tree_add_item(event_line_item, hf_mrcpv2_version, tvb, offset, str_len, ENC_UTF_8);
572 offset += str_len + 1; /* add SP */
573 /* message length */
574 str_len = (gint)strlen(field2);
575 proto_tree_add_item(event_line_item, hf_mrcpv2_message_length, tvb, offset, str_len, ENC_UTF_8);
576 offset += str_len + 1; /* add SP */
577 /* event name */
578 col_append_str(pinfo->cinfo, COL_INFO, field3);
579 str_len = (gint)strlen(field3);
580 proto_tree_add_item(event_line_item, hf_mrcpv2_Event, tvb, offset, str_len, ENC_UTF_8);
581 offset += str_len + 1; /* add SP */
582 /* request ID */
583 str_len = (gint)strlen(field4);
584 proto_tree_add_item(event_line_item, hf_mrcpv2_request_id, tvb, offset, str_len, ENC_UTF_8);
585 offset += str_len + 1; /* add SP */
586 /* request state */
587 str_len = (gint)strlen(field5);
588 proto_tree_add_item(event_line_item, hf_mrcpv2_request_state, tvb, offset, str_len, ENC_UTF_8);
589 /*offset += str_len + 2;*/ /* add CRLF */
591 break;
592 default:
594 /* mark whole packet as unknown and return */
595 col_set_str(pinfo->cinfo, COL_INFO, "UNKNOWN message");
596 proto_tree_add_item(mrcpv2_tree, hf_mrcpv2_Unknown_Message, tvb, offset, tvb_len, ENC_UTF_8);
597 return tvb_len;
601 /* process the rest of the header lines here */
602 content_length = 0;
603 while (next_offset < tvb_len)
605 /* get next line */
606 offset = next_offset;
607 linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE);
609 /* blank line separates msg header and msg body */
610 if (linelen == 0)
612 if (content_length > 0)
613 { /* content length > 0 and CRLF detected, this has to be msg body */
614 offset += 2; /* skip separating CRLF */
615 proto_tree_add_string_format(mrcpv2_tree, hf_mrcpv2_Data, tvb, offset, tvb_len - offset,
616 helper_str, "Message data: %s", tvb_format_text(tvb, offset, tvb_len - offset));
617 next_offset = tvb_len; /* we are done */
619 continue;
622 /* get header type and its value */
623 colon_offset = tvb_find_guint8(tvb, offset, linelen, ':');
624 if (colon_offset == -1)
625 { /* header type should end with ':' */
626 proto_tree_add_item(mrcpv2_tree, hf_mrcpv2_Unknown_Header, tvb, offset, linelen, ENC_UTF_8);
627 continue;
629 header_name = tvb_get_string(wmem_packet_scope(), tvb, offset, colon_offset - offset);
630 ascii_strdown_inplace(header_name);
631 value_offset = tvb_skip_wsp(tvb, colon_offset + 1, offset + linelen - (colon_offset + 1));
632 header_value = tvb_get_string(wmem_packet_scope(), tvb, value_offset, offset + linelen - value_offset);
634 /* find out header type */
635 header_type = UNKNOWN;
636 for (p = header_type_vals; p->strptr != NULL; ++p)
638 if (strncmp(p->strptr, header_name, strlen(p->strptr)) == 0)
640 header_type = (HEADER_TYPE)p->value;
641 break;
645 /* add header type and value into the tree */
646 switch (header_type)
648 case ABORT_MODEL:
649 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Abort_Model, tvb, offset, linelen, header_value);
650 break;
651 case ABORT_PHRASE_ENROLLMENT:
652 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Abort_Phrase_Enrollment, tvb, offset, linelen, header_value);
653 break;
654 case ABORT_VERIFICATION:
655 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Abort_Verification, tvb, offset, linelen, header_value);
656 break;
657 case ACCEPT:
658 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Accept, tvb, offset, linelen, header_value);
659 break;
660 case ACCEPT_CHARSET:
661 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Accept_Charset, tvb, offset, linelen, header_value);
662 break;
663 case ACTIVE_REQUEST_ID_LIST:
664 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Active_Request_Id_List, tvb, offset, linelen, header_value);
665 break;
666 case ADAPT_MODEL:
667 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Adapt_Model, tvb, offset, linelen, header_value);
668 break;
669 case AUDIO_FETCH_HINT:
670 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Audio_Fetch_Hint, tvb, offset, linelen, header_value);
671 break;
672 case CACHE_CONTROL:
673 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Cache_Control, tvb, offset, linelen, header_value);
674 break;
675 case CANCEL_IF_QUEUE:
676 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Cancel_If_Queue, tvb, offset, linelen, header_value);
677 break;
678 case CAPTURE_ON_SPEECH:
679 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Capture_On_Speech, tvb, offset, linelen, header_value);
680 break;
681 case CHANNEL_IDENTIFIER:
682 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Channel_Identifier, tvb, offset, linelen, header_value);
683 break;
684 case CLASH_THRESHOLD:
685 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Clash_Threshold, tvb, offset, linelen, header_value);
686 break;
687 case CLEAR_DTMF_BUFFER:
688 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Clear_Dtmf_Buffer, tvb, offset, linelen, header_value);
689 break;
690 case COMPLETION_CAUSE:
691 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Completion_Cause, tvb, offset, linelen, header_value);
692 break;
693 case COMPLETION_REASON:
694 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Completion_Reason, tvb, offset, linelen, header_value);
695 break;
696 case CONFIDENCE_THRESHOLD:
697 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Confidence_Threshold, tvb, offset, linelen, header_value);
698 break;
699 case CONFUSABLE_PHRASES_URI:
700 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Confusable_Phrases_URI, tvb, offset, linelen, header_value);
701 break;
702 case CONSISTENCY_THRESHOLD:
703 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Consistency_Threshold, tvb, offset, linelen, header_value);
704 break;
705 case CONTENT_BASE:
706 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Content_Base, tvb, offset, linelen, header_value);
707 break;
708 case CONTENT_ENCODING:
709 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Content_Encoding, tvb, offset, linelen, header_value);
710 break;
711 case CONTENT_ID:
712 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Content_ID, tvb, offset, linelen, header_value);
713 break;
714 case CONTENT_LENGTH:
715 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Content_Length, tvb, offset, linelen, header_value);
716 /* if content length is > 0, then there are some data after the headers */
717 content_length = atoi(header_value);
718 break;
719 case CONTENT_LOCATION:
720 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Content_Location, tvb, offset, linelen, header_value);
721 break;
722 case CONTENT_TYPE:
723 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Content_Type, tvb, offset, linelen, header_value);
724 break;
725 case DTMF_BUFFER_TIME:
726 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Dtmf_Buffer_Time, tvb, offset, linelen, header_value);
727 break;
728 case DTMF_INTERDIGIT_TIMEOUT:
729 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Dtmf_Interdigit_Timeout, tvb, offset, linelen, header_value);
730 break;
731 case DTMF_TERM_CHAR:
732 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Dtmf_Term_Char, tvb, offset, linelen, header_value);
733 break;
734 case DTMF_TERM_TIMEOUT:
735 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Dtmf_Term_Timeout, tvb, offset, linelen, header_value);
736 break;
737 case EARLY_NO_MATCH:
738 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Early_No_Match, tvb, offset, linelen, header_value);
739 break;
740 case ENROLL_UTTERANCE:
741 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Enroll_Utterance, tvb, offset, linelen, header_value);
742 break;
743 case FAILED_URI:
744 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Failed_URI, tvb, offset, linelen, header_value);
745 break;
746 case FAILED_URI_CAUSE:
747 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Failed_URI_Cause, tvb, offset, linelen, header_value);
748 break;
749 case FETCH_HINT:
750 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Fetch_Hint, tvb, offset, linelen, header_value);
751 break;
752 case FETCH_TIMEOUT:
753 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Fetch_Timeout, tvb, offset, linelen, header_value);
754 break;
755 case FINAL_SILENCE:
756 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Final_Silence, tvb, offset, linelen, header_value);
757 break;
758 case HOTWORD_MAX_DURATION:
759 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Hotword_Max_Duration, tvb, offset, linelen, header_value);
760 break;
761 case HOTWORD_MIN_DURATION:
762 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Hotword_Min_Duration, tvb, offset, linelen, header_value);
763 break;
764 case INPUT_TYPE:
765 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Input_Type, tvb, offset, linelen, header_value);
766 break;
767 case INPUT_WAVEFORM_URI:
768 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Input_Waveform_URI, tvb, offset, linelen, header_value);
769 break;
770 case INTERPRET_TEXT:
771 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Interpret_Text, tvb, offset, linelen, header_value);
772 break;
773 case JUMP_SIZE:
774 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Jump_Size, tvb, offset, linelen, header_value);
775 break;
776 case KILL_ON_BARGE_IN:
777 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Kill_On_Barge_In, tvb, offset, linelen, header_value);
778 break;
779 case LEXICON_SEARCH_ORDER:
780 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Lexicon_Search_Order, tvb, offset, linelen, header_value);
781 break;
782 case LOAD_LEXICON:
783 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Load_Lexicon, tvb, offset, linelen, header_value);
784 break;
785 case LOGGING_TAG:
786 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Logging_Tag, tvb, offset, linelen, header_value);
787 break;
788 case MAX_TIME:
789 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Max_Time, tvb, offset, linelen, header_value);
790 break;
791 case MEDIA_TYPE:
792 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Media_Type, tvb, offset, linelen, header_value);
793 break;
794 case MIN_VERIFICATION_SCORE:
795 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Min_Verification_Score, tvb, offset, linelen, header_value);
796 break;
797 case N_BEST_LIST_LENGTH:
798 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_N_Best_List_Length, tvb, offset, linelen, header_value);
799 break;
800 case NEW_AUDIO_CHANNEL:
801 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_New_Audio_Channel, tvb, offset, linelen, header_value);
802 break;
803 case NEW_PHRASE_ID:
804 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_New_Phrase_ID, tvb, offset, linelen, header_value);
805 break;
806 case NO_INPUT_TIMEOUT:
807 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_No_Input_Timeout, tvb, offset, linelen, header_value);
808 break;
809 case NUM_MAX_VERIFICATION_PHRASES:
810 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Num_Max_Verification_Phrases, tvb, offset, linelen, header_value);
811 break;
812 case NUM_MIN_CONSISTENT_PRONUNCIATIONS:
813 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Num_Min_Consistent_Pronunciations, tvb, offset, linelen, header_value);
814 break;
815 case NUM_MIN_VERIFICATION_PHRASES:
816 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Num_Min_Verification_Phrases, tvb, offset, linelen, header_value);
817 break;
818 case PERSONAL_GRAMMAR_URI:
819 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Personal_Grammar_URI, tvb, offset, linelen, header_value);
820 break;
821 case PHRASE_ID:
822 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Phrase_ID, tvb, offset, linelen, header_value);
823 break;
824 case PHRASE_NL:
825 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Phrase_NL, tvb, offset, linelen, header_value);
826 break;
827 case PROSODY_PARAMETER:
828 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Prosody_Parameter, tvb, offset, linelen, header_value);
829 break;
830 case PROXY_SYNC_ID:
831 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Proxy_Sync_Id, tvb, offset, linelen, header_value);
832 break;
833 case RECOGNITION_MODE:
834 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Recognition_Mode, tvb, offset, linelen, header_value);
835 break;
836 case RECOGNITION_TIMEOUT:
837 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Recognition_Timeout, tvb, offset, linelen, header_value);
838 break;
839 case RECOGNIZER_CONTEXT_BLOCK:
840 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Recognizer_Context_Block, tvb, offset, linelen, header_value);
841 break;
842 case RECORD_URI:
843 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Record_URI, tvb, offset, linelen, header_value);
844 break;
845 case REPOSITORY_URI:
846 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Repository_URI, tvb, offset, linelen, header_value);
847 break;
848 case SAVE_BEST_WAVEFORM:
849 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Save_Best_Waveform, tvb, offset, linelen, header_value);
850 break;
851 case SAVE_WAVEFORM:
852 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Save_Waveform, tvb, offset, linelen, header_value);
853 break;
854 case SENSITIVITY_LEVEL:
855 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Sensitivity_Level, tvb, offset, linelen, header_value);
856 break;
857 case SET_COOKIE:
858 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Set_Cookie, tvb, offset, linelen, header_value);
859 break;
860 case SPEAK_LENGTH:
861 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Speak_Length, tvb, offset, linelen, header_value);
862 break;
863 case SPEAK_RESTART:
864 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Speak_Restart, tvb, offset, linelen, header_value);
865 break;
866 case SPEAKER_PROFILE:
867 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Speaker_Profile, tvb, offset, linelen, header_value);
868 break;
869 case SPEECH_COMPLETE_TIMEOUT:
870 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Speech_Complete_Timeout, tvb, offset, linelen, header_value);
871 break;
872 case SPEECH_INCOMPLETE_TIMEOUT:
873 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Speech_Incomplete_Timeout, tvb, offset, linelen, header_value);
874 break;
875 case SPEECH_LANGUAGE:
876 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Speech_Language, tvb, offset, linelen, header_value);
877 break;
878 case SPEECH_MARKER:
879 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Speech_Marker, tvb, offset, linelen, header_value);
880 break;
881 case SPEED_VS_ACCURACY:
882 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Speed_Vs_Accuracy, tvb, offset, linelen, header_value);
883 break;
884 case START_INPUT_TIMERS:
885 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Start_Input_Timers, tvb, offset, linelen, header_value);
886 break;
887 case TRIM_LENGTH:
888 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Trim_Length, tvb, offset, linelen, header_value);
889 break;
890 case VENDOR_SPECIFIC_PARAMETERS:
891 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Vendor_Specific_Parameters, tvb, offset, linelen, header_value);
892 break;
893 case VER_BUFFER_UTTERANCE:
894 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Ver_Buffer_Utterance, tvb, offset, linelen, header_value);
895 break;
896 case VERIFICATION_MODE:
897 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Verification_Mode, tvb, offset, linelen, header_value);
898 break;
899 case VOICE_AGE:
900 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Voice_Age, tvb, offset, linelen, header_value);
901 break;
902 case VOICE_GENDER:
903 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Voice_Gender, tvb, offset, linelen, header_value);
904 break;
905 case VOICE_NAME:
906 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Voice_Name, tvb, offset, linelen, header_value);
907 break;
908 case VOICE_VARIANT:
909 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Voice_Variant, tvb, offset, linelen, header_value);
910 break;
911 case VOICEPRINT_EXISTS:
912 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Voiceprint_Exists, tvb, offset, linelen, header_value);
913 break;
914 case VOICEPRINT_IDENTIFIER:
915 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Voiceprint_Identifier, tvb, offset, linelen, header_value);
916 break;
917 case WAVEFORM_URI:
918 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Waveform_URI, tvb, offset, linelen, header_value);
919 break;
920 case WEIGHT:
921 proto_tree_add_string(mrcpv2_tree, hf_mrcpv2_Weight, tvb, offset, linelen, header_value);
922 break;
923 default:
924 proto_tree_add_item(mrcpv2_tree, hf_mrcpv2_Unknown_Header, tvb, offset, linelen, ENC_UTF_8);
925 break;
930 /* Return the amount of data this dissector was able to dissect */
931 return tvb_length(tvb);
934 /* get the length of the MRCP message */
935 static guint
936 get_mrcpv2_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
938 gint len_start;
939 gint len_end;
940 guint8 *msg_len;
941 guint num_msg_len;
943 /* first string is version */
944 len_start = tvb_find_guint8(tvb, offset, MRCPV2_MIN_PDU_LEN, ' ');
945 if (len_start == -1)
946 return 0;
947 len_start += 1; /* skip whitespace */
949 /* second string is message length */
950 len_end = tvb_find_guint8(tvb, len_start, MRCPV2_MIN_PDU_LEN - len_start, ' ');
951 if (len_end == -1)
952 msg_len = tvb_get_string(wmem_packet_scope(), tvb, len_start, MRCPV2_MIN_PDU_LEN - len_start);
953 else
954 msg_len = tvb_get_string(wmem_packet_scope(), tvb, len_start, len_end - len_start);
956 num_msg_len = atoi(msg_len);
957 return num_msg_len;
960 static int
961 dissect_mrcpv2_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
963 return dissect_mrcpv2_common(tvb, pinfo, tree);
966 static int
967 dissect_mrcpv2_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
969 gint len;
970 gint value_size;
971 guint8 *version;
972 guint8 *major;
973 guint8 *minor;
974 gint slash_offset;
975 gint dot_offset;
976 gint sp_offset;
977 int value;
979 len = tvb_length(tvb);
980 if (len < MRCPV2_MIN_LENGTH) /* too short, can't conclude if it's mrcp */
981 return 0;
983 /* we are looking for MRCP string */
984 slash_offset = tvb_find_guint8(tvb, 0, MRCPV2_MIN_LENGTH, '/');
985 if (slash_offset != 4)
986 return 0;
987 version = tvb_get_string(wmem_packet_scope(), tvb, 0, slash_offset);
988 if (strcmp(version, "MRCP") != 0)
989 return 0;
991 /* get first digit after the '/'; it should be 2 */
992 dot_offset = tvb_find_guint8(tvb, slash_offset + 1, MRCPV2_MIN_LENGTH - slash_offset - 1, '.');
993 if (dot_offset == -1)
994 return 0;
995 value_size = dot_offset - slash_offset - 1;
996 if ((value_size != 1) && (value_size != 2))
997 return 0;
998 major = tvb_get_string(wmem_packet_scope(), tvb, slash_offset + 1, dot_offset - 1);
999 value = atoi(major);
1000 if (value != 2)
1001 return 0;
1003 /* get second digit, it should be 0 */
1004 sp_offset = tvb_find_guint8(tvb, dot_offset + 1, MRCPV2_MIN_LENGTH - dot_offset - 1, ' ');
1005 if (sp_offset == -1)
1007 minor = tvb_get_string(wmem_packet_scope(), tvb, dot_offset + 1, MRCPV2_MIN_LENGTH - dot_offset - 1);
1008 len = MRCPV2_MIN_LENGTH;
1010 else
1012 minor = tvb_get_string(wmem_packet_scope(), tvb, dot_offset + 1, MRCPV2_MIN_LENGTH - sp_offset - 1);
1013 len = sp_offset;
1015 value = atoi(minor);
1016 if (value != 0)
1017 return 0;
1019 /* if we are here, then we have MRCP v 2.0 protocol, so proceed with the dissection */
1020 tcp_dissect_pdus(tvb, pinfo, tree, TRUE, MRCPV2_MIN_PDU_LEN,
1021 get_mrcpv2_pdu_len,
1022 dissect_mrcpv2_tcp_pdu, data);
1023 return len;
1026 void
1027 proto_register_mrcpv2(void)
1029 module_t *mrcpv2_module;
1031 static hf_register_info hf[] = {
1032 { &hf_mrcpv2_Request_Line,
1033 { "Request-Line", "mrcpv2.Request-Line",
1034 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
1036 { &hf_mrcpv2_Response_Line,
1037 { "Response-Line", "mrcpv2.Response-Line",
1038 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
1040 { &hf_mrcpv2_Event_Line,
1041 { "Event-Line", "mrcpv2.Event-Line",
1042 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
1044 { &hf_mrcpv2_Unknown_Message,
1045 { "Unknown Message", "mrcpv2.Unknown-Message",
1046 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
1048 { &hf_mrcpv2_Unknown_Header,
1049 { "Unknown Header", "mrcpv2.Unknown-Header",
1050 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
1052 { &hf_mrcpv2_Data,
1053 { "Data", "mrcpv2.Data",
1054 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
1056 { &hf_mrcpv2_Method,
1057 { "Method", "mrcpv2.Method",
1058 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
1060 { &hf_mrcpv2_Event,
1061 { "Event", "mrcpv2.Event",
1062 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
1064 { &hf_mrcpv2_version,
1065 { "Version", "mrcpv2.Version",
1066 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
1068 { &hf_mrcpv2_message_length,
1069 { "Message Length", "mrcpv2.msg_len",
1070 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
1072 { &hf_mrcpv2_request_id,
1073 { "Request ID", "mrcpv2.reqID",
1074 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
1076 { &hf_mrcpv2_status_code,
1077 { "Status Code", "mrcpv2.status_code",
1078 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
1080 { &hf_mrcpv2_request_state,
1081 { "Request State", "mrcpv2.request_state",
1082 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
1084 { &hf_mrcpv2_Abort_Model,
1085 { "Abort-Model", "mrcpv2.Abort-Model",
1086 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1088 { &hf_mrcpv2_Abort_Phrase_Enrollment,
1089 { "Abort-Phrase-Enrollment", "mrcpv2.Abort-Phrase-Enrollment",
1090 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1092 { &hf_mrcpv2_Abort_Verification,
1093 { "Abort-Verification", "mrcpv2.Abort-Verification",
1094 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1096 { &hf_mrcpv2_Accept,
1097 { "Accept", "mrcpv2.Accept",
1098 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1100 { &hf_mrcpv2_Accept_Charset,
1101 { "Accept-Charset", "mrcpv2.Accept-Charset",
1102 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1104 { &hf_mrcpv2_Active_Request_Id_List,
1105 { "Active-Request-Id-List", "mrcpv2.Active-Request-Id-List",
1106 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1108 { &hf_mrcpv2_Adapt_Model,
1109 { "Adapt-Model", "mrcpv2.Adapt-Model",
1110 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1112 { &hf_mrcpv2_Audio_Fetch_Hint,
1113 { "Audio-Fetch-Hint", "mrcpv2.Audio-Fetch-Hint",
1114 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1116 { &hf_mrcpv2_Cache_Control,
1117 { "Cache-Control", "mrcpv2.Cache-Control",
1118 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1120 { &hf_mrcpv2_Cancel_If_Queue,
1121 { "Cancel-If-Queue", "mrcpv2.Cancel-If-Queue",
1122 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1124 { &hf_mrcpv2_Capture_On_Speech,
1125 { "Capture-On-Speech", "mrcpv2.Capture-On-Speech",
1126 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1128 { &hf_mrcpv2_Channel_Identifier,
1129 { "Channel-Identifier", "mrcpv2.Channel-Identifier",
1130 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1132 { &hf_mrcpv2_Clash_Threshold,
1133 { "Clash-Threshold", "mrcpv2.Clash-Threshold",
1134 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1136 { &hf_mrcpv2_Clear_Dtmf_Buffer,
1137 { "Clear-Dtmf-Buffer", "mrcpv2.Clear-Dtmf-Buffer",
1138 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1140 { &hf_mrcpv2_Completion_Cause,
1141 { "Completion-Cause", "mrcpv2.Completion-Cause",
1142 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1144 { &hf_mrcpv2_Completion_Reason,
1145 { "Completion-Reason", "mrcpv2.Completion-Reason",
1146 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1148 { &hf_mrcpv2_Confidence_Threshold,
1149 { "Confidence-Threshold", "mrcpv2.Confidence-Threshold",
1150 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1152 { &hf_mrcpv2_Confusable_Phrases_URI,
1153 { "Confusable-Phrases-URI", "mrcpv2.Confusable-Phrases-URI",
1154 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1156 { &hf_mrcpv2_Consistency_Threshold,
1157 { "Consistency-Threshold", "mrcpv2.Consistency-Threshold",
1158 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1160 { &hf_mrcpv2_Content_Base,
1161 { "Content-Base", "mrcpv2.Content-Base",
1162 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1164 { &hf_mrcpv2_Content_Encoding,
1165 { "Content-Encoding", "mrcpv2.Content-Encoding",
1166 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1168 { &hf_mrcpv2_Content_ID,
1169 { "Content-ID", "mrcpv2.Content-ID",
1170 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1172 { &hf_mrcpv2_Content_Length,
1173 { "Content-Length", "mrcpv2.Content-Length",
1174 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1176 { &hf_mrcpv2_Content_Location,
1177 { "Content-Location", "mrcpv2.Content-Location",
1178 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1180 { &hf_mrcpv2_Content_Type,
1181 { "Content-Type", "mrcpv2.Content-Type",
1182 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1184 { &hf_mrcpv2_Dtmf_Buffer_Time,
1185 { "Dtmf-Buffer-Time", "mrcpv2.Dtmf-Buffer-Time",
1186 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1188 { &hf_mrcpv2_Dtmf_Interdigit_Timeout,
1189 { "Dtmf-Interdigit-Timeout", "mrcpv2.Dtmf-Interdigit-Timeout",
1190 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1192 { &hf_mrcpv2_Dtmf_Term_Char,
1193 { "Dtmf-Term-Char", "mrcpv2.Dtmf-Term-Char",
1194 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1196 { &hf_mrcpv2_Dtmf_Term_Timeout,
1197 { "Dtmf-Term-Timeout", "mrcpv2.Dtmf-Term-Timeout",
1198 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1200 { &hf_mrcpv2_Early_No_Match,
1201 { "Early-No-Match", "mrcpv2.Early-No-Match",
1202 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1204 { &hf_mrcpv2_Enroll_Utterance,
1205 { "Enroll-Utterance", "mrcpv2.Enroll-Utterance",
1206 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1208 { &hf_mrcpv2_Failed_URI,
1209 { "Failed-URI", "mrcpv2.Failed-URI",
1210 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1212 { &hf_mrcpv2_Failed_URI_Cause,
1213 { "Failed-URI-Cause", "mrcpv2.Failed-URI-Cause",
1214 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1216 { &hf_mrcpv2_Fetch_Hint,
1217 { "Fetch-Hint", "mrcpv2.Fetch-Hint",
1218 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1220 { &hf_mrcpv2_Fetch_Timeout,
1221 { "Fetch-Timeout", "mrcpv2.Fetch-Timeout",
1222 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1224 { &hf_mrcpv2_Final_Silence,
1225 { "Final-Silence", "mrcpv2.Final-Silence",
1226 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1228 { &hf_mrcpv2_Hotword_Max_Duration,
1229 { "Hotword-Max-Duration", "mrcpv2.Hotword-Max-Duration",
1230 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1232 { &hf_mrcpv2_Hotword_Min_Duration,
1233 { "Hotword-Min-Duration", "mrcpv2.Hotword-Min-Duration",
1234 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1236 { &hf_mrcpv2_Input_Type,
1237 { "Input-Type", "mrcpv2.Input-Type",
1238 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1240 { &hf_mrcpv2_Input_Waveform_URI,
1241 { "Input-Waveform-URI", "mrcpv2.Input-Waveform-URI",
1242 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1244 { &hf_mrcpv2_Interpret_Text,
1245 { "Interpret-Text", "mrcpv2.Interpret-Text",
1246 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1248 { &hf_mrcpv2_Jump_Size,
1249 { "Jump-Size", "mrcpv2.Jump-Size",
1250 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1252 { &hf_mrcpv2_Kill_On_Barge_In,
1253 { "Kill-On-Barge-In", "mrcpv2.Kill-On-Barge-In",
1254 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1256 { &hf_mrcpv2_Lexicon_Search_Order,
1257 { "Lexicon-Search-Order", "mrcpv2.Lexicon-Search-Order",
1258 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1260 { &hf_mrcpv2_Load_Lexicon,
1261 { "Load-Lexicon", "mrcpv2.Load-Lexicon",
1262 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1264 { &hf_mrcpv2_Logging_Tag,
1265 { "Logging-Tag", "mrcpv2.Logging-Tag",
1266 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1268 { &hf_mrcpv2_Max_Time,
1269 { "Max-Time", "mrcpv2.Max-Time",
1270 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1272 { &hf_mrcpv2_Media_Type,
1273 { "Media-Type", "mrcpv2.Media-Type",
1274 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1276 { &hf_mrcpv2_Min_Verification_Score,
1277 { "Min-Verification-Score", "mrcpv2.Min-Verification-Score",
1278 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1280 { &hf_mrcpv2_N_Best_List_Length,
1281 { "N-Best-List-Length", "mrcpv2.N-Best-List-Length",
1282 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1284 { &hf_mrcpv2_New_Audio_Channel,
1285 { "New-Audio-Channel", "mrcpv2.New-Audio-Channel",
1286 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1288 { &hf_mrcpv2_New_Phrase_ID,
1289 { "New-Phrase-ID", "mrcpv2.New-Phrase-ID",
1290 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1292 { &hf_mrcpv2_No_Input_Timeout,
1293 { "No-Input-Timeout", "mrcpv2.No-Input-Timeout",
1294 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1296 { &hf_mrcpv2_Num_Max_Verification_Phrases,
1297 { "Num-Max-Verification-Phrases", "mrcpv2.Num-Max-Verification-Phrases",
1298 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1300 { &hf_mrcpv2_Num_Min_Consistent_Pronunciations,
1301 { "Num-Min-Consistent-Pronunciations", "mrcpv2.Num-Min-Consistent-Pronunciations",
1302 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1304 { &hf_mrcpv2_Num_Min_Verification_Phrases,
1305 { "Num-Min-Verification-Phrases", "mrcpv2.Num-Min-Verification-Phrases",
1306 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1308 { &hf_mrcpv2_Personal_Grammar_URI,
1309 { "Personal-Grammar-URI", "mrcpv2.Personal-Grammar-URI",
1310 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1312 { &hf_mrcpv2_Phrase_ID,
1313 { "Phrase-ID", "mrcpv2.Phrase-ID",
1314 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1316 { &hf_mrcpv2_Phrase_NL,
1317 { "Phrase-NL", "mrcpv2.Phrase-NL",
1318 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1320 { &hf_mrcpv2_Prosody_Parameter,
1321 { "Prosody-Parameter", "mrcpv2.Prosody-Parameter",
1322 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1324 { &hf_mrcpv2_Proxy_Sync_Id,
1325 { "Proxy-Sync-Id", "mrcpv2.Proxy-Sync-Id",
1326 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1328 { &hf_mrcpv2_Recognition_Mode,
1329 { "Recognition-Mode", "mrcpv2.Recognition-Mode",
1330 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1332 { &hf_mrcpv2_Recognition_Timeout,
1333 { "Recognition-Timeout", "mrcpv2.Recognition-Timeout",
1334 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1336 { &hf_mrcpv2_Recognizer_Context_Block,
1337 { "Recognizer-Context-Block", "mrcpv2.Recognizer-Context-Block",
1338 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1340 { &hf_mrcpv2_Record_URI,
1341 { "Record-URI", "mrcpv2.Record-URI",
1342 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1344 { &hf_mrcpv2_Repository_URI,
1345 { "Repository-URI", "mrcpv2.Repository-URI",
1346 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1348 { &hf_mrcpv2_Save_Best_Waveform,
1349 { "Save-Best-Waveform", "mrcpv2.Save-Best-Waveform",
1350 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1352 { &hf_mrcpv2_Save_Waveform,
1353 { "Save-Waveform", "mrcpv2.Save-Waveform",
1354 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1356 { &hf_mrcpv2_Sensitivity_Level,
1357 { "Sensitivity-Level", "mrcpv2.Sensitivity-Level",
1358 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1360 { &hf_mrcpv2_Set_Cookie,
1361 { "Set-Cookie", "mrcpv2.Set-Cookie",
1362 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1364 { &hf_mrcpv2_Speak_Length,
1365 { "Speak-Length", "mrcpv2.Speak-Length",
1366 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1368 { &hf_mrcpv2_Speak_Restart,
1369 { "Speak-Restart", "mrcpv2.Speak-Restart",
1370 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1372 { &hf_mrcpv2_Speaker_Profile,
1373 { "Speaker-Profile", "mrcpv2.Speaker-Profile",
1374 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1376 { &hf_mrcpv2_Speech_Complete_Timeout,
1377 { "Speech-Complete-Timeout", "mrcpv2.Speech-Complete-Timeout",
1378 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1380 { &hf_mrcpv2_Speech_Incomplete_Timeout,
1381 { "Speech-Incomplete-Timeout", "mrcpv2.Speech-Incomplete-Timeout",
1382 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1384 { &hf_mrcpv2_Speech_Language,
1385 { "Speech-Language", "mrcpv2.Speech-Language",
1386 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1388 { &hf_mrcpv2_Speech_Marker,
1389 { "Speech-Marker", "mrcpv2.Speech-Marker",
1390 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1392 { &hf_mrcpv2_Speed_Vs_Accuracy,
1393 { "Speed-Vs-Accuracy", "mrcpv2.Speed-Vs-Accuracy",
1394 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1396 { &hf_mrcpv2_Start_Input_Timers,
1397 { "Start-Input-Timers", "mrcpv2.Start-Input-Timers",
1398 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1400 { &hf_mrcpv2_Trim_Length,
1401 { "Trim-Length", "mrcpv2.Trim-Length",
1402 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1404 { &hf_mrcpv2_Vendor_Specific_Parameters,
1405 { "Vendor-Specific-Parameters", "mrcpv2.Vendor-Specific-Parameters",
1406 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1408 { &hf_mrcpv2_Ver_Buffer_Utterance,
1409 { "Ver-Buffer-Utterance", "mrcpv2.Ver-Buffer-Utterance",
1410 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1412 { &hf_mrcpv2_Verification_Mode,
1413 { "Verification-Mode", "mrcpv2.Verification-Mode",
1414 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1416 { &hf_mrcpv2_Voice_Age,
1417 { "Voice-Age", "mrcpv2.Voice-Age",
1418 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1420 { &hf_mrcpv2_Voice_Gender,
1421 { "Voice-Gender", "mrcpv2.Voice-Gender",
1422 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1424 { &hf_mrcpv2_Voice_Name,
1425 { "Voice-Name", "mrcpv2.Voice-Name",
1426 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1428 { &hf_mrcpv2_Voice_Variant,
1429 { "Voice-Variant", "mrcpv2.Voice-Variant",
1430 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1432 { &hf_mrcpv2_Voiceprint_Exists,
1433 { "Voiceprint-Exists", "mrcpv2.Voiceprint-Exists",
1434 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1436 { &hf_mrcpv2_Voiceprint_Identifier,
1437 { "Voiceprint-Identifier", "mrcpv2.Voiceprint-Identifier",
1438 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1440 { &hf_mrcpv2_Waveform_URI,
1441 { "Waveform-URI", "mrcpv2.Waveform-URI",
1442 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1444 { &hf_mrcpv2_Weight,
1445 { "Weight", "mrcpv2.Weight",
1446 FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL },
1450 static gint *ett[] = {
1451 &ett_mrcpv2,
1452 &ett_Request_Line,
1453 &ett_Response_Line,
1454 &ett_Event_Line,
1455 &ett_Status_Code
1458 proto_mrcpv2 = proto_register_protocol(
1459 "Media Resource Control Protocol Version 2 (MRCPv2)",
1460 "MRCPv2",
1461 "mrcpv2");
1463 proto_register_field_array(proto_mrcpv2, hf, array_length(hf));
1464 proto_register_subtree_array(ett, array_length(ett));
1466 mrcpv2_module = prefs_register_protocol(proto_mrcpv2, proto_reg_handoff_mrcpv2);
1468 prefs_register_uint_preference(mrcpv2_module, "tcp.port", "MRCPv2 TCP Port",
1469 "MRCPv2 TCP port if other than the default",
1470 10, &global_mrcpv2_tcp_port);
1473 void
1474 proto_reg_handoff_mrcpv2(void)
1476 static gboolean initialized = FALSE;
1477 static dissector_handle_t mrcpv2_handle;
1478 static int TCPPort;
1480 if (!initialized) {
1481 mrcpv2_handle = new_create_dissector_handle(dissect_mrcpv2_tcp, proto_mrcpv2);
1482 initialized = TRUE;
1483 } else {
1484 dissector_delete_uint("tcp.port", TCPPort, mrcpv2_handle);
1487 TCPPort = global_mrcpv2_tcp_port;
1488 dissector_add_uint("tcp.port", TCPPort, mrcpv2_handle);
1491 * Editor modelines
1493 * Local Variables:
1494 * c-basic-offset: 4
1495 * tab-width: 8
1496 * indent-tabs-mode: nil
1497 * End:
1499 * ex: set shiftwidth=4 tabstop=8 expandtab:
1500 * :indentSize=4:tabSize=8:noTabs=true: