void SequenceDialog::fillDiagram() { QCustomPlot *sp = ui->sequencePlot; seq_analysis_info_t new_sa; new_sa = seq_analysis_; new_sa.list = NULL; new_sa.ht = NULL; new_sa.num_nodes = 0; sequence_analysis_list_get(cap_file_, &new_sa); num_items_ = sequence_analysis_get_nodes(&new_sa); seq_diagram_->setData(&new_sa); sequence_analysis_list_free(&seq_analysis_); seq_analysis_ = new_sa; QFontMetrics vfm = QFontMetrics(sp->xAxis2->labelFont()); node_label_w_ = 0; for (guint i = 0; i < seq_analysis_.num_nodes; i++) { int label_w = vfm.width(ep_address_to_display(&(seq_analysis_.nodes[i]))); if (node_label_w_ < label_w) { node_label_w_ = label_w; } } node_label_w_ = (node_label_w_ * 3 / 4) + one_em_; mouseMoved(NULL); resetAxes(); // XXX QCustomPlot doesn't seem to draw any sort of focus indicator. sp->setFocus(); }
WSLUA_METAMETHOD Address__tostring(lua_State* L) { Address addr = checkAddress(L,1); lua_pushstring(L,ep_address_to_display(addr)); WSLUA_RETURN(1); /* The string representing the address. */ }
/* * Write a header to the current output file. * The header consists of an identifying string, followed * by a binary structure. */ void rtp_write_header(rtp_stream_info_t *strinfo, FILE *file) { guint32 start_sec; /* start of recording (GMT) (seconds) */ guint32 start_usec; /* start of recording (GMT) (microseconds)*/ guint32 source; /* network source (multicast address) */ size_t sourcelen; guint16 port; /* UDP port */ guint16 padding; /* 2 padding bytes */ fprintf(file, "#!rtpplay%s %s/%u\n", RTPFILE_VERSION, ep_address_to_display(&(strinfo->dest_addr)), strinfo->dest_port); start_sec = g_htonl(strinfo->start_sec); start_usec = g_htonl(strinfo->start_usec); /* rtpdump only accepts guint32 as source, will be fake for IPv6 */ memset(&source, 0, sizeof source); sourcelen = strinfo->src_addr.len; if (sourcelen > sizeof source) sourcelen = sizeof source; memcpy(&source, strinfo->src_addr.data, sourcelen); port = g_htons(strinfo->src_port); padding = 0; if (fwrite(&start_sec, 4, 1, file) == 0) return; if (fwrite(&start_usec, 4, 1, file) == 0) return; if (fwrite(&source, 4, 1, file) == 0) return; if (fwrite(&port, 2, 1, file) == 0) return; if (fwrite(&padding, 2, 1, file) == 0) return; }
const char *get_conversation_address(address *addr, gboolean resolve_names) { if (resolve_names) { return ep_address_to_display(addr); } else { return ep_address_to_str(addr); } }