⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c-netconfig2.html

📁 vxworks相关论文
💻 HTML
📖 第 1 页 / 共 3 页
字号:
</dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="88150">Configuring the Supported DHCP Server</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="88152"> </a>Configuring the supported (target-resident) DHCP server involves setting appropriate values for certain configuration macros. For more information on configuring VxWorks, see the <i class="title">Tornado User's Guide: Projects</i>.  The relevant configuration macros are those in the following list:</p></dl><dl class="margin"><dd><div class="Item"><a name="88154"> </a>DHCP Server Lease Storage Routine<b class="symbol_UC">  </b></div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="91055"> </a>Default: None. This constant specifies the name of the routine that handles non-volatile storage of the active leases. For more information, see <a href="c-netconfig2.html#88226"><i class="title">Storing and Retrieving Active Network Configurations</i></a>. (Configuration constant: <b class="symbol_UC">DHCPS_LEASE_HOOK</b>)</div><br></dl></dl><dd><div class="Item"><a name="88160"> </a>DHCP Server Address Storage Routine<b class="symbol_UC">  </b></div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="91058"> </a>Default: None. This constant specifies the name of an optional storage routine. For more information, see <a href="c-netconfig2.html#88226"><i class="title">Storing and Retrieving Active Network Configurations</i></a>.  (Configuration constant: <b class="symbol_UC">DHCPS_ADDRESS_HOOK</b>)</div><br></dl></dl><dd><div class="Item"><a name="88166"> </a>DHCP Server Standard Lease Length<b class="symbol_UC"> </b></div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="88167"> </a>Default: 3600. This constant specifies the default lease length in seconds. This value applies if no explicit value is set in the address pool.   (Configuration constant: <b class="symbol_UC">DHCPS_DEFAULT_LEASE</b>)</div><br></dl></dl><dd><div class="Item"><a name="88169"> </a><b class="symbol_UC">DHCPS_MAX_LEASE  </b></div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="91060"> </a>Default: 3600. This constant specifies the maximum lease length in seconds. This value applies if no explicit value is set in the address pool. </div><br></dl></dl><dd><div class="Item"><a name="88172"> </a>DHCP Server/Relay Agent Network Radius<b class="symbol_UC">  </b></div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="91062"> </a>Default: 4. This value limits the number of subnets that a DHCP message can cross (prevents network flooding). The maximum valid value is 16. (Configuration constant: <b class="symbol_UC">DHCP_MAX_HOPS</b>)</div><br></dl></dl><dd><div class="Item"><a name="88175"> </a>DHCP Server/Relay Agent Host Port<b class="symbol_UC">  </b></div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="91064"> </a>Default: 67. This value specifies the port monitored by DHCP servers. (Configuration constant: <b class="symbol_UC">DHCP_SPORT</b>)</div><br></dl></dl><dd><div class="Item"><a name="88178"> </a>DHCP Server/Relay Agent Target Port<b class="symbol_UC"> </b></div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="91066"> </a>Default: 68. This value specifies the port monitored by DHCP clients. (Configuration constant: <b class="symbol_UC">DHCPS_CPORT</b>)</div><br></dl></dl></dl><dl class="margin"><dd><p class="Body"><a name="88180"> </a>To determine its initial configuration data, the supported DHCP server uses the <b class="symbol_lc">dhcpsLeaseTbl</b> structure defined in <b class="file">usrNetwork.c</b>. This structure describes the server's pool of network configuration parameter sets. It has the following format: </p><dl class="margin"><dd><pre class="Code2"><b><a name="88182">DHCPS_LEASE_DESC&nbsp;dhcpsLeaseTbl&nbsp;[]&nbsp;= &nbsp;&nbsp;&nbsp;&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;/* {"Name",&nbsp;"Start&nbsp;IP",&nbsp;"End&nbsp;IP",&nbsp;"parameters"} */  &nbsp;&nbsp;&nbsp;&nbsp;{"dflt",&nbsp;NULL,&nbsp;NULL,&nbsp;DHCPS_DEFAULT_ENTRY},  &nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Sample&nbsp;database&nbsp;entries.&nbsp;*/  /*&nbsp;&nbsp;{"ent1",&nbsp;"90.11.42.24",&nbsp;"90.11.42.24",&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"clid=\"1:0x08003D21FE90\":maxl=90:dfl&nbsp;l=60"},&nbsp;&nbsp;&nbsp;*/  /*&nbsp;&nbsp;{"ent2",&nbsp;"90.11.42.25",&nbsp;"90.11.42.26",&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"snmk=255.255.255.0:maxl=90:dfll=70:file=/vxWorks"},*/  /*&nbsp;&nbsp;{"ent3",&nbsp;"90.11.42.27",&nbsp;"90.11.42.27",&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"maxl=0xffffffff:file=/vxWorks"},&nbsp;*/  /*&nbsp;&nbsp;{"entry4",&nbsp;"90.11.42.28",&nbsp;"90.11.42.29",&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"albp=true:file=/vxWorks"}&nbsp;*/  &nbsp;&nbsp;&nbsp;&nbsp;};</a></b></pre></dl><dd><p class="Body"><a name="88203"> </a>Each entry in this lease table must include an unique entry name of up to eight characters and an IP address range for assignment to requesting clients. The parameters field contains a colon-separated list of optional parameters for inclusion in the DHCP server's response. If subnetting is in effect, a critical entry in the parameters field is the subnet mask (<b>snmk</b>). The server does not issue addresses to clients which would change their current subnet. The address pool must specify a correct subnet mask if the default class-based mask is not valid.</p><dd><p class="Body"><a name="88204"> </a>A complete description of the parameters field is found in the manual pages for the DHCP server. Any parameters not specified take default values according to the Host Requirements Documents (RFC 1122 and 1123). The server can also read additional entries from an optional storage hook (discussed below). </p><dd><p class="Body"><a name="88207"> </a>The sample entries shown above demonstrate the possible server-issued lease types: </p></dl><dl class="margin"><dd><div class="Item"><a name="88208"> </a><b class="symbol_lc">clid</b> </div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="88209"> </a>Indicates that this is a manual lease. Such a lease is issued only to the client with the matching <b class="symbol_lc">type:id</b> pair. The address range for these entries must specify a single IP address. The sample shown for "ent1" uses the hardware address which the supported DHCP client uses for an identifier. </div><br></dl></dl><dd><div class="Item"><a name="88210"> </a><b class="symbol_lc">maxl</b> </div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="88211"> </a>Indicates that this lease is dynamic. This parameter specifies the maximum lease duration granted to any requesting client. The automatic lease illustrated in the third sample entry is implied by the assignment of an infinite value for <b class="symbol_lc">maxl</b>.  </div><br></dl></dl><dd><div class="Item"><a name="88212"> </a><b class="symbol_lc">albp</b></div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="88213"> </a>Indicates a special type of automatic lease. Setting the <b class="symbol_lc">albp</b> parameter to true in the fourth entry marks this lease as suitable for BOOTP clients that contact this DHCP server. </div><br></dl></dl></dl><dl class="margin"><dd><p class="Body"><a name="88214"> </a>The lease type is used by the server to select one of the three supported mechanisms for IP address allocation. With manual allocation, DHCP simply conveys the related manual lease to the client. If dynamic allocation is used, the protocol assigns one of the dynamic leases to the client for a finite period. Automatic allocation assigns a permanent IP address from the corresponding automatic leases. </p><dd><p class="Body"><a name="88215"> </a>Dynamic allocation is the only method that allows reuse of addresses. The allocation type defines the priority for assigning an IP address to a DHCP client. Manual allocations have the highest priority, and automatic allocations the lowest. Among automatic leases, configurations which are available only to DHCP clients are preferred.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="88217">Adding Entries to the Database of a Running DHCP Server</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="88219"> </a>After the server has started, use the following routine to add new entries to the lease database:</p><dl class="margin"><dd><pre class="Code2"><b><a name="88220">STATUS&nbsp;dhcpsLeaseEntryAdd &nbsp;&nbsp;&nbsp;&nbsp;( &nbsp;&nbsp;&nbsp;&nbsp;char&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pName,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Name&nbsp;of&nbsp;lease&nbsp;entry.&nbsp;*/ &nbsp;&nbsp;&nbsp;&nbsp;char&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pStartIp,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;First&nbsp;IP&nbsp;address&nbsp;to&nbsp;assign.&nbsp;*/ &nbsp;&nbsp;&nbsp;&nbsp;char&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pEndIp,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Last&nbsp;IP&nbsp;address&nbsp;in&nbsp;assignment&nbsp;range.&nbsp;*/ &nbsp;&nbsp;&nbsp;&nbsp;char&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pParams&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Formatted&nbsp;string&nbsp;of&nbsp;lease&nbsp;parameters.&nbsp;*/ &nbsp;&nbsp;&nbsp;&nbsp;)</a></b></pre></dl><dd><p class="Body"><a name="88222"> </a>As input, <b class="routine"><i class="routine">dhcpsLeaseEntryAdd</i></b><b>(&nbsp;)</b>expects to receive an entry name, starting and ending IP addresses for assignment to clients, and a formatted string containing lease parameters. If the entry is added successfully, the routine returns OK, or ERROR otherwise. This routine allows expansion of the address pool without rebuilding the VxWorks image whenever new entries are needed. If you provide an appropriate  storage hook, these entries are preserved across server restarts.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="88226">Storing and Retrieving Active Network Configurations </a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="88228"> </a>To store and retrieve network configuration information, you need to implement an address storage routine and a lease storage routine. The lease storage routine uses the prototype:</p><dl class="margin"><dd><pre class="Code2"><b><a name="88230">STATUS dhcpsLeaseStorageHook     (     int op,             /* requested storage operation */     char *pBuffer,      /* memory location for record of active lease */     int dataLen         /* amount of lease record data */     )</a></b></pre></dl></dl></dl><dl class="margin"><dd><p class="table" callout><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><br><img border="0" alt="*" src="icons/caution.gif"></td><td><hr><div class="CalloutCell"><a name="93497"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">CAUTION:  </font></b></a>Not providing the storage routine could cause DHCP to fail.</div></td></tr><tr valign="top"><td></td><td><hr></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p callout><dl class="margin"><dd><p class="Body"><a name="88232"> </a>Your lease storage routine must store and retrieve active network configurations. To install the routine you created, configure VxWorks with the DHCP Server Lease Storage Routine  set to a string containing the  routine name. The relevant configuration macro is <b class="symbol_UC">DHCPS_LEASE_HOOK</b>. </p><dd><p class="Body"><a name="88235"> </a>The address storage routine uses the following prototype:</p><dl class="margin"><dd><pre class="Code2"><b><a name="93266">STATUS dhcpsAddressStorageHook     (     int         op,             /* requested storage operation */     char *      pName,          /* name of address pool entry */     char *      pStartIp,       /* first IP address in range */     char *      pEndIp,         /* last IP address in range */     char *      pParams         /* lease parameters for each address */     )</a></b></pre></dl><dd><p class="Body"><a name="88239"> </a>Your address storage routine (optional) stores and retrieves additional address-pool entries using <b class="routine"><i class="routine">dhcpsLeaseEntryAdd</i></b><b>(&nbsp;)</b>. To preserve these entries, configure VxWorks with the DHCP Server Address Storage Routine  set to the name of the storage routine.  The relevant configuration macro is <b class="symbol_UC">DHCPS_ADDRESS_HOOK</b>.  If this configuration is not done, active leases using alternate entries are not renewed when the server is restarted. </p>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -