~ubuntu-branches/ubuntu/gutsy/wireshark/gutsy-security

« back to all changes in this revision

Viewing changes to epan/dissectors/packet-h248.c

  • Committer: Bazaar Package Importer
  • Author(s): Frederic Peters
  • Date: 2007-04-01 08:58:40 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070401085840-or3qhrpv8alt1bwg
Tags: 0.99.5-1
* New upstream release.
* debian/patches/09_idl2wrs.dpatch: updated to patch idl2wrs.sh.in.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
 *
14
14
 * Luis Ontanon 2005 - Context and Transaction Tracing
15
15
 *
16
 
 * $Id: packet-h248.c 19544 2006-10-15 22:11:26Z etxrab $
 
16
 * $Id: packet-h248.c 20671 2007-02-01 19:15:01Z gerald $
17
17
 *
18
 
 * Ethereal - Network traffic analyzer
19
 
 * By Gerald Combs <gerald@ethereal.com>
 
18
 * Wireshark - Network traffic analyzer
 
19
 * By Gerald Combs <gerald@wireshark.org>
20
20
 * Copyright 1998 Gerald Combs
21
21
 *
22
22
 * This program is free software; you can redistribute it and/or
73
73
static int hf_h248_no_evt = -1;
74
74
static int hf_h248_no_param = -1;
75
75
 
 
76
static int hf_h248_serviceChangeReasonStr = -1;
 
77
 
76
78
 
77
79
/*--- Included file: packet-h248-hf.c ---*/
78
80
#line 1 "packet-h248-hf.c"
133
135
static int hf_h248_iepscallind = -1;              /* BOOLEAN */
134
136
static int hf_h248_contextProp = -1;              /* SEQUENCE_OF_PropertyParm */
135
137
static int hf_h248_contextProp_item = -1;         /* PropertyParm */
136
 
static int hf_h248_contextList = -1;              /* SEQUENCE_OF_ContextID */
137
 
static int hf_h248_contextList_item = -1;         /* ContextID */
 
138
static int hf_h248_contextList = -1;              /* SEQUENCE_OF_ContextIDinList */
 
139
static int hf_h248_contextList_item = -1;         /* ContextIDinList */
138
140
static int hf_h248_topology = -1;                 /* NULL */
139
141
static int hf_h248_cAAREmergency = -1;            /* NULL */
140
142
static int hf_h248_cAARPriority = -1;             /* NULL */
339
341
static int hf_h248_serviceChangeAddress = -1;     /* ServiceChangeAddress */
340
342
static int hf_h248_serviceChangeVersion = -1;     /* INTEGER_0_99 */
341
343
static int hf_h248_serviceChangeProfile = -1;     /* ServiceChangeProfile */
342
 
static int hf_h248_serviceChangeReason = -1;      /* Value */
 
344
static int hf_h248_serviceChangeReason = -1;      /* SCreasonValue */
343
345
static int hf_h248_serviceChangeDelay = -1;       /* INTEGER_0_4294967295 */
344
346
static int hf_h248_serviceChangeMgcId = -1;       /* MId */
345
347
static int hf_h248_timeStamp = -1;                /* TimeNotation */
346
348
static int hf_h248_serviceChangeInfo = -1;        /* AuditDescriptor */
347
349
static int hf_h248_serviceChangeIncompleteFlag = -1;  /* NULL */
 
350
static int hf_h248_SCreasonValue_item = -1;       /* SCreasonValueOctetStr */
348
351
static int hf_h248_timestamp = -1;                /* TimeNotation */
349
352
static int hf_h248_profileName = -1;              /* IA5String_SIZE_1_67 */
350
353
static int hf_h248_PackagesDescriptor_item = -1;  /* PackagesItem */
381
384
static int hf_h248_NotifyCompletion_onIteration = -1;
382
385
 
383
386
/*--- End of included file: packet-h248-hf.c ---*/
384
 
#line 69 "packet-h248-template.c"
 
387
#line 71 "packet-h248-template.c"
385
388
 
386
389
/* Initialize the subtree pointers */
387
390
static gint ett_h248 = -1;
399
402
static gint ett_h248_no_pkg = -1;
400
403
static gint ett_h248_no_sig = -1;
401
404
static gint ett_h248_no_evt = -1;
402
 
        
 
405
 
403
406
 
404
407
/*--- Included file: packet-h248-ett.c ---*/
405
408
#line 1 "packet-h248-ett.c"
430
433
static gint ett_h248_ContextRequest = -1;
431
434
static gint ett_h248_T_topologyReq = -1;
432
435
static gint ett_h248_SEQUENCE_OF_PropertyParm = -1;
433
 
static gint ett_h248_SEQUENCE_OF_ContextID = -1;
 
436
static gint ett_h248_SEQUENCE_OF_ContextIDinList = -1;
434
437
static gint ett_h248_ContextAttrAuditRequest = -1;
435
438
static gint ett_h248_SEQUENCE_OF_IndAudPropertyParm = -1;
436
439
static gint ett_h248_SelectLogic = -1;
529
532
static gint ett_h248_DigitMapDescriptor = -1;
530
533
static gint ett_h248_DigitMapValue = -1;
531
534
static gint ett_h248_ServiceChangeParm = -1;
 
535
static gint ett_h248_SCreasonValue = -1;
532
536
static gint ett_h248_ServiceChangeAddress = -1;
533
537
static gint ett_h248_ServiceChangeResParm = -1;
534
538
static gint ett_h248_ServiceChangeProfile = -1;
543
547
static gint ett_h248_Value = -1;
544
548
 
545
549
/*--- End of included file: packet-h248-ett.c ---*/
546
 
#line 88 "packet-h248-template.c"
 
550
#line 90 "packet-h248-template.c"
547
551
 
548
552
static dissector_handle_t h248_term_handle;
549
553
 
573
577
static dissector_handle_t h248_handle;
574
578
static dissector_handle_t h248_term_handle;
575
579
 
 
580
/* Forward declarations */
 
581
static int dissect_h248_ServiceChangeReasonStr(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index);
 
582
 
576
583
 
577
584
static const value_string package_name_vals[] = {
578
585
  {   0x0000, "Media stream properties H.248.1 Annex C" },
739
746
  {   0x00010000, "g H.248.1 Annex E" },
740
747
  {   0x00010001, "g/Cause" },
741
748
  {   0x00010002, "g/Signal Completion" },
 
749
  {   0x00040000, "tonedet H.248.1 Annex E" },
742
750
  {   0x00040001, "tonedet/std(Start tone detected)" },
743
751
  {   0x00040002, "tonedet/etd(End tone detected)" },
744
752
  {   0x00040003, "tonedet/ltd(Long tone detected)" },
 
753
  {   0x00060000, "dd H.248.1 Annex E" },
 
754
  {   0x00060001, "dd/std" },
 
755
  {   0x00060002, "dd/etd" },
 
756
  {   0x00060003, "dd/ltd" },
745
757
  {   0x00060004, "dd, DigitMap Completion Event" },
746
 
  {   0x00060010, "dd, DTMF character 0" },
747
 
  {   0x00060011, "dd, DTMF character 1" },
748
 
  {   0x00060012, "dd, DTMF character 2" },
749
 
  {   0x00060013, "dd, DTMF character 3" },
750
 
  {   0x00060014, "dd, DTMF character 4" },
751
 
  {   0x00060015, "dd, DTMF character 5" },
752
 
  {   0x00060016, "dd, DTMF character 6" },
753
 
  {   0x00060017, "dd, DTMF character 7" },
754
 
  {   0x00060018, "dd, DTMF character 8" },
755
 
  {   0x00060019, "dd, DTMF character 9" },
756
 
  {   0x0006001a, "dd, DTMF character A" },
757
 
  {   0x0006001b, "dd, DTMF character B" },
758
 
  {   0x0006001c, "dd, DTMF character C" },
759
 
  {   0x0006001d, "dd, DTMF character D" },
760
 
  {   0x00060020, "dd, DTMF character *" },
761
 
  {   0x00060021, "dd, DTMF character #" },
 
758
  {   0x00060010, "dd/d0, DTMF character 0" },
 
759
  {   0x00060011, "dd/d1, DTMF character 1" },
 
760
  {   0x00060012, "dd/d2, DTMF character 2" },
 
761
  {   0x00060013, "dd/d3, DTMF character 3" },
 
762
  {   0x00060014, "dd/d4, DTMF character 4" },
 
763
  {   0x00060015, "dd/d5, DTMF character 5" },
 
764
  {   0x00060016, "dd/d6, DTMF character 6" },
 
765
  {   0x00060017, "dd/d7, DTMF character 7" },
 
766
  {   0x00060018, "dd/d8, DTMF character 8" },
 
767
  {   0x00060019, "dd/d9, DTMF character 9" },
 
768
  {   0x0006001a, "dd/a, DTMF character A" },
 
769
  {   0x0006001b, "dd/b, DTMF character B" },
 
770
  {   0x0006001c, "dd/c, DTMF character C" },
 
771
  {   0x0006001d, "dd/d, DTMF character D" },
 
772
  {   0x00060020, "dd/*, DTMF character *" },
 
773
  {   0x00060021, "dd/#, DTMF character #" },
762
774
  {   0x00080030, "cd, Dial Tone" },
763
775
  {   0x00080031, "cd, Ringing Tone" },
764
776
  {   0x00080032, "cd, Busy Tone" },
772
784
  {   0x00090005, "al, offhook" },
773
785
  {   0x00090006, "al, flashhook" },
774
786
  {   0x0009ffff, "al, *" },
775
 
  {   0x000a0005, "ct, Completion" },
 
787
  {   0x000a0005, "ct, Completion of Continuity test" },
776
788
  {   0x000b0005, "nt, network failure" },
777
789
  {   0x000b0006, "nt, quality alert" },
778
790
  {   0x000c0001, "rtp, Payload Transition" },
779
791
  {   0x00210000, "Generic Bearer Connection Q.1950 Annex A" },
780
792
  {   0x00210001, "GB/BNCChange" },
 
793
  {   0x00220001, "BT/TIND (Tunnel Indication)" },
781
794
  {   0x002a0001, "H.245/h245msg (Incoming H.245 Message)" },
782
795
  {   0x002a0004, "H.245/h245ChC (H.245 Channel Closed)" },
 
796
  {   0x00450000, "Inactivity Timer H.248.14" },
 
797
  {   0x00450001, "it/ito" },
 
798
  {   0x00450002, "it/ito" },
 
799
  {   0x00460001, "threegmlc/mod_link_supp (Bearer Modification Support Event)" },
783
800
  {   0x800a0000, "Nokia Bearer Characteristics Package" },
784
801
        {0,     NULL}
785
802
};
824
841
  {   0x00210001, "GB/EstBNC(Establish BNC)" },
