diff options
author | Kovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com> | 2009-10-08 15:10:43 +0000 |
---|---|---|
committer | Kovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com> | 2009-10-08 15:10:43 +0000 |
commit | ad7042d2a43710ac62e4f6dfe472caa16af1e0fe (patch) | |
tree | 48a425f1fb68ce4db213c45630953aa7e6a863e1 /epan | |
parent | 30cb2b94486295e44d7c84148af0c6490573ecc1 (diff) |
calculate_crc32c -> crc32c_calculate for proper 'namespacing'
svn path=/trunk/; revision=30405
Diffstat (limited to 'epan')
-rw-r--r-- | epan/crc32.c | 2 | ||||
-rw-r--r-- | epan/crc32.h | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-iscsi.c | 38 | ||||
-rw-r--r-- | epan/dissectors/packet-iwarp-mpa.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-ntlmssp.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-zrtp.c | 12 | ||||
-rw-r--r-- | epan/libwireshark.def | 2 |
7 files changed, 32 insertions, 32 deletions
diff --git a/epan/crc32.c b/epan/crc32.c index bd7a023613..3da5f52e2f 100644 --- a/epan/crc32.c +++ b/epan/crc32.c @@ -172,7 +172,7 @@ const guint32 crc32_ccitt_table[256] = { #define CRC32_CCITT_SEED 0xFFFFFFFF guint32 -calculate_crc32c(const void *buf, int len, guint32 crc) +crc32c_calculate(const void *buf, int len, guint32 crc) { const guint8 *p = (const guint8 *)buf; crc = CRC32C_SWAP(crc); diff --git a/epan/crc32.h b/epan/crc32.h index 8de3148e38..7bc63bdde4 100644 --- a/epan/crc32.h +++ b/epan/crc32.h @@ -33,7 +33,7 @@ extern "C" { #define CRC32C_PRELOAD 0xffffffff -/* +/* * Byte swap fix contributed by Dave Wysochanski <davidw@netapp.com>. */ #define CRC32C_SWAP(crc32c_value) \ @@ -45,13 +45,13 @@ extern "C" { #define CRC32C(c,d) (c=(c>>8)^crc32c_table[(c^(d))&0xFF]) extern const guint32 crc32c_table[256]; - + /** Compute CRC32C checksum of a buffer of data. @param buf The buffer containing the data. @param len The number of bytes to include in the computation. @param crc The preload value for the CRC32C computation. @return The CRC32C checksum. */ -extern guint32 calculate_crc32c(const void *buf, int len, guint32 crc); +extern guint32 crc32c_calculate(const void *buf, int len, guint32 crc); extern const guint32 crc32_ccitt_table[256]; diff --git a/epan/dissectors/packet-iscsi.c b/epan/dissectors/packet-iscsi.c index ce5d2bcfe3..acd14d2802 100644 --- a/epan/dissectors/packet-iscsi.c +++ b/epan/dissectors/packet-iscsi.c @@ -1,11 +1,11 @@ -/* TODO for the cases where one just can not autodetect whether header digest - is used or not we might need a new preference - HeaderDigest : +/* TODO for the cases where one just can not autodetect whether header digest + is used or not we might need a new preference + HeaderDigest : Automatic (default) None CRC32 */ - + /* packet-iscsi.c * Routines for iSCSI dissection * Copyright 2001, Eurologic and Mark Burton <markb@ordern.com> @@ -511,8 +511,8 @@ static const value_string iscsi_reject_reasons[] = { {0, NULL}, }; -/* structure and functions to keep track of - * COMMAND/DATA_IN/DATA_OUT/RESPONSE matching +/* structure and functions to keep track of + * COMMAND/DATA_IN/DATA_OUT/RESPONSE matching */ typedef struct _iscsi_conv_data { guint32 data_in_frame; @@ -547,7 +547,7 @@ handleHeaderDigest(iscsi_session_t *iscsi_session, proto_item *ti, tvbuff_t *tvb switch(iscsi_session->header_digest){ case ISCSI_HEADER_DIGEST_CRC32: if(available_bytes >= (headerLen + 4)) { - guint32 crc = ~calculate_crc32c(tvb_get_ptr(tvb, offset, headerLen), headerLen, CRC32C_PRELOAD); + guint32 crc = ~crc32c_calculate(tvb_get_ptr(tvb, offset, headerLen), headerLen, CRC32C_PRELOAD); guint32 sent = tvb_get_ntohl(tvb, offset + headerLen); if(crc == sent) { proto_tree_add_uint_format(ti, hf_iscsi_HeaderDigest32, tvb, offset + headerLen, 4, sent, "HeaderDigest: 0x%08x (Good CRC32)", sent); @@ -566,7 +566,7 @@ handleDataDigest(proto_item *ti, tvbuff_t *tvb, guint offset, int dataLen) { if(enableDataDigests) { if(dataDigestIsCRC32) { if(available_bytes >= (dataLen + 4)) { - guint32 crc = ~calculate_crc32c(tvb_get_ptr(tvb, offset, dataLen), dataLen, CRC32C_PRELOAD); + guint32 crc = ~crc32c_calculate(tvb_get_ptr(tvb, offset, dataLen), dataLen, CRC32C_PRELOAD); guint32 sent = tvb_get_ntohl(tvb, offset + dataLen); if(crc == sent) { proto_tree_add_uint_format(ti, hf_iscsi_DataDigest32, tvb, offset + dataLen, 4, sent, "DataDigest: 0x%08x (Good CRC32)", sent); @@ -709,7 +709,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off people that care can add host specific dissection of vsa later. We need to keep track of this on a per transaction basis since - for error recoverylevel 0 and when the A bit is clear in a + for error recoverylevel 0 and when the A bit is clear in a Data-In PDU, there will not be a LUN field in teh iscsi layer. */ if(tvb_get_guint8(tvb, offset+8)&0x40){ @@ -891,7 +891,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off ahs_type=tvb_get_guint8(tvb, ahs_offset); proto_tree_add_item(ti, hf_iscsi_AHS_type, tvb, ahs_offset, 1, FALSE); ahs_offset++; - + switch(ahs_type){ case 0x01: /* extended CDB */ /* additional cdb */ @@ -922,7 +922,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off } offset = handleHeaderDigest(iscsi_session, ti, tvb, offset, 48 + ahsLen); - + immediate_data_offset=offset; offset = handleDataSegment(ti, tvb, offset, data_segment_len, end_offset, hf_iscsi_immediate_data); immediate_data_length=offset-immediate_data_offset; @@ -1730,7 +1730,7 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec return FALSE; } /* should we test that datasegmentlen is non zero unless we just - * entered full featured phase? + * entered full featured phase? */ break; case ISCSI_OPCODE_TASK_MANAGEMENT_FUNCTION: @@ -1925,7 +1925,7 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec return FALSE; } /* one of the F and C bits must be set but not both - * low 6 bits in byte 1 must be 0 + * low 6 bits in byte 1 must be 0 */ switch(tvb_get_guint8(tvb,offset+1)){ case 0x80: @@ -1954,7 +1954,7 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec return FALSE; } /* one of the F and C bits must be set but not both - * low 6 bits in byte 1 must be 0 + * low 6 bits in byte 1 must be 0 */ switch(tvb_get_guint8(tvb,offset+1)){ case 0x80: @@ -2178,7 +2178,7 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec badPdu = TRUE; } else if(opcode==ISCSI_OPCODE_NOP_OUT) { /* TransferTag for NOP-Out should either be -1 or - the tag value we want for a response. + the tag value we want for a response. Assume 0 means we are just inside a big all zero datablock. */ @@ -2240,9 +2240,9 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec conversation_add_proto_data(conversation, proto_iscsi, iscsi_session); /* DataOut PDUs are often mistaken by DCERPC heuristics to be - * that protocol. Now that we know this is iscsi, set a + * that protocol. Now that we know this is iscsi, set a * dissector for this conversation to block other heuristic - * dissectors. + * dissectors. */ conversation_set_dissector(conversation, iscsi_handle); } @@ -2250,7 +2250,7 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec if(digestsActive && (available_bytes>=(guint32) (48+4+ahsLen*4)) && (iscsi_session->header_digest==ISCSI_HEADER_DIGEST_AUTO) ){ guint32 crc; /* we have enough data to test if HeaderDigest is enabled */ - crc= ~calculate_crc32c(tvb_get_ptr(tvb, offset, 48+ahsLen*4), 48+ahsLen*4, CRC32C_PRELOAD); + crc= ~crc32c_calculate(tvb_get_ptr(tvb, offset, 48+ahsLen*4), 48+ahsLen*4, CRC32C_PRELOAD); if(crc==tvb_get_ntohl(tvb,48+ahsLen*4)){ iscsi_session->header_digest=ISCSI_HEADER_DIGEST_CRC32; } else { @@ -2296,7 +2296,7 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec } /* This is to help TCP keep track of PDU boundaries - and allows it to find PDUs that are not aligned to + and allows it to find PDUs that are not aligned to the start of a TCP segments. Since it also allows TCP to know what is in the middle of a large PDU, it reduces the probability of a segment diff --git a/epan/dissectors/packet-iwarp-mpa.c b/epan/dissectors/packet-iwarp-mpa.c index 02d9e274b4..e3d6d09775 100644 --- a/epan/dissectors/packet-iwarp-mpa.c +++ b/epan/dissectors/packet-iwarp-mpa.c @@ -621,7 +621,7 @@ dissect_fpdu_crc(tvbuff_t *tvb, proto_tree *tree, mpa_state_t *state, if (state->crc) { - crc = ~calculate_crc32c(tvb_get_ptr(tvb, 0, length), length, + crc = ~crc32c_calculate(tvb_get_ptr(tvb, 0, length), length, CRC32C_PRELOAD); sent_crc = tvb_get_ntohl(tvb, offset); /* crc start offset */ diff --git a/epan/dissectors/packet-ntlmssp.c b/epan/dissectors/packet-ntlmssp.c index 88221451ae..c546b6e4f4 100644 --- a/epan/dissectors/packet-ntlmssp.c +++ b/epan/dissectors/packet-ntlmssp.c @@ -2448,7 +2448,7 @@ free_payload(gpointer decrypted_payload, gpointer user_data _U_) } guint g_header_hash(gconstpointer pointer) { - guint32 crc = ~calculate_crc32c(pointer,16,CRC32C_PRELOAD); + guint32 crc = ~crc32c_calculate(pointer,16,CRC32C_PRELOAD); /* Mat TBD fprintf(stderr,"Val: %u\n",crc);*/ return crc; } diff --git a/epan/dissectors/packet-zrtp.c b/epan/dissectors/packet-zrtp.c index 8bff678277..ca8003138f 100644 --- a/epan/dissectors/packet-zrtp.c +++ b/epan/dissectors/packet-zrtp.c @@ -413,7 +413,7 @@ dissect_zrtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } sent_crc = tvb_get_ntohl(tvb,msg_offset+checksum_offset); - calc_crc = ~calculate_crc32c(tvb_get_ptr(tvb,0,msg_offset+checksum_offset),msg_offset+checksum_offset,CRC32C_PRELOAD); + calc_crc = ~crc32c_calculate(tvb_get_ptr(tvb,0,msg_offset+checksum_offset),msg_offset+checksum_offset,CRC32C_PRELOAD); if (sent_crc == calc_crc) { ti = proto_tree_add_uint_format_value(zrtp_tree, hf_zrtp_checksum, tvb, msg_offset+checksum_offset, 4, sent_crc, @@ -604,7 +604,7 @@ dissect_Commit(tvbuff_t *tvb, packet_info *pinfo, proto_tree *zrtp_tree) { "SAS type: %s",key_to_val(value,4,zrtp_sas_type_vals,"Unknown SAS type %s")); switch(key_type){ - case 1: /* + case 1: /* Mult */ proto_tree_add_item(zrtp_tree,hf_zrtp_msg_nonce,tvb,data_offset+32,16,FALSE); @@ -692,7 +692,7 @@ dissect_Hello(tvbuff_t *tvb, packet_info *pinfo, proto_tree *zrtp_tree) { run_offset+=4; } ti=proto_tree_add_uint_format(zrtp_tree,hf_zrtp_msg_authtag_count,tvb,data_offset+2,1,ac,"Auth tag count = %d",vac); - tmp_tree = proto_item_add_subtree(ti,ett_zrtp_msg_ac); + tmp_tree = proto_item_add_subtree(ti,ett_zrtp_msg_ac); for(i=0;i<vac;i++){ tvb_memcpy(tvb,(void *)value,run_offset,4); value[4]='\0'; @@ -701,7 +701,7 @@ dissect_Hello(tvbuff_t *tvb, packet_info *pinfo, proto_tree *zrtp_tree) { run_offset+=4; } ti=proto_tree_add_uint_format(zrtp_tree,hf_zrtp_msg_key_count,tvb,data_offset+3,1,kc,"Key agreement type count = %d",vkc); - tmp_tree = proto_item_add_subtree(ti,ett_zrtp_msg_kc); + tmp_tree = proto_item_add_subtree(ti,ett_zrtp_msg_kc); for(i=0;i<vkc;i++){ tvb_memcpy(tvb,(void *)value,run_offset,4); value[4]='\0'; @@ -710,7 +710,7 @@ dissect_Hello(tvbuff_t *tvb, packet_info *pinfo, proto_tree *zrtp_tree) { run_offset+=4; } ti=proto_tree_add_uint_format(zrtp_tree,hf_zrtp_msg_sas_count,tvb,data_offset+3,1,sc,"SAS type count = %d",vsc); - tmp_tree = proto_item_add_subtree(ti,ett_zrtp_msg_sc); + tmp_tree = proto_item_add_subtree(ti,ett_zrtp_msg_sc); for(i=0;i<vsc;i++){ tvb_memcpy(tvb,(void *)value,run_offset,4); value[4]='\0'; @@ -968,7 +968,7 @@ proto_register_zrtp(void) "rs1ID", "zrtp.rs1id", FT_BYTES, BASE_NONE, NULL, 0x0, - NULL, HFILL + NULL, HFILL } }, diff --git a/epan/libwireshark.def b/epan/libwireshark.def index 67a46e0bc9..079e953f0b 100644 --- a/epan/libwireshark.def +++ b/epan/libwireshark.def @@ -108,7 +108,7 @@ copy_file_binary_mode copy_prefs crc16_ccitt_tvb crc16_plain_tvb_offset -calculate_crc32c +crc32c_calculate crc32_ccitt crc32_ccitt_seed crc32_ccitt_tvb |