forked from osmocom/wireshark
Pass a structure including an atm_phdr to dissect_atm_pw_oam_cell().
This will allow the VPI and VCI to be handed to dissect_atm_cell_payload() in https://code.wireshark.org/review/c/31381/. That structure also needs to include the enable_fill_columns_by_atm_dissector flag; we remove that from the pwatm_private_data_t, which is now private to the ATM pseudo-wire dissector, and put it in the new structure. Change-Id: I88f4a9f4b3c4c1c94914311bb883ea38e10ca4b4 Reviewed-on: https://code.wireshark.org/review/31384 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
40b2ba8e7b
commit
814c57a8b5
|
@ -1684,12 +1684,12 @@ dissect_atm_oam_cell(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
|
|||
static int
|
||||
dissect_atm_pw_oam_cell(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
|
||||
{
|
||||
const pwatm_private_data_t *pwpd = (const pwatm_private_data_t *)data;
|
||||
const struct pw_atm_phdr *pw_atm_info = (const struct pw_atm_phdr *)data;
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ATM");
|
||||
|
||||
dissect_atm_cell_payload(tvb, 0, pinfo, tree, AAL_OAMCELL,
|
||||
pwpd->enable_fill_columns_by_atm_dissector);
|
||||
pw_atm_info->enable_fill_columns_by_atm_dissector);
|
||||
|
||||
return tvb_reported_length(tvb);
|
||||
}
|
||||
|
|
|
@ -114,6 +114,74 @@ static dissector_handle_t dh_atm_untruncated;
|
|||
static dissector_handle_t dh_atm_oam_cell;
|
||||
static dissector_handle_t dh_padding;
|
||||
|
||||
typedef enum {
|
||||
PWATM_MODE_UNKNOWN = 0
|
||||
,PWATM_MODE_N1_NOCW
|
||||
,PWATM_MODE_N1_CW
|
||||
,PWATM_MODE_11_VCC
|
||||
,PWATM_MODE_11_VPC
|
||||
,PWATM_MODE_AAL5_SDU
|
||||
,PWATM_MODE_AAL5_PDU
|
||||
} pwatm_mode_t;
|
||||
|
||||
typedef enum {
|
||||
PWATM_SUBMODE_DEFAULT = 0
|
||||
,PWATM_SUBMODE_ADMIN_CELL /*used in aal5_sdu dissector only*/
|
||||
} pwatm_submode_t;
|
||||
|
||||
typedef struct {
|
||||
int pw_cell_number;
|
||||
int props;
|
||||
gint packet_size;
|
||||
pwatm_mode_t mode;
|
||||
pwatm_submode_t submode;
|
||||
struct {
|
||||
/*
|
||||
* ATM-specific attributes which remain the same
|
||||
* across all the cells in the pw packet. Values are filled
|
||||
* by sub-dissectors and read by upper-level dissector.
|
||||
* Meanings of values:
|
||||
* (-1) - value is unknown
|
||||
* (-2) - value is different among cells
|
||||
* positive - value is the same in all cells
|
||||
* Machinery is implemented in the UPDATE_CUMULATIVE_VALUE macro.
|
||||
*/
|
||||
gint32 vpi;
|
||||
gint32 vci;
|
||||
gint32 clp;
|
||||
gint32 pti;
|
||||
} cumulative;
|
||||
gint32 vpi; /*-1 if unknown*/
|
||||
gint32 vci; /*-1 if unknown*/
|
||||
gint32 pti; /*-1 if unknown*/
|
||||
struct {
|
||||
/*
|
||||
* Some fields from 3rd byte of CW. Filled by cell_header dissector.
|
||||
* In in AAL5 PDU mode, this allows control_word dissector to print
|
||||
* these values in the CW heading line in the tree.
|
||||
* Meanings of values:
|
||||
* (-1) - value is unknown
|
||||
*/
|
||||
gint32 m;
|
||||
gint32 v;
|
||||
gint32 rsv;
|
||||
gint32 u;
|
||||
gint32 e;
|
||||
gint32 clp;
|
||||
} cwb3;
|
||||
gboolean aal5_sdu_frame_relay_cr_bit; /*see rfc4717 10.1*/
|
||||
gboolean cell_mode_oam; /*atm admin cell*/
|
||||
} pwatm_private_data_t;
|
||||
|
||||
#define PWATM_PRIVATE_DATA_T_INITIALIZER { \
|
||||
0, PWC_PACKET_PROPERTIES_T_INITIALIZER, 0 \
|
||||
,PWATM_MODE_UNKNOWN, PWATM_SUBMODE_DEFAULT \
|
||||
,{-1, -1, -1, -1 } \
|
||||
,-1, -1, -1 \
|
||||
,{-1, -1, -1, -1, -1, -1 } \
|
||||
,FALSE, FALSE, \
|
||||
}
|
||||
|
||||
#define PTI_IS_ADMIN(pti) ((pti) == 4 || (pti) == 5 || (pti) == 6) /*see atm_pt_vals[]*/
|
||||
|
||||
#define MODE_11(mode) (PWATM_MODE_11_VCC == (mode) || PWATM_MODE_11_VPC == (mode))
|
||||
|
@ -407,7 +475,7 @@ dissect_payload_and_padding(
|
|||
|
||||
if (pd->cell_mode_oam)
|
||||
{
|
||||
struct atm_phdr ph;
|
||||
struct pw_atm_phdr ph;
|
||||
tvbuff_t* tvb_3;
|
||||
int bytes_to_dissect;
|
||||
/* prepare buffer for old-style dissector */
|
||||
|
@ -419,13 +487,13 @@ dissect_payload_and_padding(
|
|||
tvb_3 = tvb_new_subset_length_caplen(tvb_2, 0, bytes_to_dissect, -1);
|
||||
/*aal5_sdu: disable filling columns after 1st (valid) oam cell*/
|
||||
if (pd->mode == PWATM_MODE_AAL5_SDU && (pd->pw_cell_number > 0))
|
||||
{
|
||||
pd->enable_fill_columns_by_atm_dissector = FALSE;
|
||||
}
|
||||
ph.enable_fill_columns_by_atm_dissector = FALSE;
|
||||
else
|
||||
ph.enable_fill_columns_by_atm_dissector = TRUE;
|
||||
/* prepare atm pseudo header for atm OAM cell decoding */
|
||||
prepare_pseudo_header_atm(&ph, pd, AAL_OAMCELL);
|
||||
prepare_pseudo_header_atm(&ph.info, pd, AAL_OAMCELL);
|
||||
|
||||
call_dissector_with_data(dh_atm_oam_cell, tvb_3, pinfo, tree, &pd);
|
||||
call_dissector_with_data(dh_atm_oam_cell, tvb_3, pinfo, tree, &ph);
|
||||
dissected += bytes_to_dissect;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -14,74 +14,9 @@
|
|||
|
||||
#include "packet-pw-common.h"
|
||||
|
||||
typedef enum {
|
||||
PWATM_MODE_UNKNOWN = 0
|
||||
,PWATM_MODE_N1_NOCW
|
||||
,PWATM_MODE_N1_CW
|
||||
,PWATM_MODE_11_VCC
|
||||
,PWATM_MODE_11_VPC
|
||||
,PWATM_MODE_AAL5_SDU
|
||||
,PWATM_MODE_AAL5_PDU
|
||||
} pwatm_mode_t;
|
||||
|
||||
typedef enum {
|
||||
PWATM_SUBMODE_DEFAULT = 0
|
||||
,PWATM_SUBMODE_ADMIN_CELL /*used in aal5_sdu dissector only*/
|
||||
} pwatm_submode_t;
|
||||
|
||||
typedef struct {
|
||||
int pw_cell_number;
|
||||
int props;
|
||||
gint packet_size;
|
||||
pwatm_mode_t mode;
|
||||
pwatm_submode_t submode;
|
||||
struct {
|
||||
/*
|
||||
* ATM-specific attributes which remain the same
|
||||
* across all the cells in the pw packet. Values are filled
|
||||
* by sub-dissectors and read by upper-level dissector.
|
||||
* Meanings of values:
|
||||
* (-1) - value is unknown
|
||||
* (-2) - value is different among cells
|
||||
* positive - value is the same in all cells
|
||||
* Machinery is implemented in the UPDATE_CUMULATIVE_VALUE macro.
|
||||
*/
|
||||
gint32 vpi;
|
||||
gint32 vci;
|
||||
gint32 clp;
|
||||
gint32 pti;
|
||||
} cumulative;
|
||||
gint32 vpi; /*-1 if unknown*/
|
||||
gint32 vci; /*-1 if unknown*/
|
||||
gint32 pti; /*-1 if unknown*/
|
||||
struct {
|
||||
/*
|
||||
* Some fields from 3rd byte of CW. Filled by cell_header dissector.
|
||||
* In in AAL5 PDU mode, this allows control_word dissector to print
|
||||
* these values in the CW heading line in the tree.
|
||||
* Meanings of values:
|
||||
* (-1) - value is unknown
|
||||
*/
|
||||
gint32 m;
|
||||
gint32 v;
|
||||
gint32 rsv;
|
||||
gint32 u;
|
||||
gint32 e;
|
||||
gint32 clp;
|
||||
} cwb3;
|
||||
gboolean aal5_sdu_frame_relay_cr_bit; /*see rfc4717 10.1*/
|
||||
gboolean cell_mode_oam; /*atm admin cell*/
|
||||
struct pw_atm_phdr {
|
||||
struct atm_phdr info;
|
||||
gboolean enable_fill_columns_by_atm_dissector;
|
||||
} pwatm_private_data_t;
|
||||
|
||||
|
||||
#define PWATM_PRIVATE_DATA_T_INITIALIZER { \
|
||||
0, PWC_PACKET_PROPERTIES_T_INITIALIZER, 0 \
|
||||
,PWATM_MODE_UNKNOWN, PWATM_SUBMODE_DEFAULT \
|
||||
,{-1, -1, -1, -1 } \
|
||||
,-1, -1, -1 \
|
||||
,{-1, -1, -1, -1, -1, -1 } \
|
||||
,FALSE, FALSE, TRUE \
|
||||
}
|
||||
};
|
||||
|
||||
#endif /*PACKET_PW_ATM_H*/
|
||||
|
|
Loading…
Reference in New Issue