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

📄 bootplib.c

📁 VXWORKS源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
        if (cp != NULL)            *pBootpParams->mtuTimeout = ntohs (*(unsigned long *)cp);        else            *pBootpParams->mtuTimeout = 0;        }        /* Retrieve table of MTU sizes. */    if (pBootpParams->mtuTable != NULL &&         pBootpParams->mtuTable->shortlist != NULL)        {        length = 0;        limit = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_MTU_PLATEAU_TABLE,                            &length);        if (cp != NULL)            {            number = length / sizeof (unsigned short);            limit = (pBootpParams->mtuTable->num < number) ?                     pBootpParams->mtuTable->num : number;            for (loop = 0; loop < limit; loop++)                {                pBootpParams->mtuTable->shortlist [loop] =                     ntohs (*(unsigned short *)cp);                cp += sizeof (unsigned short);                }            }        pBootpParams->mtuTable->num = limit;        }        /* Retrieve interface MTU. */    if (pBootpParams->intfaceMTU != NULL)        {        length = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_IF_MTU, &length);        if (cp != NULL)            *pBootpParams->intfaceMTU = ntohs (*(unsigned short *)cp);        else            *pBootpParams->intfaceMTU = 0;        }        /* Retrieve all subnets local option. */    if (pBootpParams->allSubnetsLocal != NULL)        {        length = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_ALL_SUBNET_LOCAL,                            &length);        if (cp != NULL)            *pBootpParams->allSubnetsLocal = *cp;        else            *pBootpParams->allSubnetsLocal = 0;        }        /* Retrieve broadcast IP address. */    if (pBootpParams->broadcastAddr != NULL)        {        length = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_BRDCAST_ADDR, &length);        if (cp != NULL)            bcopy ( (char *) cp, (char *)pBootpParams->broadcastAddr, length);        else            bzero ( (char *)pBootpParams->broadcastAddr,                     sizeof (struct in_addr));        }        /* Retrieve mask discovery option. */    if (pBootpParams->maskDiscover != NULL)        {        length = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_MASK_DISCOVER, &length);        if (cp != NULL)            *pBootpParams->maskDiscover = *cp;        else            *pBootpParams->maskDiscover = 0;        }        /* Retrieve mask supplier option. */    if (pBootpParams->maskSupplier != NULL)        {        length = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_MASK_SUPPLIER, &length);        if (cp != NULL)            *pBootpParams->maskSupplier = *cp;        else            *pBootpParams->maskSupplier = 0;        }        /* Retrieve router discovery option. */    if (pBootpParams->routerDiscover != NULL)        {        length = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_ROUTER_DISCOVER, &length);        if (cp != NULL)            *pBootpParams->routerDiscover = *cp;        else            *pBootpParams->routerDiscover = 0;        }        /* Retrieve IP address for router solicitation. */    if (pBootpParams->routerDiscAddr != NULL)        {        length = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_ROUTER_SOLICIT, &length);        if (cp != NULL)            bcopy ( (char *) cp, (char *)pBootpParams->routerDiscAddr, length);        else            bzero ( (char *)pBootpParams->routerDiscAddr,                    sizeof (struct in_addr));        }        /* Retrieve static routing table. */    if (pBootpParams->staticRoutes != NULL &&         pBootpParams->staticRoutes->addrlist != NULL)        {        length = 0;        limit = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_STATIC_ROUTE, &length);        if (cp != NULL)            {            /* Find number of pairs to retrieve. */            number = length / (2 * sizeof (struct in_addr));            limit = (pBootpParams->staticRoutes->num < number) ?                     pBootpParams->staticRoutes->num : number;            for (loop = 0; loop < limit; loop++)                {                bcopy ( (char *)cp,                       (char *)&pBootpParams->staticRoutes->addrlist[2 * loop],                       2 * sizeof (struct in_addr));                cp += 2 * sizeof (struct in_addr);                }            }        pBootpParams->staticRoutes->num = limit;        }        /* Retrieve ARP trailer encapsulation option. */    if (pBootpParams->arpTrailers != NULL)        {        length = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_TRAILER, &length);        if (cp != NULL)            *pBootpParams->arpTrailers = *cp;        else            *pBootpParams->arpTrailers = 0;        }        /* Retrieve value for ARP cache timeout. */    if (pBootpParams->arpTimeout != NULL)        {        length = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_ARP_CACHE_TIMEOUT,                            &length);        if (cp != NULL)            *pBootpParams->arpTimeout = ntohs (*(unsigned long *)cp);        else            *pBootpParams->arpTimeout = 0;        }        /* Retrieve Ethernet encapsulation option. */    if (pBootpParams->etherPacketType != NULL)        {        length = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_ETHER_ENCAP, &length);        if (cp != NULL)            *pBootpParams->etherPacketType = *cp;        else            *pBootpParams->etherPacketType = 0;        }        /* Retrieve default TCP time-to-live value. */    if (pBootpParams->tcpTTL != NULL)        {        length = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_DEFAULT_TCP_TTL, &length);        if (cp != NULL)            *pBootpParams->tcpTTL = *cp;        else            *pBootpParams->tcpTTL = 0;        }        /* Retrieve value for TCP keepalive interval. */    if (pBootpParams->tcpInterval != NULL)        {        length = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_KEEPALIVE_INTER, &length);        if (cp != NULL)            *pBootpParams->tcpInterval = ntohs (*(unsigned long *)cp);        else            *pBootpParams->tcpInterval = 0;        }        /* Retrieve value for TCP keepalive garbage option. */    if (pBootpParams->tcpGarbage != NULL)        {        length = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_KEEPALIVE_GARBA, &length);        if (cp != NULL)            *pBootpParams->tcpGarbage = *cp;        else            *pBootpParams->tcpGarbage = 0;        }        /* Retrieve NIS domain name. */    if (pBootpParams->nisDomain != NULL)        {        length = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_NIS_DOMAIN, &length);        if (cp != NULL)            {            bcopy ( (char *)cp, pBootpParams->nisDomain, length);            pBootpParams->nisDomain [length] = EOS;            }        else            pBootpParams->nisDomain[0] = EOS;        }        /* Retrieve IP addresses of NIS servers, up to number requested. */    if (pBootpParams->nisServers != NULL &&         pBootpParams->nisServers->addrlist != NULL)        {        length = 0;        limit = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_NIS_SERVER, &length);        if (cp != NULL)            {            number = length / sizeof (struct in_addr);            limit = (pBootpParams->nisServers->num < number) ?                     pBootpParams->nisServers->num : number;            for (loop = 0; loop < limit; loop++)                {                bcopy ( (char *)cp,                       (char *)&pBootpParams->nisServers->addrlist[loop],                        sizeof (struct in_addr));                cp += sizeof (struct in_addr);                }            }        pBootpParams->nisServers->num = limit;        }        /* Retrieve IP addresses of NTP servers, up to number requested. */    if (pBootpParams->ntpServers != NULL &&         pBootpParams->ntpServers->addrlist != NULL)        {        length = 0;        limit = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_NTP_SERVER, &length);        if (cp != NULL)            {            number = length / sizeof (struct in_addr);            limit = (pBootpParams->ntpServers->num < number) ?                     pBootpParams->ntpServers->num : number;            for (loop = 0; loop < limit; loop++)                {                bcopy ( (char *)cp,                       (char *)&pBootpParams->ntpServers->addrlist[loop],                        sizeof (struct in_addr));                cp += sizeof (struct in_addr);                }            }        pBootpParams->ntpServers->num = limit;        }        /* Retrieve vendor specific information. */    if (pBootpParams->vendString != NULL)        {        length = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_VENDOR_SPEC, &length);        if (cp != NULL)            {            bcopy ( (char *)cp, pBootpParams->vendString, length);            pBootpParams->vendString [length] = EOS;            }        else            pBootpParams->vendString[0] = EOS;        }        /* Retrieve IP addresses of NetBIOS name servers. */    if (pBootpParams->nbnServers != NULL &&         pBootpParams->nbnServers->addrlist != NULL)        {        length = 0;        limit = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_NBN_SERVER, &length);        if (cp != NULL)            {            number = length / sizeof (struct in_addr);            limit = (pBootpParams->nbnServers->num < number) ?                     pBootpParams->nbnServers->num : number;            for (loop = 0; loop < limit; loop++)                {                bcopy ( (char *)cp,                       (char *)&pBootpParams->nbnServers->addrlist[loop],                        sizeof (struct in_addr));                cp += sizeof (struct in_addr);                }            }        pBootpParams->nbnServers->num = limit;        }        /* Retrieve IP addresses of NetBIOS datagram distribution servers. */    if (pBootpParams->nbddServers != NULL &&         pBootpParams->nbddServers->addrlist != NULL)        {        length = 0;        limit = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_NBDD_SERVER, &length);        if (cp != NULL)            {            number = length / sizeof (struct in_addr);            limit = (pBootpParams->nbddServers->num < number) ?                     pBootpParams->nbddServers->num : number;            for (loop = 0; loop < limit; loop++)                {                bcopy ( (char *)cp,                       (char *)&pBootpParams->nbddServers->addrlist[loop],                        sizeof (struct in_addr));                cp += sizeof (struct in_addr);                }            }        pBootpParams->nbddServers->num = limit;        }        /* Retrieve value for NetBIOS Node Type option. */    if (pBootpParams->nbNodeType != NULL)        {        length = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_NB_NODETYPE, &length);        if (cp != NULL)            *pBootpParams->nbNodeType = *cp;        else            *pBootpParams->nbNodeType = 0;        }        /* Retrieve NetBIOS scope. */    if (pBootpParams->nbScope != NULL)        {        length = 0;

⌨️ 快捷键说明

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