Skip to content

Commit

Permalink
Convert asn2ws to generate C99 types
Browse files Browse the repository at this point in the history
  • Loading branch information
AndersBroman committed Aug 8, 2023
1 parent d5ea143 commit df59bff
Show file tree
Hide file tree
Showing 172 changed files with 10,517 additions and 10,520 deletions.
12 changes: 6 additions & 6 deletions epan/asn1.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@

#include "asn1.h"

void asn1_ctx_init(asn1_ctx_t *actx, asn1_enc_e encoding, gboolean aligned, packet_info *pinfo) {
void asn1_ctx_init(asn1_ctx_t *actx, asn1_enc_e encoding, bool aligned, packet_info *pinfo) {
memset(actx, '\0', sizeof(*actx));
actx->signature = ASN1_CTX_SIGNATURE;
actx->encoding = encoding;
actx->aligned = aligned;
actx->pinfo = pinfo;
}

gboolean asn1_ctx_check_signature(asn1_ctx_t *actx) {
bool asn1_ctx_check_signature(asn1_ctx_t *actx) {
return actx && (actx->signature == ASN1_CTX_SIGNATURE);
}

Expand Down Expand Up @@ -109,7 +109,7 @@ static asn1_par_t *push_new_par(asn1_ctx_t *actx) {
return par;
}

void asn1_param_push_boolean(asn1_ctx_t *actx, gboolean value) {
void asn1_param_push_boolean(asn1_ctx_t *actx, bool value) {
asn1_par_t *par;

par = push_new_par(actx);
Expand All @@ -125,7 +125,7 @@ void asn1_param_push_integer(asn1_ctx_t *actx, gint32 value) {
par->value.v_integer = value;
}

gboolean asn1_param_get_boolean(asn1_ctx_t *actx, const gchar *name) {
bool asn1_param_get_boolean(asn1_ctx_t *actx, const gchar *name) {
asn1_par_t *par = NULL;

par = get_par_by_name(actx, name);
Expand All @@ -149,7 +149,7 @@ void rose_ctx_init(rose_ctx_t *rctx) {
rctx->signature = ROSE_CTX_SIGNATURE;
}

gboolean rose_ctx_check_signature(rose_ctx_t *rctx) {
bool rose_ctx_check_signature(rose_ctx_t *rctx) {
return rctx && (rctx->signature == ROSE_CTX_SIGNATURE);
}

Expand Down Expand Up @@ -200,7 +200,7 @@ double asn1_get_real(const guint8 *real_ptr, gint len) {
len -= 1;
if (octet & 0x80) { /* binary encoding */
int i;
gboolean Eneg;
bool Eneg;
gint8 S; /* Sign */
guint8 B; /* Base */
guint8 F; /* scaling Factor */
Expand Down
28 changes: 14 additions & 14 deletions epan/asn1.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ typedef struct _asn1_par_t {
const gchar *name;
asn1_par_type ptype;
union {
gboolean v_boolean;
bool v_boolean;
gint32 v_integer;
void *v_type;
} value;
Expand All @@ -65,17 +65,17 @@ typedef struct _asn1_stack_frame_t {
typedef struct _asn1_ctx_t {
guint32 signature;
asn1_enc_e encoding;
gboolean aligned;
bool aligned;
packet_info *pinfo;
proto_item *created_item;
struct _asn1_stack_frame_t *stack;
void *value_ptr;
void *private_data;
struct {
int hf_index;
gboolean data_value_descr_present;
gboolean direct_ref_present;
gboolean indirect_ref_present;
bool data_value_descr_present;
bool direct_ref_present;
bool indirect_ref_present;
tvbuff_t *data_value_descriptor;
const char *direct_reference;
gint32 indirect_reference;
Expand All @@ -90,7 +90,7 @@ typedef struct _asn1_ctx_t {
tvbuff_t *arbitrary;
union {
struct {
int (*ber_callback)(gboolean imp_tag, tvbuff_t *tvb, int offset, struct _asn1_ctx_t* ,proto_tree *tree, int hf_index );
int (*ber_callback)(bool imp_tag, tvbuff_t *tvb, int offset, struct _asn1_ctx_t* ,proto_tree *tree, int hf_index );
} ber;
struct {
int (*type_cb)(tvbuff_t*, int, struct _asn1_ctx_t*, proto_tree*, int);
Expand All @@ -104,7 +104,7 @@ typedef struct _asn1_ctx_t {
} subtree;
struct {
int hf_index;
gboolean data_value_descr_present;
bool data_value_descr_present;
tvbuff_t *data_value_descriptor;
gint identification;
/*
Expand All @@ -121,7 +121,7 @@ typedef struct _asn1_ctx_t {
tvbuff_t *data_value;
union {
struct {
int (*ber_callback)(gboolean imp_tag, tvbuff_t *tvb, int offset, struct _asn1_ctx_t* ,proto_tree *tree, int hf_index );
int (*ber_callback)(bool imp_tag, tvbuff_t *tvb, int offset, struct _asn1_ctx_t* ,proto_tree *tree, int hf_index );
} ber;
struct {
int (*type_cb)(tvbuff_t*, int, struct _asn1_ctx_t*, proto_tree*, int);
Expand All @@ -143,7 +143,7 @@ typedef struct _rose_ctx_t {
dissector_table_t err_local_dissector_table;
/* filling in description into tree, info column, any buffer */
int apdu_depth;
gboolean fillin_info;
bool fillin_info;
gchar *fillin_ptr;
gsize fillin_buf_size;
struct { /* "dynamic" data */
Expand All @@ -167,22 +167,22 @@ typedef struct _rose_ctx_t {
void *private_data;
} rose_ctx_t;

WS_DLL_PUBLIC void asn1_ctx_init(asn1_ctx_t *actx, asn1_enc_e encoding, gboolean aligned, packet_info *pinfo);
extern gboolean asn1_ctx_check_signature(asn1_ctx_t *actx);
WS_DLL_PUBLIC void asn1_ctx_init(asn1_ctx_t *actx, asn1_enc_e encoding, bool aligned, packet_info *pinfo);
extern bool asn1_ctx_check_signature(asn1_ctx_t *actx);
extern void asn1_ctx_clean_external(asn1_ctx_t *actx);
extern void asn1_ctx_clean_epdv(asn1_ctx_t *actx);

extern void asn1_stack_frame_push(asn1_ctx_t *actx, const gchar *name);
extern void asn1_stack_frame_pop(asn1_ctx_t *actx, const gchar *name);
extern void asn1_stack_frame_check(asn1_ctx_t *actx, const gchar *name, const asn1_par_def_t *par_def);

extern void asn1_param_push_boolean(asn1_ctx_t *actx, gboolean value);
extern void asn1_param_push_boolean(asn1_ctx_t *actx, bool value);
extern void asn1_param_push_integer(asn1_ctx_t *actx, gint32 value);
extern gboolean asn1_param_get_boolean(asn1_ctx_t *actx, const gchar *name);
extern bool asn1_param_get_boolean(asn1_ctx_t *actx, const gchar *name);
extern gint32 asn1_param_get_integer(asn1_ctx_t *actx, const gchar *name);

WS_DLL_PUBLIC void rose_ctx_init(rose_ctx_t *rctx);
extern gboolean rose_ctx_check_signature(rose_ctx_t *rctx);
extern bool rose_ctx_check_signature(rose_ctx_t *rctx);
WS_DLL_PUBLIC void rose_ctx_clean_data(rose_ctx_t *rctx);

WS_DLL_PUBLIC asn1_ctx_t *get_asn1_ctx(void *ptr);
Expand Down
4 changes: 2 additions & 2 deletions epan/dissectors/asn1/HI2Operations/HI2Operations.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ GSMLocation/geoCoordinates/longitude geoCoordinates_longitude

/* Heuristic test to see if it's our content */
gint8 tmp_class;
gboolean tmp_pc;
bool tmp_pc;
gint32 tmp_tag;
int tmp_offset;
guint length = tvb_captured_length(tvb);
guint32 tmp_length;
gboolean tmp_ind;
bool tmp_ind;
/* Check for min length */
if (length < 6){
Expand Down
2 changes: 1 addition & 1 deletion epan/dissectors/asn1/ansi_map/packet-ansi_map-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ static value_string_ext ansi_map_opr_code_strings_ext = VALUE_STRING_EXT_INIT(an

static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx);
static int dissect_returnData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx);
static int dissect_ansi_map_SystemMyTypeCode(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_);
static int dissect_ansi_map_SystemMyTypeCode(bool implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_);

/* Type of Digits (octet 1, bits A-H) */
static const value_string ansi_map_type_of_digits_vals[] = {
Expand Down
2 changes: 1 addition & 1 deletion epan/dissectors/asn1/c1222/c1222.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ AE-qualifier TYPE=FT_UINT32

#.FN_BODY User-information
gint8 end_device_class;
gboolean pc, ind;
bool pc, ind;
gint32 tag;
guint32 len;
proto_item *tf = NULL;
Expand Down
4 changes: 2 additions & 2 deletions epan/dissectors/asn1/c1222/packet-c1222-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ dissect_epsem(tvbuff_t *tvb, int offset, guint32 len, packet_info *pinfo, proto_
int local_offset;
gint len2;
int cmd_err;
gboolean ind;
bool ind;
guchar *buffer;
tvbuff_t *epsem_buffer = NULL;
gboolean crypto_good = FALSE;
Expand Down Expand Up @@ -1107,7 +1107,7 @@ get_c1222_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset, void *data
{
int orig_offset;
guint length;
gboolean ind;
bool ind;

orig_offset = offset;
/* note that this assumes a Tag length of 1 which is always valid for C12.22 */
Expand Down
2 changes: 1 addition & 1 deletion epan/dissectors/asn1/camel/camel.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ proto_tree *subtree;
tvbuff_t *parameter_tvb;
proto_tree *subtree;
gint ett = -1;
gboolean digits = FALSE;
bool digits = FALSE;

offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
&parameter_tvb);
Expand Down
14 changes: 7 additions & 7 deletions epan/dissectors/asn1/camel/packet-camel-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ static struct camelsrt_info_t * gp_camelsrt_info;
static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset,asn1_ctx_t *actx);
static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset,asn1_ctx_t *actx);
static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset,asn1_ctx_t *actx);
static int dissect_camel_CAMEL_AChBillingChargingCharacteristics(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
static int dissect_camel_CAMEL_AChBillingChargingCharacteristicsV2(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
static int dissect_camel_CAMEL_CallResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
static int dissect_camel_EstablishTemporaryConnectionArgV2(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
static int dissect_camel_SpecializedResourceReportArgV23(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
static int dissect_camel_CAMEL_AChBillingChargingCharacteristics(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
static int dissect_camel_CAMEL_AChBillingChargingCharacteristicsV2(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
static int dissect_camel_CAMEL_CallResult(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
static int dissect_camel_EstablishTemporaryConnectionArgV2(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
static int dissect_camel_SpecializedResourceReportArgV23(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);

/* XXX - can we get rid of these and always do the SRT work? */
static gboolean gcamel_PersistentSRT=FALSE;
Expand Down Expand Up @@ -402,7 +402,7 @@ dissect_RP_cause_ie(tvbuff_t *tvb, guint32 offset, _U_ guint len,
return(curr_offset - offset);
}

static int dissect_camel_InitialDPArgExtensionV2(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
static int dissect_camel_InitialDPArgExtensionV2(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);

#include "packet-camel-fn.c"

Expand Down Expand Up @@ -1056,7 +1056,7 @@ static guint8 camel_pdu_size = 0;


static int
dissect_camel_camelPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_,proto_tree *tree,
dissect_camel_camelPDU(bool implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_,proto_tree *tree,
int hf_index, struct tcap_private_t * p_private_tcap) {

opcode = 0;
Expand Down
2 changes: 1 addition & 1 deletion epan/dissectors/asn1/cms/packet-cms-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static gint ett_cms = -1;

static dissector_handle_t cms_handle = NULL;

static int dissect_cms_OCTET_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) ; /* XXX kill a compiler warning until asn2wrs stops generating these silly wrappers */
static int dissect_cms_OCTET_STRING(bool implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) ; /* XXX kill a compiler warning until asn2wrs stops generating these silly wrappers */

struct cms_private_data {
const char *object_identifier_id;
Expand Down
2 changes: 1 addition & 1 deletion epan/dissectors/asn1/disp/packet-disp-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ dissect_disp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
proto_item *item;
proto_tree *tree;
struct SESSION_DATA_STRUCTURE* session;
int (*disp_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) = NULL;
int (*disp_dissector)(bool implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) = NULL;
const char *disp_op_name;
asn1_ctx_t asn1_ctx;

Expand Down
2 changes: 1 addition & 1 deletion epan/dissectors/asn1/dop/packet-dop-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ dissect_dop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da
proto_item *item;
proto_tree *tree;
struct SESSION_DATA_STRUCTURE* session;
int (*dop_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) = NULL;
int (*dop_dissector)(bool implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) = NULL;
const char *dop_op_name;
asn1_ctx_t asn1_ctx;

Expand Down
2 changes: 1 addition & 1 deletion epan/dissectors/asn1/dsp/packet-dsp-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ dissect_dsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da
proto_item *item;
proto_tree *tree;
struct SESSION_DATA_STRUCTURE* session;
int (*dsp_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) = NULL;
int (*dsp_dissector)(bool implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) = NULL;
const char *dsp_op_name;
asn1_ctx_t asn1_ctx;

Expand Down
2 changes: 1 addition & 1 deletion epan/dissectors/asn1/ftam/packet-ftam-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void proto_reg_handoff_ftam(void);
static int proto_ftam = -1;

/* Declare the function to avoid a compiler warning */
static int dissect_ftam_OR_Set(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_);
static int dissect_ftam_OR_Set(bool implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_);

static int hf_ftam_unstructured_text = -1; /* ISO FTAM unstructured text */
static int hf_ftam_unstructured_binary = -1; /* ISO FTAM unstructured binary */
Expand Down
2 changes: 1 addition & 1 deletion epan/dissectors/asn1/goose/goose.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
GOOSEpdu

#.FN_BODY IECGoosePdu/simulation VAL_PTR = &value
gboolean value;
bool value;
guint32 len = tvb_reported_length_remaining(tvb, offset);
int origin_offset = offset;
%(DEFAULT_BODY)s
Expand Down
14 changes: 7 additions & 7 deletions epan/dissectors/asn1/gsm_map/packet-gsm_map-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ typedef struct {
wmem_tree_t *packets;
} gsm_map_conv_info_t;

static gsm_map_packet_info_t *gsm_map_get_packet_info(asn1_ctx_t *actx, gboolean store_conv_info)
static gsm_map_packet_info_t *gsm_map_get_packet_info(asn1_ctx_t *actx, bool store_conv_info)
{
gsm_map_packet_info_t *gsm_map_pi = (gsm_map_packet_info_t*)p_get_proto_data(wmem_file_scope(), actx->pinfo, proto_gsm_map, 0);
if (!gsm_map_pi) {
Expand Down Expand Up @@ -1135,7 +1135,7 @@ const gchar* gsm_map_opr_code(guint32 val, proto_item *item) {
}

/* Prototype for a decoding function */
typedef int (* dissect_function_t)( gboolean,
typedef int (* dissect_function_t)( bool,
tvbuff_t *,
int ,
asn1_ctx_t *,
Expand Down Expand Up @@ -1164,13 +1164,13 @@ static int dissect_mc_message(tvbuff_t *tvb,
int offset,
asn1_ctx_t *actx,
proto_tree *tree,
gboolean implicit_param _U_, dissect_function_t parameter, int hf_index_param _U_,
gboolean implicit_seq _U_, dissect_function_t sequence, int hf_index_seq _U_,
gboolean implicit_seq3 _U_, dissect_function_t sequence3, int hf_index_seq3 _U_ )
bool implicit_param _U_, dissect_function_t parameter, int hf_index_param _U_,
bool implicit_seq _U_, dissect_function_t sequence, int hf_index_seq _U_,
bool implicit_seq3 _U_, dissect_function_t sequence3, int hf_index_seq3 _U_ )
{
guint8 octet;
gint8 bug_class;
gboolean bug_pc, bug_ind_field;
bool bug_pc, bug_ind_field;
gint32 bug_tag;
guint32 bug_len;

Expand Down Expand Up @@ -2315,7 +2315,7 @@ static int dissect_NokiaMAP_ext_DsdArgExt(tvbuff_t *tvb, packet_info *pinfo, pro
}

static int
dissect_gsm_map_GSMMAPPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset,
dissect_gsm_map_GSMMAPPDU(bool implicit_tag _U_, tvbuff_t *tvb, int offset,
asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) {

char *version_ptr;
Expand Down
Loading

0 comments on commit df59bff

Please sign in to comment.