2 * Common data for ASN.1
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
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.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 #include "ws_symbol_export.h"
32 ASN1_ENC_BER
, /* X.690 - BER, CER, DER */
33 ASN1_ENC_PER
, /* X.691 - PER */
34 ASN1_ENC_ECN
, /* X.692 - ECN */
35 ASN1_ENC_XER
/* X.693 - XER */
46 ASN1_PAR_IRR
, /* irrelevant parameter */
54 typedef struct _asn1_par_def_t
{
59 typedef struct _asn1_par_t
{
67 struct _asn1_par_t
*next
;
70 typedef struct _asn1_stack_frame_t
{
72 struct _asn1_par_t
*par
;
73 struct _asn1_stack_frame_t
*next
;
76 #define ASN1_CTX_SIGNATURE 0x41435458 /* "ACTX" */
78 typedef struct _asn1_ctx_t
{
83 proto_item
*created_item
;
84 struct _asn1_stack_frame_t
*stack
;
89 gboolean data_value_descr_present
;
90 gboolean direct_ref_present
;
91 gboolean indirect_ref_present
;
92 tvbuff_t
*data_value_descriptor
;
93 const char *direct_reference
;
94 gint32 indirect_reference
;
101 tvbuff_t
*single_asn1_type
;
102 tvbuff_t
*octet_aligned
;
106 int (*ber_callback
)(gboolean imp_tag
, tvbuff_t
*tvb
, int offset
, struct _asn1_ctx_t
* ,proto_tree
*tree
, int hf_index
);
109 int (*type_cb
)(tvbuff_t
*, int, struct _asn1_ctx_t
*, proto_tree
*, int);
115 proto_tree
*top_tree
;
120 gboolean data_value_descr_present
;
121 tvbuff_t
*data_value_descriptor
;
126 2 : presentation-context-id,
127 3 : context-negotiation,
131 gint32 presentation_context_id
;
132 const char *abstract_syntax
;
133 const char *transfer_syntax
;
134 tvbuff_t
*data_value
;
137 int (*ber_callback
)(gboolean imp_tag
, tvbuff_t
*tvb
, int offset
, struct _asn1_ctx_t
* ,proto_tree
*tree
, int hf_index
);
140 int (*type_cb
)(tvbuff_t
*, int, struct _asn1_ctx_t
*, proto_tree
*, int);
144 struct _rose_ctx_t
*rose_ctx
;
147 #define ROSE_CTX_SIGNATURE 0x524F5345 /* "ROSE" */
149 typedef struct _rose_ctx_t
{
151 dissector_table_t arg_global_dissector_table
;
152 dissector_table_t arg_local_dissector_table
;
153 dissector_table_t res_global_dissector_table
;
154 dissector_table_t res_local_dissector_table
;
155 dissector_table_t err_global_dissector_table
;
156 dissector_table_t err_local_dissector_table
;
157 /* filling in description into tree, info column, any buffer */
159 gboolean fillin_info
;
161 gsize fillin_buf_size
;
162 struct { /* "dynamic" data */
172 -1 : none (optional in ReturnResult)
177 const char *code_global
;
178 proto_item
*code_item
;
183 WS_DLL_PUBLIC
void asn1_ctx_init(asn1_ctx_t
*actx
, asn1_enc_e encoding
, gboolean aligned
, packet_info
*pinfo
);
184 extern gboolean
asn1_ctx_check_signature(asn1_ctx_t
*actx
);
185 extern void asn1_ctx_clean_external(asn1_ctx_t
*actx
);
186 extern void asn1_ctx_clean_epdv(asn1_ctx_t
*actx
);
188 extern void asn1_stack_frame_push(asn1_ctx_t
*actx
, const gchar
*name
);
189 extern void asn1_stack_frame_pop(asn1_ctx_t
*actx
, const gchar
*name
);
190 extern void asn1_stack_frame_check(asn1_ctx_t
*actx
, const gchar
*name
, const asn1_par_def_t
*par_def
);
192 extern void asn1_param_push_boolean(asn1_ctx_t
*actx
, gboolean value
);
193 extern void asn1_param_push_integer(asn1_ctx_t
*actx
, gint32 value
);
194 extern gboolean
asn1_param_get_boolean(asn1_ctx_t
*actx
, const gchar
*name
);
195 extern gint32
asn1_param_get_integer(asn1_ctx_t
*actx
, const gchar
*name
);
197 WS_DLL_PUBLIC
void rose_ctx_init(rose_ctx_t
*rctx
);
198 extern gboolean
rose_ctx_check_signature(rose_ctx_t
*rctx
);
199 WS_DLL_PUBLIC
void rose_ctx_clean_data(rose_ctx_t
*rctx
);
201 WS_DLL_PUBLIC asn1_ctx_t
*get_asn1_ctx(void *ptr
);
202 WS_DLL_PUBLIC rose_ctx_t
*get_rose_ctx(void *ptr
);
204 extern double asn1_get_real(const guint8
*real_ptr
, gint real_len
);
207 #define ASN1_EXT_ROOT 0x01
208 #define ASN1_EXT_EXT 0x02
209 #define ASN1_OPT 0x04
210 #define ASN1_DFLT 0x08
212 #define ASN1_HAS_EXT(f) ((f)&(ASN1_EXT_ROOT|ASN1_EXT_EXT))
215 #endif /* __ASN1_H__ */