1 typedef struct Packet Packet; 2 typedef struct Mem Mem; 3 typedef struct Frag Frag; 4 5 enum { 6 BigMemSize = MaxFragSize, 7 SmallMemSize = BigMemSize/8, 8 NLocalFrag = 2, 9 }; 10 11 /* position to carve out of a Mem */ 12 enum { 13 PFront, 14 PMiddle, 15 PEnd, 16 }; 17 18 struct Mem 19 { 20 Lock lk; 21 int ref; 22 uchar *bp; 23 uchar *ep; 24 uchar *rp; 25 uchar *wp; 26 Mem *next; 27 }; 28 29 enum { 30 FragLocalFree, 31 FragLocalAlloc, 32 FragGlobal, 33 }; 34 35 struct Frag 36 { 37 int state; 38 Mem *mem; 39 uchar *rp; 40 uchar *wp; 41 Frag *next; 42 }; 43 44 struct Packet 45 { 46 int size; 47 int asize; /* allocated memmory - always greater than size */ 48 49 Packet *next; 50 51 Frag *first; 52 Frag *last; 53 54 Frag local[NLocalFrag]; 55 }; 56 57