Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Networking With Open Transport / Part 2 - Open Transport Reference
Chapter 28 - Advanced Topics Reference / Constants and Data Types


The No-Copy Receive Buffer Structure

You use the no-copy receive buffer structure when you wish to receive data without copying it with the OTRcvUData function, the OTRcvURequest function, the OTRcvUReply function, the OTRcv function, the OTRcvRequest function, and the OTRcvReply function.

Note
If you are familiar with STREAMS mblk_t data structures, you can see that the no-copy receive buffer structure is just a slight modification of the mblk_t structure.
You can only use this buffer for data; you cannot use it for the address or options that may be associated with the incoming data. For example, in the case of an incoming TUnitData structure, you can only no-copy receive the udata portion, not the addr or opt fields.

WARNING
Under no circumstance write to this data structure. It is read-only. If you write to it, you can crash the system.
The no-copy receive buffer structure is defined by the OTBuffer data type.

struct OTBuffer
{
   void*      fLink;
   void*      fLink2;
   OTBuffer*  fNext;
   UInt8*     fData;
   size_t     fLen; 
   void*      fSave;
   UInt8      fBand;
   UInt8      fType;
   UInt8      fPad1;
   UInt8      fFlags;
};

typedef struct OTBuffer OTBuffer;
Field Description
fLink
Reserved.
fLink2
Reserved.
fNext
A pointer to the next OTBuffer structure in the linked chain. By tracing the chain of fNext pointers, you can access all of the data associated with the message.
fData
A pointer to the data portion of this OTBuffer structure.
fLen
The length of data pointed to by the fData field.
fSave
Reserved.
fBand
The band used for the data transmission. It must be a value between 0 and 255.
fType
The type of the data (normally M_DATA, M_PROTO, or M_PCPROTO).
fPad1
Reserved.
fFlags
The flags associated with the data (MSGMARK, MSGDELIM).

IMPORTANT
Once you have copied the data out of the no-copy receive buffer, you need to call the OTReleaseBuffer function as quickly as possible to return the buffer to Open Transport.
For more information, see "No-Copy Receiving".


Previous Book Contents Book Index Next

© Apple Computer, Inc.
15 JAN 1998