Commit c8135963 authored by garciay's avatar garciay
Browse files

Add MAP/SPaT support

parent 171b6822
Loading
Loading
Loading
Loading
+104 −0
Original line number Diff line number Diff line
@@ -76,6 +76,10 @@
#define UT_GENERATEGEOTSB               0x54
#define UT_GNEVENTINDICATION            0x55
#define UT_GNTRIGGER_RESULT             0x41
/* MAP/SPaT */
#define UT_MAPSPAT_TRIGGER_EVENT        0xA0
#define UT_MAPSPAT_TRIGGER_EVENT_RESULT 0xA1


/* Names table indexes */
#define IDX_RESULT_OK                   0x01
@@ -120,6 +124,11 @@
/* GN */
#define L_UT_GNTRIGGER_RESULT           2
#define L_UT_GNTRIGGER_RESULT_CODE      1
/* MAP/SPaT */
#define L_UT_MAPSPAT_TRIGGER_EVENT       2
#define L_UT_MAPSPAT_TRIGGER_EVENT_RESULT 3
#define L_UT_MAPSPAT_TRIGGER_EVENT_RESULT_CODE 1
#define L_UT_MAPSPAT_TRIGGER_EVENT_RESULT_MSGC 1

/* Parameters length */
#define L_HASHEDID8                     8
@@ -165,6 +174,7 @@
#define L_PAYLOADLENGTH	                2
#define L_NBHOPS    	                1
#define L_DSTGNADDR    	                8
#define L_MAPSPAT_TRIGGER_EVENT    	    1

/* Function declarations */
void proto_reg_handoff_ut(void);
@@ -319,6 +329,14 @@ static int hf_gn_event_indication_payload = -1;
static int hf_gntrigger_result = -1;
static int hf_gntrigger_result_code = -1;

/* UT MAP/SPaT Trigger Event */
static int hf_mapspat_trigger_event = -1;

/* UT MAP/SPaT Trigger Result */
static int hf_mapspat_trigger_event_result = -1;
static int hf_mapspat_trigger_event_result_code = -1;
static int hf_mapspat_trigger_event_result_msgc = -1;

/* CAM Parameters */
static int hf_delta_latitude = -1;
static int hf_delta_longitude = -1;
@@ -362,6 +380,8 @@ static int hf_payloadlength = -1;
static int hf_payload = -1;
static int hf_nbhops = -1;
static int hf_dstgnaddr = -1;
/* MAP/SPaT Parameters */
static int hf_event = -1;

/* Initialize the subtree pointers */
static gint ett_ut = -1;
@@ -406,6 +426,8 @@ static const value_string ut_command_names[] = {
    { UT_GENERATEGEOTSB,                "GeoTSB Trigger" },
    { UT_GNEVENTINDICATION,             "Geonetworking Event Indication" },
    { UT_GNTRIGGER_RESULT,              "Geonetworking Trigger Result" },
    { UT_MAPSPAT_TRIGGER_EVENT,         "MAP/SPaT Event Trigger" },
    { UT_MAPSPAT_TRIGGER_EVENT_RESULT,  "MAP/SPaT Trigger Result" },
    { 0, NULL}
};

@@ -517,6 +539,14 @@ static const value_string ut_shape_names[] = {
    { 0, NULL}
};

static const value_string ut_mapspat_event_names[] = {
    { 0x00, "Generate a SPAT message" },
    { 0x01, "Generate a MAP message with new content" },
    { 0x02, "Force MAP repetition < 10s" },
    { 0x03, "Force MAP repetition > 10s" },
    { 0, NULL}
};

/*****************************************************************************
    Command messages
*****************************************************************************/
@@ -1467,6 +1497,28 @@ static int dissect_ut_gn_event_indication(tvbuff_t *tvb, proto_tree *header_tree
  return offset;
} // End of function dissect_ut_gn_event_indication

/* Code to build tree for UtMapSpatTrigger command */
static int dissect_ut_mapspat_trigger_event(tvbuff_t *tvb, proto_tree *header_tree, int offset)
{
  proto_tree *tree = NULL;
  proto_item *ti = NULL;
   
  /* UT command tree */
  ti = proto_tree_add_item(header_tree, hf_mapspat_trigger_event, tvb, offset, L_UT_MAPSPAT_TRIGGER_EVENT, FALSE);
  tree = proto_item_add_subtree(ti, ett_ut_command);

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

  /* UtMapSpatTrigger tree */
  /* Event */
  proto_tree_add_item(tree, hf_event, tvb, offset, L_MAPSPAT_TRIGGER_EVENT, FALSE);
  offset += L_MAPSPAT_TRIGGER_EVENT;
  
  return offset;
} // End of function dissect_ut_mapspat_trigger_event

