#include "packet-ncp-int.h"
#include "packet-ncp-sss.h"
-static guint32 subverb=0;
+static guint32 gbl_subverb=0;
static gint ett_sss = -1;
proto_tree_add_item(ncp_tree, hf_length, tvb, foffset, 4, TRUE);
foffset += 4;
foffset += 12; /* Blank Context */
- subverb = tvb_get_letohl(tvb, foffset);
+ gbl_subverb = tvb_get_letohl(tvb, foffset);
if (check_col(pinfo->cinfo, COL_INFO)) {
- col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str(subverb, sss_verb_enum, "Unknown (%d)"));
+ col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str(gbl_subverb, sss_verb_enum, "Unknown (%d)"));
}
aitem = proto_tree_add_item(ncp_tree, hf_verb, tvb, foffset, 4, TRUE);
atree = proto_item_add_subtree(aitem, ett_sss);
if (request_value) {
- request_value->req_nds_flags=subverb;
+ request_value->req_nds_flags=gbl_subverb;
}
foffset += 4;
process_flags(atree, tvb, foffset);
foffset += 4;
proto_tree_add_item(atree, hf_context, tvb, foffset, 4, FALSE);
foffset += 4;
- switch (subverb) {
+ switch (gbl_subverb) {
case 0:
foffset += 4;
foffset = sss_string(tvb, hf_user, atree, foffset, TRUE, 0);
static int
print_address(tvbuff_t* tvb, proto_tree *ndps_tree, int foffset)
{
- guint32 address_type=0;
- guint32 address_len=0;
+ guint32 addr_type=0;
+ guint32 addr_len=0;
- address_type = tvb_get_ntohl(tvb, foffset);
- proto_tree_add_uint(ndps_tree, hf_ndps_address, tvb, foffset, 4, address_type);
+ addr_type = tvb_get_ntohl(tvb, foffset);
+ proto_tree_add_uint(ndps_tree, hf_ndps_address, tvb, foffset, 4, addr_type);
foffset += 4;
- address_len = tvb_get_ntohl(tvb, foffset);
+ addr_len = tvb_get_ntohl(tvb, foffset);
proto_tree_add_item(ndps_tree, hf_address_len, tvb, foffset, 4, FALSE);
foffset += 4;
/*
* XXX - should this code - and the code in packet-ncp2222.inc to
* dissect addresses - check the length for the types it supports?
*/
- switch(address_type)
+ switch(addr_type)
{
case 0x00000000:
proto_tree_add_item(ndps_tree, hf_ndps_net, tvb, foffset, 4, FALSE);
default:
break;
}
- tvb_ensure_bytes_exist(tvb, foffset, address_len);
- foffset += address_len;
- return foffset+(address_len%4);
+ tvb_ensure_bytes_exist(tvb, foffset, addr_len);
+ foffset += addr_len;
+ return foffset+(addr_len%4);
}
static int
address_item(tvbuff_t* tvb, proto_tree *ndps_tree, int foffset)
{
- guint32 address_type=0;
+ guint32 addr_type=0;
- address_type = tvb_get_ntohl(tvb, foffset);
- proto_tree_add_uint(ndps_tree, hf_address_type, tvb, foffset, 4, address_type);
+ addr_type = tvb_get_ntohl(tvb, foffset);
+ proto_tree_add_uint(ndps_tree, hf_address_type, tvb, foffset, 4, addr_type);
foffset += 4;
- switch(address_type)
+ switch(addr_type)
{
case 0:
case 1:
guint len=0;
tvbuff_t *next_tvb = NULL;
fragment_data *fd_head;
- spx_info *spx_info;
+ spx_info *spx_info_p;
ndps_req_hash_value *request_value = NULL;
conversation_t *conversation;
/* Get SPX info from SPX dissector */
- spx_info = pinfo->private_data;
+ spx_info_p = pinfo->private_data;
/* Check to see if defragmentation is enabled in the dissector */
if (!ndps_defragment) {
dissect_ndps(tvb, pinfo, tree);
return;
}
/* Check to see of this is a fragment. If so then mark as a fragment. */
- if (!spx_info->eom) {
+ if (!spx_info_p->eom) {
request_value->ndps_frag = TRUE;
}
/* Now we process the fragments */
len = tvb_reported_length(tvb);
if (tvb_length(tvb) >= len)
{
- fd_head = fragment_add_seq_next(tvb, 0, pinfo, tid, ndps_fragment_table, ndps_reassembled_table, len, !spx_info->eom);
+ fd_head = fragment_add_seq_next(tvb, 0, pinfo, tid, ndps_fragment_table, ndps_reassembled_table, len, !spx_info_p->eom);
if (fd_head != NULL)
{
/* Is this the last fragment? EOM will indicate */
- if (fd_head->next != NULL && spx_info->eom)
+ if (fd_head->next != NULL && spx_info_p->eom)
{
proto_item *frag_tree_item;
next_tvb = tvb_new_subset_remaining(tvb, 0);
if (check_col(pinfo->cinfo, COL_INFO))
{
- if (!spx_info->eom)
+ if (!spx_info_p->eom)
{
col_append_str(pinfo->cinfo, COL_INFO, "[NDPS Fragment]");
}
/* Fragment from first pass of dissection */
if (check_col(pinfo->cinfo, COL_INFO))
{
- if (!spx_info->eom)
+ if (!spx_info_p->eom)
{
col_append_str(pinfo->cinfo, COL_INFO, "[NDPS Fragment]");
}
else
{
/* This is the end fragment so dissect and mark end */
- if (spx_info->eom) {
+ if (spx_info_p->eom) {
request_value->ndps_frag = FALSE;
dissect_ndps(next_tvb, pinfo, tree);
}
}
static const gchar *
-getprefix(const guint32 * address, int prefix)
+getprefix(const guint32 * addr, int prefix)
{
guint32 gprefix;
- gprefix = *address & g_htonl((0xffffffff << (32 - prefix)));
+ gprefix = *addr & g_htonl((0xffffffff << (32 - prefix)));
return (ip_to_str((const guint8 *)&gprefix));
}
dissect_ftype(tvbuff_t *tvb, int offset, proto_tree *tree, const char* name)
{
guint32 ftype;
- const char* ftype_name = NULL;
+ const char* ftype_name_p = NULL;
ftype = tvb_get_ntohl(tvb, offset+0);
if (tree) {
- ftype_name = val_to_str(ftype, nfs2_ftype, "%u");
+ ftype_name_p = val_to_str(ftype, nfs2_ftype, "%u");
proto_tree_add_text(tree, tvb, offset, 4,
- "%s: %s (%u)", name, ftype_name, ftype);
+ "%s: %s (%u)", name, ftype_name_p, ftype);
}
offset += 4;
static void
decode_iei_ip_address(nsip_ie_t *ie, build_info_t *bi, int ie_start_offset) {
- guint8 address_type;
+ guint8 addr_type;
guint32 ip4_addr;
struct e_in6_addr ip6_addr;
- address_type = tvb_get_guint8(bi->tvb, bi->offset);
+ addr_type = tvb_get_guint8(bi->tvb, bi->offset);
proto_tree_add_item(bi->nsip_tree, hf_nsip_ip_address_type,
bi->tvb, bi->offset, 1, FALSE);
- switch (address_type) {
+ switch (addr_type) {
case NSIP_IP_ADDRESS_TYPE_IPV4:
ie->total_length = 2 + ipv4_element.address_length;
ip4_addr = tvb_get_ipv4(bi->tvb, bi->offset+1);
guint8 md4[NTLMSSP_KEY_LEN];
} md4_pass;
-static unsigned char zeros[24] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
+static unsigned char gbl_zeros[24] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
static GHashTable* hash_packet = NULL;
/*
static gint ett_ntlmssp_ntlmv2_response_name = -1;
/* Configuration variables */
-static const char *nt_password = NULL;
+static const char *gbl_nt_password = NULL;
#define MAX_BLOB_SIZE 256
typedef struct _ntlmssp_blob {
*p_pass_list = ep_alloc(nb_pass*sizeof(md4_pass));
pass_list=*p_pass_list;
- if( memcmp(nt_password_hash,zeros,NTLMSSP_KEY_LEN) != 0 ) {
+ if( memcmp(nt_password_hash,gbl_zeros,NTLMSSP_KEY_LEN) != 0 ) {
memcpy(pass_list[i].md4,nt_password_hash,NTLMSSP_KEY_LEN);
i = 1;
}
if (!(conv_ntlmssp_info->flags & NTLMSSP_NEGOTIATE_EXTENDED_SECURITY))
{
conv_ntlmssp_info->rc4_state_initialized = 0;
- create_ntlmssp_v1_key(nt_password, conv_ntlmssp_info->server_challenge,NULL, sspkey,NULL,conv_ntlmssp_info->flags,conv_ntlmssp_info->ntlm_response.contents,conv_ntlmssp_info->lm_response.contents);
- if( memcmp(sspkey,zeros,NTLMSSP_KEY_LEN) != 0 ) {
+ create_ntlmssp_v1_key(gbl_nt_password, conv_ntlmssp_info->server_challenge,NULL, sspkey,NULL,conv_ntlmssp_info->flags,conv_ntlmssp_info->ntlm_response.contents,conv_ntlmssp_info->lm_response.contents);
+ if( memcmp(sspkey,gbl_zeros,NTLMSSP_KEY_LEN) != 0 ) {
get_sealing_rc4key(sspkey,conv_ntlmssp_info->flags,&ssp_key_len,clientkey,serverkey);
crypt_rc4_init(&conv_ntlmssp_info->rc4_state_client, sspkey, ssp_key_len);
crypt_rc4_init(&conv_ntlmssp_info->rc4_state_server, sspkey, ssp_key_len);
{
conv_ntlmssp_info->rc4_state_initialized = 0;
if( conv_ntlmssp_info->is_auth_ntlm_v2 ) {
- create_ntlmssp_v2_key(nt_password, conv_ntlmssp_info->server_challenge,conv_ntlmssp_info->client_challenge, sspkey,encryptedsessionkey,conv_ntlmssp_info->flags,conv_ntlmssp_info->ntlm_response,conv_ntlmssp_info->lm_response,ntlmssph);
+ create_ntlmssp_v2_key(gbl_nt_password, conv_ntlmssp_info->server_challenge,conv_ntlmssp_info->client_challenge, sspkey,encryptedsessionkey,conv_ntlmssp_info->flags,conv_ntlmssp_info->ntlm_response,conv_ntlmssp_info->lm_response,ntlmssph);
}
else
{
memcpy(conv_ntlmssp_info->client_challenge,conv_ntlmssp_info->lm_response.contents,8);
- create_ntlmssp_v1_key(nt_password, conv_ntlmssp_info->server_challenge,conv_ntlmssp_info->client_challenge, sspkey,encryptedsessionkey,conv_ntlmssp_info->flags,conv_ntlmssp_info->ntlm_response.contents,conv_ntlmssp_info->lm_response.contents);
+ create_ntlmssp_v1_key(gbl_nt_password, conv_ntlmssp_info->server_challenge,conv_ntlmssp_info->client_challenge, sspkey,encryptedsessionkey,conv_ntlmssp_info->flags,conv_ntlmssp_info->ntlm_response.contents,conv_ntlmssp_info->lm_response.contents);
}
/* ssp is the exported session key */
- if( memcmp(sspkey,zeros,NTLMSSP_KEY_LEN) != 0) {
+ if( memcmp(sspkey,gbl_zeros,NTLMSSP_KEY_LEN) != 0) {
get_sealing_rc4key(sspkey,conv_ntlmssp_info->flags,&ssp_key_len,clientkey,serverkey);
get_siging_key((guint8*)&conv_ntlmssp_info->sign_key_server,(guint8*)&conv_ntlmssp_info->sign_key_client,sspkey,ssp_key_len);
crypt_rc4_init(&conv_ntlmssp_info->rc4_state_server, serverkey, ssp_key_len);
prefs_register_string_preference(ntlmssp_module, "nt_password",
"NT Password",
"NT Password (used to decrypt payloads)",
- &nt_password);
+ &gbl_nt_password);
register_dissector("ntlmssp", dissect_ntlmssp, proto_ntlmssp);
new_register_dissector("ntlmssp_payload", dissect_ntlmssp_payload, proto_ntlmssp);
static gboolean global_olsr_olsrorg = TRUE;
static gboolean global_olsr_nrlolsr = TRUE;
-static double getOlsrTime(guint8 time) {
+static double getOlsrTime(guint8 timeval) {
int high_bits, low_bits;
- high_bits = ((time & 0xF0) >> 4);
- low_bits = (time & 0x0F);
+ high_bits = ((timeval & 0xF0) >> 4);
+ low_bits = (timeval & 0x0F);
return ((1 << low_bits) / 16.0) * (1 + (high_bits / 16.0));
}
typedef struct _bitfield_info {
int hfindex;
gint *ett;
- int *index;
+ int *idx;
int num;
} bitfield_info;
gint length, pos;
gint i;
header_field_info *hfinfo;
- int hfindex, index;
+ int hfindex, idx;
gint returned_length;
hfindex = hf_ospf_filter[bfinfo->hfindex];
str = ep_alloc(MAX_OPTIONS_LEN);
str[0] = 0;
for (i = 0, pos = 0; i < bfinfo->num; i++) {
- index = hf_ospf_filter[bfinfo->index[i]];
- hfinfo = proto_registrar_get_nth(index);
+ idx = hf_ospf_filter[bfinfo->idx[i]];
+ hfinfo = proto_registrar_get_nth(idx);
if (flags & hfinfo->bitmask) {
returned_length = g_snprintf(&str[pos], MAX_OPTIONS_LEN-pos, "%s%s",
pos ? ", " : "",
hfinfo->name);
pos += MIN(returned_length, MAX_OPTIONS_LEN-pos);
}
- proto_tree_add_boolean(tree, index, tvb, offset, length, flags);
+ proto_tree_add_boolean(tree, idx, tvb, offset, length, flags);
}
if (str[0]) {
proto_item_append_text(item, " (%s)", str);
static int dissect_pbb_addressblock(tvbuff_t *tvb, proto_tree *tree, guint offset, guint maxoffset,
guint8 addressType, guint8 addressSize) {
- guint8 address[MAX_ADDR_SIZE];
+ guint8 addr[MAX_ADDR_SIZE];
guint8 numAddr;
guint8 address_flags;
DISSECTOR_ASSERT(addressSize <= MAX_ADDR_SIZE);
- memset(address, 0, addressSize);
+ memset(addr, 0, addressSize);
block_length = 2;
block_index = offset;
tvb_get_ptr(tvb, offset, maxoffset - offset), "Not enough octets for addressblock head");
return tvb_reported_length(tvb);
}
- tvb_memcpy(tvb, address, offset, head_length);
+ tvb_memcpy(tvb, addr, offset, head_length);
midSize -= head_length;
block_length += (head_length+1);
tvb_get_ptr(tvb, offset, maxoffset - offset), "Not enough octets for addressblock tail");
return tvb_reported_length(tvb);
}
- tvb_memcpy(tvb, &address[addressSize - tail_length], offset, tail_length);
+ tvb_memcpy(tvb, &addr[addressSize - tail_length], offset, tail_length);
midSize -= tail_length;
block_length += (tail_length+1);
proto_tree_add_item(addr_tree, hf_packetbb_addr_head, tvb, tail_index, 1, FALSE);
}
for (i=0; i<numAddr; i++) {
- guint32 ipv4 = (address[0] << 24) + (address[1] << 16) + (address[2] << 8) + address[3];
+ guint32 ipv4 = (addr[0] << 24) + (addr[1] << 16) + (addr[2] << 8) + addr[3];
guint8 prefix = addressSize * 8;
- tvb_memcpy(tvb, &address[head_length], mid_index + midSize*i, midSize);
+ tvb_memcpy(tvb, &addr[head_length], mid_index + midSize*i, midSize);
switch (addressType) {
case 0:
break;
case 1:
addrValue_item = proto_tree_add_ipv6(addr_tree, hf_packetbb_addr_value[addressType],
- tvb, mid_index, block_index + block_length - mid_index, address);
+ tvb, mid_index, block_index + block_length - mid_index, addr);
break;
case 2:
addrValue_item = proto_tree_add_ether(addr_tree, hf_packetbb_addr_value[addressType],
- tvb, mid_index, block_index + block_length - mid_index, address);
+ tvb, mid_index, block_index + block_length - mid_index, addr);
break;
default:
addrValue_item = proto_tree_add_bytes(addr_tree, hf_packetbb_addr_value[addressType],
- tvb, mid_index, block_index + block_length - mid_index, address);
+ tvb, mid_index, block_index + block_length - mid_index, addr);
break;
}
addrValue_tree = proto_item_add_subtree(addrValue_item, ett_packetbb_addr_value);
guint16 word;
guint32 new_length, check_length;
- guint32 remainder, tvb_bits;
+ guint32 remainderval, tvb_bits;
/* Calculate the size reqired */
new_length = no_of_bits/8;
- remainder = no_of_bits % 8;
+ remainderval = no_of_bits % 8;
- if(remainder){
+ if(remainderval){
new_length++;
}else{
/* Number of bits = even number of octets */
/* The bits can be contained in two "extra octets" .... .xxx [xxxx]*n xx... ....*/
tvb_bits = (boffset & 7)+ no_of_bits;
check_length = tvb_bits/8;
- remainder = no_of_bits % 8;
- if(remainder){
+ remainderval = no_of_bits % 8;
+ if(remainderval){
check_length++;
}
/* get the 'odd' bits */
shift1 = offset & 0x07;
word = tvb_get_ntohs(tvb, offset) & bit_mask16[offset & 0x07];
- word = word >> (16-(shift1+remainder));
+ word = word >> (16-(shift1+remainderval));
buf[0] = word & 0x00ff;
- boffset = boffset + remainder;
+ boffset = boffset + remainderval;
offset = boffset >> 3;
if (new_length >1){
shift1 = offset & 0x07;
}else{
word = tvb_get_guint8(tvb,offset+i) << (shift1 + 8);
}
- word = word & bit_mask16_unalligned[remainder];
+ word = word & bit_mask16_unalligned[remainderval];
word = word >> 8;
buf[i] = (guint8) (word & 0x00ff);
}
val_start = (offset>>3)-2; val_length = 2;
val+=min;
} else {
- int i,num_bytes,num_bits;
+ int i,num_bytes,n_bits;
/* 10.5.7.4 */
/* 12.2.6 */
/* calculate the number of bits to hold the length */
if ((range & G_GINT64_CONSTANT(0xffffffff0000000)) != 0){
- num_bits=3;
+ n_bits=3;
}else{
- num_bits=2;
+ n_bits=2;
}
- num_bytes =tvb_get_bits8(tvb, offset, num_bits);
+ num_bytes =tvb_get_bits8(tvb, offset, n_bits);
num_bytes++; /* lower bound for length determinant is 1 */
if (display_internal_per_fields){
- int_item = proto_tree_add_bits_item(tree, hf_per_const_int_len, tvb, offset,num_bits, FALSE);
+ int_item = proto_tree_add_bits_item(tree, hf_per_const_int_len, tvb, offset,n_bits, FALSE);
proto_item_append_text(int_item,"+1=%u bytes, Range = (%" G_GINT64_MODIFIER "u)",num_bytes, range);
}
- offset = offset+num_bits;
+ offset = offset+n_bits;
/* byte aligned */
BYTE_ALIGN_OFFSET(offset);
val=0;
int extension_root_entries;
int extension_addition_entries;
guint32 choice_index;
- int i, index, cidx;
+ int i, idx, cidx;
guint32 ext_length;
guint32 old_offset = offset;
proto_item *choice_item = NULL;
if (!display_internal_per_fields) PROTO_ITEM_SET_HIDDEN(actx->created_item);
}
- index = -1; cidx = choice_index;
+ idx = -1; cidx = choice_index;
for (i=0; choice[i].p_id; i++) {
if(choice[i].extension != ASN1_NOT_EXTENSION_ROOT){
- if (!cidx) { index = i; break; }
+ if (!cidx) { idx = i; break; }
cidx--;
}
}
offset = dissect_per_normally_small_nonnegative_whole_number(tvb, offset, actx, tree, hf_per_choice_extension_index, &choice_index);
offset = dissect_per_length_determinant(tvb, offset, actx, tree, hf_per_open_type_length, &ext_length);
- index = -1; cidx = choice_index;
+ idx = -1; cidx = choice_index;
for (i=0; choice[i].p_id; i++) {
if(choice[i].extension == ASN1_NOT_EXTENSION_ROOT){
- if (!cidx) { index = i; break; }
+ if (!cidx) { idx = i; break; }
cidx--;
}
}
}
- if (index != -1) {
- choice_item = proto_tree_add_uint(tree, hf_index, tvb, old_offset>>3, 0, choice[index].value);
+ if (idx != -1) {
+ choice_item = proto_tree_add_uint(tree, hf_index, tvb, old_offset>>3, 0, choice[idx].value);
choice_tree = proto_item_add_subtree(choice_item, ett_index);
if (!extension_flag) {
- offset = choice[index].func(tvb, offset, actx, choice_tree, *choice[index].p_id);
+ offset = choice[idx].func(tvb, offset, actx, choice_tree, *choice[idx].p_id);
} else {
- choice[index].func(tvb, offset, actx, choice_tree, *choice[index].p_id);
+ choice[idx].func(tvb, offset, actx, choice_tree, *choice[idx].p_id);
offset += ext_length * 8;
}
proto_item_set_len(choice_item, BLEN(old_offset, offset));
}
}
- if (value && (index != -1))
- *value = choice[index].value;
+ if (value && (idx != -1))
+ *value = choice[idx].value;
return offset;
}
static const char *
-index_get_optional_name(const per_sequence_t *sequence, int index)
+index_get_optional_name(const per_sequence_t *sequence, int idx)
{
int i;
header_field_info *hfi;
for(i=0;sequence[i].p_id;i++){
if((sequence[i].extension!=ASN1_NOT_EXTENSION_ROOT)&&(sequence[i].optional==ASN1_OPTIONAL)){
- if (index == 0) {
+ if (idx == 0) {
hfi = proto_registrar_get_nth(*sequence[i].p_id);
return (hfi) ? hfi->name : "<unknown filed>";
}
- index--;
+ idx--;
}
}
return "<unknown type>";
}
static const char *
-index_get_extension_name(const per_sequence_t *sequence, int index)
+index_get_extension_name(const per_sequence_t *sequence, int idx)
{
int i;
header_field_info *hfi;
for(i=0;sequence[i].p_id;i++){
if(sequence[i].extension==ASN1_NOT_EXTENSION_ROOT){
- if (index == 0) {
+ if (idx == 0) {
hfi = proto_registrar_get_nth(*sequence[i].p_id);
return (hfi) ? hfi->name : "<unknown filed>";
}
- index--;
+ idx--;
}
}
return "<unknown type>";
}
static const char *
-index_get_field_name(const per_sequence_t *sequence, int index)
+index_get_field_name(const per_sequence_t *sequence, int idx)
{
header_field_info *hfi;
- hfi = proto_registrar_get_nth(*sequence[index].p_id);
+ hfi = proto_registrar_get_nth(*sequence[idx].p_id);
return (hfi) ? hfi->name : "<unknown filed>";
}
optsstr(guint8 opts)
{
char *msg;
- gint returned_length, index = 0;
+ gint returned_length, idx = 0;
const int MAX_STR_LEN = 256;
if (opts == 0)
msg=ep_alloc(MAX_STR_LEN);
if (opts & PGM_OPT){
- returned_length = g_snprintf(&msg[index], MAX_STR_LEN-index, "Present");
- index += MIN(returned_length, MAX_STR_LEN-index);
+ returned_length = g_snprintf(&msg[idx], MAX_STR_LEN-idx, "Present");
+ idx += MIN(returned_length, MAX_STR_LEN-idx);
}
if (opts & PGM_OPT_NETSIG){
- returned_length = g_snprintf(&msg[index], MAX_STR_LEN-index, "%sNetSig", (!index)?"":",");
- index += MIN(returned_length, MAX_STR_LEN-index);
+ returned_length = g_snprintf(&msg[idx], MAX_STR_LEN-idx, "%sNetSig", (!idx)?"":",");
+ idx += MIN(returned_length, MAX_STR_LEN-idx);
}
if (opts & PGM_OPT_VAR_PKTLEN){
- returned_length = g_snprintf(&msg[index], MAX_STR_LEN-index, "%sVarLen", (!index)?"":",");
- index += MIN(returned_length, MAX_STR_LEN-index);
+ returned_length = g_snprintf(&msg[idx], MAX_STR_LEN-idx, "%sVarLen", (!idx)?"":",");
+ idx += MIN(returned_length, MAX_STR_LEN-idx);
}
if (opts & PGM_OPT_PARITY){
- returned_length = g_snprintf(&msg[index], MAX_STR_LEN-index, "%sParity", (!index)?"":",");
- index += MIN(returned_length, MAX_STR_LEN-index);
+ returned_length = g_snprintf(&msg[idx], MAX_STR_LEN-idx, "%sParity", (!idx)?"":",");
+ idx += MIN(returned_length, MAX_STR_LEN-idx);
}
- if (!index) {
- g_snprintf(&msg[index], MAX_STR_LEN-index, "0x%x", opts);
+ if (!idx) {
+ g_snprintf(&msg[idx], MAX_STR_LEN-idx, "0x%x", opts);
}
return(msg);
}
paritystr(guint8 parity)
{
char *msg;
- gint returned_length, index = 0;
+ gint returned_length, idx = 0;
const int MAX_STR_LEN = 256;
if (parity == 0)
msg=ep_alloc(MAX_STR_LEN);
if (parity & PGM_OPT_PARITY_PRM_PRO){
- returned_length = g_snprintf(&msg[index], MAX_STR_LEN-index, "Pro-active");
- index += MIN(returned_length, MAX_STR_LEN-index);
+ returned_length = g_snprintf(&msg[idx], MAX_STR_LEN-idx, "Pro-active");
+ idx += MIN(returned_length, MAX_STR_LEN-idx);
}
if (parity & PGM_OPT_PARITY_PRM_OND){
- returned_length = g_snprintf(&msg[index], MAX_STR_LEN-index, "%sOn-demand", (!index)?"":",");
- index += MIN(returned_length, MAX_STR_LEN-index);
+ returned_length = g_snprintf(&msg[idx], MAX_STR_LEN-idx, "%sOn-demand", (!idx)?"":",");
+ idx += MIN(returned_length, MAX_STR_LEN-idx);
}
- if (!index) {
- g_snprintf(&msg[index], MAX_STR_LEN-index, "0x%x", parity);
+ if (!idx) {
+ g_snprintf(&msg[idx], MAX_STR_LEN-idx, "0x%x", parity);
}
return(msg);
}
static void
dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- struct pop_proto_data *frame_data;
+ struct pop_proto_data *frame_data_p;
gboolean is_request;
gboolean is_continuation;
proto_tree *pop_tree, *reqresp_tree;
is_continuation = response_is_continuation(line);
}
- frame_data = p_get_proto_data(pinfo->fd, proto_pop);
+ frame_data_p = p_get_proto_data(pinfo->fd, proto_pop);
- if (!frame_data) {
+ if (!frame_data_p) {
conversation = find_conversation(pinfo->fd->num,
&pinfo->src, &pinfo->dst,
if (pop_data_desegment) {
- if (!frame_data) {
+ if (!frame_data_p) {
data_val->msg_read_len += tvb_length(tvb);
- frame_data = se_alloc(sizeof(struct pop_proto_data));
+ frame_data_p = se_alloc(sizeof(struct pop_proto_data));
- frame_data->conversation_id = conversation->index;
- frame_data->more_frags = data_val->msg_read_len < data_val->msg_tot_len;
+ frame_data_p->conversation_id = conversation->index;
+ frame_data_p->more_frags = data_val->msg_read_len < data_val->msg_tot_len;
- p_add_proto_data(pinfo->fd, proto_pop, frame_data);
+ p_add_proto_data(pinfo->fd, proto_pop, frame_data_p);
}
frag_msg = fragment_add_seq_next(tvb, 0, pinfo,
- frame_data->conversation_id,
+ frame_data_p->conversation_id,
pop_data_segment_table,
pop_data_reassembled_table,
tvb_length(tvb),
- frame_data->more_frags);
+ frame_data_p->more_frags);
next_tvb = process_reassembled_data(tvb, offset, pinfo,
"Reassembled DATA",
dissect_getport_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
proto_tree *tree)
{
- guint32 port;
+ guint32 portx;
/* we might have learnt a <ipaddr><protocol><port> mapping for ONC-RPC*/
if(!pinfo->fd->flags.visited){
}
}
- port = tvb_get_ntohl(tvb, offset);
+ portx = tvb_get_ntohl(tvb, offset);
offset = dissect_rpc_uint32(tvb, tree, hf_portmap_port,
offset);
- proto_item_append_text(tree, " GETPORT Reply Port:%d", port);
- if(port){
+ proto_item_append_text(tree, " GETPORT Reply Port:%d", portx);
+ if(portx){
if (check_col(pinfo->cinfo, COL_INFO)) {
- col_append_fstr(pinfo->cinfo, COL_INFO, " Port:%d", port);
+ col_append_fstr(pinfo->cinfo, COL_INFO, " Port:%d", portx);
}
- proto_item_append_text(tree, " Port:%d", port);
+ proto_item_append_text(tree, " Port:%d", portx);
} else {
col_append_str(pinfo->cinfo, COL_INFO, " PROGRAM_NOT_AVAILABLE");
proto_item_append_text(tree, " PROGRAM_NOT_AVAILABLE");
dissect_ptp_v2_timeInterval(tvbuff_t *tvb, guint16 *cur_offset, proto_tree *tree, char* name, int hf_ptp_v2_timeInterval_ns, int hf_ptp_v2_timeInterval_subns)
{
- double time;
+ double time_double;
gint64 time_ns;
guint16 time_subns;
proto_item *ptptimeInterval_ti;
time_ns = time_ns | G_GINT64_CONSTANT(0xFFFFFFFFFF000000);
time_ns = time_ns | tvb_get_ntohs(tvb, *cur_offset+4);
- time = ((1.0*time_ns) + (time_subns/65536.0));
+ time_double = ((1.0*time_ns) + (time_subns/65536.0));
}
else
{
time_ns = time_ns | tvb_get_ntohs(tvb, *cur_offset+4);
- time = time_ns + (time_subns/65536.0);
+ time_double = time_ns + (time_subns/65536.0);
}
ptptimeInterval_ti = proto_tree_add_text(tree, tvb, *cur_offset, 8,
- "%s: %f nanoseconds", name, time);
+ "%s: %f nanoseconds", name, time_double);
ptptimeInterval_subtree = proto_item_add_subtree(ptptimeInterval_ti, ett_ptp_v2_timeInterval);
item = proto_tree_add_item(tree, proto_pw_padding, tvb, 0, -1, FALSE);
pwc_item_append_text_n_items(item,size,"byte");
{
- proto_tree* tree;
- tree = proto_item_add_subtree(item, ett);
- call_dissector(dh_data, tvb, pinfo, tree);
- item = proto_tree_add_int(tree, hf_padding_len, tvb, 0, 0, size);
+ proto_tree* tree_p;
+ tree_p = proto_item_add_subtree(item, ett);
+ call_dissector(dh_data, tvb, pinfo, tree_p);
+ item = proto_tree_add_int(tree_p, hf_padding_len, tvb, 0, 0, size);
PROTO_ITEM_SET_HIDDEN(item); /*allow filtering*/
}
}
proto_item *item;
proto_item *item_address;
proto_item *item_control;
- guint8 address;
+ guint8 addr;
guint8 control;
- address = tvb_get_guint8(tvb, 0);
+ addr = tvb_get_guint8(tvb, 0);
control = tvb_get_guint8(tvb, 1);
item = proto_tree_add_item( tree, proto_pw_hdlc_nocw_hdlc_ppp, tvb, 0, 2, FALSE );
tr = proto_item_add_subtree( item, ett_pw_hdlc );
- item_address = proto_tree_add_uint( tr, hf_pw_hdlc_address_field, tvb, 0, 1, address );
+ item_address = proto_tree_add_uint( tr, hf_pw_hdlc_address_field, tvb, 0, 1, addr );
item_control = proto_tree_add_uint_format( tr, hf_pw_hdlc_control_field, tvb, 1, 1, control, "Control field: 0x%x", control );
tr = proto_item_add_subtree( item_address, ett_pw_hdlc );
- if ( 0x3F == (( address & 0xFC ) >> 2 ))
+ if ( 0x3F == (( addr & 0xFC ) >> 2 ))
proto_tree_add_uint_format( tr, hf_pw_hdlc_address, tvb, 0, 1, 0xFC, "Address: 0x%x (All stations)", 0x3F );
else
- proto_tree_add_uint( tr, hf_pw_hdlc_address, tvb, 0, 1, ( address & 0xFC ) >> 2 );
+ proto_tree_add_uint( tr, hf_pw_hdlc_address, tvb, 0, 1, ( addr & 0xFC ) >> 2 );
- proto_tree_add_uint( tr, hf_pw_hdlc_cr_bit, tvb, 0, 1, ( address & 2 ) >> 1 );
+ proto_tree_add_uint( tr, hf_pw_hdlc_cr_bit, tvb, 0, 1, ( addr & 2 ) >> 1 );
tr = proto_item_add_subtree( item_control, ett_pw_hdlc );