Exemplo n.º 1
0
static void
dag_platform_cleanup(pcap_t *p)
{
    struct pcap_dag *pd;

    if (p != NULL) {
        pd = p->priv;
#ifdef HAVE_DAG_STREAMS_API
        if(dag_stop_stream(p->fd, pd->dag_stream) < 0)
            fprintf(stderr,"dag_stop_stream: %s\n", strerror(errno));

        if(dag_detach_stream(p->fd, pd->dag_stream) < 0)
            fprintf(stderr,"dag_detach_stream: %s\n", strerror(errno));
#else
        if(dag_stop(p->fd) < 0)
            fprintf(stderr,"dag_stop: %s\n", strerror(errno));
#endif /* HAVE_DAG_STREAMS_API */
        if(p->fd != -1) {
            if(dag_close(p->fd) < 0)
                fprintf(stderr,"dag_close: %s\n", strerror(errno));
            p->fd = -1;
        }
        delete_pcap_dag(p);
        pcap_cleanup_live_common(p);
    }
    /* Note: don't need to call close(p->fd) here as dag_close(p->fd) does this. */
}
Exemplo n.º 2
0
static void
atexit_handler(void)
{
	while (pcap_dags != NULL) {
		if (pcap_dags->pid == getpid()) {
			dag_platform_close(pcap_dags->p);
		} else {
			delete_pcap_dag(pcap_dags->p);
		}
	}
}
Exemplo n.º 3
0
static void
dag_platform_cleanup(pcap_t *p)
{
	struct pcap_dag *pd = p->priv;

	if(dag_stop_stream(p->fd, pd->dag_stream) < 0)
		fprintf(stderr,"dag_stop_stream: %s\n", strerror(errno));

	if(dag_detach_stream(p->fd, pd->dag_stream) < 0)
		fprintf(stderr,"dag_detach_stream: %s\n", strerror(errno));

	if(pd->dag_ref != NULL) {
		dag_config_dispose(pd->dag_ref);
		p->fd = -1;
		pd->dag_ref = NULL;
	}
	delete_pcap_dag(p);
	pcap_cleanup_live_common(p);
	/* Note: don't need to call close(p->fd) or dag_close(p->fd) as dag_config_dispose(pd->dag_ref) does this. */
}
Exemplo n.º 4
0
static void
dag_platform_cleanup(pcap_t *p)
{
	struct pcap_dag *pd = p->priv;

	if(dag_stop_stream(p->fd, pd->dag_stream) < 0)
		fprintf(stderr,"dag_stop_stream: %s\n", strerror(errno));

	if(dag_detach_stream(p->fd, pd->dag_stream) < 0)
		fprintf(stderr,"dag_detach_stream: %s\n", strerror(errno));

	if(p->fd != -1) {
		if(dag_close(p->fd) < 0)
			fprintf(stderr,"dag_close: %s\n", strerror(errno));
		p->fd = -1;
	}
	delete_pcap_dag(p);
	pcap_cleanup_live_common(p);
	/* Note: don't need to call close(p->fd) here as dag_close(p->fd) does this. */
}
Exemplo n.º 5
0
static void
dag_platform_close(pcap_t *p)
{
	
	if (p != NULL) {
#ifdef HAVE_DAG_STREAMS_API
		if(dag_stop_stream(p->fd, p->md.dag_stream) < 0)
			fprintf(stderr,"dag_stop_stream: %s\n", strerror(errno));
		
		if(dag_detach_stream(p->fd, p->md.dag_stream) < 0)
			fprintf(stderr,"dag_detach_stream: %s\n", strerror(errno));
#else
		if(dag_stop(p->fd) < 0)
			fprintf(stderr,"dag_stop: %s\n", strerror(errno));
#endif /* HAVE_DAG_STREAMS_API */
		if(dag_close(p->fd) < 0)
			fprintf(stderr,"dag_close: %s\n", strerror(errno));
#ifdef linux		
		free(p->md.device);
#endif
	}
	delete_pcap_dag(p);
	/* Note: don't need to call close(p->fd) here as dag_close(p->fd) does this. */
}