diff options
author | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2005-03-12 12:04:44 +0000 |
---|---|---|
committer | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2005-03-12 12:04:44 +0000 |
commit | 3a26213e88700e24cb8be27a64ca45d009da84b6 (patch) | |
tree | 229ae20f6aac188687fb1b8c9282e17415226823 /epan/dissectors/packet-dcerpc-drsuapi.c | |
parent | 7d7a54112576a1e1227da0bebc084638e6c6d665 (diff) |
the previous drsuapi patch showed how idl2eth can handle embedded arrays just fine.
beautifully fine.
this patch overrides the array, tells idl2eth to not generate code to unmarshall the conformance blob or the data for the array.
a handwritted replacement function is implemented in the template instead which prettifies the output a lot.
svn path=/trunk/; revision=13735
Diffstat (limited to 'epan/dissectors/packet-dcerpc-drsuapi.c')
-rw-r--r-- | epan/dissectors/packet-dcerpc-drsuapi.c | 68 |
1 files changed, 44 insertions, 24 deletions
diff --git a/epan/dissectors/packet-dcerpc-drsuapi.c b/epan/dissectors/packet-dcerpc-drsuapi.c index 54a42452e0..7b47d774f8 100644 --- a/epan/dissectors/packet-dcerpc-drsuapi.c +++ b/epan/dissectors/packet-dcerpc-drsuapi.c @@ -41,6 +41,7 @@ #include "packet-dcerpc-drsuapi.h" static int proto_drsuapi = -1; +static int hf_drsuapi_DsReplicaSyncRequest1Info_nc_dn = -1; /* INCLUDED FILE : ETH_HF */ @@ -93,7 +94,6 @@ static int hf_drsuapi_DsReplicaSyncRequest1Info_unknown2 = -1; static int hf_drsuapi_DsReplicaSyncRequest1Info_guid1 = -1; static int hf_drsuapi_DsReplicaSyncRequest1Info_byte_array = -1; static int hf_drsuapi_DsReplicaSyncRequest1Info_str_len = -1; -static int hf_drsuapi_DsReplicaSyncRequest1Info_nc_dn = -1; static int hf_drsuapi_DsReplicaSyncOptions_DRSUAPI_DS_REPLICA_SYNC_ASYNCHRONOUS_OPERATION = -1; static int hf_drsuapi_DsReplicaSyncOptions_DRSUAPI_DS_REPLICA_SYNC_WRITEABLE = -1; static int hf_drsuapi_DsReplicaSyncOptions_DRSUAPI_DS_REPLICA_SYNC_PERIODIC = -1; @@ -446,11 +446,47 @@ static gint ett_drsuapi_DsReplicaInfo = -1; static int -drsuapi_dissect_u_string(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, int hf_index, guint32 param _U_) +ucarray_drsuapi_dissect_DsReplicaSyncRequest1Info_nc_dn(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) { - offset=dissect_ndr_vstring(tvb, offset, pinfo, tree, drep, 2, hf_index, FALSE, NULL); - return offset; + header_field_info *hfinfo; + static guint32 len; + dcerpc_info *di; + char *s; + int old_offset; + + di=pinfo->private_data; + if(di->conformant_run){ + /*just a run to handle conformant arrays, nothing to dissect + but we need to remember how long this array was. + see packet-dcerpc.c for examples of conformant_run + and what it is. + */ + old_offset=offset; + offset=dissect_dcerpc_uint32(tvb, offset, pinfo, NULL, drep, -1, &len); + di->array_max_count_offset=offset-4; + di->conformant_run=1; + di->conformant_eaten=offset-old_offset; + return offset; + } + + ALIGN_TO_2_BYTES; + + s = tvb_fake_unicode(tvb, offset, len, TRUE); + if (tree && len) { + hfinfo = proto_registrar_get_nth(hf_drsuapi_DsReplicaSyncRequest1Info_nc_dn); + if (hfinfo->type == FT_STRING) { + proto_tree_add_string(tree, hf_drsuapi_DsReplicaSyncRequest1Info_nc_dn, tvb, offset, + len, s); + } else { + proto_tree_add_item(tree, hf_drsuapi_DsReplicaSyncRequest1Info_nc_dn, tvb, offset, + len, drep[0] & 0x10); + } + } + + offset+=2*len; + return offset; } + static int drsuapi_dissect_a_string(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, int hf_index, guint32 param _U_) { @@ -1123,21 +1159,6 @@ drsuapi_dissect_uint16(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree return offset; } -static int -drsuapi_dissect_DsReplicaSyncRequest1Info_nc_dn(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) -{ - guint32 param=0; - offset=drsuapi_dissect_uint16(tvb, offset, pinfo, tree, drep, hf_drsuapi_DsReplicaSyncRequest1Info_nc_dn, param); - return offset; -} - -static int -ucarray_drsuapi_dissect_DsReplicaSyncRequest1Info_nc_dn(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) -{ - offset=dissect_ndr_ucarray(tvb, offset, pinfo, tree, drep, drsuapi_dissect_DsReplicaSyncRequest1Info_nc_dn); - return offset; -} - int drsuapi_dissect_DsReplicaSyncRequest1Info(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *parent_tree, guint8 *drep, int hf_index, guint32 param _U_) @@ -6491,6 +6512,10 @@ void proto_register_drsuapi(void) { static hf_register_info hf[] = { + { &hf_drsuapi_DsReplicaSyncRequest1Info_nc_dn, + { "nc_dn", "drsuapi.DsReplicaSyncRequest1Info.nc_dn", FT_STRING, BASE_DEC, + NULL, 0, + "", HFILL }}, @@ -6740,11 +6765,6 @@ proto_register_drsuapi(void) NULL, 0, "", HFILL }}, - { &hf_drsuapi_DsReplicaSyncRequest1Info_nc_dn, - { "nc_dn", "drsuapi.DsReplicaSyncRequest1Info.nc_dn", FT_UINT16, BASE_DEC, - NULL, 0, - "", HFILL }}, - { &hf_drsuapi_DsReplicaSyncOptions_DRSUAPI_DS_REPLICA_SYNC_ASYNCHRONOUS_OPERATION, { "DRSUAPI_DS_REPLICA_SYNC_ASYNCHRONOUS_OPERATION", "drsuapi.DsReplicaSyncOptions.DRSUAPI_DS_REPLICA_SYNC_ASYNCHRONOUS_OPERATION", FT_BOOLEAN, 32, TFS(&DRSUAPI_DS_REPLICA_SYNC_ASYNCHRONOUS_OPERATION_tfs), 0x00000001, |