Commit a40c830c authored by garciay's avatar garciay
Browse files

Wrong BTP ports for itsis

Bug fixed for itsut
parent e4f122a7
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -40,11 +40,11 @@
#define PNAME  "ETSI TS 103301"
#define PSNAME "ITSIS"
#define PFNAME "itsis"
#define MAPEM_PORT 2003    /* BTP port */
#define SPATEM_PORT 2004    /* BTP port */
#define IVIM_PORT 2005    /* BTP port */
#define SREM_PORT 2006    /* BTP port */
#define SSEM_PORT 2007    /* BTP port */
#define MAPEM_PORT  2003    /* MAPEM BTP port */
#define SPATEM_PORT 2004    /* SPATEM BTP port */
#define IVIM_PORT   2006    /* IVIM BTP port */
#define SREM_PORT   2007    /* SREM BTP port */
#define SSEM_PORT   2008    /* SSEM BTP port */

void proto_reg_handoff_itsis(void);

@@ -121,8 +121,8 @@ static int dissect_regionalextension_pdu_type(tvbuff_t *tvb, packet_info *pinfo,
static void
dissect_itsis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
    proto_item      *mapem_item = NULL;
    proto_tree      *mapem_tree = NULL;
    proto_item      *itsis_item = NULL;
    proto_tree      *itsis_tree = NULL;

    /* make entry in the Protocol column on summary display */
    col_set_str(pinfo->cinfo, COL_PROTOCOL, PNAME);
@@ -161,7 +161,7 @@ dissect_itsis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/*--- proto_register_mapem -------------------------------------------*/
void proto_register_mapem(void) {

  module_t *mapem_module;
  module_t *itsis_module;

  /* List of fields */
  static hf_register_info hf[] = {
+101 −82
Original line number Diff line number Diff line
@@ -157,11 +157,13 @@
/* IVIM */
#define L_ITSUT_IVIM_TRIGGER_EVENT_RESULT             4
#define L_ITSUT_IVIM_TRIGGER_EVENT_RESULT_CODE        1
#define L_ITSUT_IVIM_TRIGGER_EVENT_RESULT_ID          2
#define L_ITSUT_IVIM_UPDATE_EVENT_RESULT              4
#define L_ITSUT_IVIM_UPDATE_EVENT_RESULT_CODE         1
#define L_ITSUT_IVIM_UPDATE_EVENT_RESULT_ID           2
#define L_ITSUT_IVIM_TERMINATE_EVENT_RESULT           4
#define L_ITSUT_IVIM_TERMINATE_EVENT_RESULT_CODE      1
#define L_ITSUT_IVIM_TRIGGER_EVENT_RESULT_ID          2
#define L_ITSUT_IVIM_TERMINATE_EVENT_RESULT_ID        2
/* SREM/SSEM */
#define L_ITSUT_SREM_TRIGGER_EVENT                    1
#define L_ITSUT_SREM_TRIGGER_EVENT_RESULT             2
@@ -401,6 +403,7 @@ static int hf_spatem_event_indication_payload = -1;
static int hf_ivim_trigger_event = -1;
static int hf_ivim_trigger_event_result = -1;
static int hf_ivim_trigger_event_result_code = -1;
static int hf_ivim_trigger_event_result_id = -1;
static int hf_ivim_trigger_event_flags = -1;
static int hf_ivim_trigger_event_flags_F_bit = -1;
static int hf_ivim_trigger_event_flags_T_bit = -1;
@@ -411,6 +414,7 @@ static int hf_ivim_trigger_event_flags_X_bit = -1;
static int hf_ivim_update_event = -1;
static int hf_ivim_update_event_result = -1;
static int hf_ivim_update_event_result_code = -1;
static int hf_ivim_update_event_result_id = -1;
static int hf_ivim_update_event_flags = -1;
static int hf_ivim_update_event_flags_F_bit = -1;
static int hf_ivim_update_event_flags_T_bit = -1;
@@ -421,6 +425,7 @@ static int hf_ivim_update_event_flags_X_bit = -1;
static int hf_ivim_terminate_event = -1;
static int hf_ivim_terminate_event_result = -1;
static int hf_ivim_terminate_event_result_code = -1;
static int hf_ivim_terminate_event_result_id = -1;

/* ITSUT IVIM Event Indication */
static int hf_ivim_event_indication = -1;
@@ -495,7 +500,7 @@ static int hf_payloadlength = -1;
static int hf_payload = -1;
static int hf_nbhops = -1;
static int hf_dstgnaddr = -1;
/* MAP/SPaT Parameters */
/* MAPEM/SPATEM Parameters */
static int hf_event = -1;
/* IVIM Parameters */
static int hf_ivi_id = -1;
@@ -727,7 +732,7 @@ static int dissect_itsut_change_position(tvbuff_t *tvb, proto_tree *header_tree,
  ti = proto_tree_add_item(header_tree, hf_change_position, tvb, offset, L_ITSUT_CHANGEPOSITION, FALSE);
  tree = proto_item_add_subtree(ti, ett_itsut_command);

  /* UtInitialize */
  /* UtChangePosition */
  proto_tree_add_item(tree, hf_command, tvb, offset, L_ITSUT_COMMAND, FALSE);
  offset += L_ITSUT_COMMAND;

@@ -755,7 +760,7 @@ static int dissect_itsut_change_pseudonym(tvbuff_t *tvb, proto_tree *header_tree
  ti = proto_tree_add_item(header_tree, hf_change_pseudonym, tvb, offset, L_ITSUT_CHANGEPSEUDONYM, FALSE);
  tree = proto_item_add_subtree(ti, ett_itsut_command);

  /* UtInitialize */
  /* UtChangePseudonym */
  proto_tree_add_item(tree, hf_command, tvb, offset, L_ITSUT_COMMAND, FALSE);
  offset += L_ITSUT_COMMAND;

@@ -1034,7 +1039,7 @@ static int dissect_itsut_cam_event_indication(tvbuff_t *tvb, proto_tree *header_
    /* call sub-dissector if any */
    next_tvb = tvb_new_subset(tvb, offset, -1, length);
    dissector_table = find_dissector_table("btp.dport");
    dissector_try_uint(dissector_table, 2001, next_tvb, pinfo, tree); // TODO How to parametrize BTPport for CAM/DENM/MAP/SPaT
    dissector_try_uint(dissector_table, 2001, next_tvb, pinfo, tree); // TODO How to parametrize BTPport for CAM/DENM/MAPEM/SPATEM
    offset += length;
  }

@@ -1446,7 +1451,7 @@ static int dissect_itsut_denm_event_indication(tvbuff_t *tvb, proto_tree *header
    /* call sub-dissector if any */
    next_tvb = tvb_new_subset(tvb, offset, -1, length);
    dissector_table = find_dissector_table("btp.dport");
    dissector_try_uint(dissector_table, 2002, next_tvb, pinfo, tree); // TODO How to parametrize BTPport for CAM/DENM/MAP/SPaT
    dissector_try_uint(dissector_table, 2002, next_tvb, pinfo, tree); // TODO How to parametrize BTPport for CAM/DENM/MAPEM/SPATEM
    offset += length;
 }

@@ -1744,13 +1749,13 @@ static int dissect_itsut_mapem_event_indication(tvbuff_t *tvb, proto_tree *heade
  /* MapemEventIndication tree */
  /* Length */
  length = (guint16)((tvb_get_guint8(tvb, offset) << 8) & 0xff00) | (guint16)(tvb_get_guint8(tvb, offset + 1) & 0x00ff);
  proto_tree_add_item(tree, hf_mapem_event_indication, tvb, offset, L_PAYLOADLENGTH, FALSE);
  proto_tree_add_item(tree, hf_mapem_event_indication_length, tvb, offset, L_PAYLOADLENGTH, FALSE);
  offset += L_PAYLOADLENGTH;
  if (length != 0) {
    dissector_table_t dissector_table;
    tvbuff_t *next_tvb = NULL;
    
    proto_tree_add_item(tree, hf_mapem_event_indication, tvb, offset, length, FALSE);
    proto_tree_add_item(tree, hf_mapem_event_indication_payload, tvb, offset, length, FALSE);
    
    /* call sub-dissector if any */
    next_tvb = tvb_new_subset(tvb, offset, -1, length);
@@ -1780,13 +1785,13 @@ static int dissect_itsut_spatem_event_indication(tvbuff_t *tvb, proto_tree *head
  /* UtSpatemEventInd tree */
  /* Length */
  length = (guint16)((tvb_get_guint8(tvb, offset) << 8) & 0xff00) | (guint16)(tvb_get_guint8(tvb, offset + 1) & 0x00ff);
  proto_tree_add_item(tree, hf_spatem_event_indication, tvb, offset, L_PAYLOADLENGTH, FALSE);
  proto_tree_add_item(tree, hf_spatem_event_indication_length, tvb, offset, L_PAYLOADLENGTH, FALSE);
  offset += L_PAYLOADLENGTH;
  if (length != 0) {
    dissector_table_t dissector_table;
    tvbuff_t *next_tvb = NULL;
    
    proto_tree_add_item(tree, hf_spatem_event_indication, tvb, offset, length, FALSE);
    proto_tree_add_item(tree, hf_spatem_event_indication_payload, tvb, offset, length, FALSE);
    
    /* call sub-dissector if any */
    next_tvb = tvb_new_subset(tvb, offset, -1, length);
@@ -1845,9 +1850,6 @@ static int dissect_itsut_ivim_trigger_event(tvbuff_t *tvb, proto_tree *header_tr
    proto_tree_add_item(tree_flags, hf_ivim_trigger_event_flags_X_bit, tvb, offset, L_ITSUT_FLAGS, FALSE);
  }
  offset += L_ITSUT_FLAGS;
  /* IVI Identification Number */
  proto_tree_add_item(tree, hf_ivi_id, tvb, offset, L_IVIIDENTIFICATIONNUMBER, FALSE);
  offset += L_IVIIDENTIFICATIONNUMBER;
  /* ValidityFrom */
  proto_tree_add_item(tree, hf_validity_from, tvb, offset, L_VALIDITYFROM, FALSE);
  offset += L_VALIDITYFROM;
@@ -1992,18 +1994,18 @@ static int dissect_itsut_srem_trigger_event(tvbuff_t *tvb, proto_tree *header_tr
  ti = proto_tree_add_item(header_tree, hf_srem_trigger_event, tvb, offset, L_ITSUT_SREM_TRIGGER_EVENT, FALSE);
  tree = proto_item_add_subtree(ti, ett_itsut_command);

  /* UtMapSpatTrigger */
  /* UtSremTrigger */
  proto_tree_add_item(tree, hf_command, tvb, offset, L_ITSUT_COMMAND, FALSE);
  offset += L_ITSUT_COMMAND;

  /* UtMapSpatTrigger tree */
  /* UtSremTrigger tree */
  /* Event */
  proto_tree_add_item(tree, hf_event, tvb, offset, L_SREM_TRIGGER_EVENT, FALSE);
  offset += L_SREM_TRIGGER_EVENT;
  // TODO Add details according the byte value
  
  return offset;
} // End of function dissect_itsut_mapspat_trigger_event
} // End of function dissect_itsut_srem_trigger_event

/* Code to build tree for UtSremUpdate command */
static int dissect_itsut_srem_update_event(tvbuff_t *tvb, proto_tree *header_tree, int offset)
@@ -2039,20 +2041,20 @@ static int dissect_itsut_srem_event_indication(tvbuff_t *tvb, proto_tree *header
  ti = proto_tree_add_item(header_tree, hf_srem_event_indication, tvb, offset, -1, FALSE);
  tree = proto_item_add_subtree(ti, ett_itsut_command);

  /* GnEventIndication */
  /* SremEventIndication */
  proto_tree_add_item(tree, hf_command, tvb, offset, L_ITSUT_COMMAND, FALSE);
  offset += L_ITSUT_COMMAND;

  /* GnEventIndication tree */
  /* SremEventIndication tree */
  /* Length */
  length = (guint16)((tvb_get_guint8(tvb, offset) << 8) & 0xff00) | (guint16)(tvb_get_guint8(tvb, offset + 1) & 0x00ff);
  proto_tree_add_item(tree, hf_srem_event_indication, tvb, offset, L_PAYLOADLENGTH, FALSE);
  proto_tree_add_item(tree, hf_srem_event_indication_length, tvb, offset, L_PAYLOADLENGTH, FALSE);
  offset += L_PAYLOADLENGTH;
  if (length != 0) {
    dissector_table_t dissector_table;
    tvbuff_t *next_tvb = NULL;
    
    proto_tree_add_item(tree, hf_srem_event_indication, tvb, offset, length, FALSE);
    proto_tree_add_item(tree, hf_srem_event_indication_payload, tvb, offset, length, FALSE);
    
    /* call sub-dissector if any */
    next_tvb = tvb_new_subset(tvb, offset, -1, length);
@@ -2062,10 +2064,10 @@ static int dissect_itsut_srem_event_indication(tvbuff_t *tvb, proto_tree *header
  }

  return offset;
} // End of function dissect_itsut_map_event_indication
} // End of function dissect_itsut_srem_event_indication

/* Code to build tree for SPaTEventIndication command */
static int dissect_itsut_spat_event_indication(tvbuff_t *tvb, proto_tree *header_tree, packet_info *pinfo, int offset)
/* Code to build tree for UtSsemEventInd command */
static int dissect_itsut_ssem_event_indication(tvbuff_t *tvb, proto_tree *header_tree, packet_info *pinfo, int offset)
{
  proto_tree *tree = NULL;
  proto_item *ti = NULL;
@@ -2075,11 +2077,11 @@ static int dissect_itsut_spat_event_indication(tvbuff_t *tvb, proto_tree *header
  ti = proto_tree_add_item(header_tree, hf_ssem_event_indication, tvb, offset, -1, FALSE);
  tree = proto_item_add_subtree(ti, ett_itsut_command);

  /* MAPEventIndication */
  /* UtSsemEventInd */
  proto_tree_add_item(tree, hf_command, tvb, offset, L_ITSUT_COMMAND, FALSE);
  offset += L_ITSUT_COMMAND;

  /* MAPEventIndication tree */
  /* UtSsemEventInd tree */
  /* Length */
  length = (guint16)((tvb_get_guint8(tvb, offset) << 8) & 0xff00) | (guint16)(tvb_get_guint8(tvb, offset + 1) & 0x00ff);
  proto_tree_add_item(tree, hf_ssem_event_indication, tvb, offset, L_PAYLOADLENGTH, FALSE);
@@ -2093,12 +2095,12 @@ static int dissect_itsut_spat_event_indication(tvbuff_t *tvb, proto_tree *header
    /* call sub-dissector if any */
    next_tvb = tvb_new_subset(tvb, offset, -1, length);
    dissector_table = find_dissector_table("btp.dport");
    dissector_try_uint(dissector_table, 2004, next_tvb, pinfo, tree); // TODO How to parametrize BTPport for CAM/DENM/MAP/SPaT
    dissector_try_uint(dissector_table, 2004, next_tvb, pinfo, tree); // TODO How to parametrize BTPport for CAM/DENM/MAPEM/SPATEM
    offset += length;
  }

  return offset;
} // End of function dissect_itsut_spat_event_indication
} // End of function dissect_itsut_ssem_event_indication

/*****************************************************************************
    Result messages
@@ -2389,7 +2391,7 @@ static int dissect_itsut_ivim_trigger_event_result(tvbuff_t *tvb, proto_tree *he
  offset += L_ITSUT_IVIM_TRIGGER_EVENT_RESULT_CODE;

  /* IviIdentification number */
  proto_tree_add_item(tree, hf_ivi_id, tvb, offset, L_ITSUT_IVIM_TRIGGER_EVENT_RESULT_ID, FALSE);
  proto_tree_add_item(tree, hf_ivim_trigger_event_result_id, tvb, offset, L_ITSUT_IVIM_TRIGGER_EVENT_RESULT_ID, FALSE);
  offset += L_ITSUT_IVIM_TRIGGER_EVENT_RESULT_ID;

  return offset;
@@ -2402,7 +2404,7 @@ static int dissect_itsut_ivim_update_event_result(tvbuff_t *tvb, proto_tree *hea
  proto_item *ti = NULL;

  /* ITSUT command tree */
  ti = proto_tree_add_item(header_tree, hf_ivim_update_event_result, tvb, offset, L_ITSUT_IVIM_TRIGGER_EVENT_RESULT, FALSE);
  ti = proto_tree_add_item(header_tree, hf_ivim_update_event_result, tvb, offset, L_ITSUT_IVIM_UPDATE_EVENT_RESULT, FALSE);
  tree = proto_item_add_subtree(ti, ett_itsut_command);

  /* UtIvimUpdateResult */
@@ -2410,11 +2412,11 @@ static int dissect_itsut_ivim_update_event_result(tvbuff_t *tvb, proto_tree *hea
  offset += L_ITSUT_COMMAND;
  
  /* Result */
  proto_tree_add_item(tree, hf_ivim_update_event_result_code, tvb, offset, L_ITSUT_IVIM_TRIGGER_EVENT_RESULT_CODE, FALSE);
  proto_tree_add_item(tree, hf_ivim_update_event_result_code, tvb, offset, L_ITSUT_IVIM_UPDATE_EVENT_RESULT_CODE, FALSE);
  offset += L_ITSUT_IVIM_TRIGGER_EVENT_RESULT_CODE;

  /* IviIdentification number */
  proto_tree_add_item(tree, hf_ivi_id, tvb, offset, L_ITSUT_IVIM_TRIGGER_EVENT_RESULT_ID, FALSE);
  proto_tree_add_item(tree, hf_ivim_update_event_result_id, tvb, offset, L_ITSUT_IVIM_UPDATE_EVENT_RESULT_ID, FALSE);
  offset += L_ITSUT_IVIM_TRIGGER_EVENT_RESULT_ID;

  return offset;
@@ -2427,7 +2429,7 @@ static int dissect_itsut_ivim_terminate_event_result(tvbuff_t *tvb, proto_tree *
  proto_item *ti = NULL;

  /* ITSUT command tree */
  ti = proto_tree_add_item(header_tree, hf_ivim_terminate_event_result, tvb, offset, L_ITSUT_IVIM_TRIGGER_EVENT_RESULT, FALSE);
  ti = proto_tree_add_item(header_tree, hf_ivim_terminate_event_result, tvb, offset, L_ITSUT_IVIM_TERMINATE_EVENT_RESULT, FALSE);
  tree = proto_item_add_subtree(ti, ett_itsut_command);

  /* UtIvimTerminateResult */
@@ -2435,11 +2437,11 @@ static int dissect_itsut_ivim_terminate_event_result(tvbuff_t *tvb, proto_tree *
  offset += L_ITSUT_COMMAND;
  
  /* Result */
  proto_tree_add_item(tree, hf_ivim_terminate_event_result_code, tvb, offset, L_ITSUT_IVIM_TRIGGER_EVENT_RESULT_CODE, FALSE);
  proto_tree_add_item(tree, hf_ivim_terminate_event_result_code, tvb, offset, L_ITSUT_IVIM_TERMINATE_EVENT_RESULT_CODE, FALSE);
  offset += L_ITSUT_IVIM_TRIGGER_EVENT_RESULT_CODE;

  /* IviIdentification number */
  proto_tree_add_item(tree, hf_ivi_id, tvb, offset, L_ITSUT_IVIM_TRIGGER_EVENT_RESULT_ID, FALSE);
  proto_tree_add_item(tree, hf_ivim_terminate_event_result_id, tvb, offset, L_ITSUT_IVIM_TERMINATE_EVENT_RESULT_ID, FALSE);
  offset += L_ITSUT_IVIM_TRIGGER_EVENT_RESULT_ID;

  return offset;
@@ -2485,7 +2487,7 @@ static int dissect_itsut_srem_update_event_result(tvbuff_t *tvb, proto_tree *hea
  offset += L_ITSUT_SREM_UPDATE_EVENT_RESULT_CODE;

  return offset;
} // End of function dissect_itsut_mapspat_trigger_event_result
} // End of function dissect_itsut_srem_update_event_result

/* Code to actually dissect the ITSUT packets */
static int dissect_itsut_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
@@ -3033,12 +3035,12 @@ proto_register_itsut(void)
    
    /* ITSUT IVIM Trigger Event */
    { &hf_ivim_trigger_event,
      {"UtMapemSpatemTrigger ", "itsut.ivim.trigger", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}
      {"UtIvimTrigger ", "itsut.ivim.trigger", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}
    },

    /* ITSUT IVIM Trigger Result */
    { &hf_ivim_trigger_event_result,
      {"UtMapemSpatemTriggerResult", "itsut.ivim.trigger_result", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}
      {"UtIvimTriggerResult", "itsut.ivim.trigger_result", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}
    },
    
    /* ITSUT IVIM Update Event */
@@ -3303,10 +3305,27 @@ proto_register_itsut(void)
      {"K bit", "itsut.ivim_update_event.flags.xbit", FT_UINT8, BASE_HEX, NULL, 0x10, NULL, HFILL}
    },
    
    /* ITSUT Trigger IVIM Event Result code */
    { &hf_ivim_trigger_event_result_code,
      {"Code", "itsut.ivim_trigger_event.result.code", FT_UINT8, BASE_HEX, VALS(itsut_result_names), 0x00, NULL, HFILL}
    },
    { &hf_ivim_trigger_event_result_id,
      {"Code", "itsut.ivim_trigger_event.result.id", FT_UINT16, BASE_HEX, NULL, 0x00, NULL, HFILL}
    },
    /* ITSUT Update IVIM Event Result code */
    { &hf_ivim_update_event_result_code,
      {"Code", "itsut.ivim_update_event.result.code", FT_UINT8, BASE_HEX, VALS(itsut_result_names), 0x00, NULL, HFILL}
    },
    { &hf_ivim_update_event_result_id,
      {"Code", "itsut.ivim_update_event.result.id", FT_UINT16, BASE_HEX, NULL, 0x00, NULL, HFILL}
    },
    /* ITSUT Terminate IVIM Event Result code */
    { &hf_ivim_terminate_event_result_code,
      {"Code", "itsut.ivim_terminate_event.result.code", FT_UINT8, BASE_HEX, VALS(itsut_result_names), 0x00, NULL, HFILL}
    },
    { &hf_ivim_terminate_event_result_id,
      {"Code", "itsut.ivim_terminate_event.result.id", FT_UINT16, BASE_HEX, NULL, 0x00, NULL, HFILL}
    },
    
    /* ITSUT IVIM Event Indication */
    { &hf_ivim_event_indication,