aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-pw-atm.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2019-01-04 23:39:38 -0800
committerGuy Harris <guy@alum.mit.edu>2019-01-05 08:19:03 +0000
commit814c57a8b53a0841f513fd83f367844243a6833e (patch)
treee4a9d9fadab3ede851b7273095c24729de835143 /epan/dissectors/packet-pw-atm.c
parent40b2ba8e7b6c1b03ca2a85e4f7c5e31e36140b5d (diff)
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>
Diffstat (limited to 'epan/dissectors/packet-pw-atm.c')
-rw-r--r--epan/dissectors/packet-pw-atm.c80
1 files changed, 74 insertions, 6 deletions
diff --git a/epan/dissectors/packet-pw-atm.c b/epan/dissectors/packet-pw-atm.c
index 1daf133ca7..eb6af4d1a4 100644
--- a/epan/dissectors/packet-pw-atm.c
+++ b/epan/dissectors/packet-pw-atm.c
@@ -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