Example #1
0
static int afpacket_daq_get_stats(void *handle, DAQ_Stats_t *stats)
{
    AFPacket_Context_t *afpc = (AFPacket_Context_t *) handle;

    update_hw_stats(afpc);
    memcpy(stats, &afpc->stats, sizeof(DAQ_Stats_t));

    return DAQ_SUCCESS;
}
Example #2
0
static int pfring_zc_daq_get_stats(void *handle, DAQ_Stats_t *stats) {
    Pfring_Context_t *context =(Pfring_Context_t *) handle;

    update_hw_stats(context);

    memcpy(stats, &context->stats, sizeof(DAQ_Stats_t));

    return DAQ_SUCCESS;
}
Example #3
0
static int pfring_zc_daq_stop(void *handle) {
    Pfring_Context_t *context =(Pfring_Context_t *) handle;

    update_hw_stats(context);

    context->state = DAQ_STATE_STOPPED;

    return DAQ_SUCCESS;
}
Example #4
0
static int pcaprr_daq_get_stats(void *handle, DAQ_Stats_t *stats)
{
    Pcaprr_Context_t *context = (Pcaprr_Context_t *) handle;

    if (update_hw_stats(context) != DAQ_SUCCESS)
        return DAQ_ERROR;

    memcpy(stats, &context->stats, sizeof(DAQ_Stats_t));

    return DAQ_SUCCESS;
}
Example #5
0
static int pcaprr_daq_stop(void *handle)
{
    Pcaprr_Context_t *context = (Pcaprr_Context_t *) handle;
    int i;

    if (context->handle)
    {
        /* Store the hardware stats for post-stop stat calls. */
        update_hw_stats(context);
	for (i = 0 ; i < context->handle_count ; i++)
	        pcap_close(context->handle[i]);
        context->handle[i] = NULL;
    }

    context->state = DAQ_STATE_STOPPED;

    return DAQ_SUCCESS;
}
Example #6
0
static int af_packet_close(AFPacket_Context_t *afpc)
{
    AFPacketInstance *instance;

    if (!afpc)
        return -1;

    /* Cache the latest hardware stats before stopping. */
    update_hw_stats(afpc);

    while ((instance = afpc->instances) != NULL)
    {
        afpc->instances = instance->next;
        destroy_instance(instance);
    }

    sfbpf_freecode(&afpc->fcode);

    afpc->state = DAQ_STATE_STOPPED;

    return 0;
}