Ejemplo n.º 1
0
void sequence_analysis_use_col_info_as_label_comment(packet_info *pinfo, seq_analysis_item_t *sai)
{
    const gchar *protocol = NULL;
    const gchar *colinfo = NULL;

    if (pinfo->cinfo) {
        colinfo = col_get_text(pinfo->cinfo, COL_INFO);
        protocol = col_get_text(pinfo->cinfo, COL_PROTOCOL);
    }

    if (colinfo != NULL) {
        sai->frame_label = g_strdup(colinfo);
        if (protocol != NULL) {
            sai->comment = g_strdup_printf("%s: %s", protocol, colinfo);
        } else {
            sai->comment = g_strdup(colinfo);
        }
    } else {
        /* This will probably never happen...*/
        if (protocol != NULL) {
            sai->frame_label = g_strdup(protocol);
            sai->comment = g_strdup(protocol);
        }
    }
}
Ejemplo n.º 2
0
WSLUA_METAMETHOD Column__tostring(lua_State *L) {
    Column c = checkColumn(L,1);
    const gchar* text;

    if (!c->cinfo) {
        text = col_id_to_name(c->col);
        lua_pushfstring(L, "(%s)", text ? text : "unknown");
    }
    else {
        text = col_get_text(c->cinfo, c->col);
        lua_pushstring(L, text ? text : "(nil)");
    }

    WSLUA_RETURN(1); /* The column's string text (in parenthesis if not available). */
}