Don't do fcn calls in arg of g_?to??(); Macro may very well eval args multiple times.
[obnox/wireshark/wip.git] / epan / dissectors / packet-tetra.c
index 3a4f16a4d2deb7b5c879641f43dcc08208fd32eb..a42f77cb35381542a1e4615ce6c93a5a327674da 100644 (file)
 
 #include <glib.h>
 #include <epan/packet.h>
+#include <epan/prefs.h>
+#include <epan/oids.h>
 #include <epan/conversation.h>
 #include <epan/asn1.h>
-#include <epan/prefs.h>
 
 #include <stdio.h>
 #include <string.h>
@@ -684,7 +685,7 @@ static int hf_tetra_proprietary_element_owner_extension = -1;  /* BIT_STRING */
 static int hf_tetra_simplex_duplex_selection_06 = -1;  /* T_simplex_duplex_selection_05 */
 
 /*--- End of included file: packet-tetra-hf.c ---*/
-#line 86 "../../asn1/tetra/packet-tetra-template.c"
+#line 87 "../../asn1/tetra/packet-tetra-template.c"
 
 /* Initialize the subtree pointers */
 /* These are the ids of the subtrees that we may be creating */
@@ -965,7 +966,7 @@ static gint ett_tetra_Type2 = -1;
 static gint ett_tetra_Modify_type = -1;
 
 /*--- End of included file: packet-tetra-ett.c ---*/
-#line 96 "../../asn1/tetra/packet-tetra-template.c"
+#line 97 "../../asn1/tetra/packet-tetra-template.c"
 
 
 /*--- Included file: packet-tetra-fn.c ---*/
@@ -2510,7 +2511,7 @@ static const per_sequence_t U_LOCATION_UPDATE_DEMAND_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_U_LOCATION_UPDATE_DEMAND(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 102 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -2545,7 +2546,7 @@ static const per_sequence_t U_MM_STATUS_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_U_MM_STATUS(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 238 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -2772,7 +2773,7 @@ static const per_sequence_t U_ATTACH_DETACH_GROUP_IDENTITY_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_U_ATTACH_DETACH_GROUP_IDENTITY(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 248 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -2867,7 +2868,7 @@ static const per_sequence_t U_ATTACH_DETACH_GROUP_IDENTITY_ACK_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_U_ATTACH_DETACH_GROUP_IDENTITY_ACK(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 253 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -3159,7 +3160,7 @@ static const per_sequence_t U_ALERT_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_U_ALERT(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 187 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -3277,7 +3278,7 @@ static const per_sequence_t U_CONNECT_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_U_CONNECT(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 192 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -3365,7 +3366,7 @@ static const per_sequence_t U_DISCONNECT_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_U_DISCONNECT(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 197 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -3384,7 +3385,7 @@ static const per_sequence_t U_INFO_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_U_INFO(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
                                    ett_tetra_U_INFO, U_INFO_sequence);
@@ -3399,7 +3400,7 @@ static const per_sequence_t U_RELEASE_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_U_RELEASE(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 79 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -3574,7 +3575,7 @@ static const per_sequence_t U_SETUP_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_U_SETUP(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 207 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -3630,7 +3631,7 @@ static const per_sequence_t U_STATUS_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_U_STATUS(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 212 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -3707,7 +3708,7 @@ static const per_sequence_t U_TX_CEASED_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_U_TX_CEASED(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 232 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -3787,7 +3788,7 @@ static const per_sequence_t U_TX_DEMAND_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_U_TX_DEMAND(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 227 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -3876,7 +3877,7 @@ static const per_sequence_t U_CALL_RESTORE_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_U_CALL_RESTORE(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 222 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -3968,7 +3969,7 @@ static const per_sequence_t U_SDS_DATA_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_U_SDS_DATA(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 217 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -5951,7 +5952,7 @@ static const per_sequence_t D_LOCATION_UPDATE_ACCEPT_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_D_LOCATION_UPDATE_ACCEPT(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 108 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -5971,7 +5972,7 @@ static const per_sequence_t D_LOCATION_UPDATE_REJECT_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_D_LOCATION_UPDATE_REJECT(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 258 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -6190,7 +6191,7 @@ static const per_sequence_t D_ATTACH_DETACH_GROUP_IDENTITY_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_D_ATTACH_DETACH_GROUP_IDENTITY(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 263 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -6285,7 +6286,7 @@ static const per_sequence_t D_ATTACH_DETACH_GROUP_IDENTITY_ACK_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_D_ATTACH_DETACH_GROUP_IDENTITY_ACK(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 268 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -6303,7 +6304,7 @@ static const per_sequence_t D_MM_STATUS_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_D_MM_STATUS(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 243 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -6496,7 +6497,7 @@ static const per_sequence_t D_ALERT_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_D_ALERT(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 139 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -6645,7 +6646,7 @@ static const per_sequence_t D_CALL_PROCEEDING_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_D_CALL_PROCEEDING(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 91 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -6836,7 +6837,7 @@ static const per_sequence_t D_CONNECT_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_D_CONNECT(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 114 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -6939,7 +6940,7 @@ static const per_sequence_t D_CONNECT_ACK_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_D_CONNECT_ACK(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 124 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -6958,7 +6959,7 @@ static const per_sequence_t D_DISCONNECT_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_D_DISCONNECT(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 134 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -6978,7 +6979,7 @@ static const per_sequence_t D_INFO_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_D_INFO(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 129 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -7079,7 +7080,7 @@ static const per_sequence_t D_RELEASE_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_D_RELEASE(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 84 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -7229,7 +7230,7 @@ static const per_sequence_t D_SETUP_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_D_SETUP(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 96 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -7284,7 +7285,7 @@ static const per_sequence_t D_STATUS_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_D_STATUS(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 150 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -7385,7 +7386,7 @@ static const per_sequence_t D_TX_CEASED_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_D_TX_CEASED(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 144 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -7405,7 +7406,7 @@ static const per_sequence_t D_TX_CONTINUE_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_D_TX_CONTINUE(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 155 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -7427,7 +7428,7 @@ static const per_sequence_t D_TX_GRANTED_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_D_TX_GRANTED(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 160 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -7447,7 +7448,7 @@ static const per_sequence_t D_TX_WAIT_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_D_TX_WAIT(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 166 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -7677,7 +7678,7 @@ static const per_sequence_t D_CALL_RESTORE_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_D_CALL_RESTORE(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 171 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -7758,7 +7759,7 @@ static const per_sequence_t D_SDS_DATA_sequence[] = {
   { NULL, 0, 0, NULL }
 };
 
-int
+static int
 dissect_tetra_D_SDS_DATA(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 176 "../../asn1/tetra/tetra.cnf"
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
@@ -8609,7 +8610,7 @@ static void dissect_MAC_ACCESS_DEFINE_PDU(tvbuff_t *tvb _U_, packet_info *pinfo
 
 
 /*--- End of included file: packet-tetra-fn.c ---*/
-#line 98 "../../asn1/tetra/packet-tetra-template.c"
+#line 99 "../../asn1/tetra/packet-tetra-template.c"
 
 static const value_string channeltypenames[] = {
        { 0, "Reserved" },
@@ -8837,12 +8838,12 @@ static void dissect_tetra_UNITDATA_IND(tvbuff_t *tvb, packet_info *pinfo, proto_
 
        /* Length */
        rxreg = tvb_get_letohl(tvb, offset);
-       tetra_sub_item = proto_tree_add_uint(tetra_tree, hf_tetra_len0, tvb, offset, 4, rxreg);
+       proto_tree_add_uint(tetra_tree, hf_tetra_len0, tvb, offset, 4, rxreg);
 
        /* RvSteR */
        offset += 4;
        rxreg = tvb_get_letohl(tvb, offset);
-       tetra_sub_item = proto_tree_add_uint(tetra_tree, hf_tetra_rvstr, tvb, offset, 4, rxreg);
+       proto_tree_add_uint(tetra_tree, hf_tetra_rvstr, tvb, offset, 4, rxreg);
 
        /* Logical channels */
        channels = rxreg & 0x3;
@@ -8893,7 +8894,7 @@ void dissect_tetra_UNITDATA_REQ(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
 
        /* TxR */
        txreg = tvb_get_letohl(tvb, offset);
-       tetra_sub_item = proto_tree_add_uint(tetra_tree, hf_tetra_txreg, tvb, offset, 4, txreg);
+       proto_tree_add_uint(tetra_tree, hf_tetra_txreg, tvb, offset, 4, txreg);
 
        /* Logical channels */
        channels = (txreg & 0x3) + 1;
@@ -9006,13 +9007,12 @@ dissect_tetra(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 
                tetra_item = proto_tree_add_item(tree, proto_tetra, tvb, 0, -1, ENC_NA);
                tetra_tree = proto_item_add_subtree(tetra_item, ett_tetra);
-               tetra_header_tree = proto_item_add_subtree(tetra_item, ett_tetra);
 
                offset ++;
 
                /* Carrier number */
                if(include_carrier_number) {
-                       tetra_sub_item = proto_tree_add_uint(tetra_tree, hf_tetra_carriernumber, tvb, offset, 1, carriernumber);
+                       proto_tree_add_uint(tetra_tree, hf_tetra_carriernumber, tvb, offset, 1, carriernumber);
                        offset ++;
                }