| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Enumerations | Functions
asn1.h File Reference
`#include <epan/packet.h>`
`#include "ws_symbol_export.h"`

Go to the source code of this file.

## Classes
struct | _asn1_par_def_t
| Static definition of a single ASN.1 parameterized type parameter (name + kind). More...
struct | _asn1_par_t
| Runtime instance of a resolved ASN.1 parameterized type argument. More...
struct | _asn1_stack_frame_t
| Single frame on the ASN.1 parameterized type resolution stack. More...
struct | _asn1_ctx_t
| Central context object threaded through all ASN.1 dissection calls. More...
struct | _rose_ctx_t
| Context object carrying per-association state for ROSE (Remote Operations Service Element) dissection. More...

## Macros
#define | ASN1_CTX_SIGNATURE 0x41435458
| Magic signature value used to validate an asn1_ctx_t pointer ("ACTX").
#define | ROSE_CTX_SIGNATURE 0x524F5345
| Magic signature value used to validate a rose_ctx_t pointer ("ROSE").
#define | ASN1_EXT_ROOT 0x01
#define | ASN1_EXT_EXT 0x02
#define | ASN1_OPT 0x04
#define | ASN1_DFLT 0x08
#define | ASN1_HAS_EXT(f)

## Typedefs
typedef struct _asn1_par_def_t | asn1_par_def_t
| Static definition of a single ASN.1 parameterized type parameter (name + kind).
typedef struct _asn1_par_t | asn1_par_t
| Runtime instance of a resolved ASN.1 parameterized type argument.
typedef struct _asn1_stack_frame_t | asn1_stack_frame_t
| Single frame on the ASN.1 parameterized type resolution stack.
typedef struct _asn1_ctx_t | asn1_ctx_t
| Central context object threaded through all ASN.1 dissection calls.
typedef struct _rose_ctx_t | rose_ctx_t
| Context object carrying per-association state for ROSE (Remote Operations Service Element) dissection.

## Enumerations
enum | asn1_enc_e { ASN1_ENC_BER , ASN1_ENC_PER , ASN1_ENC_ECN , ASN1_ENC_XER , ASN1_ENC_OER }
| Identifies the ASN.1 transfer syntax encoding used for a PDU. More...
enum | asn1_cb_variant { CB_ASN1_ENC , CB_NEW_DISSECTOR , CB_DISSECTOR_HANDLE }
| Identifies the variant of an ASN.1 callback registered for a type. More...
enum | asn1_par_type { ASN1_PAR_IRR , ASN1_PAR_BOOLEAN , ASN1_PAR_INTEGER , ASN1_PAR_TYPE }
| Identifies the kind of an ASN.1 parameterized type argument. More...

## Functions
WS_DLL_PUBLIC void | asn1_ctx_init (asn1_ctx_t *actx, asn1_enc_e encoding, bool aligned, packet_info *pinfo)
| Initialize an ASN.1 context.
WS_DLL_PUBLIC bool | asn1_ctx_check_signature (asn1_ctx_t *actx)
| Check the signature of an ASN.1 context.
WS_DLL_PUBLIC void | asn1_ctx_clean_external (asn1_ctx_t *actx)
| Clean the external data of an ASN.1 context.
void | asn1_ctx_clean_epdv (asn1_ctx_t *actx)
| Clean the EPDV data of an ASN.1 context.
WS_DLL_PUBLIC void | asn1_stack_frame_push (asn1_ctx_t *actx, const char *name)
| Push a stack frame onto the ASN.1 context.
WS_DLL_PUBLIC void | asn1_stack_frame_pop (asn1_ctx_t *actx, const char *name)
| Pop a stack frame from the ASN.1 context.
WS_DLL_PUBLIC void | asn1_stack_frame_check (asn1_ctx_t *actx, const char *name, const asn1_par_def_t *par_def)
| Check that the current stack frame matches the expected name and parameter definitions.
WS_DLL_PUBLIC void | asn1_param_push_boolean (asn1_ctx_t *actx, bool value)
| Push a boolean parameter onto the ASN.1 context parameter stack.
WS_DLL_PUBLIC void | asn1_param_push_integer (asn1_ctx_t *actx, int32_t value)
| Push an integer parameter onto the ASN.1 context parameter stack.
bool | asn1_param_get_boolean (asn1_ctx_t *actx, const char *name)
| Get a named boolean parameter from the ASN.1 context.
WS_DLL_PUBLIC int32_t | asn1_param_get_integer (asn1_ctx_t *actx, const char *name)
| Get a named integer parameter from the ASN.1 context.
WS_DLL_PUBLIC void | rose_ctx_init (rose_ctx_t *rctx)
| Initialize a ROSE context.
bool | rose_ctx_check_signature (rose_ctx_t *rctx)
| Check the signature of a ROSE context.
WS_DLL_PUBLIC void | rose_ctx_clean_data (rose_ctx_t *rctx)
| Clean the data of a ROSE context.
WS_DLL_PUBLIC asn1_ctx_t * | get_asn1_ctx (void *ptr)
| Retrieve the ASN.1 context from an opaque pointer.
WS_DLL_PUBLIC rose_ctx_t * | get_rose_ctx (void *ptr)
| Retrieve the ROSE context from an opaque pointer.
WS_DLL_PUBLIC double | asn1_get_real (const uint8_t *real_ptr, int len, int *err)
| Convert an ASN.1 encoded real value to a double.

