/// Example application that opens a packet socket with rx_ring int main(int argc, char **argv) { char *ring, pkt[100]; int fd; fd = init_packetsock(&ring, PACKET_TX_RING); if (fd < 0) return 1; // TODO: make correct IP packet out of pkt process_tx(fd, ring, pkt, 100); if (exit_packetsock(fd, ring)) return 1; printf("OK\n"); return 0; }
/// Example application that opens a packet socket with rx_ring int main(int argc, char **argv) { char *ring, *pkt; int fd; fd = init_packetsock(&ring, PACKET_RX_RING); if (fd < 0) return 1; pkt = process_rx(fd, ring); process_rx_release(ring); if (exit_packetsock(fd, ring)) return 1; printf("OK\n"); return 0; }