Hi Ulric, Got it! Many thanks :)
+++++++++++++++++ Best, Hao On Thu, Nov 26, 2015 at 6:25 PM, <ul...@siag.nu> wrote: > > > 2015-11-25 15:30 skrev Hao Wu: > >> Hi all, >> >> I just start using Netmap. I want to know can I build the Ethernet >> frames and send out via Netmap? I used to build the Ethernet frames via >> Libnet, but it is too slow. So I turn to Netmap now. But I have no idea on >> how to write the code using Netmap or what functions should I call? >> >> Any replay is highly appreciated! >> > > > It's crazy simple. To open a netmap descriptor: > > d = nm_open(ifname, NULL, 0, 0); > > To receive a frame: > > uint8_t *b = nm_nextpkt(d, &h); > > To send a frame: > > int n = nm_inject(d, b, len); > > Working example from Pen: > > https://github.com/UlricE/pen/blob/master/dsr.c > > Ulric > _______________________________________________ freebsd-net@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-net To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"