aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-ansi_a.c8
-rw-r--r--epan/dissectors/packet-ber.c158
-rw-r--r--epan/dissectors/packet-dcerpc.c4
-rw-r--r--epan/dissectors/packet-scsi.c116
-rw-r--r--epan/dissectors/packet-smb2.c114
5 files changed, 192 insertions, 208 deletions
diff --git a/epan/dissectors/packet-ansi_a.c b/epan/dissectors/packet-ansi_a.c
index c648d1bf64..87d82d855f 100644
--- a/epan/dissectors/packet-ansi_a.c
+++ b/epan/dissectors/packet-ansi_a.c
@@ -53,10 +53,6 @@
void proto_reg_handoff_ansi_a(void);
-#define ANSI_A_MAX(x,y) (((x) < (y)) ? (y) : (x))
-
-#define ANSI_A_MIN(x,y) (((x) < (y)) ? (x) : (y))
-
const value_string ansi_a_ios401_bsmap_strings[] = {
{ 0x69, "Additional Service Notification" },
{ 0x65, "ADDS Page" },
@@ -8313,8 +8309,8 @@ proto_register_ansi_a(void)
};
/* Setup protocol subtree array */
-#define MAX_NUM_DTAP_MSG ANSI_A_MAX(ANSI_A_IOS401_DTAP_NUM_MSG, 0)
-#define MAX_NUM_BSMAP_MSG ANSI_A_MAX(ANSI_A_IOS401_BSMAP_NUM_MSG, 0)
+#define MAX_NUM_DTAP_MSG MAX(ANSI_A_IOS401_DTAP_NUM_MSG, 0)
+#define MAX_NUM_BSMAP_MSG MAX(ANSI_A_IOS401_BSMAP_NUM_MSG, 0)
#define NUM_INDIVIDUAL_ELEMS 9
gint **ett;
gint ett_len = (NUM_INDIVIDUAL_ELEMS+MAX_NUM_DTAP_MSG+MAX_NUM_BSMAP_MSG+NUM_ELEM_1+NUM_MS_INFO_REC) * sizeof(gint *);
diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c
index bd60e6ae0f..600bd9d578 100644
--- a/epan/dissectors/packet-ber.c
+++ b/epan/dissectors/packet-ber.c
@@ -11,7 +11,7 @@
* as well as the signatures for the callbacks to include the indefinite length
* indication that would be a major job.
*
- * Originally we used a kludge - we set a global variable in the
+ * Originally we used a kludge - we set a global variable in the
* CHOICE/SEQUENCE [OF]/SET [OF] helpers to indicate to the next helper
* whether the length is indefinite or not.
* That had currently only been implemented for {SEQUENCE|SET} [OF] but not
@@ -50,12 +50,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-/*
+/*
* ITU-T Recommendation X.690 (07/2002),
* Information technology ASN.1 encoding rules:
* Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER)
- *
- */
+ *
+ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -77,10 +77,6 @@
#include <epan/oid_resolv.h>
#include "packet-ber.h"
-#ifndef MIN
-#define MIN(x,y) ((x)<(y))?(x):(y)
-#endif
-
static gint proto_ber = -1;
static gint hf_ber_id_class = -1;
static gint hf_ber_id_pc = -1;
@@ -227,7 +223,7 @@ int dissect_unknown_ber(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tre
if(len>(guint32)tvb_length_remaining(tvb, offset)){
/* hmm maybe something bad happened or the frame is short,
- since these are not vital outputs just return instead of
+ since these are not vital outputs just return instead of
throwing an exception.
*/
@@ -311,8 +307,8 @@ int dissect_unknown_ber(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tre
c = tvb_get_guint8(tvb, offset+i);
if(is_printable && !g_ascii_isprint(c))
- is_printable=FALSE;
-
+ is_printable=FALSE;
+
proto_item_append_text(pi,"%02x",c);
}
@@ -382,7 +378,7 @@ call_ber_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *p
dissect_unknown_ber(pinfo, next_tvb, 0, next_tree);
}
- /*XXX until we change the #.REGISTER signature for _PDU()s
+ /*XXX until we change the #.REGISTER signature for _PDU()s
* into new_dissector_t we have to do this kludge with
* manually step past the content in the ANY type.
*/
@@ -421,7 +417,7 @@ printf ("BER ID=%02x", id);
printf (" %02x", t);
#endif
offset += 1;
- tmp_tag <<= 7;
+ tmp_tag <<= 7;
tmp_tag |= t & 0x7F;
if (!(t & 0x80)) break;
}
@@ -440,7 +436,7 @@ printf ("\n");
return offset;
}
-int dissect_ber_identifier(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset, gint8 *class, gboolean *pc, gint32 *tag)
+int dissect_ber_identifier(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset, gint8 *class, gboolean *pc, gint32 *tag)
{
int old_offset = offset;
gint8 tmp_class;
@@ -448,7 +444,7 @@ int dissect_ber_identifier(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *t
gint32 tmp_tag;
offset = get_ber_identifier(tvb, offset, &tmp_class, &tmp_pc, &tmp_tag);
-
+
if(show_internal_ber_fields){
proto_tree_add_uint(tree, hf_ber_id_class, tvb, old_offset, 1, tmp_class<<6);
proto_tree_add_boolean(tree, hf_ber_id_pc, tvb, old_offset, 1, (tmp_pc)?0x20:0x00);
@@ -498,7 +494,7 @@ get_ber_length(proto_tree *tree, tvbuff_t *tvb, int offset, guint32 *length, gbo
oct = tvb_get_guint8(tvb, offset);
offset += 1;
-
+
if(!(oct&0x80)) {
/* 8.1.3.4 */
tmp_length = oct;
@@ -513,10 +509,10 @@ get_ber_length(proto_tree *tree, tvbuff_t *tvb, int offset, guint32 *length, gbo
}
} else {
/* 8.1.3.6 */
-
+
tmp_offset = offset;
/* ok in here we can traverse the BER to find the length, this will fix most indefinite length issues */
- /* Assumption here is that indefinite length is always used on constructed types*/
+ /* Assumption here is that indefinite length is always used on constructed types*/
/* check for EOC */
while ((tvb_reported_length_remaining(tvb,offset)>0) && ( tvb_get_guint8(tvb, offset) || tvb_get_guint8(tvb,offset+1)))
{
@@ -527,7 +523,7 @@ get_ber_length(proto_tree *tree, tvbuff_t *tvb, int offset, guint32 *length, gbo
tmp_length += tmp_len+(offset-s_offset); /* length + tag and length */
offset += tmp_len;
}
- tmp_length += 2;
+ tmp_length += 2;
tmp_ind = TRUE;
offset = tmp_offset;
}
@@ -560,7 +556,7 @@ dissect_ber_length(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int
gboolean tmp_ind;
offset = get_ber_length(tree, tvb, offset, &tmp_length, &tmp_ind);
-
+
if(show_internal_ber_fields){
if(tmp_ind){
proto_tree_add_text(tree, tvb, old_offset, 1, "Length: Indefinite length %d", tmp_length);
@@ -574,8 +570,8 @@ dissect_ber_length(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int
*ind = tmp_ind;
return offset;
}
-static int
-reassemble_octet_string(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, guint32 con_len, gboolean ind, tvbuff_t **out_tvb)
+static int
+reassemble_octet_string(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, guint32 con_len, gboolean ind, tvbuff_t **out_tvb)
{
static GHashTable *octet_segment_table = NULL;
static GHashTable *octet_reassembled_table = NULL;
@@ -610,14 +606,14 @@ reassemble_octet_string(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int
if(ind) {
/* this was indefinite length - so check for EOC */
-
+
if((tvb_get_guint8(tvb, offset)==0)&&(tvb_get_guint8(tvb, offset+1)==0)) {
fragment = FALSE;
/* skip past EOC */
offset +=2;
}
} else {
-
+
if((guint32)(offset - start_offset) >= con_len)
fragment = FALSE;
}
@@ -662,13 +658,13 @@ reassemble_octet_string(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int
/* again - not sure we need this */
pinfo->fragmented = FALSE;
-
+
return offset;
}
/* 8.7 Encoding of an octetstring value */
-int
+int
dissect_ber_octet_string(gboolean implicit_tag, packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, gint hf_id, tvbuff_t **out_tvb) {
gint8 class;
gboolean pc, ind;
@@ -705,7 +701,7 @@ printf("OCTET STRING dissect_ber_octet_string(%s) entered\n",name);
/* sanity check: we only handle Constructed Universal Sequences */
if ((class!=BER_CLASS_APP)&&(class!=BER_CLASS_PRI))
- if( (class!=BER_CLASS_UNI)
+ if( (class!=BER_CLASS_UNI)
||((tag<BER_UNI_TAG_NumericString)&&(tag!=BER_UNI_TAG_OCTETSTRING)&&(tag!=BER_UNI_TAG_UTF8String)) ){
tvb_ensure_bytes_exist(tvb, offset-2, 2);
proto_tree_add_text(tree, tvb, offset-2, 2, "BER Error: OctetString expected but Class:%d PC:%d Tag:%d was unexpected", class, pc, tag);
@@ -718,7 +714,7 @@ printf("OCTET STRING dissect_ber_octet_string(%s) entered\n",name);
pc=FALSE;
len=tvb_length_remaining(tvb,offset);
end_offset=offset+len;
- }
+ }
ber_last_created_item = NULL;
if (pc) {
@@ -736,7 +732,7 @@ printf("OCTET STRING dissect_ber_octet_string(%s) entered\n",name);
ber_last_created_item = it;
} else {
proto_item *pi;
-
+
pi=proto_tree_add_text(tree, tvb, offset, len, "Unknown OctetString: Length: 0x%02x, Value: 0x", len);
if(pi){
for(i=0;i<len;i++){
@@ -767,7 +763,7 @@ int dissect_ber_octet_string_wcb(gboolean implicit_tag, packet_info *pinfo, prot
}
/* 8.8 Encoding of a null value */
-int
+int
dissect_ber_null(gboolean implicit_tag, packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, gint hf_id) {
gint8 class;
gboolean pc;
@@ -776,14 +772,14 @@ dissect_ber_null(gboolean implicit_tag, packet_info *pinfo, proto_tree *tree, tv
int offset_old;
if (!implicit_tag)
{
- offset_old = offset;
+ offset_old = offset;
offset = dissect_ber_identifier(pinfo, tree, tvb, offset, &class, &pc, &tag);
if((pc) ||
(!implicit_tag && ((class != BER_CLASS_UNI) || (tag != BER_UNI_TAG_NULL)))) {
proto_tree_add_text(tree, tvb, offset_old, offset - offset_old, "BER Error: NULL expected but Class:%d(%s) PC:%d Tag:%d was unexpected", class,val_to_str(class,ber_class_codes,"Unknown"), pc, tag);
}
- offset_old = offset;
+ offset_old = offset;
offset = dissect_ber_length(pinfo, tree, tvb, offset, &len, NULL);
if(len) {
proto_tree_add_text(tree, tvb, offset_old, offset - offset_old, "BER Error: NULL expect zero length but Length=%d", len);
@@ -852,7 +848,7 @@ printf("INTEGERnew dissect_ber_integer(%s) entered implicit_tag:%d \n",name,impl
}
return offset;
}
-
+
val=0;
if(len > 0) {
/* extend sign bit */
@@ -867,7 +863,7 @@ printf("INTEGERnew dissect_ber_integer(%s) entered implicit_tag:%d \n",name,impl
ber_last_created_item=NULL;
- if(hf_id >= 0){
+ if(hf_id >= 0){
/* */
if(len < 1 || len > 8) {
proto_tree_add_text(tree, tvb, offset-len, len, "Can't handle integer length: %u", len);
@@ -937,7 +933,7 @@ dissect_ber_boolean(gboolean implicit_tag, packet_info *pinfo, proto_tree *tree,
} else {
/* nothing to do here, yet */
}
-
+
val=tvb_get_guint8(tvb, offset);
offset+=1;
@@ -958,7 +954,7 @@ dissect_ber_boolean(gboolean implicit_tag, packet_info *pinfo, proto_tree *tree,
-/* this function dissects a BER sequence
+/* this function dissects a BER sequence
*/
int dissect_ber_sequence(gboolean implicit_tag, packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, int offset, const ber_sequence_t *seq, gint hf_id, gint ett_id) {
gint8 class;
@@ -996,7 +992,7 @@ printf("SEQUENCE dissect_ber_sequence(%s) entered\n",name);
if(ind){
/* Fixed the length is correctly returned from dissect ber_length
end_offset = tvb_length(tvb);*/
- end_offset = offset + len -2;
+ end_offset = offset + len -2;
} else {
end_offset = offset + len;
}
@@ -1064,13 +1060,13 @@ ber_sequence_try_again:
*/
/* XXX Bug in asn2eth,
* for scope [7] Scope OPTIONAL,
- * it generates
+ * it generates
* { BER_CLASS_CON, 7, BER_FLAGS_OPTIONAL|BER_FLAGS_NOTCHKTAG, dissect_scope },
* and there should not be a NOTCHKTAG here
*/
if( ((seq->class==BER_CLASS_CON)||(seq->class==BER_CLASS_APP)||(seq->class==BER_CLASS_PRI)) && (!(seq->flags&BER_FLAGS_NOOWNTAG)) ){
- if( (seq->class!=BER_CLASS_ANY)
- && (seq->tag!=-1)
+ if( (seq->class!=BER_CLASS_ANY)
+ && (seq->tag!=-1)
&&( (seq->class!=class)
||(seq->tag!=tag) ) ){
/* it was not, move to the next one and try again */
@@ -1086,7 +1082,7 @@ ber_sequence_try_again:
"BER Error: Wrong field in SEQUENCE expected class:%d (%s) tag:%d (%s) but found class:%d tag:%d",
seq->class,val_to_str(seq->class,ber_class_codes,"Unknown"),
seq->tag,val_to_str(seq->tag,ber_uni_tag_codes,"Unknown"),
- class,tag);
+ class,tag);
}else{
proto_tree_add_text(tree, tvb, offset, len,
"BER Error: Wrong field in SEQUENCE expected class:%d (%s) tag:%d but found class:%d tag:%d",
@@ -1098,8 +1094,8 @@ ber_sequence_try_again:
continue;
}
} else if(!(seq->flags & BER_FLAGS_NOTCHKTAG)) {
- if( (seq->class!=BER_CLASS_ANY)
- && (seq->tag!=-1)
+ if( (seq->class!=BER_CLASS_ANY)
+ && (seq->tag!=-1)
&&( (seq->class!=class)
||(seq->tag!=tag) ) ){
/* it was not, move to the next one and try again */
@@ -1137,7 +1133,7 @@ ber_sequence_try_again:
length_remaining=eoffset-hoffset;
next_tvb = tvb_new_subset(tvb, hoffset, length_remaining, eoffset-hoffset);
}
-
+
/* call the dissector for this field */
/*if ((eoffset-hoffset)>length_remaining) {*/
/* If the field is indefinite (i.e. we dont know the
@@ -1146,7 +1142,7 @@ ber_sequence_try_again:
*/
/*next_tvb = tvb_new_subset(tvb, hoffset, -1, -1);*/
/*} else {*/
-
+
/*}*/
#ifdef DEBUG_BER
@@ -1171,7 +1167,7 @@ printf("SEQUENCE dissect_ber_sequence(%s) calling subdissector\n",name);
THROW(ReportedBoundsError);
}
count=seq->func(pinfo, tree, next_tvb, 0);
-
+
#ifdef DEBUG_BER
{
char *name;
@@ -1214,7 +1210,7 @@ printf("SEQUENCE dissect_ber_sequence(%s) subdissector ate %d bytes\n",name,coun
if(ind){
/* need to eat this EOC
end_offset = tvb_length(tvb);*/
- end_offset += 2;
+ end_offset += 2;
if(show_internal_ber_fields){
proto_tree_add_text(tree, tvb, end_offset-2,2 , "SEQ EOC");
}
@@ -1265,7 +1261,7 @@ printf("SET dissect_ber_set(%s) entered\n",name);
if(ind){
/* Fixed the length is correctly returned from dissect ber_length
end_offset = tvb_length(tvb);*/
- end_offset = offset + len -2;
+ end_offset = offset + len -2;
} else {
end_offset = offset + len;
}
@@ -1297,7 +1293,7 @@ printf("SET dissect_ber_set(%s) entered\n",name);
we can only record 32 elements for now ... */
for(set_idx = 0; (cset=&set[set_idx])->func && (set_idx < MAX_SET_ELEMENTS); set_idx++) {
- if(!(cset->flags & BER_FLAGS_OPTIONAL))
+ if(!(cset->flags & BER_FLAGS_OPTIONAL))
mandatory_fields |= 1 << set_idx;
}
@@ -1326,7 +1322,7 @@ printf("SET dissect_ber_set(%s) entered\n",name);
offset = get_ber_length(tree, tvb, offset, &len, &ind_field);
eoffset = offset + len;
- /* Look through the Set to see if this class/id exists and
+ /* Look through the Set to see if this class/id exists and
* hasn't been seen before
* Skip check completely if class==ANY
* of if NOCHKTAG is set
@@ -1342,7 +1338,7 @@ printf("SET dissect_ber_set(%s) entered\n",name);
cset=set; /* reset to the beginning */
set_idx = 0;
}
-
+
if((first_pass && ((cset->class==class) && (cset->tag==tag))) ||
(!first_pass && ((cset->class== BER_CLASS_ANY) && (cset->tag == -1))) ) /* choices */
{
@@ -1363,7 +1359,7 @@ printf("SET dissect_ber_set(%s) entered\n",name);
next_tvb = tvb_new_subset(tvb, hoffset, length_remaining, eoffset-hoffset);
}
-
+
/* call the dissector for this field */
/*if ((eoffset-hoffset)>length_remaining) {*/
/* If the field is indefinite (i.e. we dont know the
@@ -1372,7 +1368,7 @@ printf("SET dissect_ber_set(%s) entered\n",name);
*/
/*next_tvb = tvb_new_subset(tvb, hoffset, -1, -1);*/
/*} else {*/
-
+
/*}*/
#ifdef DEBUG_BER
@@ -1422,8 +1418,8 @@ printf("SET dissect_ber_set(%s) calling subdissector\n",name);
if(!cset->func) {
/* we didn't find a match */
proto_tree_add_text(tree, tvb, hoffset, len, "BER Error: Unknown field in SET class:%d(%s) tag:%d",class,val_to_str(class,ber_class_codes,"Unknown"),tag);
- offset = eoffset;
- }
+ offset = eoffset;
+ }
}
if(mandatory_fields) {
@@ -1450,11 +1446,11 @@ printf("SET dissect_ber_set(%s) calling subdissector\n",name);
tvb_ensure_bytes_exist(tvb, offset-2, 2);
proto_tree_add_text(tree, tvb, offset-2, 2, "BER Error: SET ate %d too many bytes", offset-end_offset);
}
-
+
if(ind){
/* need to eat this EOC
end_offset = tvb_length(tvb);*/
- end_offset += 2;
+ end_offset += 2;
if(show_internal_ber_fields){
proto_tree_add_text(tree, tvb, end_offset-2,2 , "SET EOC");
}
@@ -1465,7 +1461,7 @@ printf("SET dissect_ber_set(%s) calling subdissector\n",name);
}
-/* this function dissects a BER choice
+/* this function dissects a BER choice
* If we did not find a matching choice, just return offset unchanged
* in case it was a CHOICE { } OPTIONAL
*/
@@ -1509,9 +1505,9 @@ printf("CHOICE dissect_ber_choice(%s) entered len:%d\n",name,tvb_length_remainin
offset=get_ber_identifier(tvb, offset, &class, &pc, &tag);
offset=get_ber_length(parent_tree, tvb, offset, &len, &ind);
end_offset = offset + len ;
-
- /* Some sanity checks.
- * The hf field passed to us MUST be an integer type
+
+ /* Some sanity checks.
+ * The hf field passed to us MUST be an integer type
*/
if(hf_id >= 0){
hfinfo=proto_registrar_get_nth(hf_id);
@@ -1528,9 +1524,9 @@ printf("CHOICE dissect_ber_choice(%s) entered len:%d\n",name,tvb_length_remainin
}
}
-
- /* loop over all entries until we find the right choice or
+
+ /* loop over all entries until we find the right choice or
run out of entries */
ch = choice;
if(branch_taken){
@@ -1586,7 +1582,7 @@ printf("CHOICE testing potential subdissector class:%d:(expected)%d tag:%d:(exp
if(length_remaining>length)
length_remaining=length;
-#ifdef REMOVED
+#ifdef REMOVED
/* This is bogus and makes the OID_1.0.9506.1.1.cap file
* in Steven J Schaeffer's email of 2005-09-12 fail to dissect
* properly. Maybe we should get rid of 'first_pass'
@@ -1651,7 +1647,7 @@ printf("CHOICE dissect_ber_choice(%s) subdissector ate %d bytes\n",name,count);
if(show_internal_ber_fields){
proto_tree_add_text(tree, tvb, start_offset, count+2, "CHOICE EOC");
}
- }
+ }
}
return end_offset;
break;
@@ -1659,7 +1655,7 @@ printf("CHOICE dissect_ber_choice(%s) subdissector ate %d bytes\n",name,count);
ch++;
}
if(branch_taken){
- /* none of the branches were taken so set the param
+ /* none of the branches were taken so set the param
back to -1 */
*branch_taken=-1;
}
@@ -1717,7 +1713,7 @@ dissect_ber_GeneralString(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, i
if(len>=(max_len-1)){
len=max_len-1;
}
-
+
tvb_memcpy(tvb, str, offset, len);
str[len]=0;
@@ -1796,7 +1792,7 @@ dissect_ber_GeneralString(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, i
* if value_string is non-NULL it must point to a buffer of at least
* MAX_OID_STR_LEN bytes.
*/
-int dissect_ber_object_identifier(gboolean implicit_tag, packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, gint hf_id, tvbuff_t **value_tvb)
+int dissect_ber_object_identifier(gboolean implicit_tag, packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, gint hf_id, tvbuff_t **value_tvb)
{
gint8 class;
gboolean pc;
@@ -1932,12 +1928,12 @@ printf("SQ OF dissect_ber_sq_of(%s) entered\n",name);
||(!implicit_tag&&((class!=BER_CLASS_UNI)
||(tag!=type)))) {
tvb_ensure_bytes_exist(tvb, offset-2, 2);
- proto_tree_add_text(tree, tvb, offset-2, 2, "BER Error: %s Of expected but Class:%d PC:%d Tag:%d was unexpected",
+ proto_tree_add_text(tree, tvb, offset-2, 2, "BER Error: %s Of expected but Class:%d PC:%d Tag:%d was unexpected",
(type==BER_UNI_TAG_SEQUENCE)?"Set":"Sequence", class, pc, tag);
return end_offset;
}
} else {
- /* the tvb length should be correct now nope we could be comming from an implicit choice or sequence, thus we
+ /* the tvb length should be correct now nope we could be comming from an implicit choice or sequence, thus we
read the items we match and return the length*/
len=tvb_length_remaining(tvb,offset);
end_offset = offset + len;
@@ -1954,9 +1950,9 @@ printf("SQ OF dissect_ber_sq_of(%s) entered\n",name);
if(tvb_length_remaining(tvb, offset)==tvb_reported_length_remaining(tvb, offset)){
while (offset < end_offset){
guint32 len;
-
+
if(ind){ /* this sequence of was of indefinite length, so check for EOC */
- if((tvb_get_guint8(tvb, offset)==0)&&(tvb_get_guint8(tvb, offset+1)==0)){
+ if((tvb_get_guint8(tvb, offset)==0)&&(tvb_get_guint8(tvb, offset+1)==0)){
break;
}
}
@@ -2036,10 +2032,10 @@ printf("SQ OF dissect_ber_sq_of(%s) entered\n",name);
hoffset = dissect_ber_identifier(pinfo, tree, tvb, hoffset, NULL, NULL, NULL);
hoffset = dissect_ber_length(pinfo, tree, tvb, hoffset, NULL, NULL);
}
-
+
/* call the dissector for this field */
count=seq->func(pinfo, tree, tvb, hoffset)-hoffset;
- /* hold on if we are implicit and the result is zero, i.e. the item in the sequence of
+ /* hold on if we are implicit and the result is zero, i.e. the item in the sequence of
doesnt match the next item, thus this implicit sequence is over, return the number of bytes
we have eaten to allow the possible upper sequence continue... */
cnt++; /* rubbish*/
@@ -2058,7 +2054,7 @@ printf("SQ OF dissect_ber_sq_of(%s) entered\n",name);
/* if we didnt end up at exactly offset, then we ate too many bytes */
if(offset != end_offset) {
tvb_ensure_bytes_exist(tvb, offset-2, 2);
- proto_tree_add_text(tree, tvb, offset-2, 2, "BER Error: %s Of ate %d too many bytes",
+ proto_tree_add_text(tree, tvb, offset-2, 2, "BER Error: %s Of ate %d too many bytes",
(type==BER_UNI_TAG_SEQUENCE)?"Set":"Sequence", offset-end_offset);
}
@@ -2073,7 +2069,7 @@ int dissect_ber_set_of(gboolean implicit_tag, packet_info *pinfo, proto_tree *pa
return dissect_ber_sq_of(implicit_tag, BER_UNI_TAG_SET, pinfo, parent_tree, tvb, offset, seq, hf_id, ett_id);
}
-int
+int
dissect_ber_GeneralizedTime(gboolean implicit_tag, packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, gint hf_id)
{
char str[32];
@@ -2101,14 +2097,14 @@ dissect_ber_GeneralizedTime(gboolean implicit_tag, packet_info *pinfo, proto_tre
len=tvb_length_remaining(tvb,offset);
end_offset=offset+len;
}
-
+
tmpstr=tvb_get_ptr(tvb, offset, len);
g_snprintf(str, 32, "%.4s-%.2s-%.2s %.2s:%.2s:%.2s (%.1s)",
tmpstr, tmpstr+4, tmpstr+6, tmpstr+8,
tmpstr+10, tmpstr+12, tmpstr+14);
str[31]=0; /* just in case ... */
-
+
if(hf_id >= 0){
proto_tree_add_string(tree, hf_id, tvb, offset, len, str);
}
@@ -2118,7 +2114,7 @@ dissect_ber_GeneralizedTime(gboolean implicit_tag, packet_info *pinfo, proto_tre
}
/* 8.6 Encoding of a bitstring value */
-int dissect_ber_bitstring(gboolean implicit_tag, packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, int offset, const asn_namedbit *named_bits, gint hf_id, gint ett_id, tvbuff_t **out_tvb)
+int dissect_ber_bitstring(gboolean implicit_tag, packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, int offset, const asn_namedbit *named_bits, gint hf_id, gint ett_id, tvbuff_t **out_tvb)
{
gint8 class;
gboolean pc, ind;
@@ -2220,7 +2216,7 @@ int dissect_ber_bitstring(gboolean implicit_tag, packet_info *pinfo, proto_tree
return end_offset;
}
-int dissect_ber_bitstring32(gboolean implicit_tag, packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, int offset, int **bit_fields, gint hf_id, gint ett_id, tvbuff_t **out_tvb)
+int dissect_ber_bitstring32(gboolean implicit_tag, packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, int offset, int **bit_fields, gint hf_id, gint ett_id, tvbuff_t **out_tvb)
{
tvbuff_t *tmp_tvb = NULL;
proto_tree *tree;
@@ -2232,7 +2228,7 @@ int dissect_ber_bitstring32(gboolean implicit_tag, packet_info *pinfo, proto_tre
unsigned int i, tvb_len;
offset = dissect_ber_bitstring(implicit_tag, pinfo, parent_tree, tvb, offset, NULL, hf_id, ett_id, &tmp_tvb);
-
+
tree = proto_item_get_subtree(ber_last_created_item);
if(bit_fields && tree && tmp_tvb) {
/* tmp_tvb points to the actual bitstring (including any pad bits at the end.
diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c
index 8c32bfbf51..ed17a96a5c 100644
--- a/epan/dissectors/packet-dcerpc.c
+++ b/epan/dissectors/packet-dcerpc.c
@@ -51,10 +51,6 @@
#include <tchar.h>
#endif
-#ifndef MIN
-#define MIN(x,y) ((x)<(y))?(x):(y)
-#endif
-
static int dcerpc_tap = -1;
diff --git a/epan/dissectors/packet-scsi.c b/epan/dissectors/packet-scsi.c
index 164a2a630c..192573349d 100644
--- a/epan/dissectors/packet-scsi.c
+++ b/epan/dissectors/packet-scsi.c
@@ -47,7 +47,7 @@
* transport, it can be set to 0.
* o dissect_scsi_rsp - invoked to destroy the data structures associated with a
* SCSI task.
- * void dissect_scsi_rsp (tvbuff_t *, packet_info *, proto_tree *, guint16,
+ * void dissect_scsi_rsp (tvbuff_t *, packet_info *, proto_tree *, guint16,
* guint8);
* o dissect_scsi_snsinfo - invoked to decode the sense data provided in case of
* an error.
@@ -88,8 +88,6 @@
#include <epan/emem.h>
#include "packet-scsi.h"
-#define MIN(x,y) (((x)>(y))?(y):(x))
-
static int proto_scsi = -1;
static int hf_scsi_lun = -1;
static int hf_scsi_status = -1;
@@ -595,7 +593,7 @@ static const value_string scsi_smc2_val[] = {
/* For commands from SPC we have automatic fallback, for all
* commands not in SSC and not from SPC we must add them to this
* value string for proper prettyprinting.
- */
+ */
static const value_string scsi_ssc2_val[] = {
{SCSI_SSC2_ERASE_16 , "Erase(16)"},
{SCSI_SSC2_FORMAT_MEDIUM , "Format Medium"},
@@ -2963,7 +2961,7 @@ dissect_spc3_modesense6 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += 1;
tot_len -= 1;
-
+
if(tvb_length_remaining(tvb, offset)>0){
blockdesc_tvb=tvb_new_subset(tvb, offset, MIN(tvb_length_remaining(tvb, offset),desclen), desclen);
dissect_scsi_blockdescs (blockdesc_tvb, pinfo, tree, cdata, FALSE);
@@ -3081,7 +3079,7 @@ dissect_spc3_modesense10 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
static void
-dissect_spc3_persistentreservein (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
+dissect_spc3_persistentreservein (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
guint offset, gboolean isreq, gboolean iscdb,
guint payload_len, scsi_task_data_t *cdata)
{
@@ -3145,8 +3143,8 @@ dissect_spc3_persistentreservein (tvbuff_t *tvb, packet_info *pinfo _U_, proto_t
}
static void
-dissect_spc3_persistentreserveout (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
- guint offset, gboolean isreq, gboolean iscdb,
+dissect_spc3_persistentreserveout (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
+ guint offset, gboolean isreq, gboolean iscdb,
guint payload_len _U_, scsi_task_data_t *cdata _U_)
{
guint8 flags;
@@ -3172,7 +3170,7 @@ dissect_spc3_persistentreserveout (tvbuff_t *tvb, packet_info *pinfo _U_, proto_
}
static void
-dissect_spc2_release6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
+dissect_spc2_release6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
guint offset, gboolean isreq, gboolean iscdb,
guint payload_len _U_, scsi_task_data_t *cdata _U_)
{
@@ -3223,7 +3221,7 @@ dissect_spc2_release10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
static void
dissect_spc3_reportdeviceidentifier (tvbuff_t *tvb _U_, packet_info *pinfo _U_,
-proto_tree *tree _U_,
+proto_tree *tree _U_,
guint offset _U_, gboolean isreq _U_, gboolean iscdb _U_,
guint payload_len _U_, scsi_task_data_t *cdata _U_)
{
@@ -3231,8 +3229,8 @@ proto_tree *tree _U_,
}
static void
-dissect_spc3_reportluns (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
- guint offset, gboolean isreq, gboolean iscdb,
+dissect_spc3_reportluns (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
+ guint offset, gboolean isreq, gboolean iscdb,
guint payload_len, scsi_task_data_t *cdata _U_)
{
guint8 flags;
@@ -3243,7 +3241,7 @@ dissect_spc3_reportluns (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree
if (isreq && iscdb) {
proto_tree_add_item (tree, hf_scsi_select_report, tvb, offset+1, 1, 0);
-
+
proto_tree_add_item (tree, hf_scsi_alloclen32, tvb, offset+5, 4, 0);
flags = tvb_get_guint8 (tvb, offset+10);
@@ -3261,7 +3259,7 @@ dissect_spc3_reportluns (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree
if (payload_len != 0) {
listlen = (listlen < payload_len) ? listlen : payload_len;
}
-
+
for (i = 0; i < listlen/8; i++) {
if (!tvb_get_guint8 (tvb, offset))
proto_tree_add_item (tree, hf_scsi_rluns_lun, tvb, offset+1, 1,
@@ -3325,7 +3323,7 @@ dissect_spc3_requestsense (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr
flags & 0xC0, flags & 0x4, flags & 0x1);
}
else if (!isreq)
- dissect_scsi_fix_snsinfo(tvb, tree, offset);
+ dissect_scsi_fix_snsinfo(tvb, tree, offset);
}
static void
@@ -3379,12 +3377,12 @@ dissect_spc2_reserve10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
}
static void
-dissect_sbc2_startstopunit (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
+dissect_sbc2_startstopunit (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
guint offset, gboolean isreq _U_, gboolean iscdb,
guint payload_len _U_, scsi_task_data_t *cdata _U_)
{
guint8 flags;
-
+
if (!tree || !iscdb)
return;
@@ -3401,7 +3399,7 @@ dissect_sbc2_startstopunit (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t
}
static void
-dissect_spc3_testunitready (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
+dissect_spc3_testunitready (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
guint offset, gboolean isreq, gboolean iscdb,
guint payload_len _U_, scsi_task_data_t *cdata _U_)
{
@@ -3420,7 +3418,7 @@ dissect_spc3_testunitready (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t
}
static void
-dissect_sbc2_formatunit (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
+dissect_sbc2_formatunit (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
guint offset, gboolean isreq, gboolean iscdb,
guint payload_len _U_, scsi_task_data_t *cdata _U_)
{
@@ -3605,7 +3603,7 @@ dissect_sbc2_verify12 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
{
guint8 flags;
-
+
if (isreq && iscdb) {
if (check_col (pinfo->cinfo, COL_INFO))
col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
@@ -3668,7 +3666,7 @@ dissect_sbc2_wrverify10 (tvbuff_t *tvb, packet_info *pinfo _U_,
{
guint8 flags;
-
+
if (isreq && iscdb) {
if (check_col (pinfo->cinfo, COL_INFO))
col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
@@ -3700,7 +3698,7 @@ dissect_sbc2_wrverify12 (tvbuff_t *tvb, packet_info *pinfo _U_,
scsi_task_data_t *cdata _U_)
{
guint8 flags;
-
+
if (isreq && iscdb) {
if (check_col (pinfo->cinfo, COL_INFO))
col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: 0x%08x, Len: %u)",
@@ -3732,7 +3730,7 @@ dissect_sbc2_wrverify16 (tvbuff_t *tvb, packet_info *pinfo _U_,
scsi_task_data_t *cdata _U_)
{
guint8 flags;
-
+
if (isreq && iscdb) {
if (check_col (pinfo->cinfo, COL_INFO))
col_append_fstr (pinfo->cinfo, COL_INFO, "(LBA: %" PRIu64 ", Len: %u)",
@@ -3835,7 +3833,7 @@ dissect_mmc4_reportkey (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
proto_tree_add_item (tree, hf_scsi_report_key_rpc_scheme, tvb, offset+6, 1, 0);
break;
default:
- ti = proto_tree_add_text (tree, tvb, 0, 0,
+ ti = proto_tree_add_text (tree, tvb, 0, 0,
"SCSI/MMC Unknown Format:0x%02x/Class:0x%02x combination",
cdata->flags>>8,cdata->flags&0xff);
PROTO_ITEM_SET_GENERATED(ti);
@@ -3885,7 +3883,7 @@ dissect_mmc4_setstreaming (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr
proto_tree_add_item (tree, hf_scsi_setstreaming_write_time, tvb, offset+24, 4, 0);
break;
default:
- ti = proto_tree_add_text (tree, tvb, 0, 0,
+ ti = proto_tree_add_text (tree, tvb, 0, 0,
"SCSI/MMC Unknown SetStreaming Type:0x%02x",cdata->flags);
PROTO_ITEM_SET_GENERATED(ti);
break;
@@ -4078,7 +4076,7 @@ dissect_mmc4_getconfiguration (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree
proto_tree_add_item (tree, hf_scsi_feature_lun_sn, tvb, offset, additional_length, 0);
break;
default:
- proto_tree_add_text (tree, tvb, offset, additional_length,
+ proto_tree_add_text (tree, tvb, offset, additional_length,
"SCSI/MMC Unknown Feature:0x%04x",feature);
break;
}
@@ -4217,7 +4215,7 @@ dissect_mmc4_readtocpmaatip (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *
}
break;
default:
- proto_tree_add_text (tree, tvb, offset, len,
+ proto_tree_add_text (tree, tvb, offset, len,
"SCSI/MMC Unknown READ TOC Format:0x%04x",cdata->flags&0x000f);
break;
}
@@ -4334,7 +4332,7 @@ dissect_mmc4_readtrackinformation (tvbuff_t *tvb, packet_info *pinfo _U_, proto_
proto_tree_add_item (tree, hf_scsi_session, tvb, offset+1,
4, 0);
break;
- }
+ }
proto_tree_add_item (tree, hf_scsi_alloclen16, tvb, offset+6, 2, 0);
@@ -4446,7 +4444,7 @@ dissect_mmc4_readdiscinformation (tvbuff_t *tvb, packet_info *pinfo _U_, proto_t
}
static void
-dissect_sbc2_readcapacity10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
+dissect_sbc2_readcapacity10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
guint offset, gboolean isreq, gboolean iscdb,
guint payload_len _U_, scsi_task_data_t *cdata _U_)
{
@@ -4509,7 +4507,7 @@ static const value_string service_action_vals[] = {
};
-/* this is either readcapacity16 or readlong16 depending of what service
+/* this is either readcapacity16 or readlong16 depending of what service
action is set to. for now we only implement readcapacity16
*/
static void
@@ -4661,7 +4659,7 @@ dissect_spc3_senddiagnostic (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *
guint payload_len _U_, scsi_task_data_t *cdata _U_)
{
guint8 flags;
-
+
if (!tree && !isreq)
return;
@@ -4671,7 +4669,7 @@ dissect_spc3_senddiagnostic (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *
proto_tree_add_boolean (tree, hf_scsi_senddiag_devoff, tvb, offset, 1, 0);
proto_tree_add_boolean (tree, hf_scsi_senddiag_unitoff, tvb, offset, 1, 0);
proto_tree_add_uint (tree, hf_scsi_paramlen16, tvb, offset+2, 2, 0);
-
+
flags = tvb_get_guint8 (tvb, offset+4);
proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1,
flags,
@@ -4685,7 +4683,7 @@ dissect_spc3_writebuffer (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre
guint payload_len _U_, scsi_task_data_t *cdata _U_)
{
guint8 flags;
-
+
if (!tree && !isreq)
return;
@@ -4693,7 +4691,7 @@ dissect_spc3_writebuffer (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre
proto_tree_add_uint (tree, hf_scsi_wb_bufferid, tvb, offset+1, 1, 0);
proto_tree_add_uint (tree, hf_scsi_wb_bufoffset, tvb, offset+2, 3, 0);
proto_tree_add_uint (tree, hf_scsi_paramlen24, tvb, offset+5, 3, 0);
-
+
flags = tvb_get_guint8 (tvb, offset+8);
proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+8, 1,
flags,
@@ -5082,8 +5080,8 @@ dissect_ssc2_locate10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
flags = tvb_get_guint8 (tvb, offset);
proto_tree_add_text (tree, tvb, offset, 1,
"BT: %u, CP: %u, IMMED: %u",
- (flags & 0x04) >> 2,
- (flags & 0x02) >> 1,
+ (flags & 0x04) >> 2,
+ (flags & 0x02) >> 1,
flags & 0x01);
proto_tree_add_item (tree, hf_ssc3_locate10_loid, tvb, offset+2, 4, 0);
@@ -5115,8 +5113,8 @@ dissect_ssc2_locate16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
flags = tvb_get_guint8 (tvb, offset);
proto_tree_add_text (tree, tvb, offset, 1,
"DEST_TYPE: %u, CP: %u, IMMED: %u",
- (flags & 0x18) >> 3,
- (flags & 0x02) >> 1,
+ (flags & 0x18) >> 3,
+ (flags & 0x02) >> 1,
flags & 0x01);
flags = tvb_get_guint8 (tvb, offset+2);
@@ -5148,7 +5146,7 @@ dissect_ssc2_erase6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
flags = tvb_get_guint8 (tvb, offset);
proto_tree_add_text (tree, tvb, offset, 1,
"IMMED: %u, LONG: %u",
- (flags & 0x02) >> 1,
+ (flags & 0x02) >> 1,
flags & 0x01);
flags = tvb_get_guint8 (tvb, offset+4);
@@ -5173,16 +5171,16 @@ dissect_ssc2_erase16 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
flags = tvb_get_guint8 (tvb, offset);
proto_tree_add_text (tree, tvb, offset, 1,
"FCS: %u, LCS: %u, IMMED: %u, LONG: %u",
- (flags & 0x08) >> 3,
- (flags & 0x04) >> 2,
- (flags & 0x02) >> 1,
+ (flags & 0x08) >> 3,
+ (flags & 0x04) >> 2,
+ (flags & 0x02) >> 1,
flags & 0x01);
proto_tree_add_text (tree, tvb, offset+2, 1,
"Partition: %u", tvb_get_guint8(tvb,offset+2));
proto_tree_add_text (tree, tvb, offset+3, 8,
- "Logical Object Identifier: 0x%02x%02x%02x%02x%02x%02x%02x%02x",
+ "Logical Object Identifier: 0x%02x%02x%02x%02x%02x%02x%02x%02x",
tvb_get_guint8(tvb,offset+3),
tvb_get_guint8(tvb,offset+4),
tvb_get_guint8(tvb,offset+5),
@@ -5270,7 +5268,7 @@ dissect_ssc2_formatmedium (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr
flags = tvb_get_guint8 (tvb, offset);
proto_tree_add_text (tree, tvb, offset, 1,
"VERIFY: %u, IMMED: %u",
- (flags & 0x02) >> 1,
+ (flags & 0x02) >> 1,
flags & 0x01);
proto_tree_add_text (tree, tvb, offset+1, 1,
@@ -5734,8 +5732,8 @@ dissect_scsi_snsinfo (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* list of commands for each commandset */
-typedef void (*scsi_dissector_t)(tvbuff_t *tvb, packet_info *pinfo,
- proto_tree *tree, guint offset,
+typedef void (*scsi_dissector_t)(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, guint offset,
gboolean isreq, gboolean iscdb,
guint32 payload_len, scsi_task_data_t *cdata);
@@ -7169,7 +7167,7 @@ dissect_scsi_cdb (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
ti=proto_tree_add_uint(scsi_tree, hf_scsi_lun, tvb, 0, 0, lun);
PROTO_ITEM_SET_GENERATED(ti);
-
+
if (valstr != NULL) {
proto_tree_add_uint_format (scsi_tree, hf_opcode, tvb,
@@ -7186,10 +7184,10 @@ dissect_scsi_cdb (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
All commandsets support SPC?
*/
if(cdb_table && cdb_table[opcode].func){
- cdb_table[opcode].func(tvb, pinfo, scsi_tree, offset+1,
+ cdb_table[opcode].func(tvb, pinfo, scsi_tree, offset+1,
TRUE, TRUE, 0, cdata);
} else if(spc[opcode].func){
- spc[opcode].func(tvb, pinfo, scsi_tree, offset+1,
+ spc[opcode].func(tvb, pinfo, scsi_tree, offset+1,
TRUE, TRUE, 0, cdata);
} else {
call_dissector (data_handle, tvb, pinfo, scsi_tree);
@@ -7230,10 +7228,10 @@ dissect_scsi_payload (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
"0x%02x"),
isreq ? "Request" : "Response");
if (check_col (pinfo->cinfo, COL_INFO)) {
- col_add_fstr (pinfo->cinfo, COL_INFO,
- "SCSI: Data %s LUN: 0x%02x (%s %s) ",
- isreq ? "Out" : "In",
- lun,
+ col_add_fstr (pinfo->cinfo, COL_INFO,
+ "SCSI: Data %s LUN: 0x%02x (%s %s) ",
+ isreq ? "Out" : "In",
+ lun,
val_to_str (opcode, cdata->cdb_vals, "0x%02x"),
isreq ? "Request" : "Response");
}
@@ -7265,10 +7263,10 @@ dissect_scsi_payload (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
All commandsets support SPC?
*/
if(cdata->cdb_table && (cdata->cdb_table)[opcode].func){
- (cdata->cdb_table)[opcode].func(tvb, pinfo, scsi_tree, offset,
+ (cdata->cdb_table)[opcode].func(tvb, pinfo, scsi_tree, offset,
isreq, FALSE, payload_len, cdata);
} else if(spc[opcode].func){
- spc[opcode].func(tvb, pinfo, scsi_tree, offset,
+ spc[opcode].func(tvb, pinfo, scsi_tree, offset,
isreq, FALSE, payload_len, cdata);
} else { /* dont know this CDB */
call_dissector (data_handle, tvb, pinfo, scsi_tree);
@@ -7281,13 +7279,13 @@ proto_register_scsi (void)
{
/* Setup list of header fields See Section 1.6.1 for details*/
static hf_register_info hf[] = {
- /*16 bit to print something useful for weirdo
+ /*16 bit to print something useful for weirdo
volume set addressing hosts*/
- { &hf_scsi_lun,
- {"LUN", "scsi.lun", FT_UINT16, BASE_HEX,
+ { &hf_scsi_lun,
+ {"LUN", "scsi.lun", FT_UINT16, BASE_HEX,
NULL, 0x0, "LUN", HFILL}},
{ &hf_scsi_status,
- { "Status", "scsi.status", FT_UINT8, BASE_HEX,
+ { "Status", "scsi.status", FT_UINT8, BASE_HEX,
VALS(scsi_status_val), 0, "SCSI command status value", HFILL }},
{ &hf_scsi_spcopcode,
{"SPC-2 Opcode", "scsi.spc.opcode", FT_UINT8, BASE_HEX,
diff --git a/epan/dissectors/packet-smb2.c b/epan/dissectors/packet-smb2.c
index 69d5894ffa..99096501ce 100644
--- a/epan/dissectors/packet-smb2.c
+++ b/epan/dissectors/packet-smb2.c
@@ -27,8 +27,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#define MIN(x,y) ((x)<(y)?(x):(y))
-
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
@@ -304,13 +302,13 @@ static const value_string smb2_file_info_levels[] = {
-#define SMB2_FS_INFO_01 0x01
-#define SMB2_FS_INFO_03 0x03
-#define SMB2_FS_INFO_04 0x04
-#define SMB2_FS_INFO_05 0x05
-#define SMB2_FS_INFO_06 0x06
-#define SMB2_FS_INFO_07 0x07
-#define SMB2_FS_OBJECTID_INFO 0x08
+#define SMB2_FS_INFO_01 0x01
+#define SMB2_FS_INFO_03 0x03
+#define SMB2_FS_INFO_04 0x04
+#define SMB2_FS_INFO_05 0x05
+#define SMB2_FS_INFO_06 0x06
+#define SMB2_FS_INFO_07 0x07
+#define SMB2_FS_OBJECTID_INFO 0x08
static const value_string smb2_fs_info_levels[] = {
{SMB2_FS_INFO_01, "SMB2_FS_INFO_01" },
{SMB2_FS_INFO_03, "SMB2_FS_INFO_03" },
@@ -430,7 +428,7 @@ static int dissect_smb2_file_info_0f(tvbuff_t *tvb, packet_info *pinfo, proto_tr
* This function is called twice, first to decode the offset/length and
* second time to dissect the actual string.
* It is done this way since there is no guarantee that we have the full packet and we dont
- * want to abort dissection too early if the packet ends somewhere between the
+ * want to abort dissection too early if the packet ends somewhere between the
* length/offset and the actual buffer.
*
*/
@@ -567,7 +565,7 @@ dissect_smb2_olb_string(packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *t
proto_tree_add_item(tree, hf_smb2_olb_length, tvb, olb->len_offset, 4, TRUE);
proto_tree_add_item(tree, hf_smb2_olb_offset, tvb, olb->off_offset, 4, TRUE);
break;
- }
+ }
return name;
}
@@ -936,7 +934,7 @@ dissect_smb2_fid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset
}
-/* this info level is unique to SMB2 and differst from the corresponding
+/* this info level is unique to SMB2 and differst from the corresponding
* SMB_FILE_ALL_INFO in SMB
*/
static int
@@ -1705,7 +1703,7 @@ dissect_smb2_buffercode(proto_tree *tree, tvbuff_t *tvb, int offset, guint16 *le
if(length){
*length=buffer_code&0xfffe;
}
-
+
return offset;
}
@@ -1728,11 +1726,11 @@ dissect_smb2_session_setup_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree
ntlmssp_header_t *ntlmssph;
static int ntlmssp_tap_id = 0;
int idx;
-
+
if(!ntlmssp_tap_id){
GString *error_string;
/* We dont specify any callbacks at all.
- * Instead we manually fetch the tapped data after the
+ * Instead we manually fetch the tapped data after the
* security blob has been fully dissected and before
* we exit from this dissector.
*/
@@ -1825,7 +1823,7 @@ dissect_smb2_tree_connect_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree
offset = dissect_smb2_olb_tvb_max_offset(offset, &olb);
- /* treelen +1 is overkill here if the string is unicode,
+ /* treelen +1 is overkill here if the string is unicode,
* but who ever has more than a handful of TCON in a trace anyways
*/
if(!pinfo->fd->flags.visited && si->saved && buf && olb.len){
@@ -2227,8 +2225,8 @@ dissect_smb2_class_infolevel(packet_info *pinfo, tvbuff_t *tvb, int offset, prot
* as well.
*/
if (check_col(pinfo->cinfo, COL_INFO)){
- col_append_fstr(pinfo->cinfo, COL_INFO, " %s/%s",
- val_to_str(cl, smb2_class_vals, "(Class:0x%08x)"),
+ col_append_fstr(pinfo->cinfo, COL_INFO, " %s/%s",
+ val_to_str(cl, smb2_class_vals, "(Class:0x%08x)"),
val_to_str(il, vs, "(Level:0x%08x)"));
}
}
@@ -2596,7 +2594,7 @@ dissect_file_data_dcerpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_
return offset;
}
-
+
static int
dissect_smb2_write_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, smb2_info_t *si)
{
@@ -2714,7 +2712,7 @@ dissect_smb2_FSCTL_GET_SHADOW_COPY_DATA(tvbuff_t *tvb, packet_info *pinfo _U_, p
if(!len){
break;
}
- }
+ }
return;
}
@@ -2841,7 +2839,7 @@ static void
dissect_smb2_ioctl_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si, gboolean data_in)
{
switch(si->ioctl_function){
- case 0x0011c017:
+ case 0x0011c017:
dissect_smb2_IOCTL_DO_DCERPC(tvb, pinfo, tree, 0, si, data_in);
break;
case 0x00144064: /* FSCTL_GET_SHADOW_COPY_DATA */
@@ -3063,7 +3061,7 @@ dissect_smb2_read_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += 8;
/* data or dcerpc ?
- * If the pidvalid flag is set we assume it is a deferred
+ * If the pidvalid flag is set we assume it is a deferred
* STATUS_PENDING read and thus a named pipe (==dcerpc)
*/
if(length && ( (si->tree && si->tree->share_type == SMB2_SHARE_TYPE_IPC)||(si->flags & SMB2_FLAGS_PID_VALID))){
@@ -3167,7 +3165,7 @@ dissect_smb2_create_extra_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *pa
/* tag offset/length */
offset = dissect_smb2_olb_length_offset(tvb, offset, &tag_olb, OLB_O_UINT16_S_UINT32, hf_smb2_tag);
-
+
/* data offset/length */
offset = dissect_smb2_olb_length_offset(tvb, offset, &data_olb, OLB_O_UINT16_S_UINT32, hf_smb2_chain_data);
@@ -3264,7 +3262,7 @@ dissect_smb2_create_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
- /* If extrainfo_offset is non-null then this points to another
+ /* If extrainfo_offset is non-null then this points to another
* buffer. The offset is relative to the start of the smb packet
*/
dissect_smb2_olb_buffer(pinfo, tree, tvb, &e_olb, si, dissect_smb2_create_extra_info);
@@ -3329,7 +3327,7 @@ dissect_smb2_create_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
/* extrainfo offset */
offset = dissect_smb2_olb_length_offset(tvb, offset, &e_olb, OLB_O_UINT32_S_UINT32, hf_smb2_extrainfo);
- /* If extrainfo_offset is non-null then this points to another
+ /* If extrainfo_offset is non-null then this points to another
* buffer. The offset is relative to the start of the smb packet
*/
dissect_smb2_olb_buffer(pinfo, tree, tvb, &e_olb, si, dissect_smb2_create_extra_info);
@@ -3662,34 +3660,34 @@ static const char *decode_smb2_name(guint16 cmd)
}
static smb2_function smb2_dissector[256] = {
- /* 0x00 NegotiateProtocol*/
+ /* 0x00 NegotiateProtocol*/
{NULL,
dissect_smb2_negotiate_protocol_response},
- /* 0x01 SessionSetup*/
- {dissect_smb2_session_setup_request,
+ /* 0x01 SessionSetup*/
+ {dissect_smb2_session_setup_request,
dissect_smb2_session_setup_response},
/* 0x02 SessionLogoff*/
- {dissect_smb2_sessionlogoff_request,
+ {dissect_smb2_sessionlogoff_request,
dissect_smb2_sessionlogoff_response},
- /* 0x03 TreeConnect*/
+ /* 0x03 TreeConnect*/
{dissect_smb2_tree_connect_request,
dissect_smb2_tree_connect_response},
/* 0x04 TreeDisconnect*/
{dissect_smb2_tree_disconnect_request,
dissect_smb2_tree_disconnect_response},
- /* 0x05 Create*/
+ /* 0x05 Create*/
{dissect_smb2_create_request,
dissect_smb2_create_response},
- /* 0x06 Close*/
+ /* 0x06 Close*/
{dissect_smb2_close_request,
dissect_smb2_close_response},
/* 0x07 Flush*/
{dissect_smb2_flush_request,
dissect_smb2_flush_response},
- /* 0x08 Read*/
+ /* 0x08 Read*/
{dissect_smb2_read_request,
dissect_smb2_read_response},
- /* 0x09 Writew*/
+ /* 0x09 Writew*/
{dissect_smb2_write_request,
dissect_smb2_write_response},
/* 0x0a Lock */
@@ -3698,22 +3696,22 @@ static smb2_function smb2_dissector[256] = {
/* 0x0b Ioctl*/
{dissect_smb2_ioctl_request,
dissect_smb2_ioctl_response},
- /* 0x0c Cancel*/
+ /* 0x0c Cancel*/
{dissect_smb2_cancel_request,
NULL},
/* 0x0d KeepAlive*/
{dissect_smb2_keepalive_request,
dissect_smb2_keepalive_response},
- /* 0x0e Find*/
+ /* 0x0e Find*/
{dissect_smb2_find_request,
dissect_smb2_find_response},
- /* 0x0f Notify*/
+ /* 0x0f Notify*/
{dissect_smb2_notify_request,
dissect_smb2_notify_response},
- /* 0x10 GetInfo*/
+ /* 0x10 GetInfo*/
{dissect_smb2_getinfo_request,
dissect_smb2_getinfo_response},
- /* 0x11 SetInfo*/
+ /* 0x11 SetInfo*/
{dissect_smb2_setinfo_request,
dissect_smb2_setinfo_response},
/* 0x12 */ {NULL, NULL},
@@ -4022,7 +4020,7 @@ dissect_smb2_tid_uid(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, in
if(!si->session) {
if (si->opcode != 0x03) return offset;
- /* if we come to a session that is unknown, and the operation is
+ /* if we come to a session that is unknown, and the operation is
* a tree connect, we create a dummy sessison, so we can hang the
* tree data on it
*/
@@ -4182,7 +4180,7 @@ dissect_smb2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
proto_tree_add_boolean(flags_tree, hf_smb2_flags_signature, tvb, offset, 4, si->flags);
proto_tree_add_boolean(flags_tree, hf_smb2_flags_pid_valid, tvb, offset, 4, si->flags);
proto_tree_add_boolean(flags_tree, hf_smb2_flags_response, tvb, offset, 4, si->flags);
-
+
offset += 4;
/* some unknown bytes */
@@ -4231,9 +4229,9 @@ dissect_smb2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
if(!(si->flags & SMB2_FLAGS_RESPONSE)){
/* This is a request */
if(ssi){
- /* this is a request and we already found
- * an older ssi so just delete the previous
- * one
+ /* this is a request and we already found
+ * an older ssi so just delete the previous
+ * one
*/
g_hash_table_remove(si->conv->unmatched, ssi);
ssi=NULL;
@@ -4241,7 +4239,7 @@ dissect_smb2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
if(!ssi){
/* no we couldnt find it, so just add it then
- * if was a request we are decoding
+ * if was a request we are decoding
*/
ssi=se_alloc(sizeof(smb2_saved_info_t));
ssi->class=0;
@@ -4482,24 +4480,24 @@ proto_register_smb2(void)
{ "In Data", "smb2.ioctl.in", FT_NONE, BASE_NONE,
NULL, 0, "Ioctl In", HFILL }},
- { &hf_smb2_server_guid,
- { "Server Guid", "smb2.server_guid", FT_GUID, BASE_NONE,
+ { &hf_smb2_server_guid,
+ { "Server Guid", "smb2.server_guid", FT_GUID, BASE_NONE,
NULL, 0, "Server GUID", HFILL }},
- { &hf_smb2_object_id,
- { "ObjectId", "smb2.object_id", FT_GUID, BASE_NONE,
+ { &hf_smb2_object_id,
+ { "ObjectId", "smb2.object_id", FT_GUID, BASE_NONE,
NULL, 0, "ObjectID for this FID", HFILL }},
- { &hf_smb2_birth_volume_id,
- { "BirthVolumeId", "smb2.birth_volume_id", FT_GUID, BASE_NONE,
+ { &hf_smb2_birth_volume_id,
+ { "BirthVolumeId", "smb2.birth_volume_id", FT_GUID, BASE_NONE,
NULL, 0, "ObjectID for the volume where this FID was originally created", HFILL }},
- { &hf_smb2_birth_object_id,
- { "BirthObjectId", "smb2.birth_object_id", FT_GUID, BASE_NONE,
+ { &hf_smb2_birth_object_id,
+ { "BirthObjectId", "smb2.birth_object_id", FT_GUID, BASE_NONE,
NULL, 0, "ObjectID for this FID when it was originally created", HFILL }},
- { &hf_smb2_domain_id,
- { "DomainId", "smb2.domain_id", FT_GUID, BASE_NONE,
+ { &hf_smb2_domain_id,
+ { "DomainId", "smb2.domain_id", FT_GUID, BASE_NONE,
NULL, 0, "", HFILL }},
{ &hf_smb2_create_timestamp,
@@ -4507,15 +4505,15 @@ proto_register_smb2(void)
NULL, 0, "Time when this object was created", HFILL }},
{ &hf_smb2_fid,
- { "File Id", "smb2.fid", FT_GUID, BASE_NONE,
+ { "File Id", "smb2.fid", FT_GUID, BASE_NONE,
NULL, 0, "SMB2 File Id", HFILL }},
{ &hf_smb2_write_data,
- { "Write Data", "smb2.write_data", FT_BYTES, BASE_HEX,
+ { "Write Data", "smb2.write_data", FT_BYTES, BASE_HEX,
NULL, 0, "SMB2 Data to be written", HFILL }},
{ &hf_smb2_read_data,
- { "Read Data", "smb2.read_data", FT_BYTES, BASE_HEX,
+ { "Read Data", "smb2.read_data", FT_BYTES, BASE_HEX,
NULL, 0, "SMB2 Data that is read", HFILL }},
{ &hf_smb2_last_access_timestamp,