* 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
#define KERNEL_FEATURES 1
#define INET 1
+#if NS_TARGET >= 40
+#if NS_TARGET >= 41
+#include <kernserv/lock.h>
+#else
+#include <kern/lock.h>
+#endif /* NS_TARGET */
+#endif /* NS_TARGET */
+
#include <sys/param.h>
+#if NS_TARGET >= 41
+typedef simple_lock_data_t lock_data_t; /* XXX */
+#endif /* NS_TARGET */
#include <sys/proc.h>
#include <sys/user.h>
#include "netbuf.h"
#include <sys/dk.h>
#include <sys/uio.h>
#include <sys/errno.h>
+#if !(NS_TARGET >= 40)
+/* XXX what happened to this header file? */
#include <machine/param.h>
-
+#endif
#include <kernserv/prototypes.h>
/* NeXT broke spl.h in 3.2/m68k. Thanks EPS! */
*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;
sc->sc_bytessent += 2;
start++;
len--;
-#ifdef NETBUF_PROXY
- ++(m->pktinfo.async_esc);
-#endif
}
}
/*
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;
* 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;
}
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...
*/
c ^= PPP_TRANS;
} else if (c == PPP_ESCAPE) {
sc->sc_flags |= SC_ESCAPED;
-#ifdef NETBUF_PROXY
- ++(sc->sc_m->pktinfo.async_esc);
-#endif
return;
}
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",
*sc->sc_mp++ = PPP_ALLSTATIONS;
*sc->sc_mp++ = PPP_UI;
sc->sc_ilen += 2;
-#ifdef NETBUF_PROXY
- m->pktinfo.flags |= NBFLAG_AC;
-#endif
}
}
/* 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) {