summaryrefslogtreecommitdiffstats
path: root/cpukit/libnetworking/net/ppp_tty.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2002-03-21 15:01:32 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2002-03-21 15:01:32 +0000
commitfd55b7dbd5b33aa71195818c2d13eeaa1a27ca69 (patch)
treeb1d93adfdf06c34a4de346093d29e1d19d07b919 /cpukit/libnetworking/net/ppp_tty.c
parent2002-03-21 Alexander Kukuta <kam@oktet.ru> (diff)
downloadrtems-fd55b7dbd5b33aa71195818c2d13eeaa1a27ca69.tar.bz2
2002-03-21 Ilya Alexeev <ilya@continuum.ru>
* net/if_ppp.c, net/ppp_tty.c: Initial preparations for multiple PPPD connections.
Diffstat (limited to '')
-rw-r--r--cpukit/libnetworking/net/ppp_tty.c22
1 files changed, 15 insertions, 7 deletions
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;
}
}