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

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

?? if_ppp.c

?? vxwork源代碼
?? C
?? 第 1 頁 / 共 4 頁
字號:
/* if_ppp.c - Point-to-Point Protocol (PPP) Asynchronous driver *//* Copyright 1996 - 2002 Wind River Systems, Inc. */#include "copyright_wrs.h"/*	$NetBSD: if_ppp.c,v 1.20 1994/10/30 21:48:52 cgd Exp $	*//* * if_ppp.c - Point-to-Point Protocol (PPP) Asynchronous driver. * * Copyright (c) 1989 Carnegie Mellon University. * All rights reserved. * * Redistribution and use in source and binary forms are permitted * provided that the above copyright notice and this paragraph are * duplicated in all such forms and that any documentation, * advertising materials, and other materials related to such * distribution and use acknowledge that the software was developed * by Carnegie Mellon University.  The name of the * University may not be used to endorse or promote products derived * from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * Drew D. Perkins * Carnegie Mellon University * 4910 Forbes Ave. * Pittsburgh, PA 15213 * (412) 268-8576 * ddp@andrew.cmu.edu * * Based on: *	@(#)if_sl.c	7.6.1.2 (Berkeley) 2/15/89 * * Copyright (c) 1987 Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms are permitted * provided that the above copyright notice and this paragraph are * duplicated in all such forms and that any documentation, * advertising materials, and other materials related to such * distribution and use acknowledge that the software was developed * by the University of California, Berkeley.  The name of the * University may not be used to endorse or promote products derived * from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * Serial Line interface * * Rick Adams * Center for Seismic Studies * 1300 N 17th Street, Suite 1450 * Arlington, Virginia 22209 * (703)276-7900 * rick@seismo.ARPA * seismo!rick * * Pounded on heavily by Chris Torek (chris@mimsy.umd.edu, umcp-cs!chris). * Converted to 4.3BSD Beta by Chris Torek. * Other changes made at Berkeley, based in part on code by Kirk Smith. * * Converted to 4.3BSD+ 386BSD by Brad Parker (brad@cayman.com) * Added VJ tcp header compression; more unified ioctls * * Extensively modified by Paul Mackerras (paulus@cs.anu.edu.au). * Cleaned up a lot of the mbuf-related code to fix bugs that * caused system crashes and packet corruption.  Changed pppstart * so that it doesn't just give up with a collision if the whole * packet doesn't fit in the output ring buffer. * * Added priority queueing for interactive IP packets, following * the model of if_sl.c, plus hooks for bpf. * Paul Mackerras (paulus@cs.anu.edu.au). *//* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp *//*modification history--------------------01y,20may02,vvv  modified receive mechanism to use ipintr without queueing01x,28mar02,jmp  Increased again read buffer size for solaris simulator and		 added global variable simPppRBufSize to make this buffer		 size increasable from solaris's bsp (SPR #74733).01w,17sep01,jmp  Increased read buffer size for solaris simulator (SPR                 #34025).01v,06feb01,ijm  Fix for SPR# 62196: pppDelete should not delete ppp_wrt_task		 while it holds the semaphore that tNetTask needs to run.01u,17oct00,spm  updated for new if_attach: reports memory allocation failures01t,16apr99,koz  Fix for 25165, communications error handling01s,17feb99,sgv  Fix for spr 23702, pppintr check for NULL ppp_softc01r,17feb99,sgv  Fix for spr 24459. pppalloc was not setting the correct		 ppp_softc structure to NULL on error condition01q.10sep98,sgv  Added fix for interoperating with Windows01p,18aug97,jmb  Add code to discard packets at interrupt level due		 to overflow of input ring buffer.01o,30dec97,sgv  fixed problem in PPP output Hooks01n,26sep97,sgv  Added PPP output Hooks01m,19sep97,vin  changed m_ext.ext_buf to m_extBuf and m_ext.ext_size to		 m_extSize01l,14nov96,vin  upgraded to use new buffering scheme.01k,13aug96,vin  upgraded to BSD4.4, removed call in_ifaddr_remove as it is 		 being done in if_dettach. 01j,30jul95,dzb  cleanup on errors while openning serial device.01i,05jul95,dzb  close out serial fd on errors in pppalloc().01h,12jun95,dzb  added SNMP MIBII support (counters and ioctl).                 header file consolidation.01g,24apr95,dzb  removed in_ifaddr_remove() because added to in.c (SPR #4109).01f,09mar95,dzb  added counters for ip packets sent/received.01e,06mar95,dzb  changed cfree() to free() (ANSI).01d,09feb95,dab  added SIOCGIFMTU command to ppptioctl().01c,07feb95,dzb  changed pppoutput() to return errno, instead of ERROR.                 removed redundant mbuf check from ppp_wrt_flush().		 zeroed out m_len after MGET (SPR #4037).01b,16jan95,dzb  warnings cleanup.  moved global prototypes to if_ppp.h.01a,21dec94,dab  VxWorks port - first WRS version.           +dzb  added: path for ppp header files, WRS copyright.*/#include "vxWorks.h"#include "net/mbuf.h"#include "sockLib.h"#include "ioctl.h"#include "stdio.h"#include "errnoLib.h"#include "ioLib.h"#include "iosLib.h"#include "semLib.h"#include "memLib.h"#include "taskLib.h"#include "signal.h"#include "sigLib.h"#include "etherLib.h"#include "netLib.h"#include "m2Lib.h"#include "private/m2LibP.h"#include "net/if.h"#include "net/unixLib.h"#include "net/route.h"#include "netinet/in.h"#include "netinet/in_systm.h"#include "netinet/in_var.h"#include "netinet/ip.h"#include "netinet/ip_var.h"#include "pppLib.h"#include "rngLib.h"#include "tyLib.h"#include "tickLib.h"#if NPPP > 0#ifdef VJC#define HDROFF  MAX_HDR/* HDROFF should really be 128, but other parts of the system will   panic on TCP+IP headers bigger than MAX_HDR = MHLEN (100). */#else#define HDROFF  (0)#endif#define PPP_HIWAT       400     /* Don't start a new packet if HIWAT on que *//* external variables */IMPORT void if_dettach();IMPORT void if_down();/* global variables */struct ppp_softc *ppp_softc[NPPP] = { 0 } ;int ppp_wrt_task_priority    	= 60;int ppp_wrt_task_options     	= VX_SUPERVISOR_MODE | VX_UNBREAKABLE;int ppp_wrt_task_stack_size   	= 0x4000;char *ppp_device_name		= "ppp";#if	(CPU_FAMILY==SIMSPARCSOLARIS)int simPppRBufSize = 48 * PPP_MTU;	/* size of PPP read ring buffer */#endifstatic int pppioctl __ARGS((struct ifnet *, int , caddr_t));static int pppattach __ARGS((int));static int pppoutput __ARGS((struct ifnet *, struct mbuf *, struct sockaddr *,			     struct rtentry *));static void pppinput __ARGS((struct ppp_softc *, int));static int pppasyncstart __ARGS((struct ppp_softc *));static u_short pppfcs __ARGS((int, u_char *, int));static int pppgetm __ARGS((struct ppp_softc *sc));static void pppdumpm __ARGS((struct mbuf *, int));static void pppdumpb __ARGS((u_char *, int));static void ppplogchar __ARGS((struct ppp_softc *, int));static void pppdealloc __ARGS((struct ppp_softc *));static struct ppp_softc *pppalloc __ARGS((int, char *));static void ppp_wrt_flush __ARGS((struct ppp_softc *));static void pinit __ARGS((int));static int pppintr __ARGS((int, int));static void ppp_tty_read __ARGS((int, struct ppp_softc *, int));/* * Some useful mbuf macros not in mbuf.h. */#define M_DATASTART(m)	(m)->m_extBuf#define M_DATASIZE(m)	(m)->m_extSize#define PPPBUFSIZE        (PPP_MTU * 2)/* * The following disgusting hack gets around the problem that IP TOS * can't be set yet.  We want to put "interactive" traffic on a high * priority queue.  To decide if traffic is interactive, we check that * a) it is TCP and b) one of its ports is telnet, rlogin or ftp control. */static u_short interactive_ports[8] = {        0,      513,    0,      0,        0,      21,     0,      23,};#define INTERACTIVE(p) (interactive_ports[(p) & 7] == (p))/* * Does c need to be escaped? */#define ESCAPE_P(c)     (sc->sc_asyncmap[(c) >> 5] & (1 << ((c) & 0x1F)))/* * Called to establish ppp interfaces. */static intpppattach(unit)    int unit;{    register struct ppp_softc *sc;    int status;    sc = ppp_softc[unit];    sc->sc_if.if_name = "ppp";    sc->sc_if.if_unit = unit;    sc->sc_if.if_mtu = PPP_MTU;    sc->sc_if.if_flags = IFF_POINTOPOINT | IFF_MULTICAST ;    sc->sc_if.if_type = IFT_PPP;    sc->sc_if.if_hdrlen = PPP_HDRLEN;    sc->sc_if.if_ioctl = pppioctl;    sc->sc_if.if_output = pppoutput;    sc->sc_if.if_snd.ifq_maxlen = IFQ_MAXLEN;    sc->sc_inq.ifq_maxlen = IFQ_MAXLEN;    sc->sc_fastq.ifq_maxlen = IFQ_MAXLEN;    sc->sc_if.if_reset = pppclose;    sc->sc_if.if_init = (FUNCPTR) pinit;    status = if_attach(&sc->sc_if);    return (status);}/* * Allocate a ppp interface unit and initialize it. */static struct ppp_softc *pppalloc(unit, device)    int unit;    char *device;{    struct ppp_softc *sc;    if (ppp_softc[unit] != NULL)        return NULL;    if ((sc = (struct ppp_softc *)calloc(1, sizeof(struct ppp_softc))) == NULL)        return (NULL);    ppp_softc[unit] = sc;    if ((sc->sc_fd = open(device, O_RDWR, 0)) == ERROR)        {        ppp_softc[unit] = (struct ppp_softc *)NULL;        free((char *) sc);        return NULL;	}#if	(CPU_FAMILY==SIMSPARCSOLARIS)    /*     * For PPP on solaris simulator, the receive buffer size must be more     * important. This is necessary because the solaris host can send several      * several PPP packets to the simulator before he is able to     * handle them (don't forget that they share the same CPU).     * If the receive buffer size is too small to store all the received     * characters, some of them may be lost. The new value has been chosen     * after some testing (with this value, the simulator has time to     * handle packets before the receive buffer is full) but may not be     * sufficient in all cases, if not sufficient simPppRBufSize can be     * increased in sysLib.c.     */    if (ioctl(sc->sc_fd, FIORBUFSET, simPppRBufSize) == ERROR ||#else	/* CPU_FAMILY==SIMSPARCSOLARIS */    if (ioctl(sc->sc_fd, FIORBUFSET, 4 * PPP_MTU) == ERROR ||#endif        ioctl(sc->sc_fd, FIOWBUFSET, 4 * PPP_MTU) == ERROR) {        close(sc->sc_fd);        ppp_softc[unit] = (struct ppp_softc *)NULL;        free((char *) sc);        return NULL;    }    if (pppattach(unit) == ERROR) {         close(sc->sc_fd);        ppp_softc[unit] = (struct ppp_softc *)NULL;        free((char *) sc);        return (NULL);    }    if (ioctl(sc->sc_fd, FIOPROTOHOOK, (int)pppintr) == ERROR ||        ioctl(sc->sc_fd, FIOPROTOARG, unit) == ERROR) {        close(sc->sc_fd);        pppdealloc(sc);        return (NULL);    }    sc->sc_flags = 0;    sc->sc_mru = PPP_MRU;#ifdef VJC    sl_compress_init(&sc->sc_comp);#endif    sc->sc_if.if_flags |=  IFF_RUNNING;    return sc;}/* * Deallocate a ppp unit. */static voidpppdealloc(sc)    struct ppp_softc *sc;{    struct mbuf *m;    if_down(&sc->sc_if);    sc->sc_devp = NULL;    sc->sc_xfer = 0;    for (;;) {        IF_DEQUEUE(&sc->sc_inq, m);        if (m == NULL)            break;        m_freem(m);    }    for (;;) {        IF_DEQUEUE(&sc->sc_fastq, m);        if (m == NULL)            break;        m_freem(m);    }    sc->sc_if.if_flags &= ~(IFF_UP|IFF_RUNNING);    if_dettach(&sc->sc_if);    ppp_softc[sc->sc_if.if_unit] = (struct ppp_softc *)NULL;    free((char *) sc);}/* * pppopen - open the ppp interface. * 	     Returns unit id. */intpppopen(unit, device)    int unit;    char *device;{    register struct ppp_softc *sc;    char ppp_wrt_name[10];    if ((sc = pppalloc(unit, device)) == NULL)        return (ERROR);    if (sc->sc_outm != NULL) {        m_freem(sc->sc_outm);        sc->sc_outm = NULL;    }    if (pppgetm(sc) == 0) {        sc->sc_if.if_flags &= ~(IFF_UP|IFF_RUNNING);        return (ERROR);    }    sc->sc_ilen  = 0;    bzero((char *)sc->sc_asyncmap, sizeof(sc->sc_asyncmap));    sc->sc_asyncmap[0] = 0xffffffff;    sc->sc_asyncmap[3] = 0x60000000;    sc->sc_rasyncmap = 0;    sc->sc_devp = (void *) NULL;    sc->sc_start = pppasyncstart;    sc->sc_qlen  = 0;    sc->sc_tid = taskIdSelf();    semBInit(&sc->sc_wrtsem, SEM_Q_PRIORITY, SEM_EMPTY);    ioctl(sc->sc_fd, FIOFLUSH, 0);    sprintf(ppp_wrt_name, "tPPP%dWrt", sc->sc_if.if_unit);    sc->sc_wrt_task_id = taskSpawn(ppp_wrt_name, ppp_wrt_task_priority,                                   ppp_wrt_task_options,                                   ppp_wrt_task_stack_size,				   (FUNCPTR)ppp_wrt_task, (int)sc,				   0, 0, 0, 0, 0, 0, 0, 0, 0);    if (sc->sc_wrt_task_id == ERROR) {        close(sc->sc_fd);        pppdealloc(sc);        return (ERROR);    }    return (OK);}    /* * Line specific close routine. * Detach the tty from the ppp unit. * Mimics part of ttyclose(). */intpppclose(unit)    int unit;{    register struct ppp_softc *sc;    int s;    if (unit >= 0 && unit < NPPP)        sc = ppp_softc[unit];    else        return (ERROR);    if (sc != NULL) {	ppp_wrt_flush(sc);        ioctl(sc->sc_fd, FIOPROTOHOOK, (int) NULL);        taskDelete(sc->sc_wrt_task_id);        s = splimp();		/* paranoid; splnet probably ok */        close(sc->sc_fd);        m_freem(sc->sc_outm);        sc->sc_outm = NULL;        m_freem(sc->sc_m);        sc->sc_m = NULL;        pppdealloc(sc);        splx(s);    }    else        return (ERROR);    return(OK);}/* * Line specific (tty) read routine. */intpppread(unit, buf, count)    int unit;    char *buf;    int count;{    register struct ppp_softc *sc = ppp_softc[unit];    struct mbuf *m;    register int s;    s = splimp();    IF_DEQUEUE(&sc->sc_inq, m);    splx(s);    if (m == NULL)	return 0;    copy_from_mbufs(buf, m, count);    return (count);}/* * Line specific (tty) write routine. */intpppwrite(unit, buf, count)    int unit;    char *buf;    int count;{    register struct ppp_softc *sc = ppp_softc[unit];    struct mbuf *m, *m0, **mp;    struct sockaddr dst;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
狠狠色狠狠色合久久伊人| 成人性生交大片免费看在线播放 | 欧美视频精品在线观看| 日韩一区有码在线| 91麻豆国产福利在线观看| 1024成人网色www| 色综合久久六月婷婷中文字幕| 最新不卡av在线| 日本高清无吗v一区| 亚洲国产另类av| 精品国产三级电影在线观看| 国产一区不卡在线| 一区二区三区91| 3d成人动漫网站| 国产成人亚洲精品青草天美| 亚洲影院理伦片| 久久女同性恋中文字幕| 91亚洲男人天堂| 亚洲成a人片综合在线| 欧美曰成人黄网| 久久精品99久久久| 亚洲激情一二三区| 欧美精品一区二区高清在线观看| 成人av网站大全| 97久久超碰国产精品电影| 亚洲欧美日韩在线| 久久人人超碰精品| 欧美日韩高清一区二区不卡| 成人国产精品免费网站| 日韩中文字幕一区二区三区| 中文字幕成人av| 一区二区在线观看免费| 中文字幕成人网| 久久久蜜臀国产一区二区| 4438成人网| 欧美日韩视频一区二区| 色成人在线视频| 成人av中文字幕| 成人精品国产一区二区4080| 国产黑丝在线一区二区三区| 精品一区二区三区免费毛片爱| 亚洲综合在线免费观看| 伊人性伊人情综合网| 国产精品乱人伦| 国产精品久久综合| 国产欧美日韩久久| 国产精品蜜臀av| 亚洲天堂免费在线观看视频| 国产精品福利电影一区二区三区四区| 久久人人97超碰com| 久久久99久久精品欧美| 久久色视频免费观看| 欧美精品一区二区三区蜜臀| 久久精品夜夜夜夜久久| 国产精品毛片大码女人| 亚洲午夜激情av| 久久综合成人精品亚洲另类欧美| 色哟哟国产精品| 欧美亚洲高清一区| 日韩一区二区三区电影| 精品国产精品网麻豆系列| 亚洲国产成人一区二区三区| 国产精品久久久久久久久果冻传媒 | 欧美成人性福生活免费看| 欧美一区二区视频网站| 久久女同精品一区二区| 亚洲视频一区二区免费在线观看 | 亚洲激情图片小说视频| 久久成人av少妇免费| 成人午夜av影视| 91麻豆精品国产无毒不卡在线观看 | wwwwww.欧美系列| 国产精品久久久久久久久久免费看 | 精品美女一区二区三区| 国产精品美女久久久久av爽李琼 | 中文字幕乱码久久午夜不卡| 日本成人在线视频网站| 日韩av电影免费观看高清完整版| 一区二区三区中文字幕| 久久精品国产亚洲a| 91麻豆国产福利在线观看| 26uuuu精品一区二区| 一区二区三区波多野结衣在线观看| 精品一区二区三区不卡| 91黄色激情网站| 国产精品久久久一本精品| 蜜臀国产一区二区三区在线播放| 91毛片在线观看| 中文字幕一区三区| 国产在线播放一区三区四| 日韩欧美中文字幕一区| 亚洲成人一区二区| 欧美日韩在线观看一区二区| 亚洲天堂中文字幕| 成人性色生活片免费看爆迷你毛片| 日韩视频不卡中文| 久久国产精品72免费观看| 91精品欧美综合在线观看最新| 成人免费小视频| 色综合一区二区三区| **性色生活片久久毛片| 91色porny蝌蚪| 夜夜嗨av一区二区三区网页 | 国产欧美日产一区| 国产成a人无v码亚洲福利| 久久蜜臀中文字幕| k8久久久一区二区三区| 中文字幕亚洲综合久久菠萝蜜| 色哟哟日韩精品| 午夜电影一区二区| 亚洲激情五月婷婷| 欧美一区二区三区免费观看视频| 丝袜亚洲另类欧美| 欧美国产一区视频在线观看| 色哟哟欧美精品| 成人视屏免费看| 国产精品无遮挡| 91天堂素人约啪| 亚洲va欧美va天堂v国产综合| 欧美一级国产精品| gogo大胆日本视频一区| 日韩电影一区二区三区| 欧美国产禁国产网站cc| 欧美日韩国产精选| av一二三不卡影片| 国产又黄又大久久| 日本一不卡视频| 亚洲自拍与偷拍| 亚洲欧洲成人自拍| 国产午夜精品在线观看| 4438x成人网最大色成网站| 色综合视频一区二区三区高清| 国产精品自产自拍| 久久精品国产**网站演员| 香蕉影视欧美成人| 亚洲一级不卡视频| 一区二区三区在线不卡| 18欧美亚洲精品| 国产精品天天摸av网| 国产日产欧美一区二区三区| 久久综合色鬼综合色| 精品盗摄一区二区三区| 久久午夜免费电影| 久久久精品国产免大香伊| 欧美mv日韩mv国产网站app| 欧美电影免费观看高清完整版在线观看| 欧美日韩一区二区三区四区| 91福利国产精品| 6080日韩午夜伦伦午夜伦| 欧美日韩亚洲丝袜制服| 日韩欧美中文一区二区| 91精品在线一区二区| 日韩精品一区二区三区在线| 久久久另类综合| 夜夜亚洲天天久久| 午夜精品久久久久久久99樱桃 | 亚洲永久免费视频| 日韩精品午夜视频| 久久av中文字幕片| 成人国产在线观看| 欧美日韩综合在线免费观看| 91精品国产色综合久久ai换脸 | 国产精品美女一区二区三区 | 国产欧美久久久精品影院| 亚洲色图制服诱惑| 蜜桃视频一区二区| 99国产精品国产精品毛片| 这里是久久伊人| 中文字幕人成不卡一区| 另类小说图片综合网| 99re亚洲国产精品| 精品国产乱码久久久久久浪潮 | 91精品蜜臀在线一区尤物| 久久久高清一区二区三区| 天天综合色天天| 在线观看欧美黄色| 《视频一区视频二区| 久久69国产一区二区蜜臀| 欧美吞精做爰啪啪高潮| 日韩毛片精品高清免费| 国产一区二区三区国产| 日韩一卡二卡三卡| 日日摸夜夜添夜夜添亚洲女人| 91一区二区三区在线播放| 亚洲国产激情av| 国产成人亚洲综合a∨猫咪| 亚洲精品在线三区| 婷婷久久综合九色综合绿巨人| 91美女蜜桃在线| 亚洲激情男女视频| 日本大香伊一区二区三区| 亚洲人成小说网站色在线| av中文字幕不卡| 亚洲另类一区二区| 欧美自拍偷拍一区| 亚洲高清免费一级二级三级| 欧美性大战久久久| 首页国产欧美久久| 欧美成人a视频| 国产成人精品免费在线|