## Detailed Description

Common data for ASN.1 2007 Anders Broman

Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs

SPDX-License-Identifier: GPL-2.0-or-later

## Macro Definition Documentation

## ◆ ASN1_HAS_EXT

#define ASN1_HAS_EXT | ( |  | f | ) |

Value:
((f)&(ASN1_EXT_ROOT|ASN1_EXT_EXT))

## Typedef Documentation

## ◆ asn1_ctx_t

typedef struct _asn1_ctx_t asn1_ctx_t

Central context object threaded through all ASN.1 dissection calls.

Carries encoding parameters, packet metadata, the type-resolution stack, and per-PDU working state for EXTERNAL and EMBEDDED PDV types.

## ◆ rose_ctx_t

typedef struct _rose_ctx_t rose_ctx_t

Context object carrying per-association state for ROSE (Remote Operations Service Element) dissection.

Holds per-direction dissector tables for argument, result, and error PDUs, plus transient per-APDU working state accumulated as each ROSE operation is decoded.

## Enumeration Type Documentation

## ◆ asn1_cb_variant

enum asn1_cb_variant

Identifies the variant of an ASN.1 callback registered for a type.

Enumerator
CB_ASN1_ENC | Callback operates on the ASN.1 encoding directly.
CB_NEW_DISSECTOR | Callback invokes a new protocol dissector.
CB_DISSECTOR_HANDLE | Callback uses a registered dissector handle.

## ◆ asn1_enc_e

enum asn1_enc_e

Identifies the ASN.1 transfer syntax encoding used for a PDU.

Enumerator
ASN1_ENC_BER | X.690 Basic/Canonical/Distinguished Encoding Rules (BER, CER, DER).
ASN1_ENC_PER | X.691 Packed Encoding Rules (PER) — aligned or unaligned.
ASN1_ENC_ECN | X.692 Encoding Control Notation (ECN).
ASN1_ENC_XER | X.693 XML Encoding Rules (XER).
ASN1_ENC_OER | X.696 Octet Encoding Rules (OER).

## ◆ asn1_par_type

enum asn1_par_type

Identifies the kind of an ASN.1 parameterized type argument.

Enumerator
ASN1_PAR_IRR | Irrelevant (unused) parameter slot.
ASN1_PAR_BOOLEAN | Value parameter of boolean type.
ASN1_PAR_INTEGER | Value parameter of integer type.
ASN1_PAR_TYPE | Governor parameter specifying a type.

## Function Documentation

## ◆ asn1_ctx_check_signature()

WS_DLL_PUBLIC bool asn1_ctx_check_signature | ( | asn1_ctx_t * | actx | ) |

Check the signature of an ASN.1 context.

Parameters

  actx | The ASN.1 context.

Returns
  true if the signature is valid, false otherwise.

## ◆ asn1_ctx_clean_epdv()

void asn1_ctx_clean_epdv | ( | asn1_ctx_t * | actx | ) |
| extern

Clean the EPDV data of an ASN.1 context.

Parameters

  actx | The ASN.1 context.

## ◆ asn1_ctx_clean_external()

WS_DLL_PUBLIC void asn1_ctx_clean_external | ( | asn1_ctx_t * | actx | ) |

Clean the external data of an ASN.1 context.

Parameters

  actx | The ASN.1 context.

## ◆ asn1_ctx_init()

WS_DLL_PUBLIC void asn1_ctx_init | ( | asn1_ctx_t * | actx,
|  | asn1_enc_e | encoding,
|  | bool | aligned,
|  | packet_info * | pinfo )

Initialize an ASN.1 context.

