mbuf manipulation
mbuf manipulation
- Subject: mbuf manipulation
- From: Eric Long <email@hidden>
- Date: Mon, 09 Dec 2002 15:11:58 -0800
Hi all,
I've been camped out reading TCP/IP Illustrated volumes, trying to digest
BSD networking. I'm trying to write a kext to perform some manipulation of
incoming data. At present, I am intercepting data in an sbappend hook.
Concerning mbufs, if I want to remove bytes...
If, for example, I have a chain of 3 mbufs and each has 50 bytes of data, If
I want to remove bytes 30-39 of mbuf 2: Can I simply shift bytes 40-49 back
by 10 bytes, shorten the mbuf's m_len by 10, and the packet header length by
10, and expect things to be "work"? What if I set the mbuf's m_len to 0?
If I want to insert bytes...
How nasty is that to deal with? Can I insert safely from sbappend?
Does anyone know of code examples I might look at that show
removing/inserting bytes into mbuf chains? I see mbuf.h seems to have all
the functions for allocating/freeing mbufs, but I'm not certain about the
big picture of how this is implemented. Seems like I may have some concerns
about exceeding space available in the socket buffer.
I'm just looking for tips to help me figure this out.
Thanks,
Eric Long
___________________________________________________________________________
Macintosh Software Engineer
Aladdin Systems, Inc.
http://www.aladdinsys.com
245 Westridge Drive, Watsonville, CA 95076 (831) 761-6200 x628
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.