2 * Routines for 3GPP LTE Positioning Protocol A (LLPa) packet dissection
3 * Copyright 2011-2024, Pascal Quantin <pascal@wireshark.org>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
11 * Ref 3GPP TS 36.455 version 18.1.0 (2024-06)
17 #include <epan/packet.h>
18 #include <epan/proto_data.h>
19 #include <epan/asn1.h>
20 #include <wsutil/array.h>
22 #include "packet-per.h"
23 #include "packet-lppa.h"
25 #define PNAME "LTE Positioning Protocol A (LPPa)"
29 void proto_register_lppa(void);
30 void proto_reg_handoff_lppa(void);
32 /* Initialize the protocol and registered fields */
33 static int proto_lppa
;
35 #include "packet-lppa-hf.c"
37 /* Initialize the subtree pointers */
39 #include "packet-lppa-ett.c"
47 /* Dissector tables */
48 static dissector_table_t lppa_ies_dissector_table
;
49 static dissector_table_t lppa_extension_dissector_table
;
50 static dissector_table_t lppa_proc_imsg_dissector_table
;
51 static dissector_table_t lppa_proc_sout_dissector_table
;
52 static dissector_table_t lppa_proc_uout_dissector_table
;
54 /* Include constants */
55 #include "packet-lppa-val.h"
57 static int dissect_ProtocolIEFieldValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *);
58 static int dissect_ProtocolExtensionFieldExtensionValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *);
59 static int dissect_InitiatingMessageValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *);
60 static int dissect_SuccessfulOutcomeValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *);
61 static int dissect_UnsuccessfulOutcomeValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *);
63 struct lppa_private_data
{
64 uint32_t procedure_code
;
65 uint32_t protocol_ie_id
;
66 uint32_t protocol_extension_id
;
67 uint32_t message_type
;
70 static struct lppa_private_data
*
71 lppa_get_private_data(packet_info
* pinfo
)
73 struct lppa_private_data
* lppa_data
= (struct lppa_private_data
*)p_get_proto_data(pinfo
->pool
, pinfo
, proto_lppa
, 0);
75 lppa_data
= wmem_new0(pinfo
->pool
, struct lppa_private_data
);
76 p_add_proto_data(pinfo
->pool
, pinfo
, proto_lppa
, 0, lppa_data
);
81 #include "packet-lppa-fn.c"
84 static int dissect_ProtocolIEFieldValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
88 struct lppa_private_data
* lppa_data
= lppa_get_private_data(pinfo
);
90 lppa_ctx
.message_type
= lppa_data
->message_type
;
91 lppa_ctx
.ProcedureCode
= lppa_data
->procedure_code
;
92 lppa_ctx
.ProtocolIE_ID
= lppa_data
->protocol_ie_id
;
93 lppa_ctx
.ProtocolExtensionID
= lppa_data
->protocol_extension_id
;
95 return (dissector_try_uint_with_data(lppa_ies_dissector_table
, lppa_ctx
.ProtocolIE_ID
, tvb
, pinfo
, tree
, false, &lppa_ctx
)) ? tvb_captured_length(tvb
) : 0;
98 static int dissect_ProtocolExtensionFieldExtensionValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
101 struct lppa_private_data
* lppa_data
= lppa_get_private_data(pinfo
);
103 lppa_ctx
.message_type
= lppa_data
->message_type
;
104 lppa_ctx
.ProcedureCode
= lppa_data
->procedure_code
;
105 lppa_ctx
.ProtocolIE_ID
= lppa_data
->protocol_ie_id
;
106 lppa_ctx
.ProtocolExtensionID
= lppa_data
->protocol_extension_id
;
108 return (dissector_try_uint_with_data(lppa_extension_dissector_table
, lppa_ctx
.ProtocolExtensionID
, tvb
, pinfo
, tree
, false, &lppa_ctx
)) ? tvb_captured_length(tvb
) : 0;
111 static int dissect_InitiatingMessageValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
)
113 struct lppa_private_data
* lppa_data
= lppa_get_private_data(pinfo
);
114 return (dissector_try_uint_with_data(lppa_proc_imsg_dissector_table
, lppa_data
->procedure_code
, tvb
, pinfo
, tree
, false, data
)) ? tvb_captured_length(tvb
) : 0;
117 static int dissect_SuccessfulOutcomeValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
)
119 struct lppa_private_data
* lppa_data
= lppa_get_private_data(pinfo
);
120 return (dissector_try_uint_with_data(lppa_proc_sout_dissector_table
, lppa_data
->procedure_code
, tvb
, pinfo
, tree
, false, data
)) ? tvb_captured_length(tvb
) : 0;
123 static int dissect_UnsuccessfulOutcomeValue(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
)
125 struct lppa_private_data
* lppa_data
= lppa_get_private_data(pinfo
);
127 return (dissector_try_uint_with_data(lppa_proc_uout_dissector_table
, lppa_data
->procedure_code
, tvb
, pinfo
, tree
, false, data
)) ? tvb_captured_length(tvb
) : 0;
130 /*--- proto_register_lppa -------------------------------------------*/
131 void proto_register_lppa(void) {
134 static hf_register_info hf
[] = {
136 #include "packet-lppa-hfarr.c"
139 /* List of subtrees */
140 static int* ett
[] = {
142 #include "packet-lppa-ettarr.c"
145 /* Register protocol */
146 proto_lppa
= proto_register_protocol(PNAME
, PSNAME
, PFNAME
);
147 register_dissector("lppa", dissect_LPPA_PDU_PDU
, proto_lppa
);
149 /* Register fields and subtrees */
150 proto_register_field_array(proto_lppa
, hf
, array_length(hf
));
151 proto_register_subtree_array(ett
, array_length(ett
));
153 /* Register dissector tables */
154 lppa_ies_dissector_table
= register_dissector_table("lppa.ies", "LPPA-PROTOCOL-IES", proto_lppa
, FT_UINT32
, BASE_DEC
);
155 lppa_extension_dissector_table
= register_dissector_table("lppa.extension", "LPPA-PROTOCOL-EXTENSION", proto_lppa
, FT_UINT32
, BASE_DEC
);
156 lppa_proc_imsg_dissector_table
= register_dissector_table("lppa.proc.imsg", "LPPA-ELEMENTARY-PROCEDURE InitiatingMessage", proto_lppa
, FT_UINT32
, BASE_DEC
);
157 lppa_proc_sout_dissector_table
= register_dissector_table("lppa.proc.sout", "LPPA-ELEMENTARY-PROCEDURE SuccessfulOutcome", proto_lppa
, FT_UINT32
, BASE_DEC
);
158 lppa_proc_uout_dissector_table
= register_dissector_table("lppa.proc.uout", "LPPA-ELEMENTARY-PROCEDURE UnsuccessfulOutcome", proto_lppa
, FT_UINT32
, BASE_DEC
);
161 /*--- proto_reg_handoff_lppa ---------------------------------------*/
163 proto_reg_handoff_lppa(void)
165 #include "packet-lppa-dis-tab.c"