Add and use accessors to get/set per-packet data for LTE MAC.

This will allow plugins to use the dissector.

svn path=/trunk/; revision=35774
This commit is contained in:
Martin Mathieson 2011-02-02 23:21:16 +00:00
parent 77333de278
commit 82cbbca3e5
4 changed files with 26 additions and 5 deletions

View File

@ -196,7 +196,6 @@ static guint outhdr_values[MAX_OUTHDR_VALUES];
static gint outhdr_values_found = 0; static gint outhdr_values_found = 0;
extern int proto_fp; extern int proto_fp;
extern int proto_mac_lte;
extern int proto_rlc_lte; extern int proto_rlc_lte;
extern int proto_pdcp_lte; extern int proto_pdcp_lte;
@ -1403,7 +1402,7 @@ static void attach_mac_lte_info(packet_info *pinfo)
unsigned int i=0; unsigned int i=0;
/* Only need to set info once per session. */ /* Only need to set info once per session. */
p_mac_lte_info = p_get_proto_data(pinfo->fd, proto_mac_lte); p_mac_lte_info = get_mac_lte_proto_data(pinfo);
if (p_mac_lte_info != NULL) { if (p_mac_lte_info != NULL) {
return; return;
} }
@ -1473,6 +1472,7 @@ static void attach_mac_lte_info(packet_info *pinfo)
} }
} }
else { else {
/* Uplink */
p_mac_lte_info->detailed_phy_info.ul_info.present = outhdr_values[i++]; p_mac_lte_info->detailed_phy_info.ul_info.present = outhdr_values[i++];
p_mac_lte_info->detailed_phy_info.ul_info.modulation_type = outhdr_values[i++]; p_mac_lte_info->detailed_phy_info.ul_info.modulation_type = outhdr_values[i++];
p_mac_lte_info->detailed_phy_info.ul_info.tbs_index = outhdr_values[i++]; p_mac_lte_info->detailed_phy_info.ul_info.tbs_index = outhdr_values[i++];
@ -1496,7 +1496,7 @@ static void attach_mac_lte_info(packet_info *pinfo)
} }
/* Store info in packet */ /* Store info in packet */
p_add_proto_data(pinfo->fd, proto_mac_lte, p_mac_lte_info); set_mac_lte_proto_data(pinfo, p_mac_lte_info);
} }
@ -1663,7 +1663,7 @@ static void check_for_oob_mac_lte_events(packet_info *pinfo, tvbuff_t *tvb, prot
/* We have an event */ /* We have an event */
/* Only need to set info once per session. */ /* Only need to set info once per session. */
p_mac_lte_info = p_get_proto_data(pinfo->fd, proto_mac_lte); p_mac_lte_info = get_mac_lte_proto_data(pinfo);
if (p_mac_lte_info == NULL) { if (p_mac_lte_info == NULL) {
/* Allocate & zero struct */ /* Allocate & zero struct */
@ -1695,7 +1695,7 @@ static void check_for_oob_mac_lte_events(packet_info *pinfo, tvbuff_t *tvb, prot
p_mac_lte_info->oob_event = oob_event; p_mac_lte_info->oob_event = oob_event;
/* Store info in packet */ /* Store info in packet */
p_add_proto_data(pinfo->fd, proto_mac_lte, p_mac_lte_info); set_mac_lte_proto_data(pinfo, p_mac_lte_info);
} }
/* Call MAC dissector */ /* Call MAC dissector */

View File

@ -4084,6 +4084,19 @@ void proto_register_mac_lte(void)
register_init_routine(&mac_lte_init_protocol); register_init_routine(&mac_lte_init_protocol);
} }
/* Function to be called from outside this module (e.g. in a plugin) to get per-packet data */
mac_lte_info *get_mac_lte_proto_data(packet_info *pinfo)
{
return p_get_proto_data(pinfo->fd, proto_mac_lte);
}
/* Function to be called from outside this module (e.g. in a plugin) to set per-packet data */
void set_mac_lte_proto_data(packet_info *pinfo, mac_lte_info *p_mac_lte_info)
{
p_add_proto_data(pinfo->fd, proto_mac_lte, p_mac_lte_info);
}
void void
proto_reg_handoff_mac_lte(void) proto_reg_handoff_mac_lte(void)
{ {

View File

@ -242,3 +242,9 @@ int is_mac_lte_frame_retx(packet_info *pinfo, guint8 direction);
continues until the end of the frame) */ continues until the end of the frame) */
#define MAC_LTE_PAYLOAD_TAG 0x01 #define MAC_LTE_PAYLOAD_TAG 0x01
/* Functions to be called from outside this module (e.g. in a plugin, where mac_lte_info
isn't available) to get/set per-packet data */
mac_lte_info *get_mac_lte_proto_data(packet_info *pinfo);
void set_mac_lte_proto_data(packet_info *pinfo, mac_lte_info *p_mac_lte_info);

View File

@ -549,6 +549,7 @@ get_host_ipaddr6
get_hostname get_hostname
get_hostname6 get_hostname6
get_key_string get_key_string
get_mac_lte_proto_data
get_manuf_name_if_known get_manuf_name_if_known
get_persconffile_path get_persconffile_path
get_persdatafile_dir get_persdatafile_dir
@ -932,6 +933,7 @@ set_column_resolved
set_column_title set_column_title
set_column_visible set_column_visible
set_actual_length set_actual_length
set_mac_lte_proto_data
set_profile_name set_profile_name
set_tap_dfilter set_tap_dfilter
show_exception show_exception