📄 zbufsocklib.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/zbufSockLib.html - generated by refgen from zbufSockLib.c --> <title> zbufSockLib </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.htm"><i>VxWorks API Reference : OS Libraries</i></a></p></blockquote><h1>zbufSockLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>zbufSockLib</strong> - zbuf socket interface library </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><a href="./zbufSockLib.html#zbufSockLibInit">zbufSockLibInit</a>( )</b> - initialize the zbuf socket interface library<br><b><a href="./zbufSockLib.html#zbufSockSend">zbufSockSend</a>( )</b> - send zbuf data to a TCP socket<br><b><a href="./zbufSockLib.html#zbufSockSendto">zbufSockSendto</a>( )</b> - send a zbuf message to a UDP socket<br><b><a href="./zbufSockLib.html#zbufSockBufSend">zbufSockBufSend</a>( )</b> - create a zbuf from user data and send it to a TCP socket<br><b><a href="./zbufSockLib.html#zbufSockBufSendto">zbufSockBufSendto</a>( )</b> - create a zbuf from a user message and send it to a UDP socket<br><b><a href="./zbufSockLib.html#zbufSockRecv">zbufSockRecv</a>( )</b> - receive data in a zbuf from a TCP socket<br><b><a href="./zbufSockLib.html#zbufSockRecvfrom">zbufSockRecvfrom</a>( )</b> - receive a message in a zbuf from a UDP socket<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library contains routines that communicate over BSD sockets usingthe<i>zbuf interface </i>described in the <b><a href="./zbufLib.html#top">zbufLib</a></b> manual page. These zbufsocket calls communicate over BSD sockets in a similar manner to thesocket routines in <b><a href="./sockLib.html#top">sockLib</a></b>, but they avoid copying data unnecessarilybetween application buffers and network buffers.<p></blockquote><h4>VXWORKS AE PROTECTION DOMAINS</h4><blockquote><p>Under VxWorks AE, this feature is accessible from the kernel protection domain only. This restriction does not apply under non-AE versions of VxWorks. <p>To use this feature, include the <b>INCLUDE_ZBUF_SOCK</b> component.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./zbufLib.html#top">zbufLib</a></b>, <b><a href="./sockLib.html#top">sockLib</a></b> <hr><a name="zbufSockLibInit"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>zbufSockLibInit( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>zbufSockLibInit( )</strong> - initialize the zbuf socket interface library</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS zbufSockLibInit (void)</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine initializes the zbuf socket interfacelibrary. It must be called before any zbuf socket routines are used.It is called automatically when <b>INCLUDE_ZBUF_SOCK</b> is defined.<p></blockquote><h4>VXWORKS AE PROTECTION DOMAINS</h4><blockquote><p>Under VxWorks AE, you can call this function from within the kernel protection domain only. In addition, all arguments to this function can reference only that data which is valid in the kernel protection domain. This restriction does not apply under non-AE versions of VxWorks. <p></blockquote><h4>RETURNS</h4><blockquote><p><p>OK, or ERROR if the zbuf socket interface could not be initialized.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./zbufSockLib.html#top">zbufSockLib</a></b><hr><a name="zbufSockSend"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>zbufSockSend( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>zbufSockSend( )</strong> - send zbuf data to a TCP socket</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int zbufSockSend ( int s, /* socket to send to */ ZBUF_ID zbufId, /* zbuf to transmit */ int zbufLen, /* length of entire zbuf */ int flags /* flags to underlying protocols */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine transmits all of the data in <i>zbufId</i> to a previouslyestablished connection-based (stream) socket.<p>The <i>zbufLen</i> parameter is used only for determining the amount of spaceneeded from the socket write buffer. <i>zbufLen</i> has no effect on how manybytes are sent; the entire zbuf is always transmitted. If the length of<i>zbufId</i> is not known, the caller must first determine it by calling<b><a href="./zbufLib.html#zbufLength">zbufLength</a>( )</b>.<p>This routine transfers ownership of the zbuf from the user applicationto the VxWorks network stack. The zbuf ID, <i>zbufId</i>, is deleted by thisroutine, and should not be used after the routine is called, even ifan ERROR status is returned. (Exceptions: when the routinefails because the zbuf socket interface library was not initialized or aninvalid zbuf ID was passed in, in which case there is no zbuf to delete.Moreover, if the call fails during a non-blocking I/O socket writewith an <b>errno</b> of EWOULDBLOCK, then <i>zbufId</i> is not deleted; thus thecaller may send it again at a later time.)<p>You may OR the following values into the <i>flags</i> parameter with thisoperation:<p><dl><dt><b>MSG_OOB</b> (0x1)<dd>Out-of-band data.<p><dt><b>MSG_DONTROUTE</b> (0x4)<dd>Send without using routing tables.</dl></blockquote><h4>VXWORKS AE PROTECTION DOMAINS</h4><blockquote><p>Under VxWorks AE, you can call this function from within the kernel protection domain only. In addition, all arguments to this function can reference only that data which is valid in the kernel protection domain. This restriction does not apply under non-AE versions of VxWorks. <p></blockquote><h4>RETURNS</h4><blockquote><p>The number of bytes sent, or ERROR if the call fails.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./zbufSockLib.html#top">zbufSockLib</a></b>, <b><a href="./zbufLib.html#zbufLength">zbufLength</a>( )</b>, <b><a href="./zbufSockLib.html#zbufSockBufSend">zbufSockBufSend</a>( )</b>, <b><a href="./sockLib.html#send">send</a>( )</b><hr><a name="zbufSockSendto"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>zbufSockSendto( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>zbufSockSendto( )</strong> - send a zbuf message to a UDP socket</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int zbufSockSendto ( int s, /* socket to send to */ ZBUF_ID zbufId, /* zbuf to transmit */ int zbufLen, /* length of entire zbuf */ int flags, /* flags to underlying protocols */ struct sockaddr * to, /* recipient's address */ int tolen /* length of <i>to</i> socket addr */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine sends the entire message in <i>zbufId</i> to the datagram socketnamed by <i>to</i>. The socket <i>s</i> is the sending socket.<p>The <i>zbufLen</i> parameter is used only for determining the amount of spaceneeded from the socket write buffer. <i>zbufLen</i> has no effect on how manybytes are sent; the entire zbuf is always transmitted. If the length of<i>zbufId</i> is not known, the caller must first determine it by calling<b><a href="./zbufLib.html#zbufLength">zbufLength</a>( )</b>.<p>This routine transfers ownership of the zbuf from the user applicationto the VxWorks network stack. The zbuf ID <i>zbufId</i> is deleted by thisroutine, and should not be used after the routine is called, even ifan ERROR status is returned. (Exceptions: when the routinefails because the zbuf socket interface library was not initialized or aninvalid zbuf ID was passed in, in which case there is no zbuf to delete.Moreover, if the call fails during a non-blocking I/O socket writewith an <b>errno</b> of EWOULDBLOCK, then <i>zbufId</i> is not deleted; thus thecaller may send it again at a later time.)<p>You may OR the following values into the <i>flags</i> parameter with thisoperation:<p><dl><dt><b>MSG_OOB</b> (0x1)<dd>Out-of-band data.<p><dt><b>MSG_DONTROUTE</b> (0x4)<dd>Send without using routing tables.</dl></blockquote><h4>VXWORKS AE PROTECTION DOMAINS</h4><blockquote><p>Under VxWorks AE, you can call this function from within the kernel protection domain only. In addition, all arguments to this function can reference only that data which is valid in the kernel protection domain. This restriction does not apply under non-AE versions of VxWorks. <p></blockquote><h4>RETURNS</h4><blockquote><p>The number of bytes sent, or ERROR if the call fails.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./zbufSockLib.html#top">zbufSockLib</a></b>, <b><a href="./zbufLib.html#zbufLength">zbufLength</a>( )</b>, <b><a href="./zbufSockLib.html#zbufSockBufSendto">zbufSockBufSendto</a>( )</b>, <b><a href="./sockLib.html#sendto">sendto</a>( )</b><hr><a name="zbufSockBufSend"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>zbufSockBufSend( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>zbufSockBufSend( )</strong> - create a zbuf from user data and send it to a TCP socket</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int zbufSockBufSend ( int s, /* socket to send to */ char * buf, /* pointer to data buffer */ int bufLen, /* number of bytes to send */ VOIDFUNCPTR freeRtn, /* free routine callback */ int freeArg, /* argument to free routine */ int flags /* flags to underlying protocols */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine creates a zbuf from the user buffer <i>buf</i>, and transmitsit to a previously established connection-based (stream) socket.<p>The user-provided free routine callback at <i>freeRtn</i> is called when <i>buf</i>is no longer in use by the TCP/IP network stack. Applications canexploit this callback to receive notification that <i>buf</i> is free.If <i>freeRtn</i> is NULL, the routine functions normally, except that the application has no way of being notified when <i>buf</i> is released by thenetwork stack. The free routine runs in the context of the task that lastreferences the buffer. This is typically either the context of tNetTask,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -