/* Performs a graceful shutdown of the DAG card, frees dynamic memory held in the pcap_t structure, and closes the file descriptor for the DAG card.  */
static void dag_platform_cleanup(pcap_t *p)
/* Performs a graceful shutdown of the DAG card, frees dynamic memory held in the pcap_t structure, and closes the file descriptor for the DAG card.  */
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);
}