From f695468fa2ca54a888d11bf61865f74d9c444cc8 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 21 Aug 2003 18:00:22 +0000 Subject: [PATCH] From Tomas Kukosa: allow subdissectors to be registered for NonStandardParameter data in the H.245 dissector. svn path=/trunk/; revision=8206 --- Makefile.am | 4 +- Makefile.nmake | 3 +- adler32.c | 57 ++++++++++++++++++++++ adler32.h | 40 ++++++++++++++++ packet-h225.c | 82 +++++++++++++++---------------- packet-h245.c | 127 +++++++++++++++++++++++++++++++++---------------- packet-per.c | 62 +++++++++++++++++------- packet-per.h | 6 +-- 8 files changed, 277 insertions(+), 104 deletions(-) create mode 100644 adler32.c create mode 100644 adler32.h diff --git a/Makefile.am b/Makefile.am index 0f8e44347a..1d3613fdfb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am # Automake file for Ethereal # -# $Id: Makefile.am,v 1.608 2003/08/17 00:54:24 guy Exp $ +# $Id: Makefile.am,v 1.609 2003/08/21 18:00:20 guy Exp $ # # Ethereal - Network traffic analyzer # By Gerald Combs @@ -688,6 +688,8 @@ noinst_HEADERS = \ packet-ypxfr.h ETHEREAL_COMMON_SRC = \ + adler32.c \ + adler32.h \ afn.c \ afn.h \ aftypes.h \ diff --git a/Makefile.nmake b/Makefile.nmake index 408af0ffa4..c808e94766 100644 --- a/Makefile.nmake +++ b/Makefile.nmake @@ -1,7 +1,7 @@ ## Makefile for building ethereal.exe with Microsoft C and nmake ## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake # -# $Id: Makefile.nmake,v 1.323 2003/08/17 00:54:24 guy Exp $ +# $Id: Makefile.nmake,v 1.324 2003/08/21 18:00:21 guy Exp $ include config.nmake include @@ -393,6 +393,7 @@ TETHEREAL_TAP_SRC = \ TETHEREAL_TAP_OBJECTS = $(TETHEREAL_TAP_SRC:.c=.obj) ETHEREAL_COMMON_OBJECTS = \ + adler32.obj \ afn.obj \ asn1.obj \ capture_stop_conditions.obj \ diff --git a/adler32.c b/adler32.c new file mode 100644 index 0000000000..9d259ac478 --- /dev/null +++ b/adler32.c @@ -0,0 +1,57 @@ +/* adler32.c + * Compute the Adler32 checksum (RFC 1950) + * 2003 Tomas Kukosa + * Based on code from RFC 1950 (Chapter 9. Appendix: Sample code) + * + * Ethereal - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include + +#include "adler32.h" + +#define BASE 65521 /* largest prime smaller than 65536 */ + +/*--- update_adler32 --------------------------------------------------------*/ +unsigned long update_adler32(unsigned long adler, const unsigned char *buf, int len) +{ + unsigned long s1 = adler & 0xffff; + unsigned long s2 = (adler >> 16) & 0xffff; + int n; + + for (n = 0; n < len; n++) { + s1 = (s1 + buf[n]) % BASE; + s2 = (s2 + s1) % BASE; + } + return (s2 << 16) + s1; +} + +/*--- adler32 ---------------------------------------------------------------*/ +unsigned long adler32_bytes(unsigned char *buf, int len) +{ + return update_adler32(1L, buf, len); +} + +/*--- adler32_str -----------------------------------------------------------*/ +unsigned long adler32_str(const char *buf) +{ + return update_adler32(1L, (unsigned char*)buf, strlen(buf)); +} + +/*---------------------------------------------------------------------------*/ diff --git a/adler32.h b/adler32.h new file mode 100644 index 0000000000..68305f5011 --- /dev/null +++ b/adler32.h @@ -0,0 +1,40 @@ +/* adler32.h + * Compute the Adler32 checksum (RFC 1950) + * 2003 Tomas Kukosa + * + * Ethereal - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef ADLER32_H +#define ADLER32_H + +#ifdef __cplusplus +extern "C"{ +#endif + +unsigned long update_adler32(unsigned long adler, const unsigned char *buf, int len); +unsigned long adler32_bytes(unsigned char *buf, int len); +unsigned long adler32_str(const char *buf); + +#ifdef __cplusplus +} +#endif + +#endif /* ADLER32_H */ + diff --git a/packet-h225.c b/packet-h225.c index 2ac2cb0118..a9cf974ddd 100644 --- a/packet-h225.c +++ b/packet-h225.c @@ -2,7 +2,7 @@ * Routines for H.225 packet dissection * 2003 Ronnie Sahlberg * - * $Id: packet-h225.c,v 1.5 2003/08/10 19:43:25 guy Exp $ + * $Id: packet-h225.c,v 1.6 2003/08/21 18:00:21 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -2044,7 +2044,7 @@ dissect_h225_TerminalInfo(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_t static int dissect_h225_h248Message(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_h248Message, -1, -1); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_h248Message, -1, -1, NULL, NULL); return offset; } @@ -2071,7 +2071,7 @@ dissect_h225_StimulusControl(tvbuff_t *tvb, int offset, packet_info *pinfo, prot static int dissect_h225_conferenceID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_conferenceID, 16, 16); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_conferenceID, 16, 16, NULL, NULL); return offset; } @@ -2080,7 +2080,7 @@ dissect_h225_conferenceID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_t static int dissect_h225_replaceWithConferenceInvite(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_replaceWithConferenceInvite, 16, 16); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_replaceWithConferenceInvite, 16, 16, NULL, NULL); return offset; } @@ -2364,7 +2364,7 @@ dissect_h225_ipSourceRoute(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_ static int dissect_h225_ipxNode(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_ipxNode, 6, 6); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_ipxNode, 6, 6, NULL, NULL); return offset; } @@ -2373,7 +2373,7 @@ dissect_h225_ipxNode(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree * static int dissect_h225_ipxNetnum(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_ipxNetnum, 4, 4); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_ipxNetnum, 4, 4, NULL, NULL); return offset; } @@ -2381,7 +2381,7 @@ dissect_h225_ipxNetnum(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree static int dissect_h225_ipxPort(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_ipxPort, 2, 2); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_ipxPort, 2, 2, NULL, NULL); return offset; } @@ -2405,7 +2405,7 @@ dissect_h225_ipxAddress(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tre static int dissect_h225_ipv6Address_ip(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_ipv6Address_ip, 16, 16); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_ipv6Address_ip, 16, 16, NULL, NULL); return offset; } @@ -2440,7 +2440,7 @@ dissect_h225_ip6Address(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tre static int dissect_h225_netBios(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_netBios, 16, 16); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_netBios, 16, 16, NULL, NULL); return offset; } @@ -2450,7 +2450,7 @@ dissect_h225_netBios(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree * static int dissect_h225_nsap(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_nsap, 1, 20); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_nsap, 1, 20, NULL, NULL); return offset; } @@ -2616,7 +2616,7 @@ dissect_h225_carrierName(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr static int dissect_h225_carrierIdentificationCode(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_carrierIdentificationCode, 3, 4); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_carrierIdentificationCode, 3, 4, NULL, NULL); return offset; } @@ -2675,7 +2675,7 @@ dissect_h225_InfoRequestResponseStatus(tvbuff_t *tvb, int offset, packet_info *p static int dissect_h225_guid(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_guid, 16, 16); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_guid, 16, 16, NULL, NULL); return offset; } @@ -2695,7 +2695,7 @@ dissect_h225_CallIdentifier(tvbuff_t *tvb, int offset, packet_info *pinfo, proto static int dissect_h225_globalCallId(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_globalCallId, 16, 16); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_globalCallId, 16, 16, NULL, NULL); return offset; } @@ -2703,7 +2703,7 @@ dissect_h225_globalCallId(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_t static int dissect_h225_threadId(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_threadId, 16, 16); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_threadId, 16, 16, NULL, NULL); return offset; } @@ -3139,7 +3139,7 @@ dissect_h225_cryptoTokens(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_t static int dissect_h225_ProtocolIdentifier(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h225_ProtocolIdentifier); + offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h225_ProtocolIdentifier, NULL); return offset; } @@ -3224,7 +3224,7 @@ dissect_h225_imsi(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tre static int dissect_h225_tmsi(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_tmsi, 1, 4); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_tmsi, 1, 4, NULL, NULL); return offset; } @@ -3355,21 +3355,21 @@ dissect_h225_mscid(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr static int dissect_h225_systemMyTypeCode(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_systemMyTypeCode, 1, 1); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_systemMyTypeCode, 1, 1, NULL, NULL); return offset; } static int dissect_h225_systemAccessType(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_systemAccessType, 1, 1); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_systemAccessType, 1, 1, NULL, NULL); return offset; } static int dissect_h225_qualificationInformationCode(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_qualificationInformationCode, 1, 1); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_qualificationInformationCode, 1, 1, NULL, NULL); return offset; } @@ -4028,7 +4028,7 @@ dissect_h225_mcu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree static int dissect_h225_tunnelledProtocolObjectID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h225_tunnelledProtocolObjectID); + offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h225_tunnelledProtocolObjectID, NULL); return offset; } @@ -4077,14 +4077,14 @@ dissect_h225_desiredTunnelledProtocol(tvbuff_t *tvb, int offset, packet_info *pi static int dissect_h225_CicInfo_cic_item(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_CicInfo_cic_item, 2, 4); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_CicInfo_cic_item, 2, 4, NULL, NULL); return offset; } static int dissect_h225_CicInfo_pointCode(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_CicInfo_pointCode, 2, 5); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_CicInfo_pointCode, 2, 5, NULL, NULL); return offset; } @@ -4181,7 +4181,7 @@ dissect_h225_Generic_standard(tvbuff_t *tvb, int offset, packet_info *pinfo, pro static int dissect_h225_Generic_oid(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h225_Generic_oid); + offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h225_Generic_oid, NULL); return offset; } @@ -4189,7 +4189,7 @@ dissect_h225_Generic_oid(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr static int dissect_h225_Generic_nonStandard(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_Generic_nonStandard, 16, 16); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_Generic_nonStandard, 16, 16, NULL, NULL); return offset; } @@ -4269,7 +4269,7 @@ dissect_h225_FeatureDescriptor(tvbuff_t *tvb, int offset, packet_info *pinfo, pr static int dissect_h225_Content_raw(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_Content_raw, -1, -1); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_Content_raw, -1, -1, NULL, NULL); return offset; } @@ -4616,21 +4616,21 @@ dissect_h225_CallCapacity(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_t static int dissect_h225_productID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_productID, 1, 256); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_productID, 1, 256, NULL, NULL); return offset; } static int dissect_h225_versionID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_versionID, 1, 256); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_versionID, 1, 256, NULL, NULL); return offset; } static int dissect_h225_enterpriseNumber(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h225_enterpriseNumber); + offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h225_enterpriseNumber, NULL); return offset; } @@ -4735,7 +4735,7 @@ dissect_h225_BandwidthDetails(tvbuff_t *tvb, int offset, packet_info *pinfo, pro static int dissect_h225_releaseCompleteCauseIE(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_releaseCompleteCauseIE, 2, 32); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_releaseCompleteCauseIE, 2, 32, NULL, NULL); return offset; } @@ -4911,7 +4911,7 @@ dissect_h225_AdmissionRejectReason(tvbuff_t *tvb, int offset, packet_info *pinfo static int dissect_h225_isoAlgorithm(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h225_isoAlgorithm); + offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h225_isoAlgorithm, NULL); return offset; } @@ -4943,7 +4943,7 @@ dissect_h225_hMAC_iso10118_2_l(tvbuff_t *tvb, int offset, packet_info *pinfo, pr static int dissect_h225_hMAC_iso10118_3(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h225_hMAC_iso10118_3); + offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h225_hMAC_iso10118_3, NULL); return offset; } @@ -4976,7 +4976,7 @@ dissect_h225_NonIsoIntegrityMechanism(tvbuff_t *tvb, int offset, packet_info *pi static int dissect_h225_iso9797(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h225_iso9797); + offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h225_iso9797, NULL); return offset; } @@ -5324,7 +5324,7 @@ NOT_DECODED_YET("icv"); static int dissect_h225_algorithmOID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h225_algorithmOID); + offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h225_algorithmOID, NULL); return offset; } @@ -6055,7 +6055,7 @@ dissect_h225_ExtendedAliasAddress(tvbuff_t *tvb, int offset, packet_info *pinfo, static int dissect_h225_messageNotUnderstood(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_messageNotUnderstood, -1, -1); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_messageNotUnderstood, -1, -1, NULL, NULL); return offset; } @@ -6336,7 +6336,7 @@ dissect_h225_RequestInProgress(tvbuff_t *tvb, int offset, packet_info *pinfo, pr static int dissect_h225_H248SignalsDescriptor(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_H248SignalsDescriptor, -1, -1); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_H248SignalsDescriptor, -1, -1, NULL, NULL); return offset; } @@ -6607,7 +6607,7 @@ dissect_h225_hopCount(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree static int dissect_h225_parallelH245Control_item(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_parallelH245Control_item, -1, -1); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_parallelH245Control_item, -1, -1, NULL, NULL); return offset; } @@ -7157,7 +7157,7 @@ dissect_h225_keepAlive(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree static int dissect_h225_H248PackagesDescriptor(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_H248PackagesDescriptor, -1, -1); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_H248PackagesDescriptor, -1, -1, NULL, NULL); return offset; } @@ -7555,7 +7555,7 @@ dissect_h225_admissionConfirmSequence(tvbuff_t *tvb, int offset, packet_info *pi static int dissect_h225_messageContent_item(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_messageContent_item, -1, -1); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_messageContent_item, -1, -1, NULL, NULL); return offset; } @@ -7591,7 +7591,7 @@ dissect_h225_tunnelledSignallingMessage(tvbuff_t *tvb, int offset, packet_info * static int dissect_h225_h4501SupplementaryService_item(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_h4501SupplementaryService_item, -1, -1); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_h4501SupplementaryService_item, -1, -1, NULL, NULL); return offset; } @@ -7614,7 +7614,7 @@ dissect_h225_h245Tunneling(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_ static int dissect_h225_h245Control_item(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_h245Control_item, -1, -1); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_h245Control_item, -1, -1, NULL, NULL); return offset; } @@ -7978,7 +7978,7 @@ dissect_h225_protocol_discriminator(tvbuff_t *tvb, int offset, packet_info *pinf static int dissect_h225_user_information(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_user_information, 1, 131); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h225_user_information, 1, 131, NULL, NULL); return offset; } diff --git a/packet-h245.c b/packet-h245.c index 33c0013b8e..01e0914843 100644 --- a/packet-h245.c +++ b/packet-h245.c @@ -4,7 +4,7 @@ * with great support with testing and providing capturefiles * from Martin Regner * - * $Id: packet-h245.c,v 1.29 2003/08/16 00:51:04 guy Exp $ + * $Id: packet-h245.c,v 1.30 2003/08/21 18:00:21 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -30,6 +30,7 @@ #endif #include +#include #include #include @@ -1458,10 +1459,18 @@ static gint ett_h245_lostPicture = -1; static gint ett_h245_recoveryReferencePicture = -1; static gint ett_h245_iPSourceRouteAddress_route = -1; +static dissector_table_t nsp_object_dissector_table; +static dissector_table_t nsp_h221_dissector_table; + +static dissector_handle_t nsp_handle; + static guint32 ipv4_address; static guint32 ipv4_port; - - +static char object[256]; +static guint32 t35CountryCode; +static guint32 t35Extension; +static guint32 manufacturerCode; +static guint32 h221NonStandard; static gboolean h245_reassembly = TRUE; @@ -7530,7 +7539,7 @@ dissect_h245_t35CountryCode(tvbuff_t *tvb, int offset, packet_info *pinfo, proto { offset=dissect_per_constrained_integer(tvb, offset, pinfo, tree, hf_h245_t35CountryCode, 0, 255, - NULL, NULL, FALSE); + &t35CountryCode, NULL, FALSE); return offset; } @@ -7541,7 +7550,7 @@ dissect_h245_t35Extension(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_t { offset=dissect_per_constrained_integer(tvb, offset, pinfo, tree, hf_h245_t35Extension, 0, 255, - NULL, NULL, FALSE); + &t35Extension, NULL, FALSE); return offset; } @@ -7553,7 +7562,7 @@ dissect_h245_manufacturerCode(tvbuff_t *tvb, int offset, packet_info *pinfo, pro { offset=dissect_per_constrained_integer(tvb, offset, pinfo, tree, hf_h245_manufacturerCode, 0, 65535, - NULL, NULL, FALSE); + &manufacturerCode, NULL, FALSE); return offset; } @@ -7573,8 +7582,14 @@ static per_sequence_t h221NonStandard_sequence[] = { int dissect_h245_h221NonStandard(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + t35CountryCode = 0; + t35Extension = 0; + manufacturerCode = 0; + offset=dissect_per_sequence(tvb, offset, pinfo, tree, hf_h245_h221NonStandard, ett_h245_h221NonStandard, h221NonStandard_sequence); + h221NonStandard = ((t35CountryCode * 256) + t35Extension) * 65536 + manufacturerCode; + return offset; } @@ -12352,7 +12367,7 @@ dissect_h245_MultilinkIndication_crcDesired(tvbuff_t *tvb, int offset, packet_in static int dissect_h245_object(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h245_object); + offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h245_object, object); return offset; } @@ -12361,7 +12376,7 @@ dissect_h245_object(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t static int dissect_h245_protocolIdentifier(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h245_protocolIdentifier); + offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h245_protocolIdentifier, NULL); return offset; } @@ -12371,7 +12386,7 @@ dissect_h245_protocolIdentifier(tvbuff_t *tvb, int offset, packet_info *pinfo, p static int dissect_h245_algorithm(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h245_algorithm); + offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h245_algorithm, NULL); return offset; } @@ -12381,7 +12396,7 @@ dissect_h245_algorithm(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree static int dissect_h245_antiSpamAlgorithm(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h245_antiSpamAlgorithm); + offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h245_antiSpamAlgorithm, NULL); return offset; } @@ -12391,7 +12406,7 @@ dissect_h245_antiSpamAlgorithm(tvbuff_t *tvb, int offset, packet_info *pinfo, pr static int dissect_h245_standard_object(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h245_standard_object); + offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h245_standard_object, NULL); return offset; } @@ -12400,7 +12415,7 @@ dissect_h245_standard_object(tvbuff_t *tvb, int offset, packet_info *pinfo, prot static int dissect_h245_oid(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h245_oid); + offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h245_oid, NULL); return offset; } @@ -12410,7 +12425,7 @@ dissect_h245_oid(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree static int dissect_h245_escrowID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h245_escrowID); + offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h245_escrowID, NULL); return offset; } @@ -12420,7 +12435,7 @@ dissect_h245_escrowID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree static int dissect_h245_field(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h245_field); + offset=dissect_per_object_identifier(tvb, offset, pinfo, tree, hf_h245_field, NULL); return offset; } @@ -12442,7 +12457,23 @@ static per_choice_t NonStandardIdentifier_choice[] = { static int dissect_h245_NonStandardIdentifier(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_choice(tvb, offset, pinfo, tree, hf_h245_NonStandardIdentifier, ett_h245_NonStandardIdentifier, NonStandardIdentifier_choice, "NonStandardIdentifier", NULL); + guint32 value; + + *object = '\0'; + h221NonStandard = 0; + + offset=dissect_per_choice(tvb, offset, pinfo, tree, hf_h245_NonStandardIdentifier, ett_h245_NonStandardIdentifier, NonStandardIdentifier_choice, "NonStandardIdentifier", &value); + + switch (value) { + case 0 : /* object */ + nsp_handle = dissector_get_port_handle(nsp_object_dissector_table, adler32_str(object)); + break; + case 1 : /* h221NonStandard */ + nsp_handle = dissector_get_port_handle(nsp_h221_dissector_table, h221NonStandard); + break; + default : + nsp_handle = NULL; + } return offset; } @@ -12451,7 +12482,16 @@ dissect_h245_NonStandardIdentifier(tvbuff_t *tvb, int offset, packet_info *pinfo static int dissect_h245_NonStandardParameterData(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_NonStandardParameterData, -1, -1); + guint32 value_offset, value_len; + tvbuff_t *next_tvb; + + if (nsp_handle) { + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, -1, -1, -1, &value_offset, &value_len); + next_tvb = tvb_new_subset(tvb, value_offset, value_len, value_len); + call_dissector(nsp_handle, next_tvb, pinfo, tree); + } else { + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_NonStandardParameterData, -1, -1, NULL, NULL); + } return offset; } @@ -12461,7 +12501,7 @@ dissect_h245_NonStandardParameterData(tvbuff_t *tvb, int offset, packet_info *pi static int dissect_h245_nlpidData(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_nlpidData, -1, -1); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_nlpidData, -1, -1, NULL, NULL); return offset; } @@ -12471,7 +12511,7 @@ dissect_h245_nlpidData(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree static int dissect_h245_nonCollapsingRaw(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_nonCollapsingRaw, -1, -1); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_nonCollapsingRaw, -1, -1, NULL, NULL); return offset; } @@ -12480,7 +12520,7 @@ dissect_h245_nonCollapsingRaw(tvbuff_t *tvb, int offset, packet_info *pinfo, pro static int dissect_h245_uuid(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_uuid, 16, 16); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_uuid, 16, 16, NULL, NULL); return offset; } @@ -12490,7 +12530,7 @@ dissect_h245_uuid(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tre static int dissect_h245_octetString(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_octetString, -1, -1); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_octetString, -1, -1, NULL, NULL); return offset; } @@ -12500,7 +12540,7 @@ dissect_h245_octetString(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr static int dissect_h245_externalReference(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_externalReference, 1, 255); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_externalReference, 1, 255, NULL, NULL); return offset; } @@ -12510,7 +12550,7 @@ dissect_h245_externalReference(tvbuff_t *tvb, int offset, packet_info *pinfo, pr static int dissect_h245_nsapAddress(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_nsapAddress, 1, 20); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_nsapAddress, 1, 20, NULL, NULL); return offset; } @@ -12520,7 +12560,7 @@ dissect_h245_nsapAddress(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr static int dissect_h245_subaddress_1_20(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_subaddress_1_20, 1, 20); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_subaddress_1_20, 1, 20, NULL, NULL); return offset; } @@ -12530,7 +12570,7 @@ dissect_h245_subaddress_1_20(tvbuff_t *tvb, int offset, packet_info *pinfo, prot static int dissect_h245_programDescriptors(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_programDescriptors, -1, -1); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_programDescriptors, -1, -1, NULL, NULL); return offset; } @@ -12539,7 +12579,7 @@ dissect_h245_programDescriptors(tvbuff_t *tvb, int offset, packet_info *pinfo, p static int dissect_h245_streamDescriptors(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_streamDescriptors, -1, -1); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_streamDescriptors, -1, -1, NULL, NULL); return offset; } @@ -12565,7 +12605,7 @@ dissect_h245_ipv4network(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, prot static int dissect_h245_ipxNode(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_ipxNode, 6, 6); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_ipxNode, 6, 6, NULL, NULL); return offset; } @@ -12574,7 +12614,7 @@ dissect_h245_ipxNode(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree * static int dissect_h245_ipxNetnum(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_ipxNetnum, 4, 4); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_ipxNetnum, 4, 4, NULL, NULL); return offset; } @@ -12584,7 +12624,7 @@ dissect_h245_ipxNetnum(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree static int dissect_h245_ipv6network(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_ipv6network, 16, 16); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_ipv6network, 16, 16, NULL, NULL); return offset; } @@ -12593,7 +12633,7 @@ dissect_h245_ipv6network(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr static int dissect_h245_netBios(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_netBios, 16, 16); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_netBios, 16, 16, NULL, NULL); return offset; } @@ -12603,7 +12643,7 @@ dissect_h245_netBios(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree * static int dissect_h245_nsap(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_nsap, 1, 20); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_nsap, 1, 20, NULL, NULL); return offset; } @@ -12613,7 +12653,7 @@ dissect_h245_nsap(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tre static int dissect_h245_h235Key(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_h235Key, 1, 65535); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_h235Key, 1, 65535, NULL, NULL); return offset; } @@ -12622,7 +12662,7 @@ dissect_h245_h235Key(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree * static int dissect_h245_value(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_value, 1, 65535); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_value, 1, 65535, NULL, NULL); return offset; } @@ -12632,7 +12672,7 @@ dissect_h245_value(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr static int dissect_h245_certificateResponse(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_certificateResponse, 1, 65535); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_certificateResponse, 1, 65535, NULL, NULL); return offset; } @@ -12642,7 +12682,7 @@ dissect_h245_certificateResponse(tvbuff_t *tvb, int offset, packet_info *pinfo, static int dissect_h245_TerminalID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_TerminalID, 1, 128); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_TerminalID, 1, 128, NULL, NULL); return offset; } @@ -12651,7 +12691,7 @@ dissect_h245_TerminalID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tre static int dissect_h245_ConferenceID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_ConferenceID, 1, 32); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_ConferenceID, 1, 32, NULL, NULL); return offset; } @@ -12660,7 +12700,7 @@ dissect_h245_ConferenceID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_t static int dissect_h245_Password(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_Password, 1, 32); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_Password, 1, 32, NULL, NULL); return offset; } @@ -12670,7 +12710,7 @@ dissect_h245_Password(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree static int dissect_h245_encryptionSE(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_encryptionSE, -1, -1); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_encryptionSE, -1, -1, NULL, NULL); return offset; } @@ -12679,7 +12719,7 @@ dissect_h245_encryptionSE(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_t static int dissect_h245_conferenceIdentifier(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_conferenceIdentifier, 1, 16); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_conferenceIdentifier, 1, 16, NULL, NULL); return offset; } @@ -12689,7 +12729,7 @@ dissect_h245_conferenceIdentifier(tvbuff_t *tvb, int offset, packet_info *pinfo, static int dissect_h245_returnedFunction(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_returnedFunction, -1, -1); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_returnedFunction, -1, -1, NULL, NULL); return offset; } @@ -12699,7 +12739,7 @@ dissect_h245_returnedFunction(tvbuff_t *tvb, int offset, packet_info *pinfo, pro static int dissect_h245_productNumber(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_productNumber, 1, 256); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_productNumber, 1, 256, NULL, NULL); return offset; } @@ -12709,7 +12749,7 @@ dissect_h245_productNumber(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_ static int dissect_h245_versionNumber(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_versionNumber, 1, 256); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_h245_versionNumber, 1, 256, NULL, NULL); return offset; } @@ -13083,6 +13123,8 @@ static per_sequence_t NonStandardParameter_sequence[] = { int dissect_h245_NonStandardParameter(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + nsp_handle = NULL; + offset=dissect_per_sequence(tvb, offset, pinfo, tree, hf_h245_NonStandardParameter, ett_h245_NonStandardParameter, NonStandardParameter_sequence); return offset; @@ -22246,6 +22288,9 @@ proto_register_h245(void) &h245_reassembly); register_dissector("h245dg", dissect_h245_MultimediaSystemControlMessage, proto_h245); register_dissector("h245", dissect_h245, proto_h245); + + nsp_object_dissector_table = register_dissector_table("h245.nsp.object", "H.245 NonStandardParameter (object)", FT_UINT32, BASE_HEX); + nsp_h221_dissector_table = register_dissector_table("h245.nsp.h221", "H.245 NonStandardParameter (h221)", FT_UINT32, BASE_HEX); } void diff --git a/packet-per.c b/packet-per.c index 38f3f9e392..907c3e7aa7 100644 --- a/packet-per.c +++ b/packet-per.c @@ -7,7 +7,7 @@ proper helper routines * Routines for dissection of ASN.1 Aligned PER * 2003 Ronnie Sahlberg * - * $Id: packet-per.c,v 1.10 2003/07/31 10:26:35 sahlberg Exp $ + * $Id: packet-per.c,v 1.11 2003/08/21 18:00:22 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -257,7 +257,7 @@ DEBUG_ENTRY("dissect_per_sequence_of"); guint32 dissect_per_IA5String(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, int min_len, int max_len) { - offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index, min_len, max_len); + offset=dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index, min_len, max_len, NULL, NULL); return offset; } @@ -501,7 +501,7 @@ DEBUG_ENTRY("dissect_per_set_of"); /* this function reads a OBJECT IDENTIFIER */ guint32 -dissect_per_object_identifier(tvbuff_t *tvb, guint32 offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) +dissect_per_object_identifier(tvbuff_t *tvb, guint32 offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index, char *value_string) { int i,count; char str[256],*strp; @@ -560,6 +560,10 @@ NOT_DECODED_YET("too long octet_string"); proto_tree_add_string(tree, hf_index, tvb, (offset>>3)-count, count, str); + if (value_string) { + strcpy(value_string, str); + } + return offset; } @@ -1271,12 +1275,12 @@ DEBUG_ENTRY("dissect_per_sequence"); hf_index can either be a FT_BYTES or an FT_STRING */ guint32 -dissect_per_octet_string(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, int min_len, int max_len) +dissect_per_octet_string(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, int min_len, int max_len, guint32 *value_offset, guint32 *value_len) { guint32 length; header_field_info *hfi; - hfi=proto_registrar_get_nth(hf_index); + hfi = (hf_index==-1) ? NULL : proto_registrar_get_nth(hf_index); DEBUG_ENTRY("dissect_per_octet_string"); /* 16.5 if the length is 0 bytes there will be no encoding */ @@ -1306,10 +1310,18 @@ DEBUG_ENTRY("dissect_per_octet_string"); } } - if(hfi->type==FT_STRING){ - proto_tree_add_string(tree, hf_index, tvb, old_offset>>3, min_len+(offset&0x07)?1:0, bytes); - } else { - proto_tree_add_bytes(tree, hf_index, tvb, old_offset>>3, min_len+(offset&0x07)?1:0, bytes); + if (hfi) { + if(hfi->type==FT_STRING){ + proto_tree_add_string(tree, hf_index, tvb, old_offset>>3, min_len+(offset&0x07)?1:0, bytes); + } else { + proto_tree_add_bytes(tree, hf_index, tvb, old_offset>>3, min_len+(offset&0x07)?1:0, bytes); + } + } + if (value_offset) { + *value_offset = old_offset>>3; + } + if (value_len) { + *value_len = min_len+(offset&0x07)?1:0; } return offset; } @@ -1322,10 +1334,18 @@ DEBUG_ENTRY("dissect_per_octet_string"); /* 16.7 if length is fixed and less than to 64k*/ if((min_len==max_len)&&(min_len<65536)){ - if(hfi->type==FT_STRING){ - proto_tree_add_string(tree, hf_index, tvb, offset>>3, min_len, tvb_get_ptr(tvb, offset>>3, min_len)); - } else { - proto_tree_add_bytes(tree, hf_index, tvb, offset>>3, min_len, tvb_get_ptr(tvb, offset>>3, min_len)); + if (hfi) { + if(hfi->type==FT_STRING){ + proto_tree_add_string(tree, hf_index, tvb, offset>>3, min_len, tvb_get_ptr(tvb, offset>>3, min_len)); + } else { + proto_tree_add_bytes(tree, hf_index, tvb, offset>>3, min_len, tvb_get_ptr(tvb, offset>>3, min_len)); + } + } + if (value_offset) { + *value_offset = offset>>3; + } + if (value_len) { + *value_len = min_len; } offset+=min_len*8; return offset; @@ -1340,12 +1360,20 @@ DEBUG_ENTRY("dissect_per_octet_string"); offset=dissect_per_length_determinant(tvb, offset, pinfo, tree, hf_per_octet_string_length, &length); } if(length){ - if(hfi->type==FT_STRING){ - proto_tree_add_string(tree, hf_index, tvb, offset>>3, length, tvb_get_ptr(tvb, offset>>3, length)); - } else { - proto_tree_add_bytes(tree, hf_index, tvb, offset>>3, length, tvb_get_ptr(tvb, offset>>3, length)); + if (hfi) { + if(hfi->type==FT_STRING){ + proto_tree_add_string(tree, hf_index, tvb, offset>>3, length, tvb_get_ptr(tvb, offset>>3, length)); + } else { + proto_tree_add_bytes(tree, hf_index, tvb, offset>>3, length, tvb_get_ptr(tvb, offset>>3, length)); + } } } + if (value_offset) { + *value_offset = offset>>3; + } + if (value_len) { + *value_len = length; + } offset+=length*8; return offset; diff --git a/packet-per.h b/packet-per.h index d5d1dfe32a..1c4d3b5b89 100644 --- a/packet-per.h +++ b/packet-per.h @@ -2,7 +2,7 @@ * Routines for dissection of ASN.1 Aligned PER * 2003 Ronnie Sahlberg * - * $Id: packet-per.h,v 1.6 2003/07/31 10:26:36 sahlberg Exp $ + * $Id: packet-per.h,v 1.7 2003/08/21 18:00:22 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -77,7 +77,7 @@ guint32 dissect_per_constrained_set_of(tvbuff_t *tvb, guint32 offset, packet_inf guint32 dissect_per_set_of(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *parent_tree, int hf_index, gint ett_index, int (*func)(tvbuff_t *, int , packet_info *, proto_tree *)); -guint32 dissect_per_object_identifier(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index); +guint32 dissect_per_object_identifier(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, char *value_string); guint32 dissect_per_boolean(tvbuff_t *tvb, guint32 offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index, gboolean *bool, proto_item **item); @@ -89,6 +89,6 @@ guint32 dissect_per_choice(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, pr guint32 dissect_per_sequence(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *parent_tree, int hf_index, gint ett_index, per_sequence_t *sequence); -guint32 dissect_per_octet_string(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, int min_len, int max_len); +guint32 dissect_per_octet_string(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, int min_len, int max_len, guint32 *value_offset, guint32 *value_len); guint32 dissect_per_restricted_character_string(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, int min_len, int max_len, char *alphabet, int alphabet_length);