/*****************************************************************************
    Result messages
*****************************************************************************/
@@ -1670,6 +1722,31 @@ static int dissect_ut_gn_trigger_result(tvbuff_t *tvb, proto_tree *header_tree,
  return offset;
} // End of function dissect_ut_gn_trigger_result

/* Code to build tree for UtMapSpatTriggerResult  indication */
static int dissect_ut_mapspat_trigger_event_result(tvbuff_t *tvb, proto_tree *header_tree, int offset)
{
  proto_tree *tree = NULL;
  proto_item *ti = NULL;

  /* UT command tree */
  ti = proto_tree_add_item(header_tree, hf_mapspat_trigger_event_result, tvb, offset, L_UT_MAPSPAT_TRIGGER_EVENT_RESULT, FALSE);
  tree = proto_item_add_subtree(ti, ett_ut_command);

  /* UtGnTriggerResult */
  proto_tree_add_item(tree, hf_command, tvb, offset, L_UT_COMMAND, FALSE);
  offset += L_UT_COMMAND;
  
  /* Result */
  proto_tree_add_item(tree, hf_mapspat_trigger_event_result_code, tvb, offset, L_UT_MAPSPAT_TRIGGER_EVENT_RESULT_CODE, FALSE);
  offset += L_UT_MAPSPAT_TRIGGER_EVENT_RESULT_CODE;

  /* Message count */
  proto_tree_add_item(tree, hf_mapspat_trigger_event_result_msgc, tvb, offset, L_UT_MAPSPAT_TRIGGER_EVENT_RESULT_MSGC, FALSE);
  offset += L_UT_MAPSPAT_TRIGGER_EVENT_RESULT_MSGC;

  return offset;
} // End of function dissect_ut_mapspat_trigger_event_result

/* Code to actually dissect the UT packets */
static int dissect_ut_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
@@ -1807,6 +1884,12 @@ static int dissect_ut_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
        case (guint8)UT_GNTRIGGER_RESULT:
            offset = dissect_ut_gn_trigger_result(tvb, ut_tree, offset);
            break;
        case (guint8)UT_MAPSPAT_TRIGGER_EVENT:
            offset = dissect_ut_mapspat_trigger_event(tvb, ut_tree, offset);
            break;
        case (guint8)UT_MAPSPAT_TRIGGER_EVENT_RESULT:
            offset = dissect_ut_mapspat_trigger_event_result(tvb, ut_tree, offset);
            break;
        default:
            return 0;
    } /* End of 'swith' statement */
@@ -2128,6 +2211,16 @@ proto_register_ut(void)
      {"UtGnTriggerResult", "ut.gntrigger_result.result", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}
    },
    
    /* UT MAP/SPaT Trigger Event */
    { &hf_mapspat_trigger_event,
      {"UtMapSpatTrigger ", "ut.mapspat.trigger", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}
    },

    /* UT MAP/SPaT Trigger Result */
    { &hf_mapspat_trigger_event_result,
      {"UtMapSpatTriggerResult", "ut.mapspat.trigger_result", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}
    },
    
    /* Parameters */
    { &hf_delta_latitude,
      {"Delta Latitude", "ut.change_position.delta_latitude", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}
@@ -2249,6 +2342,9 @@ proto_register_ut(void)
    { &hf_dstgnaddr,
      {"DstGnAddr", "ut.gn.geounicast.dstgnaddr", FT_UINT64, BASE_DEC, NULL, 0x00, NULL, HFILL}
    },
    { &hf_event,
      {"Event", "ut.mapspat.trigger.event", FT_UINT8, BASE_DEC, VALS(ut_mapspat_event_names), 0x00, NULL, HFILL}
    },
    
    /* UT Initialize Result code */
    { &hf_initialize_result_code,
@@ -2290,6 +2386,14 @@ proto_register_ut(void)
      {"Code", "ut.gntrigger_result.result.code", FT_UINT8, BASE_HEX, VALS(ut_result_names), 0x00, NULL, HFILL}
    },

    /* UT MAP/SPaT Trigger Result code */
    { &hf_mapspat_trigger_event_result_code,
      {"Code", "ut.mapspat_result.result.code", FT_UINT8, BASE_HEX, VALS(ut_result_names), 0x00, NULL, HFILL}
    },
    { &hf_mapspat_trigger_event_result_msgc,
      {"Message Count", "ut.mapspat_result.result.msgc", FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL}
    },
    
  };
  
  /* Setup protocol subtree array */