📄 bootplib.c
字号:
limit = (pBootpParams->timeServers->num < number) ? pBootpParams->timeServers->num : number; for (loop = 0; loop < limit; loop++) { bcopy ( (char *)cp, (char *)&pBootpParams->timeServers->addrlist[loop], sizeof (struct in_addr)); cp += sizeof (struct in_addr); } } pBootpParams->timeServers->num = limit; } /* Retrieve IP addresses of name servers, up to number requested. */ if (pBootpParams->nameServers != NULL && pBootpParams->nameServers->addrlist != NULL) { length = 0; limit = 0; cp = bootpTagFind (pBootpReply->bp_vend, TAG_NAME_SERVER, &length); if (cp != NULL) { number = length / sizeof (struct in_addr); limit = (pBootpParams->nameServers->num < number) ? pBootpParams->nameServers->num : number; for (loop = 0; loop < limit; loop++) { bcopy ( (char *)cp, (char *)&pBootpParams->nameServers->addrlist[loop], sizeof (struct in_addr)); cp += sizeof (struct in_addr); } } pBootpParams->nameServers->num = limit; } /* Retrieve IP addresses of DNS servers, up to number requested. */ if (pBootpParams->dnsServers != NULL && pBootpParams->dnsServers->addrlist != NULL) { length = 0; limit = 0; cp = bootpTagFind (pBootpReply->bp_vend, TAG_DNS_SERVER, &length); if (cp != NULL) { number = length / sizeof (struct in_addr); limit = (pBootpParams->dnsServers->num < number) ? pBootpParams->dnsServers->num : number; for (loop = 0; loop < limit; loop++) { bcopy ( (char *)cp, (char *)&pBootpParams->dnsServers->addrlist[loop], sizeof (struct in_addr)); cp += sizeof (struct in_addr); } } pBootpParams->dnsServers->num = limit; } /* Retrieve IP addresses of log servers, up to number requested. */ if (pBootpParams->logServers != NULL && pBootpParams->logServers->addrlist != NULL) { length = 0; limit = 0; cp = bootpTagFind (pBootpReply->bp_vend, TAG_LOG_SERVER, &length); if (cp != NULL) { number = length / sizeof (struct in_addr); limit = (pBootpParams->logServers->num < number) ? pBootpParams->logServers->num : number; for (loop = 0; loop < limit; loop++) { bcopy ( (char *)cp, (char *)&pBootpParams->logServers->addrlist[loop], sizeof (struct in_addr)); cp += sizeof (struct in_addr); } } pBootpParams->logServers->num = limit; } /* Retrieve IP addresses of cookie servers, up to number requested. */ if (pBootpParams->cookieServers != NULL && pBootpParams->cookieServers->addrlist != NULL) { length = 0; limit = 0; cp = bootpTagFind (pBootpReply->bp_vend, TAG_COOKIE_SERVER, &length); if (cp != NULL) { number = length / sizeof (struct in_addr); limit = (pBootpParams->cookieServers->num < number) ? pBootpParams->cookieServers->num : number; for (loop = 0; loop < limit; loop++) { bcopy ( (char *)cp, (char *)&pBootpParams->cookieServers->addrlist[loop], sizeof (struct in_addr)); cp += sizeof (struct in_addr); } } pBootpParams->cookieServers->num = limit; } /* Retrieve IP addresses of LPR servers, up to number requested. */ if (pBootpParams->lprServers != NULL && pBootpParams->lprServers->addrlist != NULL) { length = 0; limit = 0; cp = bootpTagFind (pBootpReply->bp_vend, TAG_LPR_SERVER, &length); if (cp != NULL) { number = length / sizeof (struct in_addr); limit = (pBootpParams->lprServers->num < number) ? pBootpParams->lprServers->num : number; for (loop = 0; loop < limit; loop++) { bcopy ( (char *)cp, (char *)&pBootpParams->lprServers->addrlist[loop], sizeof (struct in_addr)); cp += sizeof (struct in_addr); } } pBootpParams->lprServers->num = limit; } /* Retrieve IP addresses of Impress servers, up to number requested. */ if (pBootpParams->impressServers != NULL && pBootpParams->impressServers->addrlist != NULL) { length = 0; limit = 0; cp = bootpTagFind (pBootpReply->bp_vend, TAG_IMPRESS_SERVER, &length); if (cp != NULL) { number = length / sizeof (struct in_addr); limit = (pBootpParams->impressServers->num < number) ? pBootpParams->impressServers->num : number; for (loop = 0; loop < limit; loop++) { bcopy ( (char *)cp, (char *)&pBootpParams->impressServers->addrlist[loop], sizeof (struct in_addr)); cp += sizeof (struct in_addr); } } pBootpParams->impressServers->num = limit; } /* Retrieve IP addresses of RLP servers, up to number requested. */ if (pBootpParams->rlpServers != NULL && pBootpParams->rlpServers->addrlist != NULL) { length = 0; limit = 0; cp = bootpTagFind (pBootpReply->bp_vend, TAG_RLP_SERVER, &length); if (cp != NULL) { number = length / sizeof (struct in_addr); limit = (pBootpParams->rlpServers->num < number) ? pBootpParams->rlpServers->num : number; for (loop = 0; loop < limit; loop++) { bcopy ( (char *)cp, (char *)&pBootpParams->rlpServers->addrlist[loop], sizeof (struct in_addr)); cp += sizeof (struct in_addr); } } pBootpParams->rlpServers->num = limit; } /* Retrieve hostname of client. */ if (pBootpParams->clientName != NULL) { length = 0; cp = bootpTagFind (pBootpReply->bp_vend, TAG_HOSTNAME, &length); if (cp != NULL) { bcopy ( (char *)cp, pBootpParams->clientName, length); pBootpParams->clientName [length] = EOS; } else pBootpParams->clientName[0] = EOS; } /* Retrieve size of boot file. */ if (pBootpParams->filesize != NULL) { length = 0; cp = bootpTagFind (pBootpReply->bp_vend, TAG_BOOTSIZE, &length); if (cp != NULL) *pBootpParams->filesize = ntohs (*(unsigned short *)cp); else *pBootpParams->filesize = 0; } /* Retrieve name of dump file. */ if (pBootpParams->dumpfile != NULL) { length = 0; cp = bootpTagFind (pBootpReply->bp_vend, TAG_MERIT_DUMP, &length); if (cp != NULL) { bcopy ( (char *)cp, pBootpParams->dumpfile, length); pBootpParams->dumpfile [length] = EOS; } else pBootpParams->dumpfile[0] = EOS; } /* Retrieve name of DNS domain. */ if (pBootpParams->domainName != NULL) { length = 0; cp = bootpTagFind (pBootpReply->bp_vend, TAG_DNS_DOMAIN, &length); if (cp != NULL) { bcopy ( (char *)cp, pBootpParams->domainName, length); pBootpParams->domainName [length] = EOS; } else pBootpParams->domainName[0] = EOS; } /* Retrieve IP address of swap server. */ if (pBootpParams->swapServer != NULL) { length = 0; cp = bootpTagFind (pBootpReply->bp_vend, TAG_SWAP_SERVER, &length); if (cp != NULL) bcopy ( (char *)cp, (char *)pBootpParams->swapServer, length); else bzero ( (char *)pBootpParams->swapServer, sizeof (struct in_addr)); } /* Retrieve pathname of root disk. */ if (pBootpParams->rootPath != NULL) { length = 0; cp = bootpTagFind (pBootpReply->bp_vend, TAG_ROOT_PATH, &length); if (cp != NULL) { bcopy ( (char *)cp, pBootpParams->rootPath, length); pBootpParams->rootPath [length] = EOS; } else pBootpParams->rootPath[0] = EOS; } /* Retrieve pathname of extended options file. */ if (pBootpParams->extoptPath != NULL) { length = 0; cp = bootpTagFind (pBootpReply->bp_vend, TAG_EXTENSIONS_PATH, &length); if (cp != NULL) { bcopy ( (char *)cp, pBootpParams->extoptPath, length); pBootpParams->extoptPath [length] = EOS; } else pBootpParams->extoptPath[0] = EOS; } /* Retrieve IP forwarding option. */ if (pBootpParams->ipForward != NULL) { length = 0; cp = bootpTagFind (pBootpReply->bp_vend, TAG_IP_FORWARD, &length); if (cp != NULL) *pBootpParams->ipForward = *cp; else *pBootpParams->ipForward = 0; } /* Retrieve non-local source routing option. */ if (pBootpParams->nonlocalSourceRoute != NULL) { length = 0; cp = bootpTagFind (pBootpReply->bp_vend, TAG_NONLOCAL_SRCROUTE, &length); if (cp != NULL) *pBootpParams->nonlocalSourceRoute = *cp; else *pBootpParams->nonlocalSourceRoute = 0; } /* Retrieve IP addresses and masks for policy filter option. */ if (pBootpParams->policyFilter != NULL && pBootpParams->policyFilter->addrlist != NULL) { length = 0; limit = 0; cp = bootpTagFind (pBootpReply->bp_vend, TAG_POLICY_FILTER, &length); if (cp != NULL) { /* Find number of pairs to retrieve. */ number = length / (2 * sizeof (struct in_addr)); limit = (pBootpParams->policyFilter->num < number) ? pBootpParams->policyFilter->num : number; for (loop = 0; loop < limit; loop++) { bcopy ( (char *)cp, (char *)&pBootpParams->policyFilter->addrlist[2 * loop], 2 * sizeof (struct in_addr)); cp += 2 * sizeof (struct in_addr); } } pBootpParams->policyFilter->num = limit; } /* Retrieve size of maximum IP datagram. */ if (pBootpParams->maxDgramSize != NULL) { length = 0; cp = bootpTagFind (pBootpReply->bp_vend, TAG_MAX_DGRAM_SIZE, &length); if (cp != NULL) *pBootpParams->maxDgramSize = ntohs (*(unsigned short *)cp); else *pBootpParams->maxDgramSize = 0; } /* Retrieve default IP time-to-live value. */ if (pBootpParams->ipTTL != NULL) { length = 0; cp = bootpTagFind (pBootpReply->bp_vend, TAG_DEFAULT_IP_TTL, &length); if (cp != NULL) *pBootpParams->ipTTL = *cp; else *pBootpParams->ipTTL = 0; } /* Retrieve value for path MTU aging timeout. */ if (pBootpParams->mtuTimeout != NULL) { length = 0; cp = bootpTagFind (pBootpReply->bp_vend, TAG_MTU_AGING_TIMEOUT, &length);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -