示例#1
0
文件: u2spewfoo.c 项目: BMNLabs/snort
static int u2dump(char *file) {
    u2record record;
    u2iterator *it = new_iterator(file);

    memset(&record, 0, sizeof(record));

    if(!it) {
        printf("u2dump: Failed to create new iterator with file: %s\n", file);
        return -1;
    }

    while( get_record(it, &record) == SUCCESS ) {
        if(record.type == UNIFIED2_IDS_EVENT) event_dump(&record);
        else if(record.type == UNIFIED2_IDS_EVENT_VLAN) event2_dump(&record);
        else if(record.type == UNIFIED2_PACKET) packet_dump(&record);
        else if(record.type == UNIFIED2_IDS_EVENT_IPV6) event6_dump(&record);
        else if(record.type == UNIFIED2_IDS_EVENT_IPV6_VLAN) event2_6_dump(&record);
        else if(record.type == UNIFIED2_EXTRA_DATA) extradata_dump(&record);
#if defined(FEAT_OPEN_APPID)

        else if(record.type == UNIFIED2_IDS_EVENT_APPID) event3_dump(&record);
        else if(record.type == UNIFIED2_IDS_EVENT_APPID_IPV6) event3_6_dump(&record);
        else if(record.type == UNIFIED2_IDS_EVENT_APPSTAT) appid_dump(&record);
#endif /* defined(FEAT_OPEN_APPID) */
    }

    free_iterator(it);
    if(record.data)
        free(record.data);

    return 0;
}
示例#2
0
文件: u2spewfoo.c 项目: anarey/snort
int u2dump(const u2record *record, FILE *out_file) {
    if(record->type == UNIFIED2_IDS_EVENT) event_dump(record, out_file);
    else if(record->type == UNIFIED2_IDS_EVENT_VLAN) event2_dump(record,out_file);
    else if(record->type == UNIFIED2_PACKET) packet_dump(record,out_file);
    else if(record->type == UNIFIED2_IDS_EVENT_IPV6) event6_dump(record,out_file);
    else if(record->type == UNIFIED2_IDS_EVENT_IPV6_VLAN) event2_6_dump(record,out_file);
    else if(record->type == UNIFIED2_EXTRA_DATA) extradata_dump(record,out_file);

    return 0;
}