Parameters

  actx | The ASN.1 context to initialize.
  encoding | The ASN.1 encoding type.
  aligned | Whether the encoding is aligned.
  pinfo | The packet info.

## ◆ asn1_get_real()

WS_DLL_PUBLIC double asn1_get_real | ( | const uint8_t * | real_ptr,
|  | int | len,
|  | int * | err )

Convert an ASN.1 encoded real value to a double.

Sets err to EINVAL for an invalid encoding (returning 0) to ERANGE if overflow or underflow occurs (rounding, possibly to +/-HUGE_VAL, +/-0.0), and 0 if conversion is successful.

Parameters

  real_ptr | Pointer to the encoded real value.
  len | The length of the encoded buffer.
  err | Output error code.

Returns
  The decoded double value.

## ◆ asn1_param_get_boolean()

bool asn1_param_get_boolean | ( | asn1_ctx_t * | actx,
|  | const char * | name )
| extern

Get a named boolean parameter from the ASN.1 context.

Parameters

  actx | The ASN.1 context.
  name | The name of the parameter.

Returns
  The boolean value of the parameter.

## ◆ asn1_param_get_integer()

WS_DLL_PUBLIC int32_t asn1_param_get_integer | ( | asn1_ctx_t * | actx,
|  | const char * | name )

Get a named integer parameter from the ASN.1 context.

Parameters

  actx | The ASN.1 context.
  name | The name of the parameter.

Returns
  The integer value of the parameter.

## ◆ asn1_param_push_boolean()

WS_DLL_PUBLIC void asn1_param_push_boolean | ( | asn1_ctx_t * | actx,
|  | bool | value )

Push a boolean parameter onto the ASN.1 context parameter stack.

Parameters

  actx | The ASN.1 context.
  value | The boolean value to push.

## ◆ asn1_param_push_integer()

WS_DLL_PUBLIC void asn1_param_push_integer | ( | asn1_ctx_t * | actx,
|  | int32_t | value )

Push an integer parameter onto the ASN.1 context parameter stack.

Parameters

  actx | The ASN.1 context.
  value | The integer value to push.

## ◆ asn1_stack_frame_check()

WS_DLL_PUBLIC void asn1_stack_frame_check | ( | asn1_ctx_t * | actx,
|  | const char * | name,
|  | const asn1_par_def_t * | par_def )

Check that the current stack frame matches the expected name and parameter definitions.

Parameters

  actx | The ASN.1 context.
  name | The expected name of the stack frame.
  par_def | The expected parameter definitions.

## ◆ asn1_stack_frame_pop()

WS_DLL_PUBLIC void asn1_stack_frame_pop | ( | asn1_ctx_t * | actx,
|  | const char * | name )

Pop a stack frame from the ASN.1 context.

Parameters

  actx | The ASN.1 context.
  name | The name of the stack frame.

## ◆ asn1_stack_frame_push()

WS_DLL_PUBLIC void asn1_stack_frame_push | ( | asn1_ctx_t * | actx,
|  | const char * | name )

Push a stack frame onto the ASN.1 context.

Parameters

  actx | The ASN.1 context.
  name | The name of the stack frame.

## ◆ get_asn1_ctx()

WS_DLL_PUBLIC asn1_ctx_t * get_asn1_ctx | ( | void * | ptr | ) |

Retrieve the ASN.1 context from an opaque pointer.

Parameters

  ptr | Opaque pointer to a structure containing an ASN.1 context.

Returns
  The ASN.1 context.

## ◆ get_rose_ctx()

WS_DLL_PUBLIC rose_ctx_t * get_rose_ctx | ( | void * | ptr | ) |

Retrieve the ROSE context from an opaque pointer.

Parameters

  ptr | Opaque pointer to a structure containing a ROSE context.

Returns
  The ROSE context.

## ◆ rose_ctx_check_signature()

bool rose_ctx_check_signature | ( | rose_ctx_t * | rctx | ) |
| extern

Check the signature of a ROSE context.

Parameters

  rctx | The ROSE context.

Returns
  true if the signature is valid, false otherwise.

## ◆ rose_ctx_clean_data()

WS_DLL_PUBLIC void rose_ctx_clean_data | ( | rose_ctx_t * | rctx | ) |

Clean the data of a ROSE context.

Parameters

  rctx | The ROSE context.

## ◆ rose_ctx_init()

WS_DLL_PUBLIC void rose_ctx_init | ( | rose_ctx_t * | rctx | ) |

Initialize a ROSE context.

Parameters

  rctx | The ROSE context to initialize.