825
842
  {   0x00210002, "GB/ModBNC (Modify BNC)" },
826
843
  {   0x00210003, "GB/RelBNC(Release BNC)" },
827
 
  
 
844
 
828
845
  {   0x002a0001, "H.245/cs (channel state)" },
829
846
  {   0x002a0002, "H.245/termtype (Terminal Type)" },
830
847
 
964
981
};
965
982
 
966
983
static const value_string wildcard_modes[] = {
967
 
    { 0, "All" },
968
 
    { 1, "Choose" },
 
984
    { 0, "Choose" },
 
985
    { 1, "All" },
969
986
    { 0, NULL }
970
987
};
971
988
 
981
998
    { H248_CMD_ADD_REQ, "addReq"},
982
999
    { H248_CMD_MOVE_REQ, "moveReq"},
983
1000
    { H248_CMD_MOD_REQ, "modReq"},
984
 
    { H248_CMD_SUB_REQ, "subReq"},
985
 
    { H248_CMD_AUDITCAP_REQ, "auditCapReq"},
986
 
    { H248_CMD_AUDITVAL_REQ, "auditValReq"},
 
1001
    { H248_CMD_SUB_REQ, "subtractReq"},
 
1002
    { H248_CMD_AUDITCAP_REQ, "auditCapRequest"},
 
1003
    { H248_CMD_AUDITVAL_REQ, "auditValueRequest"},
987
1004
    { H248_CMD_NOTIFY_REQ, "notifyReq"},
988
 
    { H248_CMD_SVCCHG_REQ, "svcChgReq"},
 
1005
    { H248_CMD_SVCCHG_REQ, "serviceChangeReq"},
989
1006
    { H248_CMD_TOPOLOGY_REQ, "topologyReq"},
990
1007
    { H248_CMD_CTX_ATTR_AUDIT_REQ, "ctxAttrAuditReq"},
991
1008
    { H248_CMD_ADD_REPLY, "addReply"},
992
1009
    { H248_CMD_MOVE_REPLY, "moveReply"},
993
1010
    { H248_CMD_MOD_REPLY, "modReply"},
994
 
    { H248_CMD_SUB_REPLY, "subReply"},
 
1011
    { H248_CMD_SUB_REPLY, "subtractReply"},
995
1012
    { H248_CMD_AUDITCAP_REPLY, "auditCapReply"},
996
1013
    { H248_CMD_AUDITVAL_REPLY, "auditValReply"},
997
1014
    { H248_CMD_NOTIFY_REPLY, "notifyReply"},
998
 
    { H248_CMD_SVCCHG_REPLY, "svcChgReply"},
 
1015
    { H248_CMD_SVCCHG_REPLY, "serviceChangeReply"},
999
1016
    { H248_CMD_TOPOLOGY_REPLY, "topologyReply"},
1000
1017
    { 0, NULL }
1001
1018
};
1139
1156
 
1140
1157
static GPtrArray* packages = NULL;
1141
1158
 
1142
 
void h248_register_package(h248_package_t* pkg) {       
 
1159
void h248_register_package(h248_package_t* pkg) {
1143
1160
        if (! packages) packages = g_ptr_array_new();
1144
1161
 
1145
1162
        g_assert(pkg != NULL);
1146
 
        
 
1163
 
1147
1164
        g_ptr_array_add(packages,pkg);
1148
1165
}
1149
1166
 
1150
 
#if 0
1151
 
static void
1152
 
dissect_h248_pkg_data(gboolean implicit_tag, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,guint16 name_major, guint16 name_minor){
1153
 
 
1154
 
guint offset=0;
1155
 
 
1156
 
        switch ( name_major ){
1157
 
                case 0x001e: /* Bearer Characteristics Q.1950 Annex A */
1158
 
        {
1159
 
            guint bearer_type = 0;
1160
 
                        offset = dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_h248_pkg_bcp_BNCChar_PDU, &bearer_type);
1161
 
            if ( bearer_type && curr_info.term )
1162
 
                curr_info.term->type = bearer_type;
1163
 
                        break;
1164
 
        }
1165
 
        }
1166
 
 
1167
 
}
1168
 
 
1169
 
#endif
1170
 
 
1171
1167
static guint32 packageandid;
1172
1168
 
