X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=NeXT%2Fppp_tty.c;h=280ba196834c9fcf71c0534e1117de725f990383;hb=af32d6370eba9545f813546a7902575d834a0f85;hp=18286a3b100d7414b1a24ce9998e5f86c58d71d6;hpb=ffed4c0be3569ea9c8901f66e67e289c11922692;p=ppp.git diff --git a/NeXT/ppp_tty.c b/NeXT/ppp_tty.c index 18286a3..280ba19 100644 --- a/NeXT/ppp_tty.c +++ b/NeXT/ppp_tty.c @@ -4,20 +4,43 @@ * ppp_tty.c - Point-to-Point Protocol (PPP) driver for asynchronous * tty devices. * - * Copyright (c) 1989 Carnegie Mellon University. - * All rights reserved. + * Copyright (c) 1984-2000 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. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The name "Carnegie Mellon University" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For permission or any legal + * details, please contact + * Office of Technology Transfer + * Carnegie Mellon University + * 5000 Forbes Avenue + * Pittsburgh, PA 15213-3890 + * (412) 268-4387, fax: (412) 268-7395 + * tech-transfer@andrew.cmu.edu + * + * 4. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by Computing Services + * at Carnegie Mellon University (http://www.cmu.edu/computing/)." + * + * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE + * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Drew D. Perkins * Carnegie Mellon University @@ -91,7 +114,18 @@ #define KERNEL_FEATURES 1 #define INET 1 +#if NS_TARGET >= 40 +#if NS_TARGET >= 41 +#include +#else +#include +#endif /* NS_TARGET */ +#endif /* NS_TARGET */ + #include +#if NS_TARGET >= 41 +typedef simple_lock_data_t lock_data_t; /* XXX */ +#endif /* NS_TARGET */ #include #include #include "netbuf.h" @@ -103,8 +137,10 @@ #include #include #include +#if !(NS_TARGET >= 40) +/* XXX what happened to this header file? */ #include - +#endif #include /* NeXT broke spl.h in 3.2/m68k. Thanks EPS! */ @@ -675,12 +711,6 @@ pppstart(tp) *cp++ = (sc->sc_outfcs >> 8) & 0xFF; } -#ifdef NETBUF_PROXY - m->pktinfo.fourth.tv_sec = time.tv_sec; - m->pktinfo.fourth.tv_usec = time.tv_usec; -#endif - - start = mtod(m, u_char *); len = NB_SIZE(m); stop = start + len; @@ -727,9 +757,6 @@ pppstart(tp) sc->sc_bytessent += 2; start++; len--; -#ifdef NETBUF_PROXY - ++(m->pktinfo.async_esc); -#endif } } /* @@ -754,31 +781,6 @@ pppstart(tp) sc->sc_bytessent++; -#ifdef NETBUF_PROXY - m->pktinfo.fifth.tv_sec = time.tv_sec; - m->pktinfo.fifth.tv_usec = time.tv_usec; -#endif - - -#if defined(NBPFILTER) && defined(NETBUF_PROXY) - - /* - * See if bpf wants to look at the packet. Gotta be careful - * here because BPF want the uncompressed packet. For now we - * stash a copy that we hand off. In the future, we may try - * to modify BPF to handle compressed packets instead. - * - * The BPF process point will not work for - * non-NETBUF_PROXY points. In this case, we hand the packet - * to BPF earlier in the process (see if_ppp.c). - * - */ - - if (sc->sc_bpf) - bpf_tap(sc->sc_bpf, m, 0); - -#endif - /* Finished with this netbuf; free it and move on. */ NB_FREE(m); m = NULL; @@ -800,7 +802,11 @@ pppstart(tp) * drained the t_outq. */ if (!idle && (sc->sc_flags & SC_TIMEOUT) == 0) { +#if NS_TARGET >= 40 + timeout(ppp_timeout, (void *) sc, 1); +#else ns_timeout(ppp_timeout, (void *) sc, 1 * (1000000000L / HZ), CALLOUT_PRI_SOFTINT0); +#endif /*NS_TARGET */ sc->sc_flags |= SC_TIMEOUT; } @@ -1038,12 +1044,6 @@ pppinput(c, tp) return; } -#ifdef NETBUF_PROXY - sc->sc_m->pktinfo.second.tv_sec = time.tv_sec; - sc->sc_m->pktinfo.second.tv_usec = time.tv_usec; - sc->sc_m->pktinfo.size1 = ilen; -#endif - /* * Remove FCS trailer. Set packet length... */ @@ -1085,9 +1085,6 @@ pppinput(c, tp) c ^= PPP_TRANS; } else if (c == PPP_ESCAPE) { sc->sc_flags |= SC_ESCAPED; -#ifdef NETBUF_PROXY - ++(sc->sc_m->pktinfo.async_esc); -#endif return; } @@ -1119,11 +1116,6 @@ pppinput(c, tp) sc->sc_mp = mtod(m, char *); sc->sc_fcs = PPP_INITFCS; -#ifdef NETBUF_PROXY - m->pktinfo.first.tv_sec = time.tv_sec; - m->pktinfo.first.tv_usec = time.tv_usec; - m->pktinfo.flags |= NBFLAG_INCOMING; -#endif if (c != PPP_ALLSTATIONS) { if (sc->sc_flags & SC_REJ_COMP_AC) { IOLogDbg("ppp%d: garbage received: 0x%02x (need 0x%02x)\n", @@ -1133,9 +1125,6 @@ pppinput(c, tp) *sc->sc_mp++ = PPP_ALLSTATIONS; *sc->sc_mp++ = PPP_UI; sc->sc_ilen += 2; -#ifdef NETBUF_PROXY - m->pktinfo.flags |= NBFLAG_AC; -#endif } } @@ -1150,9 +1139,6 @@ pppinput(c, tp) /* a compressed protocol */ *sc->sc_mp++ = 0; sc->sc_ilen++; -#ifdef NETBUF_PROXY - m->pktinfo.flags |= NBFLAG_PC; -#endif } if (sc->sc_ilen == 3 && (c & 1) == 0) {