📄 if_sl.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/if_sl.html - generated by refgen from if_sl.c --> <title> if_sl </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.html"><i>VxWorks Reference Manual : Libraries</i></a></p></blockquote><h1>if_sl</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>if_sl</strong> - Serial Line IP (SLIP) network interface driver </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><i><a href="./if_sl.html#slipInit">slipInit</a></i>( )</b> - initialize a SLIP interface<br><b><i><a href="./if_sl.html#slipBaudSet">slipBaudSet</a></i>( )</b> - set the baud rate for a SLIP interface<br><b><i><a href="./if_sl.html#slattach">slattach</a></i>( )</b> - publish the <b>sl</b> network interface and initialize the driver and device<br><b><i><a href="./if_sl.html#slipDelete">slipDelete</a></i>( )</b> - delete a SLIP interface<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This module implements the VxWorks Serial Line IP (SLIP) network interface driver. Support for compressed TCP/IP headers (CSLIP) is included.<p>The SLIP driver enables VxWorks to talk to other machines over serialconnections by encapsulating IP packets into streams of bytes suitablefor serial transmission.<p></blockquote><h4>USER-CALLABLE ROUTINES</h4><blockquote><p>SLIP devices are initialized using <b><i><a href="./if_sl.html#slipInit">slipInit</a></i>( )</b>. Its parameters specify the Internet address for both sides of the SLIP point-to-point link,the name of the tty device on the local host, and options to enable CSLIPheader compression. The <b><i><a href="./if_sl.html#slipInit">slipInit</a></i>( )</b> routine calls <b><i><a href="./if_sl.html#slattach">slattach</a></i>( )</b> to attach theSLIP interface to the network. The <b><i><a href="./if_sl.html#slipDelete">slipDelete</a></i>( )</b> routine deletes a specifiedSLIP interface.<p></blockquote><h4>LINK-LEVEL PROTOCOL</h4><blockquote><p>SLIP is a simple protocol that uses four token charactersto delimit each packet:<p> - END (0300)<br> - ESC (0333)<br> - <b>TRANS_END</b> (0334)<br> - <b>TRANS_ESC</b> (0335)<p>The END character denotes the end of an IP packet. The ESC character is usedwith <b>TRANS_END</b> and <b>TRANS_ESC</b> to circumvent potential occurrences of END or ESCwithin a packet. If the END character is to be embedded, SLIP sends "ESC <b>TRANS_END</b>" to avoid confusion between a SLIP-specific END and actualdata whose value is END. If the ESC character is to be embedded, thenSLIP sends "ESC <b>TRANS_ESC</b>" to avoid confusion. (Note that the SLIP ESC isnot the same as the ASCII ESC.)<p>On the receiving side of the connection, SLIP uses the opposite actions todecode the SLIP packets. Whenever an END character is received, SLIPassumes a full IP packet has been received and sends it up to the IP layer.<p></blockquote><h4>TARGET-SPECIFIC PARAMETERS</h4><blockquote><p>The global flag slipLoopBack is set to 1 by default. This flag enablesthe packets to be sent to the loopback interface if they are destined toto a local slip interface address. By setting this flag, any packetssent to a local slip interface address will not be seen on the actual seriallink. Set this flag to 0 to turn off this facility. If this flag is not setany packets sent to the local slip interface address will actually be sentout on the link and it is the peer's responsibility to loop the packet back.<p></blockquote><h4>IMPLEMENTATION</h4><blockquote><p>The write side of a SLIP connection is an independent task. Each SLIPinterface has its own output task that sends SLIP packets over aparticular tty device channel. Whenever a packet is ready to be sent out,the SLIP driver activates this task by giving a semaphore. When thesemaphore is available, the output task performs packetization(as explained above) and writes the packet to the tty device.<p>The receiving side is implemented as a "hook" into the tty driver. A tty<b><i><a href="./ioLib.html#ioctl">ioctl</a></i>( )</b> request, FIOPROTOHOOK, informs the tty driver to call the SLIPinterrupt routine every time a character is received from a serial port.By tracking the number of characters and watching for the END character,the number of calls to <b><i><a href="./ioLib.html#read">read</a></i>( )</b> and context switching time have beenreduced. The SLIP interrupt routine will queue a call to the SLIP readroutine only when it knows that a packet is ready in the tty driver's ringbuffer. The SLIP read routine will read a whole SLIP packet at a time andprocess it according to the SLIP framing rules. When a full IP packet isdecoded out of a SLIP packet, it is queued to IP's input queue.<p>CSLIP compression is implemented to decrease the size of the TCP/IPheader information, thereby improving the data to header size ratio.CSLIP manipulates header information just before apacket is sent and just after a packet is received. Only TCP/IP headers are compressed and uncompressed; other protocol types aresent and received normally. A functioning CSLIP driver is requiredon the peer (destination) end of the physical link in order to carryout a CSLIP "conversation."<p>Multiple units are supported by this driver. Each individual unit mayhave CSLIP support disabled or enabled, independent of the state ofother units.<p></blockquote><h4>BOARD LAYOUT</h4><blockquote><p>No hardware is directly associated with this driver; therefore, a jumperingdiagram is not applicable.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./if_sl.html#top">if_sl</a></b>, <b><a href="./ifLib.html#top">ifLib</a></b>, <b><a href="./tyLib.html#top">tyLib</a></b>, John Romkey: RFC-1055, <i>A Nonstandard for Transmission of IP Datagrams Over Serial Lines: SLIP, </i>Van Jacobson: RFC-1144, entitled<i>Compressing TCP/IP Headers for Low-Speed Serial Links </i><p></blockquote><h4>ACKNOWLEDGEMENT</h4><blockquote><p>This program is based on original work done by Rick Adams of The Center forSeismic Studies and Chris Torek of The University of Maryland.The CSLIP enhancements are based on work done by Van Jacobson ofUniversity of California, Berkeley for the "cslip-2.7" release.<p><hr><a name="slipInit"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>slipInit</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>slipInit</i>( )</strong> - initialize a SLIP interface</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS slipInit ( int unit, /* SLIP device unit number (0 - 19) */ char * devName, /* name of the tty device to be initialized */ char * myAddr, /* address of the SLIP interface */ char * peerAddr, /* address of the remote peer SLIP interface */ int baud, /* baud rate of SLIP device: 0=don't set rate */ BOOL compressEnable, /* explicitly enable CSLIP compression */ BOOL compressAllow, /* enable CSLIP compression on Rx */ int mtu /* user set-able MTU */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine initializes a SLIP device. Its parameters specify the nameof the tty device, the Internet addresses of both sides of the SLIPpoint-to-point link (i.e., the local and remote sides of the serial lineconnection), and CSLIP options.<p>The Internet address of the local side of the connection is specified in<i>myAddr</i> and the name of its tty device is specified in <i>devName</i>.The Internet address of the remote side is specified in <i>peerAddr</i>.If <i>baud</i> is not zero, the baud rate will be the specified value;otherwise, the default baud rate will be the rate set by the tty driver.The <i>unit</i> parameter specifies the SLIP device unit number. Up to twentyunits may be created.<p>The CLSIP options parameters <i>compressEnable</i> and <i>compressAllow</i> determinesupport for TCP/IP header compression. If <i>compressAllow</i> is TRUE (1), thenCSLIP will be enabled only if a CSLIP type packet is received by thisdevice. If <i>compressEnable</i> is TRUE (1), then CSLIP compression will beenabled explicitly for all transmitted packets, and compressed packetscan be received.<p>The MTU option parameter allows the setting of the MTU for the link.<p>For example, the following call initializes a SLIP device, using theconsole's second port, where the Internet address of the local host is192.10.1.1 and the address of the remote host is 192.10.1.2.The baud rate will be the default rate for /tyCo/1. CLSIP is enabledif a CSLIP type packet is received. The MTU of the link is 1006.<pre> slipInit (0, "/tyCo/1", "192.10.1.1", "192.10.1.2", 0, 0, 1, 1006);</pre></blockquote><h4>RETURNS</h4><blockquote><p><p>OK, or ERROR if the device cannot be opened, memory is insufficient,or the route is invalid.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./if_sl.html#top">if_sl</a></b><hr><a name="slipBaudSet"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>slipBaudSet</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>slipBaudSet</i>( )</strong> - set the baud rate for a SLIP interface</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS slipBaudSet ( int unit, /* SLIP device unit number */ int baud /* baud rate */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine adjusts the baud rate of a tty device attached to a SLIPinterface. It provides a way to modify the baud rate of a ttydevice being used as a SLIP interface.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if the unit number is invalid or uninitialized.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./if_sl.html#top">if_sl</a></b><hr><a name="slattach"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>slattach</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>slattach</i>( )</strong> - publish the <b>sl</b> network interface and initialize the driver and device</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS slattach ( int unit, /* SLIP device unit number */ int fd, /* fd of tty device for SLIP interface */ BOOL compressEnable, /* explicitly enable CSLIP compression */ BOOL compressAllow, /* enable CSLIP compression on Rx */ int mtu /* user setable MTU */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine publishes the <b>sl</b> interface by filling in a network interfacerecord and adding this record to the system list. It also initializesthe driver and the device to the operational state.<p>This routine is usually called by <b><i><a href="./if_sl.html#slipInit">slipInit</a></i>( )</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK or ERROR.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./if_sl.html#top">if_sl</a></b><hr><a name="slipDelete"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>slipDelete</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>slipDelete</i>( )</strong> - delete a SLIP interface</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS slipDelete ( int unit /* SLIP unit number */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine resets a specified SLIP interface. It detaches the tty fromthe <b>sl</b> unit and deletes the specified SLIP interface from the list ofnetwork interfaces. For example, the following call will delete the firstSLIP interface from the list of network interfaces:<pre> slipDelete (0);</pre></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if the unit number is invalid or uninitialized.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./if_sl.html#top">if_sl</a></b></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -