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

📄 bootplib.c

📁 VXWORKS源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
        cp = bootpTagFind (pBootpReply->bp_vend, TAG_NB_SCOPE, &length);        if (cp != NULL)            {            bcopy ( (char *)cp, pBootpParams->nbScope, length);            pBootpParams->nbScope [length] = EOS;            }        else            pBootpParams->nbScope[0] = EOS;        }        /* Retrieve IP addresses of X Window font servers. */    if (pBootpParams->xFontServers != NULL &&         pBootpParams->xFontServers->addrlist != NULL)        {        length = 0;        limit = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_XFONT_SERVER, &length);        if (cp != NULL)            {            number = length / sizeof (struct in_addr);            limit = (pBootpParams->xFontServers->num < number) ?                     pBootpParams->xFontServers->num : number;            for (loop = 0; loop < limit; loop++)                {                bcopy ( (char *)cp,                       (char *)&pBootpParams->xFontServers->addrlist[loop],                        sizeof (struct in_addr));                cp += sizeof (struct in_addr);                }            }        pBootpParams->xFontServers->num = limit;        }        /* Retrieve IP addresses of X Window Display Manager systems. */    if (pBootpParams->xDisplayManagers != NULL &&         pBootpParams->xDisplayManagers->addrlist != NULL)        {        length = 0;        limit = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_XDISPLAY_MANAGER,                            &length);        if (cp != NULL)            {            number = length / sizeof (struct in_addr);            limit = (pBootpParams->xDisplayManagers->num < number) ?                     pBootpParams->xDisplayManagers->num : number;            for (loop = 0; loop < limit; loop++)                {                bcopy ( (char *)cp,                       (char *)&pBootpParams->xDisplayManagers->addrlist[loop],                       sizeof (struct in_addr));                cp += sizeof (struct in_addr);                }            }        pBootpParams->xDisplayManagers->num = limit;        }        /* Retrieve NIS+ domain name. */    if (pBootpParams->nispDomain != NULL)        {        length = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_NISP_DOMAIN, &length);        if (cp != NULL)            {            bcopy ( (char *)cp, pBootpParams->nispDomain, length);            pBootpParams->nispDomain [length] = EOS;            }        else            pBootpParams->nispDomain[0] = EOS;        }        /* Retrieve IP addresses of NIS+ servers. */    if (pBootpParams->nispServers != NULL &&         pBootpParams->nispServers->addrlist != NULL)        {        length = 0;        limit = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_NISP_SERVER, &length);        if (cp != NULL)            {            number = length / sizeof (struct in_addr);            limit = (pBootpParams->nispServers->num < number) ?                     pBootpParams->nispServers->num : number;            for (loop = 0; loop < limit; loop++)                {                bcopy ( (char *)cp,                       (char *)&pBootpParams->nispServers->addrlist[loop],                        sizeof (struct in_addr));                cp += sizeof (struct in_addr);                }            }        pBootpParams->nispServers->num = limit;        }        /* Retrieve IP addresses of Mobile IP Home Agents. */    if (pBootpParams->ipAgents != NULL &&         pBootpParams->ipAgents->addrlist != NULL)        {        length = 0;        limit = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_MOBILEIP_HA, &length);        if (cp != NULL)            {            number = length / sizeof (struct in_addr);            limit = (pBootpParams->ipAgents->num < number) ?                     pBootpParams->ipAgents->num : number;            for (loop = 0; loop < limit; loop++)                {                bcopy ( (char *)cp,                       (char *)&pBootpParams->ipAgents->addrlist[loop],                        sizeof (struct in_addr));                cp += sizeof (struct in_addr);                }            }        pBootpParams->ipAgents->num = limit;        }        /* Retrieve IP addresses of SMTP servers. */    if (pBootpParams->smtpServers != NULL &&         pBootpParams->smtpServers->addrlist != NULL)        {        length = 0;        limit = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_SMTP_SERVER, &length);        if (cp != NULL)            {            number = length / sizeof (struct in_addr);            limit = (pBootpParams->smtpServers->num < number) ?                     pBootpParams->smtpServers->num : number;            for (loop = 0; loop < limit; loop++)                {                bcopy ( (char *)cp,                       (char *)&pBootpParams->smtpServers->addrlist[loop],                        sizeof (struct in_addr));                cp += sizeof (struct in_addr);                }            }        pBootpParams->smtpServers->num = limit;        }        /* Retrieve IP addresses of POP3 servers. */    if (pBootpParams->pop3Servers != NULL &&         pBootpParams->pop3Servers->addrlist != NULL)        {        length = 0;        limit = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_POP3_SERVER, &length);        if (cp != NULL)            {            number = length / sizeof (struct in_addr);            limit = (pBootpParams->pop3Servers->num < number) ?                     pBootpParams->pop3Servers->num : number;            for (loop = 0; loop < limit; loop++)                {                bcopy ( (char *)cp,                       (char *)&pBootpParams->pop3Servers->addrlist[loop],                        sizeof (struct in_addr));                cp += sizeof (struct in_addr);                }            }        pBootpParams->pop3Servers->num = limit;        }        /* Retrieve IP addresses of NNTP servers. */    if (pBootpParams->nntpServers != NULL &&         pBootpParams->nntpServers->addrlist != NULL)        {        length = 0;        limit = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_NNTP_SERVER, &length);        if (cp != NULL)            {            number = length / sizeof (struct in_addr);            limit = (pBootpParams->nntpServers->num < number) ?                     pBootpParams->nntpServers->num : number;            for (loop = 0; loop < limit; loop++)                {                bcopy ( (char *)cp,                       (char *)&pBootpParams->nntpServers->addrlist[loop],                        sizeof (struct in_addr));                cp += sizeof (struct in_addr);                }            }        pBootpParams->nntpServers->num = limit;        }        /* Retrieve IP addresses of World Wide Web servers. */    if (pBootpParams->wwwServers != NULL &&         pBootpParams->wwwServers->addrlist != NULL)        {        length = 0;        limit = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_WWW_SERVER, &length);        if (cp != NULL)            {            number = length / sizeof (struct in_addr);            limit = (pBootpParams->wwwServers->num < number) ?                     pBootpParams->wwwServers->num : number;            for (loop = 0; loop < limit; loop++)                {                bcopy ( (char *)cp,                       (char *)&pBootpParams->wwwServers->addrlist[loop],                        sizeof (struct in_addr));                cp += sizeof (struct in_addr);                }            }        pBootpParams->wwwServers->num = limit;        }        /* Retrieve IP addresses of finger servers. */    if (pBootpParams->fingerServers != NULL &&         pBootpParams->fingerServers->addrlist != NULL)        {        length = 0;        limit = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_FINGER_SERVER, &length);        if (cp != NULL)            {            number = length / sizeof (struct in_addr);            limit = (pBootpParams->fingerServers->num < number) ?                     pBootpParams->fingerServers->num : number;            for (loop = 0; loop < limit; loop++)                {                bcopy ( (char *)cp,                       (char *)&pBootpParams->fingerServers->addrlist[loop],                        sizeof (struct in_addr));                cp += sizeof (struct in_addr);                }            }        pBootpParams->fingerServers->num = limit;        }        /* Retrieve IP addresses of Internet Relay Chat servers. */    if (pBootpParams->ircServers != NULL &&         pBootpParams->ircServers->addrlist != NULL)        {        length = 0;        limit = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_IRC_SERVER, &length);        if (cp != NULL)            {            number = length / sizeof (struct in_addr);            limit = (pBootpParams->ircServers->num < number) ?                     pBootpParams->ircServers->num : number;            for (loop = 0; loop < limit; loop++)                {                bcopy ( (char *)cp,                       (char *)&pBootpParams->ircServers->addrlist[loop],                        sizeof (struct in_addr));                cp += sizeof (struct in_addr);                }            }        pBootpParams->ircServers->num = limit;        }        /* Retrieve IP addresses of StreetTalk servers. */    if (pBootpParams->stServers != NULL &&         pBootpParams->stServers->addrlist != NULL)        {        length = 0;        limit = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_ST_SERVER, &length);        if (cp != NULL)            {            number = length / sizeof (struct in_addr);            limit = (pBootpParams->stServers->num < number) ?                     pBootpParams->stServers->num : number;            for (loop = 0; loop < limit; loop++)                {                bcopy ( (char *)cp,                       (char *)&pBootpParams->stServers->addrlist[loop],                        sizeof (struct in_addr));                cp += sizeof (struct in_addr);                }            }        pBootpParams->stServers->num = limit;        }        /* Retrieve IP addresses of STDA servers. */    if (pBootpParams->stdaServers != NULL &&         pBootpParams->stdaServers->addrlist != NULL)        {        length = 0;        limit = 0;        cp = bootpTagFind (pBootpReply->bp_vend, TAG_STDA_SERVER, &length);        if (cp != NULL)            {            number = length / sizeof (struct in_addr);            limit = (pBootpParams->stdaServers->num < number) ?                     pBootpParams->stdaServers->num : number;            for (loop = 0; loop < limit; loop++)                {                bcopy ( (char *)cp,                       (char *)&pBootpParams->stdaServers->addrlist[loop],                        sizeof (struct in_addr));                cp += sizeof (struct in_addr);                }            }        pBootpParams->stdaServers->num = limit;        }    return;    }/******************************************************************************** bootpMsgGet - send a BOOTP request message and retrieve reply** This routine sends a BOOTP request using the network interface* specified by <pIf> and waits for any reply. The <pIpDest> argument* specifies the destination IP address.  It must be equal to either* the broadcast address (255.255.255.255) or the IP address of a specific* BOOTP server which is directly reachable using the given network interface.* The given interface must support broadcasting in the first case.** The <srcPort> and <dstPort> arguments support sending and receiving * BOOTP messages with arbitrary UDP ports. To receive replies, any BOOTP* server must send those responses to the source port from the request.* To comply with the RFC 1542 clarification, the request message must be* sent to the reserved BOOTP server port (67) using the reserved BOOTP* client port (68).** Except for the UDP port numbers, this routine only sets the `bp_xid' and* `bp_secs' fields in the outgoing BOOTP message. All other fields in that* message use the values from the <pBootpMsg> argument, which later holds* the contents of any BOOTP reply received.** The <maxSends> parameter specifies the total number of requests to transmit* if no reply is received. The retransmission interval starts at 4 seconds* and doubles with each attempt up to a maximum of 64 seconds. Any subsequent* retransmissions will occur at that maximum interval. To reduce the chances* of network flooding, the timeout interval before each retransmission includes* a randomized delay of plus or minus one second from the base value. After* the final transmission, this routine will wait for the current interval to* expire before returning a timeout error.** NOTE: The target must be able to respond to an ARP request for any IP*       address specified in the request template's `bp_ciaddr' field.** RETURNS: OK, or ERROR.** ERRNO*  S_bootpLib_INVALID_ARGUMENT*  S_bootpLib_NO_BROADCASTS*  S_bootpLib_TIME_OUT*/STATUS bootpMsgGet    (    struct ifnet * 	pIf,          /* network device for message exchange */    struct in_addr *	pIpDest,      /* destination IP address for request */    USHORT		srcPort,      /* UDP source port for request */    USHORT 		dstPort,      /* UDP destination port for request */    BOOTP_MSG *		pBootpMsg,    /* request template and reply storage */    u_int		maxSends      /* maximum number of transmit attemp

⌨️ 快捷键说明

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