Rename address_to_str() to ep_address_to_str() because:
[metze/wireshark/wip.git] / asn1 / h245 / packet-h245-template.c
1 /* packet-h245_asn1.c
2  * Routines for h245 packet dissection
3  * Copyright 2004, Anders Broman <anders.broman@ericsson.com>
4  *
5  * $Id$
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
9  * Copyright 1998 Gerald Combs
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
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.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  *
25  * To quote the author of the previous H245 dissector:
26  *   "This is a complete replacement of the previous limitied dissector
27  * that Ronnie was crazy enough to write by hand. It was a lot of time
28  * to hack it by hand, but it is incomplete and buggy and it is good when
29  * it will go away."
30  * Ronnie did a great job and all the VoIP users had made good use of it!
31  * Credit to Tomas Kukosa for developing the asn2wrs compiler.
32  *
33  */
34
35 #ifdef HAVE_CONFIG_H
36 # include "config.h"
37 #endif
38
39 #include <glib.h>
40 #include <epan/packet.h>
41 #include <epan/strutil.h>
42
43 #include <stdio.h>
44 #include <string.h>
45
46 #include <epan/prefs.h>
47 #include <epan/t35.h>
48 #include <epan/emem.h>
49 #include <epan/oids.h>
50 #include <epan/asn1.h>
51 #include <epan/tap.h>
52 #include "packet-tpkt.h"
53 #include "packet-per.h"
54 #include "packet-h323.h"
55 #include "packet-h245.h"
56 #include "packet-rtp.h"
57 #include "packet-rtcp.h"
58 #include "packet-t38.h"
59
60 #define PNAME  "MULTIMEDIA-SYSTEM-CONTROL"
61 #define PSNAME "H.245"
62 #define PFNAME "h245"
63
64 static dissector_handle_t rtp_handle=NULL;
65 static dissector_handle_t rtcp_handle=NULL;
66 static dissector_handle_t t38_handle=NULL;
67 static dissector_table_t nsp_object_dissector_table;
68 static dissector_table_t nsp_h221_dissector_table;
69 static dissector_table_t gef_name_dissector_table;
70 static dissector_table_t gef_content_dissector_table;
71 static dissector_handle_t nsp_handle;
72 static dissector_handle_t data_handle;
73 static dissector_handle_t MultimediaSystemControlMessage_handle;
74 static dissector_handle_t h263_handle = NULL;
75 static dissector_handle_t amr_handle = NULL;
76
77 static void init_h245_packet_info(h245_packet_info *pi);
78 static int hf_h245_pdu_type = -1;
79 static int hf_h245Manufacturer = -1;
80 static int h245_tap = -1;
81 static int h245dg_tap = -1;
82 h245_packet_info *h245_pi=NULL;
83
84 static gboolean h245_reassembly = TRUE;
85 static gboolean h245_shorttypes = FALSE;
86
87 #include "packet-h245-val.h"
88
89 static const value_string h245_RequestMessage_short_vals[] = {
90         { RequestMessage_nonStandard              ,     "NSM" },
91         { RequestMessage_masterSlaveDetermination ,     "MSD" },
92         { RequestMessage_terminalCapabilitySet    ,     "TCS" },
93         { RequestMessage_openLogicalChannel       ,     "OLC" },
94         { RequestMessage_closeLogicalChannel      ,     "CLC" },
95         { RequestMessage_requestChannelClose      ,     "RCC" },
96         { RequestMessage_multiplexEntrySend       ,     "MES" },
97         { RequestMessage_requestMultiplexEntry    ,     "RME" },
98         { RequestMessage_requestMode              ,     "RM"  },
99         { RequestMessage_roundTripDelayRequest    ,     "RTDR" },
100         { RequestMessage_maintenanceLoopRequest   ,     "MLR" },
101         { RequestMessage_communicationModeRequest ,     "CMR" },
102         { RequestMessage_conferenceRequest        ,     "CR"  },
103         { RequestMessage_multilinkRequest         ,     "MR"  },
104         { RequestMessage_logicalChannelRateRequest,     "LCRR" },
105         { RequestMessage_genericRequest           ,     "GR"  },
106         {  0, NULL }
107 };
108 static const value_string h245_ResponseMessage_short_vals[] = {
109         { ResponseMessage_nonStandard                   ,       "NSM" },
110         { ResponseMessage_masterSlaveDeterminationAck   ,       "MSDAck" },
111         { ResponseMessage_masterSlaveDeterminationReject,       "MSDReject" },
112         { ResponseMessage_terminalCapabilitySetAck      ,       "TCSAck" },
113         { ResponseMessage_terminalCapabilitySetReject   ,       "TCSReject" },
114         { ResponseMessage_openLogicalChannelAck         ,       "OLCAck" },
115         { ResponseMessage_openLogicalChannelReject      ,       "OLCReject" },
116         { ResponseMessage_closeLogicalChannelAck        ,       "CLCAck" },
117         { ResponseMessage_requestChannelCloseAck        ,       "RCCAck" },
118         { ResponseMessage_requestChannelCloseReject     ,       "RCCReject" },
119         { ResponseMessage_multiplexEntrySendAck         ,       "MESAck" },
120         { ResponseMessage_multiplexEntrySendReject      ,       "MESReject" },
121         { ResponseMessage_requestMultiplexEntryAck      ,       "RMEAck" },
122         { ResponseMessage_requestMultiplexEntryReject   ,       "RMEReject" },
123         { ResponseMessage_requestModeAck                ,       "RMAck" },
124         { ResponseMessage_requestModeReject             ,       "RMReject" },
125         { ResponseMessage_roundTripDelayResponse        ,       "RTDResponse" },
126         { ResponseMessage_maintenanceLoopAck            ,       "MLAck" },
127         { ResponseMessage_maintenanceLoopReject         ,       "MLReject" },
128         { ResponseMessage_communicationModeResponse     ,       "CMResponse" },
129         { ResponseMessage_conferenceResponse            ,       "CResponse" },
130         { ResponseMessage_multilinkResponse             ,       "MResponse" },
131         { ResponseMessage_logicalChannelRateAcknowledge ,       "LCRAck" },
132         { ResponseMessage_logicalChannelRateReject      ,       "LCRReject" },
133         { ResponseMessage_genericResponse               ,       "GR" },
134         {  0, NULL }
135 };
136 static const value_string h245_IndicationMessage_short_vals[] = {
137         { IndicationMessage_nonStandard                             ,   "NSM" },
138         { IndicationMessage_functionNotUnderstood                   ,   "FNU" },
139         { IndicationMessage_masterSlaveDeterminationRelease         ,   "MSDRelease" },
140         { IndicationMessage_terminalCapabilitySetRelease            ,   "TCSRelease" },
141         { IndicationMessage_openLogicalChannelConfirm               ,   "OLCConfirm" },
142         { IndicationMessage_requestChannelCloseRelease              ,   "RCCRelease" },
143         { IndicationMessage_multiplexEntrySendRelease               ,   "MESRelease" },
144         { IndicationMessage_requestMultiplexEntryRelease            ,   "RMERelease" },
145         { IndicationMessage_requestModeRelease                      ,   "RMRelease" },
146         { IndicationMessage_miscellaneousIndication                 ,   "MI" },
147         { IndicationMessage_jitterIndication                        ,   "JI" },
148         { IndicationMessage_h223SkewIndication                      ,   "H223SI" },
149         { IndicationMessage_newATMVCIndication                      ,   "NATMVCI" },
150         { IndicationMessage_userInput                               ,   "UII" },
151         { IndicationMessage_h2250MaximumSkewIndication              ,   "H2250MSI" },
152         { IndicationMessage_mcLocationIndication                    ,   "MCLI" },
153         { IndicationMessage_conferenceIndication                    ,   "CI" },
154         { IndicationMessage_vendorIdentification                    ,   "VI" },
155         { IndicationMessage_functionNotSupported                    ,   "FNS" },
156         { IndicationMessage_multilinkIndication                     ,   "MultilinkIndication" },
157         { IndicationMessage_logicalChannelRateRelease               ,   "LCRRelease" },
158         { IndicationMessage_flowControlIndication                   ,   "FCIndication" },
159         { IndicationMessage_mobileMultilinkReconfigurationIndication,   "MMRI" },
160         { IndicationMessage_genericIndication                       ,   "GI" },
161         {  0, NULL }
162 };
163 static const value_string h245_CommandMessage_short_vals[] = {
164         { CommandMessage_nonStandard                          , "NSM" },
165         { CommandMessage_maintenanceLoopOffCommand            , "MLOC" },
166         { CommandMessage_sendTerminalCapabilitySet            , "STCS" },
167         { CommandMessage_encryptionCommand                    , "EC" },
168         { CommandMessage_flowControlCommand                   , "FCC" },
169         { CommandMessage_endSessionCommand                    , "ESC" },
170         { CommandMessage_miscellaneousCommand                 , "MC" },
171         { CommandMessage_communicationModeCommand             , "CMC" },
172         { CommandMessage_conferenceCommand                    , "CC" },
173         { CommandMessage_h223MultiplexReconfiguration         , "H223MR" },
174         { CommandMessage_newATMVCCommand                      , "NATMVCC" },
175         { CommandMessage_mobileMultilinkReconfigurationCommand, "MMRC" },
176         { CommandMessage_genericCommand                       , "GC" },
177         {  0, NULL }
178 };
179
180 static const value_string h245_AudioCapability_short_vals[] = {
181   { AudioCapability_nonStandard           , "nonStd" },
182   { AudioCapability_g711Alaw64k           , "g711A" },
183   { AudioCapability_g711Alaw56k           , "g711A56k" },
184   { AudioCapability_g711Ulaw64k           , "g711U" },
185   { AudioCapability_g711Ulaw56k           , "g711U56k" },
186   { AudioCapability_g722_64k              , "g722-64k" },
187   { AudioCapability_g722_56k              , "g722-56k" },
188   { AudioCapability_g722_48k              , "g722-48k" },
189   { AudioCapability_g7231                 , "g7231" },
190   { AudioCapability_g728                  , "g728" },
191   { AudioCapability_g729                  , "g729" },
192   { AudioCapability_g729AnnexA            , "g729A" },
193   { AudioCapability_is11172AudioCapability, "is11172" },
194   { AudioCapability_is13818AudioCapability, "is13818" },
195   { AudioCapability_g729wAnnexB           , "g729B" },
196   { AudioCapability_g729AnnexAwAnnexB     , "g729AB" },
197   { AudioCapability_g7231AnnexCCapability , "g7231C" },
198   { AudioCapability_gsmFullRate           , "gsmFR" },
199   { AudioCapability_gsmHalfRate           , "gsmHR" },
200   { AudioCapability_gsmEnhancedFullRate   , "gsmEFR" },
201   { AudioCapability_genericAudioCapability, "generic" },
202   { AudioCapability_g729Extensions        , "g729Ext" },
203   { AudioCapability_vbd                   , "vbd" },
204   { AudioCapability_audioTelephonyEvent   , "audioTelEvent" },
205   { AudioCapability_audioTone             , "audioTone" },
206   {  0, NULL }
207 };
208
209 /* To put the codec type only in COL_INFO when
210    an OLC is read */
211 const char* codec_type = NULL;
212 static guint32 rfc_number;
213
214 typedef struct _unicast_addr_t {
215   address addr;
216   guint8 addr_buf[16];
217   guint32 port;
218 } unicast_addr_t;
219
220 typedef struct _channel_info_t {
221   gchar data_type_str[32];
222   unicast_addr_t *upcoming_addr;
223   unicast_addr_t media_addr;
224   unicast_addr_t media_control_addr;
225   unsigned int rfc2198;
226   gboolean srtp_flag;
227   gboolean is_video;
228 } channel_info_t;
229
230 typedef struct _olc_info_t {
231   guint16 fwd_lc_num;
232   channel_info_t fwd_lc;
233   channel_info_t rev_lc;
234 } olc_info_t;
235
236 static GHashTable* h245_pending_olc_reqs = NULL;
237 static gboolean fast_start = FALSE;
238 static olc_info_t *upcoming_olc = NULL;
239 static channel_info_t *upcoming_channel = NULL;
240
241 /* NonStandardParameter */
242 static const char *nsiOID;
243 static guint32 h221NonStandard;
244 static guint32 t35CountryCode;
245 static guint32 t35Extension;
246 static guint32 manufacturerCode;
247
248 static const value_string h245_RFC_number_vals[] = {
249         {  2190,        "RFC 2190 - H.263 Video Streams" },
250         {  2198,        "RFC 2198 - RTP Payload for Redundant Audio Data" },
251         {  2429,        "RFC 2429 - 1998 Version of ITU-T Rec. H.263 Video (H.263+)" },
252         {  3016,        "RFC 3016 - RTP Payload Format for MPEG-4 Audio/Visual Streams" },
253         {  3267,        "RFC 3267 - Adaptive Multi-Rate (AMR) and Adaptive Multi-Rate Wideband (AMR-WB)" },
254         {  3984,        "RFC 3984 - RTP Payload Format for H.264 Video" },
255         {  0, NULL }
256 };
257
258 /* h223 multiplex codes */
259 static h223_set_mc_handle_t h223_set_mc_handle = NULL;
260 h223_mux_element *h223_me=NULL;
261 guint8 h223_mc=0;
262 void h245_set_h223_set_mc_handle( h223_set_mc_handle_t handle )
263 {
264         h223_set_mc_handle = handle;
265 }
266
267 /* h223 logical channels */
268 typedef struct {
269         h223_lc_params *fw_channel_params;
270         h223_lc_params *rev_channel_params;
271 } h223_pending_olc;
272
273 static GHashTable*          h223_pending_olc_reqs[] = { NULL, NULL };
274 static dissector_handle_t   h245_lc_dissector;
275 static guint16              h245_lc_temp;
276 static guint16              h223_fw_lc_num;
277 static guint16              h223_rev_lc_num;
278 static h223_lc_params      *h223_lc_params_temp;
279 static h223_lc_params      *h223_fw_lc_params;
280 static h223_lc_params      *h223_rev_lc_params;
281 static h223_add_lc_handle_t h223_add_lc_handle = NULL;
282
283 static void h223_lc_init_dir( int dir )
284 {
285         if ( h223_pending_olc_reqs[dir] )
286                 g_hash_table_destroy( h223_pending_olc_reqs[dir] );
287         h223_pending_olc_reqs[dir] = g_hash_table_new( g_direct_hash, g_direct_equal );
288 }
289
290 static void h223_lc_init( void )
291 {
292         h223_lc_init_dir( P2P_DIR_SENT );
293         h223_lc_init_dir( P2P_DIR_RECV );
294         h223_lc_params_temp = NULL;
295         h245_lc_dissector = NULL;
296         h223_fw_lc_num = 0;
297 }
298
299 static void h245_init(void)
300 {
301         if ( h245_pending_olc_reqs)
302                 g_hash_table_destroy(h245_pending_olc_reqs);
303         h245_pending_olc_reqs = g_hash_table_new(g_str_hash, g_str_equal);
304
305         h223_lc_init();
306 }
307
308 void h245_set_h223_add_lc_handle( h223_add_lc_handle_t handle )
309 {
310         h223_add_lc_handle = handle;
311 }
312
313 static const gchar *gen_olc_key(guint16 lc_num, address *dst_addr, address *src_addr)
314 {
315   return ep_strdup_printf("%s/%s/%u", ep_address_to_str(dst_addr), ep_address_to_str(src_addr), lc_num);
316 }
317
318 static void update_unicast_addr(unicast_addr_t *req_addr, unicast_addr_t *ack_addr)
319 {
320   if (ack_addr->addr.type!=AT_NONE && ack_addr->port!=0) {
321     memcpy(req_addr->addr_buf, ack_addr->addr_buf, sizeof(req_addr->addr_buf));
322     SET_ADDRESS(&req_addr->addr, ack_addr->addr.type, ack_addr->addr.len, req_addr->addr_buf);
323     req_addr->port = ack_addr->port;
324   }
325 }
326
327 static void h245_setup_channels(packet_info *pinfo, channel_info_t *upcoming_channel)
328 {
329         gint *key;
330         GHashTable *rtp_dyn_payload = NULL;
331         struct srtp_info *dummy_srtp_info = NULL;
332
333         if (!upcoming_channel) return;
334
335         /* T.38 */
336         if (!strcmp(upcoming_channel->data_type_str, "t38fax")) {
337                 if (upcoming_channel->media_addr.addr.type!=AT_NONE && upcoming_channel->media_addr.port!=0 && t38_handle) {
338                         t38_add_address(pinfo, &upcoming_channel->media_addr.addr,
339                                                         upcoming_channel->media_addr.port, 0,
340                                                         "H245", pinfo->fd->num);
341                 }
342                 return;
343         }
344
345         /* (S)RTP, (S)RTCP */
346         if (upcoming_channel->rfc2198 > 0) {
347                 rtp_dyn_payload = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, g_free);
348                 key = g_malloc(sizeof(gint));
349                 *key = upcoming_channel->rfc2198;
350                 g_hash_table_insert(rtp_dyn_payload, key, g_strdup("red"));
351         }
352
353         if (upcoming_channel->srtp_flag) {
354                 dummy_srtp_info = se_alloc0(sizeof(struct srtp_info));
355         }
356
357         /* DEBUG        g_warning("h245_setup_channels media_addr.addr.type %u port %u",upcoming_channel->media_addr.addr.type, upcoming_channel->media_addr.port );
358         */
359         if (upcoming_channel->media_addr.addr.type!=AT_NONE && upcoming_channel->media_addr.port!=0 && rtp_handle) {
360                 srtp_add_address(pinfo, &upcoming_channel->media_addr.addr,
361                                                 upcoming_channel->media_addr.port, 0,
362                                                 "H245", pinfo->fd->num, upcoming_channel->is_video , rtp_dyn_payload, dummy_srtp_info);
363         }
364         if (upcoming_channel->media_control_addr.addr.type!=AT_NONE && upcoming_channel->media_control_addr.port!=0 && rtcp_handle) {
365                 srtcp_add_address(pinfo, &upcoming_channel->media_control_addr.addr,
366                                                 upcoming_channel->media_control_addr.port, 0,
367                                                 "H245", pinfo->fd->num, dummy_srtp_info);
368         }
369 }
370
371 /* Initialize the protocol and registered fields */
372 int proto_h245 = -1;
373 #include "packet-h245-hf.c"
374
375 /* Initialize the subtree pointers */
376 static int ett_h245 = -1;
377 static int ett_h245_returnedFunction = -1;
378 #include "packet-h245-ett.c"
379
380 /* Forward declarations */
381 static int dissect_h245_MultimediaSystemControlMessage(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
382 static void reset_h245_pi(void *dummy _U_)
383 {
384         h245_pi = NULL; /* Make sure we don't leave ep_alloc()ated memory lying around */
385 }
386
387 #include "packet-h245-fn.c"
388
389 static void
390 dissect_h245(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
391 {
392         /*
393          * MultimediaSystemControlMessage_handle is the handle for
394          * dissect_h245_h245, so we don't want to do any h245_pi or tap stuff here.
395          */
396         dissect_tpkt_encap(tvb, pinfo, parent_tree, h245_reassembly, MultimediaSystemControlMessage_handle);
397 }
398
399
400 static void
401 dissect_h245_h245(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
402 {
403         proto_item *it;
404         proto_tree *tr;
405         guint32 offset=0;
406         asn1_ctx_t asn1_ctx;
407
408         fast_start = FALSE;
409         /* Clean up from any previous packet dissection */
410         upcoming_olc = NULL;
411         upcoming_channel = NULL;
412         codec_type = NULL;
413
414         if (check_col(pinfo->cinfo, COL_PROTOCOL)){
415                 col_set_str(pinfo->cinfo, COL_PROTOCOL, PSNAME);
416         }
417
418         it=proto_tree_add_protocol_format(parent_tree, proto_h245, tvb, 0, tvb_length(tvb), PSNAME);
419         tr=proto_item_add_subtree(it, ett_h245);
420
421         /* assume that whilst there is more tvb data, there are more h245 commands */
422         while ( tvb_length_remaining( tvb, offset>>3 )>0 ){
423                 CLEANUP_PUSH(reset_h245_pi, NULL);
424                 h245_pi=ep_alloc(sizeof(h245_packet_info));
425                 init_h245_packet_info(h245_pi);
426                 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
427                 offset = dissect_h245_MultimediaSystemControlMessage(tvb, offset, &asn1_ctx, tr, hf_h245_pdu_type);
428                 tap_queue_packet(h245dg_tap, pinfo, h245_pi);
429                 offset = (offset+0x07) & 0xfffffff8;
430                 CLEANUP_CALL_AND_POP;
431         }
432 }
433
434 void
435 dissect_h245_FastStart_OLC(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, char *codec_str) {
436
437   fast_start = TRUE;
438   /* Clean up from any previous packet dissection */
439   upcoming_olc = NULL;
440   upcoming_channel = NULL;
441   codec_type = NULL;
442
443   dissect_OpenLogicalChannel_PDU(tvb, pinfo, tree);
444
445   if (h245_pi != NULL)
446           h245_pi->msg_type = H245_OpenLogChn;
447
448   if (codec_str && codec_type){
449         g_strlcpy(codec_str, codec_type, 50);
450   }
451
452 }
453
454 /*--- proto_register_h245 -------------------------------------------*/
455 void proto_register_h245(void) {
456
457   /* List of fields */
458   static hf_register_info hf[] = {
459     { &hf_h245_pdu_type,
460  { "PDU Type", "h245.pdu_type", FT_UINT32, BASE_DEC,
461                 VALS(h245_MultimediaSystemControlMessage_vals), 0, "Type of H.245 PDU", HFILL }},
462         { &hf_h245Manufacturer,
463                 { "H.245 Manufacturer", "h245.Manufacturer", FT_UINT32, BASE_HEX,
464                 VALS(H221ManufacturerCode_vals), 0, "h245.H.221 Manufacturer", HFILL }},
465 #include "packet-h245-hfarr.c"
466   };
467
468   /* List of subtrees */
469   static gint *ett[] = {
470           &ett_h245,
471           &ett_h245_returnedFunction,
472 #include "packet-h245-ettarr.c"
473   };
474   module_t *h245_module;
475
476   /* Register protocol */
477   proto_h245 = proto_register_protocol(PNAME, PSNAME, PFNAME);
478   register_init_routine(h245_init);
479   /* Register fields and subtrees */
480   proto_register_field_array(proto_h245, hf, array_length(hf));
481   proto_register_subtree_array(ett, array_length(ett));
482
483   /* From Ronnie Sahlbergs original H245 dissector */
484
485   h245_module = prefs_register_protocol(proto_h245, NULL);
486   prefs_register_bool_preference(h245_module, "reassembly",
487                 "Reassemble H.245 messages spanning multiple TCP segments",
488                 "Whether the H.245 dissector should reassemble messages spanning multiple TCP segments."
489                 " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
490                 &h245_reassembly);
491   prefs_register_bool_preference(h245_module, "shorttypes",
492                 "Show short message types",
493                 "Whether the dissector should show short names or the long names from the standard",
494                 &h245_shorttypes);
495   register_dissector("h245dg", dissect_h245_h245, proto_h245);
496   register_dissector("h245", dissect_h245, proto_h245);
497
498   nsp_object_dissector_table = register_dissector_table("h245.nsp.object", "H.245 NonStandardParameter (object)", FT_STRING, BASE_NONE);
499   nsp_h221_dissector_table = register_dissector_table("h245.nsp.h221", "H.245 NonStandardParameter (h221)", FT_UINT32, BASE_HEX);
500   gef_name_dissector_table = register_dissector_table("h245.gef.name", "H.245 Generic Extensible Framework (names)", FT_STRING, BASE_NONE);
501   gef_content_dissector_table = register_dissector_table("h245.gef.content", "H.245 Generic Extensible Framework", FT_STRING, BASE_NONE);
502
503   h245_tap = register_tap("h245");
504   h245dg_tap = register_tap("h245dg");
505
506   oid_add_from_string("h239ControlCapability","0.0.8.239.1.1");
507   oid_add_from_string("h239ExtendedVideoCapability","0.0.8.239.1.2");
508   oid_add_from_string("generic-message","0.0.8.239.2");
509   oid_add_from_string("h245 version 3","0.0.8.245.0.3");
510   oid_add_from_string("h245 version 4","0.0.8.245.0.4");
511   oid_add_from_string("h245 version 5","0.0.8.245.0.5");
512   oid_add_from_string("h245 version 6","0.0.8.245.0.6");
513   oid_add_from_string("h245 version 7","0.0.8.245.0.7");
514   oid_add_from_string("h245 version 8","0.0.8.245.0.8");
515   oid_add_from_string("h245 version 9","0.0.8.245.0.9");
516   oid_add_from_string("h245 version 10","0.0.8.245.0.10");
517   oid_add_from_string("h245 version 11","0.0.8.245.0.11");
518   oid_add_from_string("h245 version 12","0.0.8.245.0.12");
519   oid_add_from_string("h245 version 13","0.0.8.245.0.13");
520   /* This capability is defined in Annex E. */
521   oid_add_from_string("ISO/IEC 14496-2 MPEG-4 video","0.0.8.245.1.0.0");
522   /* This capability is defined in Annex H. */
523   oid_add_from_string("ISO/IEC 14496-3 MPEG-4 audio","0.0.8.245.1.1.0");
524   /* This capability is defined in Annex I. */
525   oid_add_from_string("AMR","0.0.8.245.1.1.1");
526   /* This capability is defined in Annex J. */
527   oid_add_from_string("acelp","0.0.8.245.1.1.2");
528   /* This capability is defined in Annex K. */
529   oid_add_from_string("us1","0.0.8.245.1.1.3");
530   /* This capability is defined in Annex L. */
531   oid_add_from_string("is127evrc","0.0.8.245.1.1.4");
532   /* This capability is defined in Annex M. */
533   oid_add_from_string("ISO/IEC 13818-7","0.0.8.245.1.1.5");
534   /* This capability is defined in Annex N. */
535   oid_add_from_string("rfc3389","0.0.8.245.1.1.6");
536   /* This capability is defined in Annex O. */
537   oid_add_from_string("L-16","0.0.8.245.1.1.7");
538   /* This capability is defined in Annex P. */
539   oid_add_from_string("bounded-audio-stream","0.0.8.245.1.1.8");
540   /* This capability is defined in Annex R. */
541   oid_add_from_string("AMR-NB","0.0.8.245.1.1.9");
542   /* This capability is defined in Annex R. */
543   oid_add_from_string("AMR-WB","0.0.8.245.1.1.10");
544   /* This capability is defined in Annex S. */
545   oid_add_from_string("ilbc","0.0.8.245.1.1.11");
546
547   oid_add_from_string("ISO/IEC 14496-1","0.0.8.245.1.2.0");
548   oid_add_from_string("Nx64","0.0.8.245.1.2.1");
549   oid_add_from_string("logical-channel-bit-ratemanagement","0.0.8.245.1.3.0");
550
551   oid_add_from_string("h264 generic-capabilities","0.0.8.241.0.0.1");
552   oid_add_from_string("iPpacketization_h241AnnexA(single NAL unit mode)","0.0.8.241.0.0.0.0");
553   oid_add_from_string("iPpacketization_RFC3984NonInterleaved","0.0.8.241.0.0.0.1");
554   oid_add_from_string("iPpacketization_RFC3984Interleaved","0.0.8.241.0.0.0.2");
555 }
556
557
558 /*--- proto_reg_handoff_h245 ---------------------------------------*/
559 void proto_reg_handoff_h245(void) {
560         dissector_handle_t h245_handle;
561
562         rtp_handle = find_dissector("rtp");
563         rtcp_handle = find_dissector("rtcp");
564         t38_handle = find_dissector("t38");
565         data_handle = find_dissector("data");
566         h263_handle = find_dissector("h263data");
567         amr_handle = find_dissector("amr_if2_nb");
568
569
570         h245_handle = find_dissector("h245");
571         dissector_add_handle("tcp.port", h245_handle);
572         MultimediaSystemControlMessage_handle = find_dissector("h245dg");
573         dissector_add_handle("udp.port", MultimediaSystemControlMessage_handle);
574 }
575
576 static void init_h245_packet_info(h245_packet_info *pi)
577 {
578         if(pi == NULL) {
579                 return;
580         }
581
582         pi->msg_type = H245_OTHER;
583                 pi->frame_label[0] = '\0';
584                 g_snprintf(pi->comment, sizeof(pi->comment), "H245 ");
585 }
586