Changeset cd7eec7 for lib/format_erf.c


Ignore:
Timestamp:
05/16/06 14:37:22 (15 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
abc66e7
Parents:
da34e20
Message:

Added a new format for reading and writing DUCK packets
Added corresponding test cases for DUCK
Removed references to RT_DUCK_* from format_rt
Added a configuration option for meta-data frequency (used solely for DUCK frequency at the moment) and updated other formats to ignore the option

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_erf.c

    rda34e20 rcd7eec7  
    104104                uint32_t duck_freq;
    105105                uint32_t last_pkt;
    106                 libtrace_t *dummy_rt;
     106                libtrace_t *dummy_duck;
    107107        } duck;
    108108       
     
    183183
    184184        DUCK.last_duck = 0;
    185         DUCK.duck_freq = 60;  /** 5 minutes */
     185        DUCK.duck_freq = 0; 
    186186        DUCK.last_pkt = 0;
    187         DUCK.dummy_rt = NULL;
     187        DUCK.dummy_duck = NULL;
    188188       
    189189        return 0;
    190190}
    191191
     192static int dag_config_input(libtrace_t *libtrace, trace_option_t option,
     193                                void *data) {
     194        switch(option) {
     195                case TRACE_META_FREQ:
     196                        DUCK.duck_freq = *(int *)data;
     197                        return 0;
     198                case TRACE_OPTION_SNAPLEN:
     199                        /* Surely we can set this?? Fall through for now*/
     200               
     201                case TRACE_OPTION_PROMISC:
     202                        /* DAG already operates in a promisc fashion */
     203
     204                case TRACE_OPTION_FILTER:
     205
     206                default:
     207                        trace_set_err(libtrace, TRACE_ERR_UNKNOWN_OPTION,
     208                                        "Unknown or unsupported option: %i",
     209                                        option);
     210                        return -1;
     211        }
     212        assert (0);
     213}
    192214#endif
    193215
     
    436458        /* dag pause input implicitly called to cleanup before this */
    437459        dag_close(INPUT.fd);
    438         if (DUCK.dummy_rt)
    439                 trace_destroy_dead(DUCK.dummy_rt);
     460        if (DUCK.dummy_duck)
     461                trace_destroy_dead(DUCK.dummy_duck);
    440462        free(libtrace->format_data);
    441463        return 0; /* success */
     
    500522        packet->type = RT_DUCK_2_4;
    501523        packet->size = sizeof(duck_inf);
    502         if (!DUCK.dummy_rt)
    503                 DUCK.dummy_rt = trace_create_dead("rt:localhost:3434");
    504         packet->trace = DUCK.dummy_rt; 
     524        if (!DUCK.dummy_duck)
     525                DUCK.dummy_duck = trace_create_dead("duck:dummy");
     526        packet->trace = DUCK.dummy_duck;
     527        return packet->size;
    505528}       
    506529#else
     
    541564        packet->type = RT_DUCK_2_5;
    542565        packet->size = sizeof(duckinf_t);
    543         if (!DUCK.dummy_rt)
    544                 DUCK.dummy_rt = trace_create_dead("rt:localhost:3434");
    545         packet->trace = DUCK.dummy_rt; 
     566        if (!DUCK.dummy_duck)
     567                DUCK.dummy_duck = trace_create_dead("rt:localhost:3434");
     568        packet->trace = DUCK.dummy_duck;       
     569        return packet->size;
    546570}       
    547571#endif
     
    843867        assert(OUTPUT.file);
    844868
     869        if (!packet->header) {
     870                //trace_set_err_output(libtrace, TRACE_ERR_BAD_PACKET,
     871                //              "Packet has no header - probably an RT packet");
     872                return -1;
     873        }
     874       
    845875        pad = erf_get_padding(packet);
    846876
     
    10651095        TRACE_FORMAT_ERF,
    10661096        dag_init_input,                 /* init_input */       
    1067         NULL,                           /* config_input */
     1097        dag_config_input,               /* config_input */
    10681098        dag_start_input,                /* start_input */
    10691099        dag_pause_input,                /* pause_input */
Note: See TracChangeset for help on using the changeset viewer.