Get rid of private byte-order definition. The definition didn't match

the name - a non-zero last argument to proto_tree_add_item(), such as
TRUE or REP_LITTLE_ENDIAN, means "little-endian", and a zero argument,
such as FALSE or REP_BIG_ENDIAN, means "big-endian"; at least as I read
the spec, little-endian is correct, but the wrong definition's been used
for a while, so we'll use REP_BIG_ENDIAN.

svn path=/trunk/; revision=32923
This commit is contained in:
Guy Harris 2010-05-24 02:28:16 +00:00
parent 20914ee220
commit 313b3edf0a
1 changed files with 30 additions and 10 deletions

View File

@ -40,7 +40,27 @@
#include "packet-gsm_a_common.h"
/* #define BSSGP_DEBUG */
#define BSSGP_LITTLE_ENDIAN FALSE
/*
* TS 48.018 V6.6.0 (2004-11) says, of information elements:
*
* Refer to General Structure Of The Information Elements/3GPP TS 48.016.
*
* TS 48.016 V9.0.0 (2010-02), in that section, says, of information elements:
*
* When a field extends over more than one octet, the order of bit
* values progressively decreases as the octet number increases.
* The least significant bit of the field is represented by the
* lowest numbered bit of the highest numbered octet of the field.
*
* which sure sounds little-endian.
*
* However, for some not-entirely-obvious reason, BSSGP_LITTLE_ENDIAN, which
* was passed to proto_tree_add_item() as the byte-order argument, was
* defined as FALSE - which meant big-endian.
*
* For now, we'll use REP_BIG_ENDIAN, now that we have REP_BIG_ENDIAN and
* REP_LITTLE_ENDIAN definitions.
*/
#define BSSGP_TRANSLATION_MAX_LEN 50
#define BSSGP_MASK_LEFT_OCTET_HALF 0xf0
#define BSSGP_MASK_RIGHT_OCTET_HALF 0x0f
@ -1367,7 +1387,7 @@ decode_mobile_identity(bssgp_ie_t *ie, build_info_t *bi, int ie_start_offset) {
"TMSI/P-TMSI %0x04x", tmsi);
if (bi->bssgp_tree) {
proto_tree_add_item(tf, hf_bssgp_tmsi_ptmsi, bi->tvb, bi->offset, 4,
BSSGP_LITTLE_ENDIAN);
REP_BIG_ENDIAN);
proto_item_append_text(ti, ": %#04x", tmsi);
}
decode_nri(tf, bi, tmsi);
@ -1445,7 +1465,7 @@ decode_lai(build_info_t *bi, proto_tree *parent_tree) {
lac = tvb_get_ntohs(bi->tvb, bi->offset);
proto_tree_add_item(parent_tree, hf_bssgp_lac,
bi->tvb, bi->offset, 2, BSSGP_LITTLE_ENDIAN);
bi->tvb, bi->offset, 2, REP_BIG_ENDIAN);
bi->offset += 2;
g_snprintf(lai, RES_LEN, "%s-%u", mcc_mnc, lac);
@ -1461,7 +1481,7 @@ decode_rai(build_info_t *bi, proto_tree *parent_tree) {
char *lai = decode_lai(bi, parent_tree);
rac = tvb_get_guint8(bi->tvb, bi->offset);
proto_tree_add_item(parent_tree, hf_bssgp_rac, bi->tvb, bi->offset, 1, BSSGP_LITTLE_ENDIAN);
proto_tree_add_item(parent_tree, hf_bssgp_rac, bi->tvb, bi->offset, 1, REP_BIG_ENDIAN);
bi->offset++;
g_snprintf(rai, RES_LEN, "%s-%u", lai, rac);
@ -1480,7 +1500,7 @@ decode_rai_ci(build_info_t *bi, proto_tree *parent_tree) {
ci = tvb_get_ntohs(bi->tvb, bi->offset);
proto_tree_add_item(parent_tree, hf_bssgp_ci,
bi->tvb, bi->offset, 2, BSSGP_LITTLE_ENDIAN);
bi->tvb, bi->offset, 2, REP_BIG_ENDIAN);
bi->offset += 2;
g_snprintf(rai_ci, RES_LEN, "RAI %s, CI %u", rai, ci);
#undef RES_LEN
@ -1683,7 +1703,7 @@ decode_iei_bvci(bssgp_ie_t *ie, build_info_t *bi, int ie_start_offset) {
proto_item_append_text(ti, ": %u", bvci);
hidden_item = proto_tree_add_item(bi->bssgp_tree, hf_bssgp_bvci,
bi->tvb, bi->offset, 2,
BSSGP_LITTLE_ENDIAN);
REP_BIG_ENDIAN);
PROTO_ITEM_SET_HIDDEN(hidden_item);
}
bi->offset += ie->value_length;
@ -2859,7 +2879,7 @@ decode_iei_tlli(bssgp_ie_t *ie, build_info_t *bi, int ie_start_offset) {
tf = proto_item_add_subtree(ti, ett_bssgp_tlli);
proto_tree_add_item(tf, hf_bssgp_tlli,
bi->tvb, bi->offset, 4, BSSGP_LITTLE_ENDIAN);
bi->tvb, bi->offset, 4, REP_BIG_ENDIAN);
bi->offset += 4;
@ -2885,7 +2905,7 @@ decode_iei_tmsi(bssgp_ie_t *ie, build_info_t *bi, int ie_start_offset) {
tf = proto_item_add_subtree(ti, ett_bssgp_tmsi_ptmsi);
proto_tree_add_item(tf, hf_bssgp_tmsi_ptmsi,
bi->tvb, bi->offset, 4, BSSGP_LITTLE_ENDIAN);
bi->tvb, bi->offset, 4, REP_BIG_ENDIAN);
}
bi->offset += 4;
@ -3386,7 +3406,7 @@ decode_iei_nsei(bssgp_ie_t *ie, build_info_t *bi, int ie_start_offset) {
ti = bssgp_proto_tree_add_ie(ie, bi, ie_start_offset);
proto_item_append_text(ti, ": %u", nsei);
hidden_item = proto_tree_add_item(bi->bssgp_tree, hf_bssgp_nsei,
bi->tvb, bi->offset, 2, BSSGP_LITTLE_ENDIAN);
bi->tvb, bi->offset, 2, REP_BIG_ENDIAN);
PROTO_ITEM_SET_HIDDEN(hidden_item);
}
bi->offset += ie->value_length;
@ -4047,7 +4067,7 @@ decode_iei_rim_routing_information(bssgp_ie_t *ie, build_info_t *bi, int ie_star
decode_rai(bi, tf);
proto_tree_add_item(tf, hf_bssgp_ci,
bi->tvb, bi->offset, 2, BSSGP_LITTLE_ENDIAN);
bi->tvb, bi->offset, 2, REP_BIG_ENDIAN);
bi->offset += 2;
} else {