📄 iflib.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/ifLib.html - generated by refgen from ifLib.c --> <title> ifLib </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>ifLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>ifLib</strong> - network interface library </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><a href="./ifLib.html#ifUnnumberedSet">ifUnnumberedSet</a>( )</b> - configure an interface to be unnumbered<br><b><a href="./ifLib.html#ifAddrAdd">ifAddrAdd</a>( )</b> - add an interface address for a network interface<br><b><a href="./ifLib.html#ifAddrSet">ifAddrSet</a>( )</b> - set an interface address for a network interface<br><b><a href="./ifLib.html#ifAddrDelete">ifAddrDelete</a>( )</b> - delete an interface address for a network interface<br><b><a href="./ifLib.html#ifAddrGet">ifAddrGet</a>( )</b> - get the Internet address of a network interface<br><b><a href="./ifLib.html#ifBroadcastSet">ifBroadcastSet</a>( )</b> - set the broadcast address for a network interface<br><b><a href="./ifLib.html#ifBroadcastGet">ifBroadcastGet</a>( )</b> - get the broadcast address for a network interface<br><b><a href="./ifLib.html#ifDstAddrSet">ifDstAddrSet</a>( )</b> - define an address for the other end of a point-to-point link<br><b><a href="./ifLib.html#ifDstAddrGet">ifDstAddrGet</a>( )</b> - get the Internet address of a point-to-point peer<br><b><a href="./ifLib.html#ifMaskSet">ifMaskSet</a>( )</b> - define a subnet for a network interface<br><b><a href="./ifLib.html#ifMaskGet">ifMaskGet</a>( )</b> - get the subnet mask for a network interface<br><b><a href="./ifLib.html#ifFlagChange">ifFlagChange</a>( )</b> - change the network interface flags<br><b><a href="./ifLib.html#ifFlagSet">ifFlagSet</a>( )</b> - specify the flags for a network interface<br><b><a href="./ifLib.html#ifFlagGet">ifFlagGet</a>( )</b> - get the network interface flags<br><b><a href="./ifLib.html#ifMetricSet">ifMetricSet</a>( )</b> - specify a network interface hop count<br><b><a href="./ifLib.html#ifMetricGet">ifMetricGet</a>( )</b> - get the metric for a network interface<br><b><a href="./ifLib.html#ifRouteDelete">ifRouteDelete</a>( )</b> - delete routes associated with a network interface<br><b><a href="./ifLib.html#ifAllRoutesDelete">ifAllRoutesDelete</a>( )</b> - delete all routes associated with a network interface<br><b><a href="./ifLib.html#ifunit">ifunit</a>( )</b> - map an interface name to an interface structure pointer<br><b><a href="./ifLib.html#ifNameToIfIndex">ifNameToIfIndex</a>( )</b> - returns the interface index given the interface name<br><b><a href="./ifLib.html#ifIndexToIfName">ifIndexToIfName</a>( )</b> - returns the interface name given the interface index<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library contains routines to configure the network interface parameters.Generally, each routine corresponds to one of the functions of the UNIXcommand <b>ifconfig</b>.<p>To use this feature, include the following component:<b>INCLUDE_NETWRS_IFLIB</b><p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>ifLib.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./hostLib.html#top">hostLib</a></b><hr><a name="ifUnnumberedSet"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>ifUnnumberedSet( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>ifUnnumberedSet( )</strong> - configure an interface to be unnumbered</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>#ifdef ROUTER_STACK STATUS ifUnnumberedSet ( char * pIfName, /* Name of interface to configure */ char * pDstIp, /* Destination address of the point to */ /* point link */ char * pBorrowedIp, /* The borrowed IP address/router ID */ char * pDstMac /* Destination MAC address */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This API sets an interface unnumbered. It sets the <b>IFF_POINTOPOINT</b> flagsand creates a routing entry through the interface using a user-specifieddestination IP address. The unnumbered link can then be uniquely referredto by the destination IP address, <i>pDstIp</i>, when adding routes. Theinterface is assigned a "borrowed" IP address--borrowed from anotherinterface on the machine. In RFC 1812 it is also called the router ID.This address will be used to generate any needed ICMP messages or the like.Note that ARP is not able to run on an unnumbered link.<p>The initialization of the unnumbered device is similar to othernetwork devices, but it does have a few additional steps and concerns.<b><a href="./ifLib.html#ifUnnumberedSet">ifUnnumberedSet</a>( )</b> must come next after <b><a href="./ipProto.html#ipAttach">ipAttach</a>( )</b>. Please note thatthe interface using the IP address that the unnumbered interface willborrow must be brought up first and configured with <i>ifAddrSet</i> or equivalent. This is required to ensure normal network operation forthat IP address/interface. After <b><a href="./ifLib.html#ifUnnumberedSet">ifUnnumberedSet</a>( )</b>, one must createadditional routing entries (using <b><a href="./routeLib.html#mRouteAdd">mRouteAdd</a>( )</b>, <b><a href="./routeLib.html#routeNetAdd">routeNetAdd</a>( )</b>, etc)in order to reach other networks, including the network to whichthe destination IP address belongs. <p>The <i>pDstMac</i> field in <b><a href="./ifLib.html#ifUnnumberedSet">ifUnnumberedSet</a>( )</b> is used to specify thedestination's MAC address. It should be left NULL if the destinationis not an Ethernet device. If the MAC address is not known, thensupply an artificial address. We recommend using "00:00:00:00:00:01"The destination interface can then be set promiscuous to acceptthis artificial address. This is accomplished using the <i>ifpromisc</i>command.<p>Example:<pre>ipAttach (1, "fei")ifUnnumberedSet ("fei1", "120.12.12.12", "140.34.78.94", "00:a0:d0:d8:c8:14")routeNetAdd ("120.12.0.0","120.12.12.12") <One possible network>routeNetAdd ("178.45.0.0","120.12.12.12") <Another possible network></pre></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if the interface cannot be set.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ifLib.html#top">ifLib</a></b><hr><a name="ifAddrAdd"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>ifAddrAdd( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>ifAddrAdd( )</strong> - add an interface address for a network interface</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS ifAddrAdd ( char * interfaceName, /* name of interface to configure */ char * interfaceAddress, /* Internet address to assign to interface */ char * broadcastAddress, /* broadcast address to assign to interface */ int subnetMask /* subnetMask */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine assigns an Internet address to a specified network interface.The Internet address can be a host name or a standard Internet addressformat (e.g., 90.0.0.4). If a host name is specified, it should alreadyhave been added to the host table with <b><a href="./hostLib.html#hostAdd">hostAdd</a>( )</b>.<p>You must specify both an <i>interfaceName</i> and an <i>interfaceAddress</i>. A <i>broadcastAddress</i> is optional. If <i>broadcastAddress</i> is NULL, <b>in_ifinit( )</b> generates a <i>broadcastAddress</i> value based on the <i>interfaceAddress</i> valueand the netmask. A <i>subnetMask</i> value is optional. If <i>subnetMask</i> is 0, <b>in_ifinit( )</b> uses a <i>subnetMask</i> the same as the netmask that is generated by the <i>interfaceAddress</i>. The <i>broadcastAddress</i> is also <i>destAddress</i> in case of <b>IFF_POINTOPOINT</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if the interface cannot be set.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ifLib.html#top">ifLib</a></b>, <b><a href="./ifLib.html#ifAddrGet">ifAddrGet</a>( )</b>, <b><a href="./ifLib.html#ifDstAddrSet">ifDstAddrSet</a>( )</b>, <b><a href="./ifLib.html#ifDstAddrGet">ifDstAddrGet</a>( )</b><hr><a name="ifAddrSet"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>ifAddrSet( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>ifAddrSet( )</strong> - set an interface address for a network interface</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS ifAddrSet ( char * interfaceName, /* name of interface to configure, i.e. ei0 */ char * interfaceAddress /* Internet address to assign to interface */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine assigns an Internet address to a specified network interface.The Internet address can be a host name or a standard Internet addressformat (e.g., 90.0.0.4). If a host name is specified, it should alreadyhave been added to the host table with <b><a href="./hostLib.html#hostAdd">hostAdd</a>( )</b>.<p>A successful call to <b><a href="./ifLib.html#ifAddrSet">ifAddrSet</a>( )</b> results in the addition of a new route.<p>The subnet mask used in determining the network portion of the address willbe that set by <b><a href="./ifLib.html#ifMaskSet">ifMaskSet</a>( )</b>, or the default class mask if <b><a href="./ifLib.html#ifMaskSet">ifMaskSet</a>( )</b> has notbeen called. It is standard practice to call <b><a href="./ifLib.html#ifMaskSet">ifMaskSet</a>( )</b> prior to calling<b><a href="./ifLib.html#ifAddrSet">ifAddrSet</a>( )</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if the interface cannot be set.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ifLib.html#top">ifLib</a></b>, <b><a href="./ifLib.html#ifAddrGet">ifAddrGet</a>( )</b>, <b><a href="./ifLib.html#ifDstAddrSet">ifDstAddrSet</a>( )</b>, <b><a href="./ifLib.html#ifDstAddrGet">ifDstAddrGet</a>( )</b><hr><a name="ifAddrDelete"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>ifAddrDelete( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>ifAddrDelete( )</strong> - delete an interface address for a network interface</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS ifAddrDelete ( char * interfaceName, /* name of interface to delete addr from */ char * interfaceAddress /* Internet address to delete from interface */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine deletes an Internet address from a specified network interface.The Internet address can be a host name or a standard Internet addressformat (e.g., 90.0.0.4). If a host name is specified, it should alreadyhave been added to the host table with <b><a href="./hostLib.html#hostAdd">hostAdd</a>( )</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if the interface cannot be deleted.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ifLib.html#top">ifLib</a></b>, <b><a href="./ifLib.html#ifAddrGet">ifAddrGet</a>( )</b>, <b><a href="./ifLib.html#ifDstAddrSet">ifDstAddrSet</a>( )</b>, <b><a href="./ifLib.html#ifDstAddrGet">ifDstAddrGet</a>( )</b><hr><a name="ifAddrGet"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>ifAddrGet( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>ifAddrGet( )</strong> - get the Internet address of a network interface</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS ifAddrGet ( char * interfaceName, /* name of interface, i.e. ei0 */ char * interfaceAddress /* buffer for Internet address */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine gets the Internet address of a specified network interface andcopies it to <i>interfaceAddress</i>. This pointer should point to a bufferlarge enough to contain <b>INET_ADDR_LEN</b> bytes.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK or ERROR.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ifLib.html#top">ifLib</a></b>, <b><a href="./ifLib.html#ifAddrSet">ifAddrSet</a>( )</b>, <b><a href="./ifLib.html#ifDstAddrSet">ifDstAddrSet</a>( )</b>, <b><a href="./ifLib.html#ifDstAddrGet">ifDstAddrGet</a>( )</b><hr><a name="ifBroadcastSet"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>ifBroadcastSet( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>ifBroadcastSet( )</strong> - set the broadcast address for a network interface</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS ifBroadcastSet ( char * interfaceName, /* name of interface to assign, i.e. ei0 */ char * broadcastAddress /* broadcast address to assign to interface */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine assigns a broadcast address for the specified network interface.The broadcast address must be a string in standard Internet address format(e.g., 90.0.0.0).<p>An interface's default broadcast address is its Internet address with a
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -