In message <email@hidden>,"C
arl Smith" writes:
>I have tried several methods of creating the mbuf but when I use
>dlil_if_inject_output I get an error =3D 22. But if I do an m_copyback =
>of
>an mbuf I copied coming in I can make dlil_if_inject_output work, but
>not with the 240 bytes I want. Instead of going into a lot of
>explanation of what I am doing and why I basically just need to know how
>to create a 'new' mbuf with the data as described above for sending
>out/in the driver.
i ported parts of the forethought atm stack and while it doesnt generate
packets completly from scratch, you do need to a little work on the
mbufs before you can hand them over to dlil.
mbuf_t m;
char *ehdr, *pkt; /* ethernet header */
ifnet_t ifp;
int maxchunks = 1;
ifp = /* you will need to find this somewhow */
mbuf_allocpacket(MBUF_WAITOK, 240, &maxchunks, &m);
mbuf_pkthdr_setlen(m, 240);
mbuf_pkthdr_setrcvif(m, ifp);
mbuf_pkthdr_setheader(m, mbuf_data(m));
ehdr = mbuf_data(m);
mbuf_adj(m, ETHER_HDR_LEN);
pkt = mbuf_data(m);
/* write ehdr */
/* write pkt */
#ifdef tiger
ifnet_input(ifp, m, &stats);
#else
dlil_input(ifp, m, m);
#endif
looking at the ppp (or firewire) source code can be pretty helpful.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-drivers mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-drivers/email@hidden
This email sent to email@hidden