亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
综合欧美亚洲日本| 久久综合久久鬼色中文字| 五月天网站亚洲| 欧美—级在线免费片| av在线不卡电影| 天堂一区二区在线免费观看| 国产欧美日本一区二区三区| 色综合中文综合网| 国产成人综合在线观看| 亚洲国产cao| 一区二区三区国产精品| 国产精品理伦片| 久久午夜免费电影| 在线不卡a资源高清| 94色蜜桃网一区二区三区| 福利一区福利二区| 国产精品资源在线观看| 麻豆精品视频在线| 午夜精品aaa| 另类小说欧美激情| 亚洲成年人网站在线观看| 久久精品水蜜桃av综合天堂| 精品久久久久久久人人人人传媒| 555www色欧美视频| 欧美精品第一页| 日韩一区二区中文字幕| 日韩一区二区三区在线| 91麻豆精品国产91久久久久久久久 | 欧美日韩中文字幕一区二区| 欧美三级在线看| 欧美裸体一区二区三区| www精品美女久久久tv| 4438x亚洲最大成人网| 91精品国产91久久久久久一区二区| 884aa四虎影成人精品一区| 日韩欧美一二区| 亚洲一区在线观看视频| 亚洲国产综合色| 韩国午夜理伦三级不卡影院| 国产成人精品影视| 91网站最新地址| 91精品国产综合久久精品app| 精品国产a毛片| 中文字幕中文字幕中文字幕亚洲无线| 亚洲综合久久av| 黄页网站大全一区二区| 99国产精品视频免费观看| 精品视频一区二区不卡| 国产欧美一区二区精品秋霞影院| 亚洲欧美日韩国产中文在线| 中文字幕亚洲精品在线观看| 日韩精品一二区| 成人免费高清在线| 欧美老年两性高潮| 久久蜜桃一区二区| 中文字幕一区二区三区乱码在线| 亚洲婷婷国产精品电影人久久| 麻豆国产欧美一区二区三区| 91色婷婷久久久久合中文| 久久综合久色欧美综合狠狠| 亚洲第一成人在线| 99精品视频在线免费观看| 久久毛片高清国产| 美女精品自拍一二三四| 精品少妇一区二区三区| 亚洲国产欧美在线| 欧日韩精品视频| 中文字幕va一区二区三区| 九色综合狠狠综合久久| 欧美性生活一区| 一区二区三国产精华液| 99天天综合性| 欧美群妇大交群的观看方式| 69堂成人精品免费视频| 亚洲精品国产品国语在线app| 国产不卡视频一区二区三区| 日韩欧美专区在线| 激情综合色丁香一区二区| 欧美电视剧免费观看| 国产乱码一区二区三区| 亚洲欧洲中文日韩久久av乱码| 欧美少妇xxx| 青青草97国产精品免费观看| 日韩精品中文字幕在线不卡尤物| 国产精品自产自拍| 亚洲在线一区二区三区| 欧美一二三四在线| 91丨九色丨蝌蚪丨老版| 日韩av一区二| 亚洲国产精品精华液ab| 欧美日韩综合在线| 国产成人aaaa| 久久精品噜噜噜成人av农村| 亚洲国产精品精华液2区45| 欧美日韩国产高清一区二区 | 欧美激情综合在线| 欧美日韩综合不卡| 91污在线观看| 丁香天五香天堂综合| 麻豆精品一区二区三区| 亚洲图片欧美色图| 亚洲欧美电影一区二区| 中文字幕精品综合| 日韩一区二区三区四区五区六区| 99riav一区二区三区| 老汉av免费一区二区三区| 一区二区理论电影在线观看| 欧美国产丝袜视频| 久久新电视剧免费观看| 欧美一卡二卡在线| 日本一区二区三区免费乱视频| 欧美日韩国产综合久久| 日本高清不卡视频| 成人黄色在线看| 成人一道本在线| 久久99久久久久| 蜜桃一区二区三区在线| 石原莉奈一区二区三区在线观看| 国产一区中文字幕| 国产成人综合视频| 国产成人啪免费观看软件| 成人在线综合网站| 成人精品亚洲人成在线| 日本高清不卡aⅴ免费网站| 欧美三级日韩在线| 91精品国产综合久久精品图片| 欧美精品v国产精品v日韩精品| 日韩欧美激情一区| 国产三级久久久| 中文字幕一区二区三区色视频| 一级中文字幕一区二区| 丝袜美腿高跟呻吟高潮一区| 久久国产免费看| 国产成人一区在线| 在线免费观看日本欧美| 欧美老年两性高潮| 久久先锋影音av鲁色资源 | 久久蜜桃香蕉精品一区二区三区| 国产色综合久久| 丝袜美腿高跟呻吟高潮一区| 高清视频一区二区| 777亚洲妇女| 亚洲女人的天堂| 国产一二精品视频| 欧美日韩在线综合| 国产精品视频一区二区三区不卡| 亚洲无人区一区| 成人丝袜18视频在线观看| 欧美日韩一区高清| 国产精品素人一区二区| 秋霞国产午夜精品免费视频| 99久久精品免费看| 久久综合久久综合久久| 日本强好片久久久久久aaa| 色欧美片视频在线观看 | 欧美精品久久久久久久多人混战 | 亚洲精品久久久久久国产精华液| 精品一区二区av| 欧美一区二区三区系列电影| 亚洲伦理在线免费看| 99久久国产免费看| 欧美激情在线观看视频免费| 久久99国产精品麻豆| 日韩女优av电影在线观看| 爽好久久久欧美精品| 欧美日韩免费电影| 日韩av一区二区在线影视| 日本精品视频一区二区三区| 亚洲精品欧美在线| 欧美天天综合网| 亚洲国产成人精品视频| 欧美日韩综合在线| 日韩av午夜在线观看| 欧美mv和日韩mv国产网站| 国产精品一区二区免费不卡 | 精品国产乱码久久久久久1区2区 | 91精品国产综合久久蜜臀| 天天做天天摸天天爽国产一区| 欧美另类videos死尸| 久久电影国产免费久久电影| 久久久精品日韩欧美| 91网站最新地址| 午夜在线成人av| 日韩精品影音先锋| 国产激情视频一区二区在线观看 | 久久中文娱乐网| 97se亚洲国产综合自在线| 亚洲成人精品在线观看| 欧美一卡二卡三卡| 国产精品亚洲一区二区三区妖精 | 午夜激情久久久| 久久久国产一区二区三区四区小说| 国产99一区视频免费| 亚洲精品免费在线| 精品久久久久久久久久久久久久久久久 | 久久精品一区二区三区不卡牛牛| 不卡的电影网站| 奇米888四色在线精品| 亚洲日本护士毛茸茸| 日韩一区二区在线观看|