static void dissect_ap1394(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_item *ti; proto_tree *fh_tree = NULL; const guint8 *src_addr, *dst_addr; guint16 etype; tvbuff_t *next_tvb; col_set_str(pinfo->cinfo, COL_PROTOCOL, "IP/IEEE1394"); col_clear(pinfo->cinfo, COL_INFO); src_addr=tvb_get_ptr(tvb, 8, 8); SET_ADDRESS(&pinfo->dl_src, AT_EUI64, 8, src_addr); SET_ADDRESS(&pinfo->src, AT_EUI64, 8, src_addr); dst_addr=tvb_get_ptr(tvb, 0, 8); SET_ADDRESS(&pinfo->dl_dst, AT_EUI64, 8, dst_addr); SET_ADDRESS(&pinfo->dst, AT_EUI64, 8, dst_addr); if (tree) { ti = proto_tree_add_protocol_format(tree, proto_ap1394, tvb, 0, 18, "Apple IP-over-IEEE 1394, Src: %s, Dst: %s", bytes_to_ep_str(src_addr, 8), bytes_to_ep_str(dst_addr, 8)); fh_tree = proto_item_add_subtree(ti, ett_ap1394); proto_tree_add_bytes(fh_tree, hf_ap1394_dst, tvb, 0, 8, dst_addr); proto_tree_add_bytes(fh_tree, hf_ap1394_src, tvb, 8, 8, src_addr); } etype = tvb_get_ntohs(tvb, 16); if (tree) proto_tree_add_uint(fh_tree, hf_ap1394_type, tvb, 16, 2, etype); next_tvb = tvb_new_subset_remaining(tvb, 18); if (!dissector_try_uint(ethertype_subdissector_table, etype, next_tvb, pinfo, tree)) call_dissector(data_handle, next_tvb, pinfo, tree); }
QString LBMStreamEntry::formatEndpoint(const lbm_uim_stream_endpoint_t * endpoint) { if (endpoint->type == lbm_uim_instance_stream) { return QString(bytes_to_ep_str(endpoint->stream_info.ctxinst.ctxinst, sizeof(endpoint->stream_info.ctxinst.ctxinst))); } else { return QString("%1:%2:%3") .arg(endpoint->stream_info.dest.domain) .arg(ep_address_to_str(&(endpoint->stream_info.dest.addr))) .arg(endpoint->stream_info.dest.port); } }
static gchar * lbmc_stream_dlg_format_endpoint_ep(const lbm_uim_stream_endpoint_t * endpoint) { gchar * buf = NULL; if (endpoint->type == lbm_uim_instance_stream) { buf = bytes_to_ep_str(endpoint->stream_info.ctxinst.ctxinst, sizeof(endpoint->stream_info.ctxinst.ctxinst)); } else { buf = wmem_strdup_printf(wmem_packet_scope(), "%" G_GUINT32_FORMAT ":%s:%" G_GUINT16_FORMAT, endpoint->stream_info.dest.domain, address_to_str(wmem_packet_scope(), &(endpoint->stream_info.dest.addr)), endpoint->stream_info.dest.port); } return (buf); }
/* This function is only called from the IGMP dissector */ int dissect_igap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset) { proto_tree *tree; proto_item *item; guint8 type, tsecs, subtype, asize, msize; guchar account[ACCOUNT_SIZE+1], message[MESSAGE_SIZE+1]; if (!proto_is_protocol_enabled(find_protocol_by_id(proto_igap))) { /* we are not enabled, skip entire packet to be nice to the igmp layer. (so clicking on IGMP will display the data) */ return offset + tvb_length_remaining(tvb, offset); } item = proto_tree_add_item(parent_tree, proto_igap, tvb, offset, -1, ENC_NA); tree = proto_item_add_subtree(item, ett_igap); col_set_str(pinfo->cinfo, COL_PROTOCOL, "IGAP"); col_clear(pinfo->cinfo, COL_INFO); type = tvb_get_guint8(tvb, offset); col_add_str(pinfo->cinfo, COL_INFO, val_to_str(type, igap_types, "Unknown Type: 0x%02x")); proto_tree_add_uint(tree, hf_type, tvb, offset, 1, type); offset += 1; tsecs = tvb_get_guint8(tvb, offset); proto_tree_add_uint_format_value(tree, hf_max_resp, tvb, offset, 1, tsecs, "%.1f sec (0x%02x)", tsecs * 0.1, tsecs); offset += 1; igmp_checksum(tree, tvb, hf_checksum, hf_checksum_bad, pinfo, 0); offset += 2; proto_tree_add_item(tree, hf_maddr, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; proto_tree_add_uint(tree, hf_version, tvb, offset, 1, tvb_get_guint8(tvb, offset)); offset += 1; subtype = tvb_get_guint8(tvb, offset); proto_tree_add_uint(tree, hf_subtype, tvb, offset, 1, subtype); offset += 2; proto_tree_add_uint(tree, hf_challengeid, tvb, offset, 1, tvb_get_guint8(tvb, offset)); offset += 1; asize = tvb_get_guint8(tvb, offset); proto_tree_add_uint(tree, hf_asize, tvb, offset, 1, asize); offset += 1; msize = tvb_get_guint8(tvb, offset); proto_tree_add_uint(tree, hf_msize, tvb, offset, 1, msize); offset += 3; if (asize > 0) { if (asize > ACCOUNT_SIZE) { /* Bogus account size. XXX - flag this? */ asize = ACCOUNT_SIZE; } tvb_memcpy(tvb, account, offset, asize); account[asize] = '\0'; proto_tree_add_string(tree, hf_account, tvb, offset, asize, account); } offset += ACCOUNT_SIZE; if (msize > 0) { if (msize > MESSAGE_SIZE) { /* Bogus message size. XXX - flag this? */ msize = MESSAGE_SIZE; } tvb_memcpy(tvb, message, offset, msize); switch (subtype) { case IGAP_SUBTYPE_PASSWORD_JOIN: case IGAP_SUBTYPE_PASSWORD_LEAVE: /* Challenge field is user's password */ message[msize] = '\0'; proto_tree_add_text(tree, tvb, offset, msize, "User password: %s", message); break; case IGAP_SUBTYPE_CHALLENGE_RESPONSE_JOIN: case IGAP_SUBTYPE_CHALLENGE_RESPONSE_LEAVE: /* Challenge field is the results of MD5 calculation */ proto_tree_add_text(tree, tvb, offset, msize, "Result of MD5 calculation: 0x%s", bytes_to_ep_str(message, msize)); break; case IGAP_SUBTYPE_CHALLENGE: /* Challenge field is the challenge value */ proto_tree_add_text(tree, tvb, offset, msize, "Challenge: 0x%s", bytes_to_ep_str(message, msize)); break; case IGAP_SUBTYPE_AUTH_MESSAGE: /* Challenge field indicates the result of the authenticaion */ proto_tree_add_text(tree, tvb, offset, msize, "Authentication result: %s (0x%x)", val_to_str_const(message[0], igap_auth_result, "Unknown"), message[0]); break; case IGAP_SUBTYPE_ACCOUNTING_MESSAGE: /* Challenge field indicates the accounting status */ proto_tree_add_text(tree, tvb, offset, msize, "Accounting status: %s (0x%x)", val_to_str_const(message[0], igap_account_status, "Unknown"), message[0]); break; default: proto_tree_add_text(tree, tvb, offset, msize, "Message: (Unknown)"); } } offset += MESSAGE_SIZE; if (item) proto_item_set_len(item, offset); return offset; }
static gboolean lbm_uimflow_add_to_graph(seq_analysis_info_t * seq_info, packet_info * pinfo, const lbm_uim_stream_info_t * stream_info) { lbm_uim_stream_endpoint_t epa; lbm_uim_stream_endpoint_t epb; seq_analysis_item_t * item; gchar * ctxinst1 = NULL; gchar * ctxinst2 = NULL; gboolean swap_endpoints = FALSE; int rc; if (stream_info->endpoint_a.type != stream_info->endpoint_b.type) { return (FALSE); } if (stream_info->endpoint_a.type == lbm_uim_instance_stream) { rc = memcmp((void *)stream_info->endpoint_a.stream_info.ctxinst.ctxinst, (void *)stream_info->endpoint_b.stream_info.ctxinst.ctxinst, LBM_CONTEXT_INSTANCE_BLOCK_SZ); if (rc <= 0) { swap_endpoints = FALSE; } else { swap_endpoints = TRUE; } } else { if (stream_info->endpoint_a.stream_info.dest.domain < stream_info->endpoint_b.stream_info.dest.domain) { swap_endpoints = FALSE; } else if (stream_info->endpoint_a.stream_info.dest.domain > stream_info->endpoint_b.stream_info.dest.domain) { swap_endpoints = TRUE; } else { int compare; compare = CMP_ADDRESS(&(stream_info->endpoint_a.stream_info.dest.addr), &(stream_info->endpoint_b.stream_info.dest.addr)); if (compare < 0) { swap_endpoints = FALSE; } else if (compare > 0) { swap_endpoints = TRUE; } else { if (stream_info->endpoint_a.stream_info.dest.port <= stream_info->endpoint_b.stream_info.dest.port) { swap_endpoints = FALSE; } else { swap_endpoints = TRUE; } } } } if (swap_endpoints == FALSE) { epa = stream_info->endpoint_a; epb = stream_info->endpoint_b; } else { epb = stream_info->endpoint_a; epa = stream_info->endpoint_b; } item = (seq_analysis_item_t *)g_malloc(sizeof(seq_analysis_item_t)); COPY_ADDRESS(&(item->src_addr), &(pinfo->src)); COPY_ADDRESS(&(item->dst_addr), &(pinfo->dst)); item->fd = pinfo->fd; item->port_src = pinfo->srcport; item->port_dst = pinfo->destport; if (stream_info->description == NULL) { item->frame_label = g_strdup_printf("(%" G_GUINT32_FORMAT ")", stream_info->sqn); } else { item->frame_label = g_strdup_printf("%s (%" G_GUINT32_FORMAT ")", stream_info->description, stream_info->sqn); } if (epa.type == lbm_uim_instance_stream) { ctxinst1 = bytes_to_ep_str(epa.stream_info.ctxinst.ctxinst, sizeof(epa.stream_info.ctxinst.ctxinst)); ctxinst2 = bytes_to_ep_str(epb.stream_info.ctxinst.ctxinst, sizeof(epb.stream_info.ctxinst.ctxinst)); item->comment = g_strdup_printf("%s <-> %s [%" G_GUINT64_FORMAT "]", ctxinst1, ctxinst2, stream_info->channel); } else { item->comment = g_strdup_printf("%" G_GUINT32_FORMAT ":%s:%" G_GUINT16_FORMAT " <-> %" G_GUINT32_FORMAT ":%s:%" G_GUINT16_FORMAT " [%" G_GUINT64_FORMAT "]", epa.stream_info.dest.domain, address_to_str(wmem_packet_scope(), &(epa.stream_info.dest.addr)), epa.stream_info.dest.port, epb.stream_info.dest.domain, address_to_str(wmem_packet_scope(), &(epb.stream_info.dest.addr)), epb.stream_info.dest.port, stream_info->channel); } item->conv_num = (guint16)LBM_CHANNEL_ID(stream_info->channel); item->display = TRUE; item->line_style = 1; seq_info->list = g_list_prepend(seq_info->list, (gpointer)item); return (TRUE); }