📄 netbuflib.html
字号:
routine blocks until a <b>clBlk</b>-cluster construct is available. If <i>canWait</i> is <b>M_DONTWAIT</b> and no <b>clBlk</b>-cluster construct is immediately available, this routine returns immediately (no blocking) with an ERROR value.<p><dt><i>bestFit</i><dd> Expects either TRUE or FALSE. If <i>bestFit</i> is TRUE and a cluster of the exact size is unavailable, this routine gets a larger cluster (ifavailable). If <i>bestFit</i> is FALSE and an exact size cluster is unavailable, this routine gets either a smaller or a larger cluster (depending on what is available). Otherwise, it returns immediately with an ERROR value.For memory pools containing only one cluster size, <i>bestFit</i> should alwaysbe set to FALSE.<p></dl>.SH<br> "RETURNS"OK or ERROR.<p></blockquote><h4>ERRNO</h4><blockquote><p><p> S_netBufLib_CLSIZE_INVALID</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./netBufLib.html#top">netBufLib</a></b><hr><a name="netTupleGet"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>netTupleGet</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>netTupleGet</i>( )</strong> - get an <b>mBlk</b>-<b>clBlk</b>-cluster</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>M_BLK_ID netTupleGet ( NET_POOL_ID pNetPool, /* pointer to the net pool */ int bufSize, /* size of the buffer to get */ int canWait, /* wait or dontwait */ UCHAR type, /* type of data */ BOOL bestFit /* TRUE/FALSE */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine gets a <b>mBlk</b>-<b>clBlk</b>-cluster construct from thespecified memory pool. Use this construct to pass data across the layers of the network stack.<p><dl><dt><i>pNetPool</i><dd>Expects a pointer to the memory pool from which you want to get a free <b>mBlk</b>-<b>clBlk</b>-cluster construct. <p><dt><i>bufSize</i><dd>Expects the size, in bytes, of the cluster in the <b>clBlk</b>-clusterconstruct. <p><dt><i>canWait</i><dd>Expects either <b>M_WAIT</b> or <b>M_DONTWAIT</b>. If <i>canWait</i> is <b>M_WAIT</b>, thisroutine blocks until an <b>mBlk</b>-<b>clBlk</b>-cluster construct is available.If <i>canWait</i> is <b>M_DONTWAIT</b> and no <b>mBlk</b>-<b>clBlk</b>-cluster construct isimmediately available, this routine returns immediately (no blocking) with a NULL value.<p><dt><i>type</i><dd>Expects the type of data. For example <b>MT_DATA</b>, <b>MT_HEADER</b>. The variousvalues for this type are defined in <b>netBufLib.h</b>.<p><dt><i>bestFit</i><dd> Expects either TRUE or FALSE. If <i>bestFit</i> is TRUE and a cluster of the exact size is unavailable, this routine gets a larger cluster (ifavailable). If <i>bestFit</i> is FALSE and an exact size cluster is unavailable, this routine gets either a smaller or a larger cluster (depending on what is available). Otherwise, it returns immediately with an ERROR value.For memory pools containing only one cluster size, <i>bestFit</i> should alwaysbe set to FALSE.<p></dl></blockquote><h4>RETURNS</h4><blockquote><p><p>* <b>M_BLK_ID</b> or NULL.<p></blockquote><h4>ERRNO</h4><blockquote><p><p> S_netBufLib_MBLK_INVALID<br> S_netBufLib_CLSIZE_INVALID<br> S_netBufLib_NETPOOL_INVALID</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./netBufLib.html#top">netBufLib</a></b><hr><a name="netClBlkJoin"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>netClBlkJoin</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>netClBlkJoin</i>( )</strong> - join a cluster to a <b>clBlk</b> structure </p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>CL_BLK_ID netClBlkJoin ( CL_BLK_ID pClBlk, /* pointer to a cluster Blk */ char * pClBuf, /* pointer to a cluster buffer */ int size, /* size of the cluster buffer */ FUNCPTR pFreeRtn, /* pointer to the free routine */ int arg1, /* argument 1 of the free routine */ int arg2, /* argument 2 of the free routine */ int arg3 /* argument 3 of the free routine */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine joins the previously reserved cluster specified by <i>pClBuf</i> to the previously reserved <b>clBlk</b> structure specified by <i>pClBlk</i>. The <i>size</i> parameter passes in the size of the cluster referenced in <i>pClBuf</i>. The arguments <i>pFreeRtn</i>, <i>arg1</i>, <i>arg2</i>, <i>arg3</i> set the values of the <b>pCLFreeRtn</b>, <b>clFreeArg1</b>, <b>clFreeArg2</b>, and <b>clFreeArg1</b>, members of the specified <b>clBlk</b> structure.<p></blockquote><h4>RETURNS</h4><blockquote><p><b>CL_BLK_ID</b> or NULL.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./netBufLib.html#top">netBufLib</a></b><hr><a name="netMblkClJoin"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>netMblkClJoin</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>netMblkClJoin</i>( )</strong> - join an <b>mBlk</b> to a <b>clBlk</b>-cluster construct</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>M_BLK_ID netMblkClJoin ( M_BLK_ID pMblk, /* pointer to an mBlk */ CL_BLK_ID pClBlk /* pointer to a cluster Blk */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine joins the previously reserved <b>mBlk</b> referenced in <i>pMblk</i> tothe <b>clBlk</b>-cluster construct referenced in <i>pClBlk</i>. Internally, this routine sets the <b>M_EXT</b> flag in <b>mBlk.mBlkHdr.mFlags</b>. It also and sets the <b>mBlk.mBlkHdr.mData</b> to point to the start of the data in the cluster.<p></blockquote><h4>RETURNS</h4><blockquote><p><b>M_BLK_ID</b> or NULL.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./netBufLib.html#top">netBufLib</a></b><hr><a name="netClPoolIdGet"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>netClPoolIdGet</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>netClPoolIdGet</i>( )</strong> - return a <b>CL_POOL_ID</b> for a specified buffer size </p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>CL_POOL_ID netClPoolIdGet ( NET_POOL_ID pNetPool, /* pointer to the net pool */ int bufSize, /* size of the buffer */ BOOL bestFit /* TRUE/FALSE */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine returns a <b>CL_POOL_ID</b> for a cluster pool containing clusters that match the specified <i>bufSize</i>. If bestFit is TRUE, this routine returns a <b>CL_POOL_ID</b> for a pool that contains clusters greater than or equal to <i>bufSize</i>. If <i>bestFit</i> is FALSE, this routine returns a <b>CL_POOL_ID</b> for a cluster from whatever cluster pool is available. If the memory pool specified by <i>pNetPool</i> contains only one cluster pool, <i>bestFit</i> should always be FALSE.<p></blockquote><h4>RETURNS</h4><blockquote><p><b>CL_POOL_ID</b> or NULL.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./netBufLib.html#top">netBufLib</a></b><hr><a name="netMblkToBufCopy"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>netMblkToBufCopy</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>netMblkToBufCopy</i>( )</strong> - copy data from an <b>mBlk</b> to a buffer</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int netMblkToBufCopy ( M_BLK_ID pMblk, /* pointer to an mBlk */ char * pBuf, /* pointer to the buffer to copy */ FUNCPTR pCopyRtn /* function pointer for copy routine */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine copies data from the <b>mBlk</b> chain referenced in <i>pMblk</i> to the buffer referenced in <i>pBuf</i>. It is assumed that <i>pBuf</i> points to enough memory to contain all the data in the entire <b>mBlk</b> chain.The argument <i>pCopyRtn</i> expects either a NULL or a function pointer to a copy routine. The arguments passed to the copy routine are source pointer, destination pointer and the length of data to copy. If <i>pCopyRtn</i> is NULL, <b><i><a href="./netBufLib.html#netMblkToBufCopy">netMblkToBufCopy</a></i>( )</b> uses a default routine to extract the data from the chain.<p></blockquote><h4>RETURNS</h4><blockquote><p>The length of data copied or zero.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./netBufLib.html#top">netBufLib</a></b><hr><a name="netMblkDup"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>netMblkDup</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>netMblkDup</i>( )</strong> - duplicate an <b>mBlk</b></p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>M_BLK_ID netMblkDup ( M_BLK_ID pSrcMblk, /* pointer to source mBlk */ M_BLK_ID pDestMblk /* pointer to the destination mBlk */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine copies the references from a source <b>mBlk</b> in an <b>mBlk</b>-<b>clBlk</b>-cluster construct to a stand-alone <b>mBlk</b>.This lets the two <b>mBlk</b> structures share the same <b>clBlk</b>-clusterconstruct. This routine also increments the reference count in the shared <b>clBlk</b>. The <i>pSrcMblk</i> expects a pointer to the source <b>mBlk</b>. The <i>pDescMblk</i> parameter expects a pointer to the destination <b>mBlk</b>. <p></blockquote><h4>RETURNS</h4><blockquote><p>A pointer to the destination <b>mBlk</b> or NULL if the source <b>mBlk</b> referenced in <i>pSrcMblk</i> is not part of a valid <b>mBlk</b>-<b>clBlk</b>-cluster construct.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./netBufLib.html#top">netBufLib</a></b><hr><a name="netMblkChainDup"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>netMblkChainDup</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>netMblkChainDup</i>( )</strong> - duplicate an <b>mBlk</b> chain</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>M_BLK_ID netMblkChainDup ( NET_POOL_ID pNetPool, /* pointer to the pool */ M_BLK_ID pMblk, /* pointer to source mBlk chain */ int offset, /* offset to duplicate from */ int len, /* length to copy */ int canWait /* M_DONTWAIT/M_WAIT */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine makes a copy of an <b>mBlk</b> chain starting at <i>offset</i> bytes fromthe beginning of the chain and continuing for <i>len</i> bytes. If <i>len</i> is <b>M_COPYALL</b>, then this routine will copy the entire <b>mBlk</b> chain from the <i>offset</i>.<p>This routine copies the references from a source <i>pMblk</i> chain toa newly allocated <b>mBlk</b> chain. This lets the two <b>mBlk</b> chains share the same <b>clBlk</b>-clusterconstructs. This routine also increments the reference count in the shared <b>clBlk</b>. The <i>pMblk</i> expects a pointer to the source <b>mBlk</b>chain. The <i>pNetPool</i> parameter expects a pointer to the netPool from whichthe new <b>mBlk</b> chain is allocated.<p>The <i>canWait</i> parameter expectseither <b>M_WAIT</b> or <b>M_DONTWAIT</b>. If <i>canWait</i> is <b>M_WAIT</b>, thisroutine blocks until <b>mBlk</b> is available. If <i>canWait</i> is <b>M_DONTWAIT</b> and no <b>mBlk</b> is immediately available,this routine returns immediately (no blocking) with a NULL value.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><i><a href="./netBufLib.html#netMblkDup">netMblkDup</a></i>( )</b><p></blockquote><h4>RETURNS</h4><blockquote><p>A pointer to the newly allocated <b>mBlk</b> chain or NULL.<p></blockquote><h4>ERRNO</h4><blockquote><p><p> S_netBufLib_INVALID_ARGUMENT<br> S_netBufLib_NO_POOL_MEMORY</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -