Esempio n. 1
0
static int dissect_pathport_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
    /* Set up structures needed to add the protocol subtree and manage it */
    proto_item *ti;
    proto_tree *pathport_tree;
    guint offset = 0;
    guint remaining_len;
    guint len;
    guint16 type;
    guint32 srcid;
    guint32 dstid;

    len = tvb_reported_length(tvb);

    /* Set the Protocol column to the constant string of Pathport */
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "Pathport");

    /* Set the info column to reflect the first PDU in the packet */
    col_clear(pinfo->cinfo, COL_INFO);
    srcid = tvb_get_ntohl(tvb, PATHPORT_HEADER_SRCID_OFFSET);
    type  = tvb_get_ntohs(tvb, PATHPORT_HEADER_LENGTH);

    if(type == PP_ARP_REQUEST)
    {
        dstid = tvb_get_ntohl(tvb, PATHPORT_HEADER_DSTID_OFFSET);
        col_add_fstr(pinfo->cinfo, COL_INFO, "Who has %s? Tell %s",
                    resolve_pp_id(dstid), resolve_pp_id(srcid));
    }
    else
    {
        if((type == PP_ARP_REPLY) && (len >= 36))
        {
            guint32 id = tvb_get_ntohl(tvb, 24);
            col_add_fstr(pinfo->cinfo, COL_INFO, "%s is at %s", resolve_pp_id(id), tvb_ip_to_str(tvb, 28));
        }
        else if((type == PP_DATA) && (len >= 32))
        {
            guint16 xdmx_start = tvb_get_ntohs(tvb, 30);
            col_add_fstr(pinfo->cinfo, COL_INFO, "xDMX Data - %d channels @ %d (Univ %d.%d)",
                         tvb_get_ntohs(tvb, 26),
                         xdmx_start, xdmx_start / 512 + 1, xdmx_start % 512);
        }
        else /* default */
        {
            col_add_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str(type, pp_pdu_vals, TYPE_UNKNOWN));
        }
    }
    if(tree == NULL)
        return tvb_reported_length(tvb);

    /* create display subtree for the protocol */
    ti = proto_tree_add_item(tree, proto_pathport, tvb, 0, -1, ENC_NA);

    pathport_tree = proto_item_add_subtree(ti, ett_pathport);
    offset = dissect_header(tvb, pathport_tree, PATHPORT_HEADER_OFFSET);
    remaining_len = tvb_reported_length_remaining(tvb, offset);
    offset = dissect_multiple_pdus(tvb, tree, offset, remaining_len);

    return offset;
}
Esempio n. 2
0
static void
dissect_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_item *m2pa_item, proto_tree *m2pa_tree, proto_tree *tree)
{
  dissect_header(message_tvb, pinfo, m2pa_tree);
  dissect_message_data(message_tvb, pinfo, m2pa_item, m2pa_tree, tree);
}