Esempio n. 1
0
/* Returns the first bundle socket with something to read */
int pfring_bundle_poll(pfring_bundle *bundle, u_int wait_duration) {
  int i;

  for(i=0; i<bundle->num_sockets; i++) {
    pfring_sync_indexes_with_kernel(bundle->sockets[i]);
    bundle->pfd[i].events  = POLLIN /* | POLLERR */;
    bundle->pfd[i].revents = 0;
  }

  errno = 0;
  return poll(bundle->pfd, bundle->num_sockets, wait_duration);
}
Esempio n. 2
0
void pfring_close(pfring *ring) {
  if(!ring)
    return;

  if(ring->one_copy_rx_pfring)
    pfring_close(ring->one_copy_rx_pfring);

  pfring_shutdown(ring);

  pfring_sync_indexes_with_kernel(ring);

  if(ring->close)
    ring->close(ring);

  if(unlikely(ring->reentrant)) {
    pthread_rwlock_destroy(&ring->rx_lock);
    pthread_rwlock_destroy(&ring->tx_lock);
  }

  free(ring->device_name);
  free(ring);
}
Esempio n. 3
0
int pfring_dna_poll(pfring *ring, u_int wait_duration) {
    pfring_sync_indexes_with_kernel(ring);
    return pfring_mod_poll(ring, wait_duration);
}