From fd55b7dbd5b33aa71195818c2d13eeaa1a27ca69 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 21 Mar 2002 15:01:32 +0000 Subject: 2002-03-21 Ilya Alexeev * net/if_ppp.c, net/ppp_tty.c: Initial preparations for multiple PPPD connections. --- cpukit/libnetworking/net/ppp_tty.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'cpukit/libnetworking/net/ppp_tty.c') diff --git a/cpukit/libnetworking/net/ppp_tty.c b/cpukit/libnetworking/net/ppp_tty.c index cab3278f30..b655fd4f04 100644 --- a/cpukit/libnetworking/net/ppp_tty.c +++ b/cpukit/libnetworking/net/ppp_tty.c @@ -192,6 +192,7 @@ pppopen(struct rtems_termios_tty *tty) int i; register struct ppp_softc *sc; struct mbuf *m = (struct mbuf *)0; + extern int termios_baud_to_number(int); if (tty->t_line == PPPDISC) { sc = (struct ppp_softc *)tty->t_sc; @@ -238,7 +239,8 @@ pppopen(struct rtems_termios_tty *tty) /* initialize values */ sc->sc_if.if_flags |= IFF_RUNNING; - sc->sc_if.if_baudrate = 57600; /* FIX: get line speed from termios */ + sc->sc_if.if_baudrate = + termios_baud_to_number(tty->termios.c_cflag & CBAUD); tty->t_sc = (void *)sc; @@ -421,7 +423,7 @@ pppwrite(struct rtems_termios_tty *tty, rtems_libio_rw_args_t *rw_args) int ppptioctl(struct rtems_termios_tty *tty, rtems_libio_ioctl_args_t *args) { - int i; +/* int i; */ int error = RTEMS_SUCCESSFUL; int cmd = args->command; caddr_t data = args->buffer; @@ -561,6 +563,7 @@ int pppstart(struct rtems_termios_tty *tp) { char c; + char *sendBegin; char cFrame = (char )PPP_FLAG; u_char ioffset = (u_char )0; struct mbuf *m = (struct mbuf *)0; @@ -618,15 +621,20 @@ pppstart(struct rtems_termios_tty *tp) /* set the escape flag */ sc->sc_outflag |= SC_TX_ESCAPE; } + sendBegin = &c; } else { - /* escape not needed - increment the offset */ - ioffset++; + /* escape not needed - increment the offset as much as possible */ + while ((!ESCAPE_P(c)) && ((sc->sc_outoff + ioffset) < sc->sc_outlen)) { + ioffset++; + c = sc->sc_outbuf[sc->sc_outoff + ioffset]; + } + sendBegin = &sc->sc_outbuf[sc->sc_outoff]; } - /* write out the character and update the stats */ - (*tp->device.write)(tp->minor, &c, 1); - sc->sc_stats.ppp_obytes++; + /* write out the character(s) and update the stats */ + (*tp->device.write)(tp->minor, sendBegin, (ioffset > 0) ? ioffset : 1); + sc->sc_stats.ppp_obytes += (ioffset > 0) ? ioffset : 1; sc->sc_outoff += ioffset; } } -- cgit v1.2.3