2003-07-12 22:35:21 +00:00
|
|
|
/* packet-per.h
|
|
|
|
* Routines for dissection of ASN.1 Aligned PER
|
|
|
|
* 2003 Ronnie Sahlberg
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
2003-07-12 22:35:21 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2003-07-12 22:35:21 +00:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2004-03-04 07:07:57 +00:00
|
|
|
#ifndef __PACKET_PER_H__
|
|
|
|
#define __PACKET_PER_H__
|
|
|
|
|
2006-05-22 11:49:50 +00:00
|
|
|
|
2004-05-17 20:03:36 +00:00
|
|
|
#define PER_NOT_DECODED_YET(x) \
|
2005-03-29 16:11:11 +00:00
|
|
|
proto_tree_add_text(tree, tvb, 0, 0, "something unknown here [%s]",x); \
|
2006-05-22 11:49:50 +00:00
|
|
|
if (check_col(actx->pinfo->cinfo, COL_INFO)){ \
|
|
|
|
col_append_fstr(actx->pinfo->cinfo, COL_INFO, "[UNKNOWN PER: %s]", x); \
|
2004-04-09 00:31:41 +00:00
|
|
|
} \
|
|
|
|
tvb_get_guint8(tvb, 9999);
|
2003-07-12 22:35:21 +00:00
|
|
|
|
2006-07-04 06:49:53 +00:00
|
|
|
typedef int (*per_type_fn)(tvbuff_t*, int, asn1_ctx_t*, proto_tree*, int);
|
2005-07-15 15:20:40 +00:00
|
|
|
|
2003-07-12 22:35:21 +00:00
|
|
|
/* in all functions here, offset is guint32 and is
|
|
|
|
byteposition<<3 + bitposition
|
|
|
|
*/
|
|
|
|
|
2005-11-14 13:05:17 +00:00
|
|
|
/* value for value and size constraints */
|
|
|
|
#define NO_BOUND -1
|
|
|
|
|
|
|
|
|
2003-07-12 22:35:21 +00:00
|
|
|
/* values for extensions */
|
2003-10-09 22:35:07 +00:00
|
|
|
#define ASN1_NO_EXTENSIONS 0
|
2006-07-04 06:49:53 +00:00
|
|
|
#define ASN1_EXTENSION_ROOT ASN1_EXT_ROOT
|
|
|
|
#define ASN1_NOT_EXTENSION_ROOT ASN1_EXT_EXT
|
2003-07-12 22:35:21 +00:00
|
|
|
|
|
|
|
/* value for optional */
|
2003-10-09 20:52:57 +00:00
|
|
|
#define ASN1_NOT_OPTIONAL 0
|
2006-07-04 06:49:53 +00:00
|
|
|
#define ASN1_OPTIONAL ASN1_OPT
|
2003-07-12 22:35:21 +00:00
|
|
|
|
|
|
|
typedef struct _per_choice_t {
|
2007-07-18 13:15:36 +00:00
|
|
|
gint value;
|
2006-06-29 15:26:41 +00:00
|
|
|
const int *p_id;
|
2003-07-12 22:35:21 +00:00
|
|
|
int extension;
|
2006-06-29 15:26:41 +00:00
|
|
|
per_type_fn func;
|
2003-07-12 22:35:21 +00:00
|
|
|
} per_choice_t;
|
|
|
|
|
|
|
|
typedef struct _per_sequence_t {
|
2006-06-29 15:26:41 +00:00
|
|
|
const int *p_id;
|
2003-07-12 22:35:21 +00:00
|
|
|
int extension;
|
|
|
|
int optional;
|
2006-06-29 15:26:41 +00:00
|
|
|
per_type_fn func;
|
2003-07-12 22:35:21 +00:00
|
|
|
} per_sequence_t;
|
|
|
|
|
2006-07-04 06:49:53 +00:00
|
|
|
extern guint32 dissect_per_length_determinant(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, guint32 *length);
|
2003-07-12 22:35:21 +00:00
|
|
|
|
2006-07-04 06:49:53 +00:00
|
|
|
extern guint32 dissect_per_null(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index);
|
2005-04-27 14:17:14 +00:00
|
|
|
|
2006-07-04 06:49:53 +00:00
|
|
|
extern guint32 dissect_per_GeneralString(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index);
|
2003-07-12 22:35:21 +00:00
|
|
|
|
2006-07-04 06:49:53 +00:00
|
|
|
extern guint32 dissect_per_sequence_of(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *parent_tree, int hf_index, gint ett_index, const per_sequence_t *seq);
|
2003-07-12 22:35:21 +00:00
|
|
|
|
2006-07-04 06:49:53 +00:00
|
|
|
extern guint32 dissect_per_IA5String(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len);
|
2003-07-12 22:35:21 +00:00
|
|
|
|
2006-07-04 06:49:53 +00:00
|
|
|
extern guint32 dissect_per_NumericString(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len);
|
2003-07-19 03:45:04 +00:00
|
|
|
|
2006-07-04 06:49:53 +00:00
|
|
|
extern guint32 dissect_per_PrintableString(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len);
|
2003-07-31 10:26:36 +00:00
|
|
|
|
2006-07-04 06:49:53 +00:00
|
|
|
extern guint32 dissect_per_VisibleString(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len);
|
2005-01-17 10:09:43 +00:00
|
|
|
|
2006-07-04 06:49:53 +00:00
|
|
|
extern guint32 dissect_per_BMPString(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len);
|
2003-07-13 01:43:33 +00:00
|
|
|
|
2007-05-02 12:13:29 +00:00
|
|
|
extern guint32 dissect_per_object_descriptor(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, tvbuff_t **value_tvb);
|
|
|
|
|
2006-07-04 06:49:53 +00:00
|
|
|
extern guint32 dissect_per_constrained_sequence_of(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *parent_tree, int hf_index, gint ett_index, const per_sequence_t *seq, int min_len, int max_len);
|
2003-07-12 22:35:21 +00:00
|
|
|
|
2006-07-04 06:49:53 +00:00
|
|
|
extern guint32 dissect_per_constrained_set_of(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *parent_tree, int hf_index, gint ett_index, const per_sequence_t *seq, int min_len, int max_len);
|
2003-07-12 22:35:21 +00:00
|
|
|
|
2006-07-04 06:49:53 +00:00
|
|
|
extern guint32 dissect_per_set_of(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *parent_tree, int hf_index, gint ett_index, const per_sequence_t *seq);
|
2003-07-12 22:35:21 +00:00
|
|
|
|
2006-07-04 06:49:53 +00:00
|
|
|
extern guint32 dissect_per_object_identifier(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, tvbuff_t **value_tvb);
|
|
|
|
extern guint32 dissect_per_object_identifier_str(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, const char **value_string);
|
2003-07-12 22:35:21 +00:00
|
|
|
|
2006-07-04 06:49:53 +00:00
|
|
|
extern guint32 dissect_per_boolean(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, gboolean *bool);
|
2003-07-12 22:35:21 +00:00
|
|
|
|
2006-07-04 06:49:53 +00:00
|
|
|
extern guint32 dissect_per_integer(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, gint32 *value);
|
2003-07-12 22:35:21 +00:00
|
|
|
|
2006-07-04 06:49:53 +00:00
|
|
|
extern guint32 dissect_per_constrained_integer(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, guint32 min, guint32 max, guint32 *value, gboolean has_extension);
|
2003-07-12 22:35:21 +00:00
|
|
|
|
2007-05-03 09:15:04 +00:00
|
|
|
extern guint32 dissect_per_real(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, double *value);
|
|
|
|
|
2007-07-18 13:15:36 +00:00
|
|
|
extern guint32 dissect_per_choice(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, gint ett_index, const per_choice_t *choice, gint *value);
|
2003-07-12 22:35:21 +00:00
|
|
|
|
2006-07-04 06:49:53 +00:00
|
|
|
extern guint32 dissect_per_sequence(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *parent_tree, int hf_index, gint ett_index, const per_sequence_t *sequence);
|
2003-07-12 22:35:21 +00:00
|
|
|
|
2006-07-04 06:49:53 +00:00
|
|
|
extern guint32 dissect_per_octet_string(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, tvbuff_t **value_tvb);
|
2003-07-16 08:17:14 +00:00
|
|
|
|
2006-07-04 06:49:53 +00:00
|
|
|
extern guint32 dissect_per_bit_string(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension, tvbuff_t **value_tvb);
|
2007-05-23 13:36:25 +00:00
|
|
|
extern guint32 dissect_per_bit_string_containing_pdu(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension, dissector_t type_cb);
|
|
|
|
extern guint32 dissect_per_bit_string_containing_pdu_new(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension, new_dissector_t type_cb);
|
2004-02-16 18:31:40 +00:00
|
|
|
|
2006-07-04 06:49:53 +00:00
|
|
|
extern guint32 dissect_per_restricted_character_string(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, const char *alphabet, int alphabet_length, tvbuff_t **value_tvb);
|
2004-03-04 07:07:57 +00:00
|
|
|
|
2006-07-04 06:49:53 +00:00
|
|
|
extern guint32 dissect_per_enumerated(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, guint32 root_num, guint32 *value, gboolean has_extension, guint32 ext_num, guint32 *value_map);
|
2006-03-05 20:21:19 +00:00
|
|
|
|
2007-05-02 12:13:29 +00:00
|
|
|
extern guint32 dissect_per_open_type(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, per_type_fn type_cb);
|
2007-05-14 13:39:31 +00:00
|
|
|
extern guint32 dissect_per_open_type_pdu(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, dissector_t type_cb);
|
|
|
|
extern guint32 dissect_per_open_type_pdu_new(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, new_dissector_t type_cb);
|
2007-05-02 12:13:29 +00:00
|
|
|
|
|
|
|
extern guint32 dissect_per_external_type(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, per_type_fn type_cb);
|
2006-06-05 06:49:52 +00:00
|
|
|
|
2004-03-04 07:07:57 +00:00
|
|
|
#endif /* __PACKET_PER_H__ */
|