1173
1169
static int dissect_h248_PkgdName(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index) {
1178
1174
  int hf_param;
1179
1175
  h248_package_t* pkg = NULL;
1180
1176
  guint i;
1181
 
  
 
1177
 
1182
1178
  old_offset=offset;
1183
1179
  offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index, &new_tvb);
1184
1180
 
1195
1191
                package_tree = proto_item_add_subtree(ber_last_created_item, ett_packagename);
1196
1192
                proto_tree_add_uint(package_tree, hf_h248_pkg_name, tvb, offset-4, 2, name_major);
1197
1193
    }
1198
 
        
 
1194
 
1199
1195
        for(i=0; i < packages->len; i++) {
1200
1196
                pkg = g_ptr_array_index(packages,i);
1201
 
                
 
1197
 
1202
1198
                if (name_major == pkg->id) {
1203
1199
                        break;
1204
1200
                } else {
1205
1201
                        pkg = NULL;
1206
1202
                }
1207
1203
        }
1208
 
        
 
1204
 
1209
1205
        if (! pkg ) pkg = &no_package;
1210
1206
 
1211
1207
        hf_param = *(pkg->hfid_params);
1212
1208
 
1213
1209
        if (hf_param > 0)
1214
1210
                /* TODO: Will this ever happen now??*/
1215
 
                proto_tree_add_uint(package_tree, hf_param, tvb, offset-2, 2, name_minor); 
1216
 
        
 
1211
                proto_tree_add_uint(package_tree, hf_param, tvb, offset-2, 2, name_minor);
 
1212
 
1217
1213
  } else {
1218
1214
          pkg = &no_package;
1219
1215
  }
1220
 
  
 
1216
 
1221
1217
  curr_info.pkg = pkg;
1222
 
  
 
1218
 
1223
1219
  return offset;
1224
1220
}
1225
1221
 
1233
1229
  h248_package_t* pkg = NULL;
1234
1230
  h248_pkg_evt_t* evt = NULL;
1235
1231
  guint i;
1236
 
  
 
1232
 
1237
1233
  old_offset=offset;
1238
1234
  offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index, &new_tvb);
1239
1235
 
1250
1246
    }
1251
1247
    proto_tree_add_uint(package_tree, hf_h248_event_name, tvb, offset-4, 4, packageandid);
1252
1248
 
1253
 
    
 
1249
 
1254
1250
        for(i=0; i < packages->len; i++) {
1255
1251
                pkg = g_ptr_array_index(packages,i);
1256
 
                
 
1252
 
1257
1253
                if (name_major == pkg->id) {
1258
1254
                        break;
 
1255
                } else {
 
1256
                        pkg = NULL;
1259
1257
                }
1260
1258
        }
1261
 
        
1262
 
        if (!pkg->hfid) pkg = &no_package;
 
1259
 
 
1260
        if (! pkg ) pkg = &no_package;
1263
1261
 
1264
1262
        curr_info.pkg = pkg;
1265
1263
 
1274
1272
        } else {
1275
1273
                evt = &no_event;
1276
1274
        }
1277
 
        
 
1275
 
1278
1276
        curr_info.evt = evt;
1279
 
        
 
1277
 
1280
1278
  } else {
1281
1279
          curr_info.pkg = &no_package;
1282
1280
          curr_info.evt = &no_event;
1283
1281
  }
1284
 
  
 
1282
 
1285
1283
  return offset;
1286
1284
}
1287
1285
 
1315
1313
 
1316
1314
    for(i=0; i < packages->len; i++) {
1317
1315
                pkg = g_ptr_array_index(packages,i);
1318
 
                
 
1316
 
1319
1317
                if (name_major == pkg->id) {
1320
1318
                        break;
1321
1319
                } else {
1322
1320
                        pkg = NULL;
1323
1321
                }
1324
1322
        }
1325
 
        
 
1323
 
1326
1324
        if (! pkg ) pkg = &no_package;
1327
 
        
 
1325
 
1328
1326
        if (pkg->signals) {
1329
1327
                for (sig = pkg->signals; sig->hfid; sig++) {
1330
1328
                        if (name_minor == sig->id) {
1331
1329
                                break;
1332
1330
                        }
1333
1331
                }
1334
 
        
 
1332
 
1335
1333
                if (! sig->hfid) sig = &no_signal;
1336
 
        
 
1334
 
1337
1335
                curr_info.pkg = pkg;
1338
1336
                curr_info.sig = sig;
1339
1337
        } else {
1340
1338
                curr_info.pkg = &no_package;
1341
1339
                curr_info.sig = &no_signal;
1342
1340
        }
1343
 
        
 
1341
 
1344
1342
  } else {
1345
1343
          curr_info.pkg = &no_package;
1346
1344
          curr_info.sig = &no_signal;
1347
1345
  }
1348
 
  
 
1346
 
1349
1347
  return offset;
1350
1348
}
1351
1349
 
1378
1376
        next_tvb = tvb_new_subset(tvb, offset , len , len );
1379
1377
        name_major = packageandid >> 16;
1380
1378
        name_minor = packageandid & 0xffff;
1381
 
        
 
1379
 
1382
1380
        pkg = (curr_info.pkg) ? curr_info.pkg : &no_package;
1383
 
        
 
1381
 
1384
1382
        if (pkg->properties) {
1385
 
                for (prop = pkg->properties; prop->hfid; prop++) {
 
1383
                for (prop = pkg->properties; prop && prop->hfid; prop++) {
1386
1384
                        if (name_minor == prop->id) {
1387
1385
                                break;
1388
1386
                        }
1390
1388
        } else {
1391
1389
                prop = &no_param;
1392
1390
        }
1393
 
        
1394
 
        if (prop) {
 
1391
 
 
1392
        if (prop && prop->hfid ) {
1395
1393
                if (!prop->dissector) prop = &no_param;
1396
1394
                prop->dissector(tree, next_tvb, pinfo, *(prop->hfid), &curr_info, prop->data);
1397
1395
        }
1398
 
        
 
1396
 
1399
1397
        return end_offset;
1400
1398
}
1401
1399
 
1405
1403
        tvbuff_t *next_tvb;
1406
1404
        guint32 param_id = 0xffffffff;
1407
1405
        h248_pkg_param_t* sigpar;
1408
 
        
 
1406
 
1409
1407
        offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset,  hf_index, &next_tvb);
1410
1408
        switch(tvb_length(next_tvb)) {
1411
1409
                case 4: param_id = tvb_get_ntohl(next_tvb,0); break;
1414
1412
                case 1: param_id = tvb_get_guint8(next_tvb,0); break;
1415
1413
                default: break;
1416
1414
        }
1417
 
        
 
1415
 
1418
1416
        curr_info.par = &no_param;
1419
 
        
 
1417
 
1420
1418
        if (curr_info.sig && curr_info.sig->parameters) {
1421
1419
                for(sigpar = curr_info.sig->parameters; sigpar->hfid; sigpar++) {
1422
1420
                        if (sigpar->id == param_id) {
1425
1423
                        }
1426
1424
                }
1427
1425
        }
1428
 
        
 
1426
 
1429
1427
        return offset;
1430
1428
}
1431
1429
 
1437
1435
        gboolean pc, ind;
1438
1436
        gint32 tag;
1439
1437
        guint32 len;
1440
 
        
 
1438
 
1441
1439
        old_offset=offset;
1442
1440
        offset=dissect_ber_identifier(pinfo, tree, tvb, offset, &class, &pc, &tag);
1443
1441
        offset=dissect_ber_length(pinfo, tree, tvb, offset, &len, &ind);
1444
1442
        end_offset=offset+len;
1445
 
        
 
1443
 
1446
1444
        if( (class!=BER_CLASS_UNI)
1447
1445
                ||(tag!=BER_UNI_TAG_OCTETSTRING) ){
1448
1446
                proto_tree_add_text(tree, tvb, offset-2, 2, "H.248 BER Error: OctetString expected but Class:%d PC:%d Tag:%d was unexpected", class, pc, tag);
1449
1447
                return end_offset;
1450
1448
        }
1451
 
        
1452
 
        
 
1449
 
 
1450
 
1453
1451
        next_tvb = tvb_new_subset(tvb,offset,len,len);
1454
 
        
 
1452
 
1455
1453
        if ( curr_info.par && curr_info.par->dissector) {
1456
1454
                curr_info.par->dissector(tree, next_tvb, pinfo, *(curr_info.par->hfid), &curr_info, curr_info.par->data);
1457
1455
        }
1476
1474
                        default: break;
1477
1475
                }
1478
1476
        }
1479
 
        
 
1477
 
1480
1478
        curr_info.par = &no_param;
1481
 
        
 
1479
 
1482
1480
        if (curr_info.evt->parameters) {
1483
1481
                for(evtpar = curr_info.evt->parameters; evtpar->hfid; evtpar++) {
1484
1482
                        if (evtpar->id == param_id) {
1489
1487
        } else {
1490
1488
                curr_info.par = &no_param;
1491
1489
        }
1492
 
        
 
1490
 
1493
1491
        return offset;
1494
1492
}
1495
1493
 
1501
1499
        gboolean pc, ind;
1502
1500
        gint32 tag;
1503
1501
        guint32 len;
1504
 
        
 
1502
 
1505
1503
        old_offset=offset;
1506
1504
        offset=dissect_ber_identifier(pinfo, tree, tvb, offset, &class, &pc, &tag);
1507
1505
        offset=dissect_ber_length(pinfo, tree, tvb, offset, &len, &ind);
1508
1506
        end_offset=offset+len;
1509
 
        
 
1507
 
1510
1508
        if( (class!=BER_CLASS_UNI)
1511
1509
                ||(tag!=BER_UNI_TAG_OCTETSTRING) ){
1512
1510
                proto_tree_add_text(tree, tvb, offset-2, 2, "H.248 BER Error: OctetString expected but Class:%d PC:%d Tag:%d was unexpected", class, pc, tag);
1513
1511
                return end_offset;
1514
1512
        }
1515
 
        
1516
 
        
 
1513
 
 
1514
 
1517
1515
        next_tvb = tvb_new_subset(tvb,offset,len,len);
1518
 
        
 
1516
 
1519
1517
        if ( curr_info.par && curr_info.par->dissector) {
1520
1518
                curr_info.par->dissector(tree, next_tvb, pinfo, *(curr_info.par->hfid), &curr_info, curr_info.par->data);
1521
1519
        }
1522
 
        
 
1520
 
1523
1521
        return end_offset;
1524
1522
}
1525
1523
 
1567
1565
        address* dst = &(pinfo->dst);
1568
1566
        address* lo_addr;
1569
1567
        address* hi_addr;
1570
 
        
1571
 
        
 
1568
 
 
1569
 
1572
1570
    if (keep_persistent_data) {
1573
1571
                emem_tree_key_t key[] = {
1574
1572
                        {1,&(framenum)},
1601
1599
                lo_addr = dst;
1602
1600
                hi_addr = src;
1603
1601
        }
1604
 
        
 
1602
 
1605
1603
        switch(lo_addr->type) {
1606
1604
                case AT_NONE:
1607
1605
                        m->lo_addr = 0;
1621
1619
                        m->lo_addr = g_str_hash(address_to_str(lo_addr));
1622
1620
                        break;
1623
1621
        }
1624
 
        
 
1622
 
1625
1623
    return m;
1626
1624
}
1627
1625
 
1649
1647
                                {1,&(t_id)},
1650
1648
                                {0,NULL}
1651
1649
                        };
1652
 
                        
 
1650
 
1653
1651
            trxmsg = se_alloc(sizeof(h248_trx_msg_t));
1654
1652
            t = se_tree_lookup32_array(trxs,key);
1655
1653
 
1703
1701
static h248_ctx_t* h248_ctx(h248_msg_t* m, h248_trx_t* t, guint32 c_id) {
1704
1702
    h248_ctx_t* context = NULL;
1705
1703
    h248_ctx_t** context_p = NULL;
1706
 
        
 
1704
 
1707
1705
    if ( !m || !t ) return NULL;
1708
1706
 
1709
1707
    if (keep_persistent_data) {
1713
1711
                {1,&(c_id)},
1714
1712
                {0,NULL}
1715
1713
                };
1716
 
                
 
1714
 
1717
1715
                emem_tree_key_t trx_key[] = {
1718
1716
                {1,&(m->hi_addr)},
1719
1717
                {1,&(m->lo_addr)},
1720
1718
                {1,&(t->id)},
1721
1719
                {0,NULL}
1722
1720
                };
1723
 
                
 
1721
 
1724
1722
        if (m->commited) {
1725
1723
            if (( context = se_tree_lookup32_array(ctxs_by_trx,trx_key) )) {
1726
1724
                return context;
2083
2081
    h248_cmd_msg_t* c;
2084
2082
 
2085
2083
    if ( !m || !t ) return "-";
2086
 
        
 
2084
 
2087
2085
        s = ep_strdup_printf("T %x { ",t->id);
2088
2086
 
2089
2087
    if (t->cmds) {
2607
2605
 
2608
2606
  return offset;
2609
2607
}
2610
 
static int dissect_contextList_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
2611
 
  return dissect_h248_ContextID(FALSE, tvb, offset, pinfo, tree, hf_h248_contextList_item);
2612
 
}
2613
2608
 
2614
2609
 
2615
2610
 
3035
3030
}
3036
3031
 
3037
3032
 
3038
 
static const ber_sequence_t SEQUENCE_OF_ContextID_sequence_of[1] = {
 
3033
 
 
3034
static int
 
3035
dissect_h248_ContextIDinList(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
 
3036
  offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
 
3037
                                  NULL);
 
3038
 
 
3039
  return offset;
 
3040
}
 
3041
static int dissect_contextList_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
 
3042
  return dissect_h248_ContextIDinList(FALSE, tvb, offset, pinfo, tree, hf_h248_contextList_item);
 
3043
}
 
3044
 
 
3045
 
 
3046
static const ber_sequence_t SEQUENCE_OF_ContextIDinList_sequence_of[1] = {
3039
3047
  { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_contextList_item },
3040
3048
};
3041
3049
 
3042
3050
static int
3043
 
dissect_h248_SEQUENCE_OF_ContextID(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
 
3051
dissect_h248_SEQUENCE_OF_ContextIDinList(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
3044
3052
  offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
3045
 
                                      SEQUENCE_OF_ContextID_sequence_of, hf_index, ett_h248_SEQUENCE_OF_ContextID);
 
3053
                                      SEQUENCE_OF_ContextIDinList_sequence_of, hf_index, ett_h248_SEQUENCE_OF_ContextIDinList);
3046
3054
 
3047
3055
  return offset;
3048
3056
}
3049
3057
static int dissect_contextList_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
3050
 
  return dissect_h248_SEQUENCE_OF_ContextID(TRUE, tvb, offset, pinfo, tree, hf_h248_contextList);
 
3058
  return dissect_h248_SEQUENCE_OF_ContextIDinList(TRUE, tvb, offset, pinfo, tree, hf_h248_contextList);
3051
3059
}
3052
3060
 
3053
3061
 
3466
3474
 
3467
3475
  return offset;
3468
3476
}
3469
 
static int dissect_serviceChangeReason_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
3470
 
  return dissect_h248_Value(TRUE, tvb, offset, pinfo, tree, hf_h248_serviceChangeReason);
3471
 
}
3472
3477
 
3473
3478
 
3474
3479
 
5368
5373
 
5369
5374
  return offset;
5370
5375
}
5371
 
static int dissect_profileName(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
5372
 
  return dissect_h248_IA5String_SIZE_1_67(FALSE, tvb, offset, pinfo, tree, hf_h248_profileName);
 
5376
static int dissect_profileName_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
 
5377
  return dissect_h248_IA5String_SIZE_1_67(TRUE, tvb, offset, pinfo, tree, hf_h248_profileName);
5373
5378
}
5374
5379
 
5375
5380
 
5376
5381
static const ber_sequence_t ServiceChangeProfile_sequence[] = {
5377
 
  { BER_CLASS_UNI, BER_UNI_TAG_IA5String, BER_FLAGS_NOOWNTAG, dissect_profileName },
 
5382
  { BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_profileName_impl },
5378
5383
  { 0, 0, 0, NULL }
5379
5384
};
5380
5385
 
5392
5397
 
5393
5398
 
5394
5399
static int
 
5400
dissect_h248_SCreasonValueOctetStr(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
 
5401
#line 271 "h248.cnf"
 
5402
 
 
5403
 tvbuff_t       *parameter_tvb;
 
5404
   offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
 
5405
                                       &parameter_tvb);
 
5406
 
 
5407
 
 
5408
 if (!parameter_tvb)
 
5409
        return offset;
 
5410
 
 
5411
 dissect_h248_ServiceChangeReasonStr(FALSE, parameter_tvb, 0, pinfo, tree, hf_h248_serviceChangeReasonStr);
 
5412
 
 
5413
 
 
5414
 
 
5415
  return offset;
 
5416
}
 
5417
static int dissect_SCreasonValue_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
 
5418
  return dissect_h248_SCreasonValueOctetStr(FALSE, tvb, offset, pinfo, tree, hf_h248_SCreasonValue_item);
 
5419
}
 
5420
 
 
5421
 
 
5422
static const ber_sequence_t SCreasonValue_sequence_of[1] = {
 
5423
  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_SCreasonValue_item },
 
5424
};
 
5425
 
 
5426
static int
 
5427
dissect_h248_SCreasonValue(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
 
5428
  offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
 
5429
                                      SCreasonValue_sequence_of, hf_index, ett_h248_SCreasonValue);
 
5430
 
 
5431
  return offset;
 
5432
}
 
5433
static int dissect_serviceChangeReason_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
 
5434
  return dissect_h248_SCreasonValue(TRUE, tvb, offset, pinfo, tree, hf_h248_serviceChangeReason);
 
5435
}
 
5436
 
 
5437
 
 
5438
 
 
5439
static int
5395
5440
dissect_h248_INTEGER_0_4294967295(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
5396
5441
  offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
5397
5442
                                  NULL);
6286
6331
}
6287
6332
 
6288
6333
 
 
6334
 
 
6335
static int
 
6336
dissect_h248_ServiceChangeReasonStr(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
 
6337
  offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
 
6338
                                            pinfo, tree, tvb, offset, hf_index,
 
6339
                                            NULL);
 
6340
 
 
6341
  return offset;
 
6342
}
 
6343
 
 
6344
 
6289
6345
/*--- End of included file: packet-h248-fn.c ---*/
6290
 
#line 1760 "packet-h248-template.c"
 
6346
#line 1756 "packet-h248-template.c"
6291
6347
 
6292
6348
static void
6293
6349
dissect_h248(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
6308
6364
    curr_info.stat = NULL;
6309
6365
    curr_info.par = NULL;
6310
6366
 
6311
 
    /* Check if it is actually a text based h248 encoding, which we call
6312
 
        megaco in ehtereal.
6313
 
        */
 
6367
    /* Check if it is actually a text-based H.248 encoding, which we
 
6368
       dissect with the "megaco" dissector in Wireshark.  (Both
 
6369
       encodings are MEGACO (RFC 3015) and both are H.248.)
 
6370
     */
6314
6371
    if(tvb_length(tvb)>=6){
6315
6372
        if(!tvb_strneql(tvb, 0, "MEGACO", 6)){
6316
6373
            static dissector_handle_t megaco_handle=NULL;
6346
6403
        if ( udp_port )
6347
6404
            dissector_delete("udp.port", udp_port, h248_handle);
6348
6405
        }
6349
 
    
 
6406
 
6350
6407
    udp_port = temp_udp_port;
6351
 
    
 
6408
 
6352
6409
    if ( udp_port ) {
6353
6410
                dissector_add("udp.port", udp_port, h248_handle);
6354
6411
        }
6355
 
    
 
6412
 
6356
6413
}
6357
6414
 
6358
6415
/*--- proto_register_h248 ----------------------------------------------*/
6420
6477
  { "Unknown Parameter", "h248.pkg.unknown.param",
6421
6478
          FT_BYTES, BASE_HEX, NULL, 0,
6422
6479
          "", HFILL }},
