亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? interface.c

?? 大名鼎鼎的嵌入式操作系統vxworks的完整的源代碼
?? C
字號:
/* interface.c - DHCP server and relay agent network interface library *//* Copyright 1984 - 2001 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01f,10oct01,rae  fixed modhist line01e,06oct97,spm  split interface name into device name and unit number01d,26aug97,spm  moved routines from common_subr.c not used by DHCP client01c,06may97,spm  changed memory access to align IP header on four byte                 boundary; removed unused timeout variable01b,18apr97,spm  added conditional include DHCPS_DEBUG for displayed output01a,07apr97,spm  created by modifying WIDE project DHCP implementation*//*DESCRIPTIONThis library contains the code used by the DHCP server and relay agents tomonitor one or more network interfaces for incoming DHCP messages. The monitorroutine is triggered on a semaphore given by an Ethernet input hook. Thecorresponding message, read from a pre-allocated ring buffer, identifies theoriginating network interface and the amount of received data. The data itselfis then copied from another ring buffer into a temporary interface-specificbuffer.INCLUDE_FILES: None*//* * WIDE Project DHCP Implementation * Copyright (c) 1995 Akihiro Tominaga * Copyright (c) 1995 WIDE Project * All rights reserved. * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided only with the following * conditions are satisfied: * * 1. Both the copyright notice and this permission notice appear in *    all copies of the software, derivative works or modified versions, *    and any portions thereof, and that both notices appear in *    supporting documentation. * 2. All advertising materials mentioning features or use of this software *    must display the following acknowledgement: *      This product includes software developed by WIDE Project and *      its contributors. * 3. Neither the name of WIDE Project nor the names of its contributors *    may be used to endorse or promote products derived from this software *    without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND WIDE * PROJECT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ALSO, THERE * IS NO WARRANTY IMPLIED OR OTHERWISE, NOR IS SUPPORT PROVIDED. * * Feedback of the results generated from any improvements or * extensions made to this software would be much appreciated. * Any such feedback should be sent to: *  *  Akihiro Tominaga *  WIDE Project *  Keio University, Endo 5322, Kanagawa, Japan *  (E-mail: dhcp-dist@wide.ad.jp) * * WIDE project has the rights to redistribute these changes. */#include "vxWorks.h"#include "ioLib.h" 	/* ioctl() declaration */#include "vxLib.h" 	/* checksum() declaration */#include "sockLib.h"#include "logLib.h"#include "rngLib.h"#include <stdio.h>#include <stdlib.h>#include <fcntl.h>#include <string.h>#include <unistd.h>#include <sys/ioctl.h>#include <sys/socket.h>#include <net/if.h>#include <netinet/in_systm.h>#include <netinet/in.h>#include "dhcp/dhcp.h"#include "dhcp/common.h"#include "dhcp/common_subr.h"/********************************************************************************* open_if - initialize per-interface data structure** This routine sets the IP address and subnet mask entries for each* interface monitored by the DHCP server or relay agent.** RETURNS: 0 if successful, or -1 on error.** ERRNO: N/A** NOMANUAL*/int open_if    (    struct if_info *ifinfo 	/* pointer to interface descriptor */    )    {    int n;    struct ifreq ifreq;    bzero ( (char *)&ifreq, sizeof(ifreq));    sprintf (ifreq.ifr_name, "%s%d", ifinfo->name, ifinfo->unit);    /*     * Initialize the interface information (subnet and IP address).     */    n = socket (AF_INET, SOCK_DGRAM, 0);    if (n < 0)         return (-1);    if (ioctl (n, SIOCGIFNETMASK, (int)&ifreq) < 0)         {#ifdef DHCPS_DEBUG        logMsg("Error: Can't retrieve netmask in open_if().\n",                 0, 0, 0, 0, 0, 0);#endif        close (n);        return (-1);        }    ifinfo->subnetmask.s_addr =                    ( (struct sockaddr_in *)&ifreq.ifr_addr)->sin_addr.s_addr;    if (ioctl(n, SIOCGIFADDR, (int)&ifreq) < 0)         {#ifdef DHCPS_DEBUG        logMsg("Error: can't retrieve address in open_if().\n",                 0, 0, 0, 0, 0, 0);#endif        close (n);        return (-1);        }    ifinfo->ipaddr.s_addr =                     ( (struct sockaddr_in *)&ifreq.ifr_addr)->sin_addr.s_addr;    close(n);    /*     * Store size of preallocated buffer. Offset used to align IP header on      * 4-byte boundary for Sun BSP's.      */    ifinfo->buf_size = DHCP_MSG_SIZE + DHCPS_OFF;    return (0);    }/********************************************************************************* read_interfaces - extract arriving messages from shared buffers** This function waits for the arrival of a DHCP message (extracted by* a BPF device) and copies the message into the private buffer* associated with the receiving interface.** RETURNS: Pointer to data structure of receiving interface, or NULL on error.** ERRNO: N/A** NOMANUAL*/struct if_info * read_interfaces    (    struct if_info *iflist, 	/* pointer to interface descriptors */    int *n, 			/* buffer for actual length of message */    int maxSize 		/* length of (internal) buffer for message */    )    {    struct if_info *ifp = NULL; 	/* descriptor of receiver's interface */    int status; 			/* message extraction results */    fd_set readFds;    int fileNum = 0;    int maxFileNum = 0;    /* Wait for an arriving DHCP message. */    FD_ZERO (&readFds);    ifp = iflist;    while (ifp != NULL)        {        fileNum = ifp->bpfDev;        FD_SET (fileNum, &readFds);        if (fileNum > maxFileNum)            maxFileNum = fileNum;        ifp = ifp->next;        }    maxFileNum++;    /* Adjust maximum for select() routine. */#ifdef DHCPS_DEBUG    logMsg ("DHCP server: waiting for data.\n", 0, 0, 0, 0, 0, 0);#endif    status = select (maxFileNum, &readFds, NULL, NULL, NULL);    if (status <= 0)        return (NULL);#ifdef DHCPS_DEBUG   logMsg ("DHCP server: read_interfaces() received new message.\n",            0, 0, 0, 0, 0, 0);#endif    /* Find the interface descriptor for the first available DHCP message. */    ifp = iflist;    while (ifp != NULL)        {        fileNum = ifp->bpfDev;        if (FD_ISSET (fileNum, &readFds))            break;        ifp = ifp->next;        }   if (ifp == NULL)        {#ifdef DHCPS_DEBUG       logMsg ("Warning: invalid network device in read_interfaces()\n",                0, 0, 0, 0, 0, 0);#endif       return (NULL);       }   status = read (fileNum, ifp->buf, maxSize);   if (status <= 0)       {#ifdef DHCPS_DEBUG       logMsg ("Warning: error reading DHCP message.\n", 0, 0, 0, 0, 0, 0);#endif       return (NULL);       }   *n = status;   return (ifp);   }/********************************************************************************* get_ipsum - retrieve the IP header checksum** This routine fetches the checksum for the given IP header.** RETURNS: Value of checksum in network byte order.** ERRNO:   N/A** NOMANUAL*/u_short get_ipsum    (    struct ip * 	pIph 	/* IP header */    )    {    pIph->ip_sum = 0;#if BSD<44    return (checksum ( (u_short *)pIph, (pIph->ip_v_hl & 0xf) << 2));#else    return (checksum ( (u_short *)pIph, pIph->ip_hl << 2));#endif    }/********************************************************************************* check_ipsum - verify the IP header checksum** This routine retrieves the checksum for the given IP header and compares* it to the received checksum.** RETURNS: TRUE if checksums match, or FALSE otherwise.** ERRNO:   N/A** NOMANUAL*/BOOL check_ipsum    (    struct ip * 	pIph 	/* Received IP header */    )    {    u_short ripcksum;   /* received IP checksum */    ripcksum = pIph->ip_sum;    return (ripcksum == get_ipsum (pIph));    }/********************************************************************************* get_udpsum - retrieve the UDP header checksum** This routine fetches the checksum for a UDP header.** RETURNS: Value of checksum in network byte order.** ERRNO:   N/A** NOMANUAL*/u_short get_udpsum    (    struct ip * 	pIph, 	/* IP header */    struct udphdr * 	pUdph 	/* UDP header */    )    {    struct ps_udph UdpPh;       /* UDP pseudo-header */    bzero ( (char *)&UdpPh, sizeof (UdpPh));    UdpPh.srcip.s_addr = pIph->ip_src.s_addr;    UdpPh.dstip.s_addr = pIph->ip_dst.s_addr;    UdpPh.zero = 0;    UdpPh.prto = IPPROTO_UDP;    UdpPh.ulen = pUdph->uh_ulen;    pUdph->uh_sum = 0;    return (udp_cksum (&UdpPh, (char *)pUdph, ntohs (UdpPh.ulen)));    }/********************************************************************************* check_udpsum - verify the IP header checksum** This routine retrieves the checksum for a UDP header and compares it* to the received checksum.** RETURNS: TRUE if checksums match, or FALSE otherwise.** ERRNO:   N/A** NOMANUAL*/int check_udpsum    (    struct ip * 	pIph, 	/* Received IP header */    struct udphdr * 	pUdph 	/* Received UDP header */    )    {    u_short rudpcksum;  /* received UDP checksum */    if (pUdph->uh_sum == 0)        return(TRUE);    rudpcksum = pUdph->uh_sum;    return (rudpcksum == get_udpsum (pIph, pUdph));    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产精品一区二区www| 成人免费视频在线观看| 久久色视频免费观看| 国产精品毛片高清在线完整版| 亚洲欧美aⅴ...| 免费高清不卡av| 午夜日韩在线电影| 风间由美性色一区二区三区| 欧美视频三区在线播放| 欧美mv日韩mv亚洲| 1024成人网色www| 精品一区二区日韩| 91麻豆国产自产在线观看| 91精品国产欧美一区二区18| 国产精品久久久久久久裸模| 偷拍自拍另类欧美| 日本道精品一区二区三区| 精品国产区一区| 亚洲一卡二卡三卡四卡五卡| 国产精品自拍网站| 日韩欧美三级在线| 日本女人一区二区三区| 99国产精品国产精品久久| 欧美一区二区在线看| 亚洲主播在线观看| 国产成人精品一区二区三区四区 | jizzjizzjizz欧美| 91精品国产综合久久久久| 亚洲国产综合人成综合网站| 91社区在线播放| 亚洲国产精品二十页| 免费久久99精品国产| 精品一区二区三区影院在线午夜 | 美女视频免费一区| 欧美性猛片xxxx免费看久爱| 2020国产精品| 蜜桃av一区二区| 欧美日韩免费高清一区色橹橹 | 国产成人精品亚洲日本在线桃色| 欧美日本在线观看| 亚洲高清在线精品| 91福利精品第一导航| 亚洲欧洲av一区二区三区久久| 国产精品1区二区.| 精品久久国产字幕高潮| 美国一区二区三区在线播放| 欧美优质美女网站| 亚洲国产精品一区二区www | 精品国精品国产| 美腿丝袜亚洲色图| 久久网这里都是精品| 国产精品亚洲综合一区在线观看| 精品国产乱码久久久久久浪潮| 人人精品人人爱| 国产三级精品三级在线专区| 国产成人免费网站| 国产精品美女久久久久aⅴ国产馆| 国产mv日韩mv欧美| 精品91自产拍在线观看一区| 成人av电影在线网| 一区二区不卡在线播放 | 婷婷久久综合九色综合绿巨人| 色一区在线观看| 亚洲免费观看高清完整版在线 | 日韩三级伦理片妻子的秘密按摩| 日本免费新一区视频| 91丨porny丨在线| 美女在线观看视频一区二区| 久久久影院官网| 成人av电影免费在线播放| 国产亚洲成av人在线观看导航 | 欧美在线短视频| 亚洲图片有声小说| 久久久久久久国产精品影院| 99免费精品视频| 天天影视色香欲综合网老头| 欧美成人一区二区三区片免费| 国产另类ts人妖一区二区| 一区二区在线观看av| 丰满岳乱妇一区二区三区| 日韩高清不卡一区二区三区| 国产精品污网站| 日韩欧美在线影院| 91免费看视频| 国产原创一区二区| 午夜欧美电影在线观看| 国产精品美女久久久久久久| 日韩精品一区二区三区在线观看| 色婷婷综合视频在线观看| 国产很黄免费观看久久| 蜜桃91丨九色丨蝌蚪91桃色| 亚洲永久免费视频| 国产精品三级视频| 欧美精品一区二区三区很污很色的 | 成人性生交大合| 老司机午夜精品| 视频一区免费在线观看| 日韩一区有码在线| 中文字幕第一页久久| xvideos.蜜桃一区二区| 91精品国产91久久久久久一区二区 | 亚洲精选免费视频| 国产精品久久久久久一区二区三区| 精品99999| 久久免费美女视频| 久久青草国产手机看片福利盒子| 日韩一级完整毛片| 欧美一级久久久| 欧美日韩第一区日日骚| 欧美日韩综合一区| 在线视频一区二区三| 色偷偷久久人人79超碰人人澡 | 亚洲美女偷拍久久| 亚洲人成网站影音先锋播放| 亚洲欧洲成人精品av97| 亚洲欧洲日韩av| 亚洲视频图片小说| 亚洲激情图片qvod| 天堂在线一区二区| 日本不卡在线视频| 麻豆国产欧美日韩综合精品二区| 免费在线观看视频一区| 黄色日韩网站视频| 高清日韩电视剧大全免费| 成人免费看片app下载| 色综合中文综合网| 国产在线一区二区| 国产乱一区二区| 丁香六月综合激情| 91视频com| 91精品国产免费| 久久久精品人体av艺术| 国产精品毛片无遮挡高清| 有坂深雪av一区二区精品| 亚洲福利视频一区| 麻豆精品在线观看| 成人高清视频免费观看| 欧美三级中文字| 精品国产污网站| 国产精品麻豆视频| 亚洲高清在线视频| 国产麻豆精品95视频| 一本高清dvd不卡在线观看| 欧美日韩色综合| 久久久久成人黄色影片| 一区二区三区在线播放| 热久久国产精品| 不卡高清视频专区| 欧美日韩国产在线播放网站| 精品国产乱码久久久久久浪潮| 亚洲天堂久久久久久久| 男女视频一区二区| av不卡免费电影| 欧美一区二区免费视频| 国产精品久久久久久久蜜臀| 日本一区中文字幕 | 一区二区中文字幕在线| 天天色天天操综合| 国产69精品久久99不卡| 欧美日韩久久久一区| 欧美国产日产图区| 日本怡春院一区二区| 99亚偷拍自图区亚洲| 337p粉嫩大胆噜噜噜噜噜91av| 亚洲免费在线电影| 国产一区二区调教| 91精品国产色综合久久久蜜香臀| 国产精品久99| 国产美女一区二区| 欧美性大战久久久久久久蜜臀| 国产色婷婷亚洲99精品小说| 午夜激情综合网| 色婷婷激情久久| 亚洲国产岛国毛片在线| 日韩av在线播放中文字幕| 91欧美一区二区| 国产亚洲综合性久久久影院| 天堂资源在线中文精品| 在线免费不卡视频| 国产精品久久国产精麻豆99网站| 国产麻豆91精品| 亚洲精品在线三区| 免费欧美日韩国产三级电影| 欧美肥胖老妇做爰| 亚洲美女淫视频| 色先锋久久av资源部| 国产精品剧情在线亚洲| 福利一区福利二区| 国产亚洲精品资源在线26u| 麻豆91小视频| 欧美一级一区二区| 日本一区中文字幕| 日韩视频一区二区三区在线播放| 亚洲成人免费视频| 欧美色国产精品| 亚洲第一综合色| 欧美日韩在线观看一区二区| 亚洲一二三级电影| 5月丁香婷婷综合| 奇米亚洲午夜久久精品|