📄 bootplib.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/bootpLib.html - generated by refgen from bootpLib.c --> <title> bootpLib </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>bootpLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>bootpLib</strong> - BOOTP client library </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><i><a href="./bootpLib.html#bootpParamsGet">bootpParamsGet</a></i>( )</b> - retrieve boot parameters using BOOTP<br><b><i><a href="./bootpLib.html#bootpMsgSend">bootpMsgSend</a></i>( )</b> - send a BOOTP request message<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library implements the client side of the Bootstrap Protocol(BOOTP). This network protocol allows the dynamic configuration of the target's boot parameters at boot time. This is in contrast to using the boot information encoded in system non-volatile RAM or ROM. Thus, at boot time, BOOTP goes over the network to get an IP address, a boot file name, and the boot host's IP address. <p>The actual transfer of the boot image is handled by a file transfer protocol, such as TFTP or FTP, or by an RSH command.<p>To access BOOTP services, you can use either the high-level interfacesupported by <b><i><a href="./bootpLib.html#bootpParamsGet">bootpParamsGet</a></i>( )</b>, or the low-level interface supportedby <b><i><a href="./bootpLib.html#bootpMsgSend">bootpMsgSend</a></i>( )</b>.<p></blockquote><h4>HIGH-LEVEL INTERFACE</h4><blockquote><p>The <b><i><a href="./bootpLib.html#bootpParamsGet">bootpParamsGet</a></i>( )</b> routine provides the highest level interface to BOOTP. It accepts a parameter descriptor structure that allows the retrieval of any combination of the options described in RFC 1533 (if supported by the BOOTP server and if specified in the database). During system boot, the routine obtains the boot file, the Internet address, and the host Internet address. It also obtains the subnet mask and the Internet address of an IP router, if available.<p></blockquote><h4>LOW-LEVEL INTERFACE</h4><blockquote><p>The <b><i><a href="./bootpLib.html#bootpMsgSend">bootpMsgSend</a></i>( )</b> routine provides a lower-level interface to BOOTP. It accepts and returns a BOOTP message as a parameter. This interface is moreflexible because it gives the caller direct access to the data in theBOOTP request/reply messages. For example, if the BOOTP message includes implementation-specific options not defined in an RFC, the caller canuse <b><i><a href="./bootpLib.html#bootpMsgSend">bootpMsgSend</a></i>( )</b> to retrieve them from the vendor-specific field in the BOOTP message. The <b><i><a href="./bootpLib.html#bootpParamsGet">bootpParamsGet</a></i>( )</b> routine already provides all defined options.<p></blockquote><h4>EXAMPLE</h4><blockquote><p>The following code provides and example of how to use <b><i><a href="./bootpLib.html#bootpParamsGet">bootpParamsGet</a></i>( )</b>: <pre> #include "bootpLib.h" struct bootpParams bootParams; struct in_addr clntAddr; struct in_addr hostAddr; char bootFile [FILENAME_SIZE]; int subnetMask; struct in_addr_list routerList; struct in_addr gateway; char clntAddr [INET_ADDR_LEN]; char bootServer [INET_ADDR_LEN]; char bootFile [SIZE_FILE]; int fileSize; int subnetMask; char gateway [INET_ADDR_LEN]; bzero ( (char *)&clntAddr, sizeof (struct in_addr)); bzero ( (char *)&hostAddr, sizeof (struct in_addr)); bzero (bootFile, FILENAME_SIZE); subnetMask = 0; bzero ( (char *)&gateway, sizeof (struct in_addr)); /* Set all pointers in parameter descriptor to NULL. */ bzero ((char *)&bootParams, sizeof (struct bootpParams)); /* Set pointers corresponding to desired options. */ bootParams.clientAddr = &clntAddr; bootParams.bootHostAddr = &hostAddr; bootParams.bootfile = pBootFile; bootParams.netmask = (struct in_addr *)&subnetMask; routerlist.addr = &gateway; routerlist.num = 1; bootParams.routers = &routerlist; if (bootpParamsGet ("ln0", 0, 0, &bootParams) == ERROR) return (ERROR);</pre></blockquote><h4>NOTE</h4><blockquote><p>Certain targets (typically those with no NVRAM) construct their Ethernet address based on the target's IP address. An IP addressmust be entered for these targets in order to boot over the network.The remaining information can be obtained with BOOTP.<p>BOOTP is not supported over the following network interfaces: if_sl (SLIP) and if_ie (Sun IE driver).if_sl (SLIP) and if_ppp (PPP).<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>bootpLib.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./bootLib.html#top">bootLib</a></b>, RFC 951, RFC 1542, RFC 1533, <i>VxWorks Programmer's Guide: Network</i><p><hr><a name="bootpParamsGet"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>bootpParamsGet</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>bootpParamsGet</i>( )</strong> - retrieve boot parameters using BOOTP</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS bootpParamsGet ( char * ifName, /* network interface name */ int port, /* optional port number */ u_int timeOut, /* timeout in ticks */ struct bootpParams * pBootpParams /* parameters descriptor */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine transmits a BOOTP request message over the network interfaceassociated with <i>ifName</i>. This interface must already be attached andinitialized prior to calling this routine.<p>A non-zero value for <i>port</i> specifies an alternate BOOTP server port.A zero value means the default BOOTP server port (67).<p><i>timeOut</i> specifies a timeout value in ticks. If no reply is received within this period, an error is returned. Specify zero for an infinite<i>timeout</i> value.<p><i>pBootpParams</i> is a structure pointer to a <b>bootpParams</b> structure thatyou can use to indicate the parameters of interest to you. The <b>bootpParams</b> structure is defined as follows:<p><pre> struct bootpParams { struct in_addr * clientAddr; struct in_addr * bootHostAddr; char * bootfile; char * serverName; struct in_addr * netmask; unsigned short * timeOffset; struct in_addr_list * routers; struct in_addr_list * timeServers; struct in_addr_list * nameServers; struct in_addr_list * dnsServers; struct in_addr_list * logServers; struct in_addr_list * cookieServers; struct in_addr_list * lprServers; struct in_addr_list * impressServers; struct in_addr_list * rlpServers; char * clientName; unsigned short * filesize; char * dumpfile; char * domainName; struct in_addr * swapServer; char * rootPath; char * extoptPath; unsigned char * ipForward; unsigned char * nonlocalSourceRoute; struct in_addr_list * policyFilter; unsigned short * maxDgramSize; unsigned char * ipTTL; unsigned long * mtuTimeout; struct ushort_list * mtuTable;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -