コード例 #1
0
ファイル: wslua_field.c プロジェクト: HeartFlying/wireshark
FieldInfo* push_FieldInfo(lua_State* L, field_info* f) {
    FieldInfo fi = (FieldInfo) g_malloc(sizeof(struct _wslua_field_info));
    fi->ws_fi = f;
    fi->expired = FALSE;
    g_ptr_array_add(outstanding_FieldInfo,fi);
    return pushFieldInfo(L,fi);
}
コード例 #2
0
WSLUA_FUNCTION wslua_all_field_infos(lua_State* L) {
	/* Obtain all fields from the current tree */
	GPtrArray* found;
	int items_found = 0;
	guint i;

	if (! lua_tree || ! lua_tree->tree ) {
		WSLUA_ERROR(wslua_all_field_infos,"Cannot be called outside a listener or dissector");
	}
	
	found = proto_all_finfos(lua_tree->tree);
	
	if (found) {
		for (i=0; i<found->len; i++) {
			pushFieldInfo(L,g_ptr_array_index(found,i));
			items_found++;
		}

		g_ptr_array_free(found,TRUE);
	}

	return items_found;
}