6423
 
          
 
6480
  { &hf_h248_serviceChangeReasonStr,
 
6481
      { "ServiceChangeReasonStr", "h248.serviceChangeReasonstr",
 
6482
        FT_STRING, BASE_NONE, NULL, 0,
 
6483
        "h248.IA5String", HFILL }},
 
6484
 
6424
6485
 
6425
6486
/*--- Included file: packet-h248-hfarr.c ---*/
6426
6487
#line 1 "packet-h248-hfarr.c"
6655
6716
    { &hf_h248_contextList,
6656
6717
      { "contextList", "h248.contextList",
6657
6718
        FT_UINT32, BASE_DEC, NULL, 0,
6658
 
        "h248.SEQUENCE_OF_ContextID", HFILL }},
 
6719
        "h248.SEQUENCE_OF_ContextIDinList", HFILL }},
6659
6720
    { &hf_h248_contextList_item,
6660
6721
      { "Item", "h248.contextList_item",
6661
6722
        FT_UINT32, BASE_DEC, NULL, 0,
6662
 
        "h248.ContextID", HFILL }},
 
6723
        "h248.ContextIDinList", HFILL }},
6663
6724
    { &hf_h248_topology,
6664
6725
      { "topology", "h248.topology",
6665
6726
        FT_NONE, BASE_NONE, NULL, 0,
7479
7540
    { &hf_h248_serviceChangeReason,
7480
7541
      { "serviceChangeReason", "h248.serviceChangeReason",
7481
7542
        FT_UINT32, BASE_DEC, NULL, 0,
7482
 
        "h248.Value", HFILL }},
 
7543
        "h248.SCreasonValue", HFILL }},
7483
7544
    { &hf_h248_serviceChangeDelay,
7484
7545
      { "serviceChangeDelay", "h248.serviceChangeDelay",
7485
7546
        FT_UINT32, BASE_DEC, NULL, 0,
7500
7561
      { "serviceChangeIncompleteFlag", "h248.serviceChangeIncompleteFlag",
7501
7562
        FT_NONE, BASE_NONE, NULL, 0,
7502
7563
        "h248.NULL", HFILL }},
 
7564
    { &hf_h248_SCreasonValue_item,
 
7565
      { "Item", "h248.SCreasonValue_item",
 
7566
        FT_BYTES, BASE_HEX, NULL, 0,
 
7567
        "h248.SCreasonValueOctetStr", HFILL }},
7503
7568
    { &hf_h248_timestamp,
7504
7569
      { "timestamp", "h248.timestamp",
7505
7570
        FT_NONE, BASE_NONE, NULL, 0,
7634
7699
        "", HFILL }},
7635
7700
 
7636
7701
/*--- End of included file: packet-h248-hfarr.c ---*/
7637
 
#line 1894 "packet-h248-template.c"
 
7702
#line 1895 "packet-h248-template.c"
7638
7703
 
7639
7704
  { &hf_h248_ctx, { "Context", "h248.ctx", FT_UINT32, BASE_HEX, NULL, 0, "", HFILL }},
7640
7705
  { &hf_h248_ctx_term, { "Termination", "h248.ctx.term", FT_STRING, BASE_NONE, NULL, 0, "", HFILL }},
7689
7754
    &ett_h248_ContextRequest,
7690
7755
    &ett_h248_T_topologyReq,
7691
7756
    &ett_h248_SEQUENCE_OF_PropertyParm,
7692
 
    &ett_h248_SEQUENCE_OF_ContextID,
 
7757
    &ett_h248_SEQUENCE_OF_ContextIDinList,
7693
7758
    &ett_h248_ContextAttrAuditRequest,
7694
7759
    &ett_h248_SEQUENCE_OF_IndAudPropertyParm,
7695
7760
    &ett_h248_SelectLogic,
7788
7853
    &ett_h248_DigitMapDescriptor,
7789
7854
    &ett_h248_DigitMapValue,
7790
7855
    &ett_h248_ServiceChangeParm,
 
7856
    &ett_h248_SCreasonValue,
7791
7857
    &ett_h248_ServiceChangeAddress,
7792
7858
    &ett_h248_ServiceChangeResParm,
7793
7859
    &ett_h248_ServiceChangeProfile,
7802
7868
    &ett_h248_Value,
7803
7869
 
7804
7870
/*--- End of included file: packet-h248-ettarr.c ---*/
7805
 
#line 1919 "packet-h248-template.c"
 
7871
#line 1920 "packet-h248-template.c"
7806
7872
  };
7807
7873
 
7808
7874
  module_t *h248_module;
7826
7892
                                 "Port to be decoded as h248",
7827
7893
                                 10,
7828
7894
                                 &temp_udp_port);
7829
 
  
 
7895
 
7830
7896
  register_init_routine( &h248_init );
7831
7897
 
7832
7898
  msgs = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "h248_msgs");