diff options
author | brian <brian@FreeBSD.org> | 1999-05-12 09:49:12 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1999-05-12 09:49:12 +0000 |
commit | 89ce3ea906517d4df3f75dc7721280428c5e6159 (patch) | |
tree | 9146deb551e427cf4160888e787361aab1620dd4 /usr.sbin/ppp/physical.h | |
parent | 174d713c5168fee5dbc7f58d899b5947f191ed9a (diff) | |
download | FreeBSD-src-89ce3ea906517d4df3f75dc7721280428c5e6159.zip FreeBSD-src-89ce3ea906517d4df3f75dc7721280428c5e6159.tar.gz |
Allow ``host:port/udp'' devices and support ``host:port/tcp'' as
being the same as the previous (still supported) ``host:port''
syntax for tcp socket devices.
A udp device uses synchronous ppp rather than async, and avoids
the double-retransmit overhead that comes with ppp over tcp (it's
usually a bad idea to transport IP over a reliable transport that
itself is using an unreliable transport). PPP over UDP provides
througput of ** 1.5Mb per second ** with all compression disabled,
maxing out a PPro/200 when running ppp twice, back-to-back.
This proves that PPPoE is plausable in userland....
This change adds a few more handler functions to struct device and
allows derivations of struct device (which may contain their own
data etc) to pass themselves through the unix domain socket for MP.
** At last **, struct physical has lost all the tty crud !
iov2physical() is now smart enough to restore the correct stack of
layers so that MP servers will work again.
The version number has bumped as our MP link transfer contents have
changed (they now may contain a `struct device').
Don't extract the protocol twice in MP mode (resulting in protocol
rejects for every MP packet). This was broken with my original
layering changes.
Add ``Physical'' and ``Sync'' log levels for logging the relevent
raw packets and add protocol-tracking LogDEBUG stuff in various
LayerPush & LayerPull functions.
Assign our physical device name for incoming tcp connections by
calling getpeername().
Assign our physical device name for incoming udp connections from
the address retrieved by the first recvfrom().
Diffstat (limited to 'usr.sbin/ppp/physical.h')
-rw-r--r-- | usr.sbin/ppp/physical.h | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/usr.sbin/ppp/physical.h b/usr.sbin/ppp/physical.h index bad8926..fef4ac0 100644 --- a/usr.sbin/ppp/physical.h +++ b/usr.sbin/ppp/physical.h @@ -16,7 +16,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: physical.h,v 1.8 1999/04/27 00:23:57 brian Exp $ + * $Id: physical.h,v 1.9 1999/05/08 11:07:24 brian Exp $ * */ @@ -30,17 +30,21 @@ struct cmdargs; #define TTY_DEVICE 1 #define TCP_DEVICE 2 -#define EXEC_DEVICE 3 +#define UDP_DEVICE 3 +#define EXEC_DEVICE 4 struct device { int type; const char *name; - int (*open)(struct physical *); + int (*raw)(struct physical *); void (*offline)(struct physical *); void (*cooked)(struct physical *); - void (*postclose)(struct physical *); - void (*restored)(struct physical *); + void (*stoptimer)(struct physical *); + void (*destroy)(struct physical *); + ssize_t (*read)(struct physical *, void *, size_t); + ssize_t (*write)(struct physical *, const void *, size_t); + void (*device2iov)(struct physical *, struct iovec *, int *, int, pid_t); int (*speed)(struct physical *); const char *(*openinfo)(struct physical *); }; @@ -52,7 +56,6 @@ struct physical { struct async async; /* Our async state */ struct hdlc hdlc; /* Our hdlc state */ int fd; /* File descriptor for this device */ - int mbits; /* Current DCD status */ struct mbuf *out; /* mbuf that suffered a short write */ int connect_count; struct datalink *dl; /* my owner */ @@ -67,9 +70,11 @@ struct physical { char *base; } name; - unsigned Utmp : 1; /* Are we in utmp ? */ + unsigned Utmp : 1; /* Are we in utmp ? (move to ttydevice ?) */ pid_t session_owner; /* HUP this when closing the link */ + struct device *handler; /* device specific handler */ + struct { unsigned rts_cts : 1; /* Is rts/cts enabled ? */ unsigned parity; /* What parity is enabled? (tty flags) */ @@ -82,12 +87,6 @@ struct physical { int delay; /* Wait this many seconds after login script */ } cd; } cfg; - - struct termios ios; /* To be able to reset from raw mode */ - - struct pppTimer Timer; /* CD checks */ - - const struct device *handler; /* device specific handlers */ }; #define field2phys(fp, name) \ @@ -99,6 +98,10 @@ struct physical { #define descriptor2physical(d) \ ((d)->type == PHYSICAL_DESCRIPTOR ? field2phys(d, desc) : NULL) +#define PHYSICAL_NOFORCE 1 +#define PHYSICAL_FORCE_ASYNC 2 +#define PHYSICAL_FORCE_SYNC 3 + extern struct physical *physical_Create(struct datalink *, int); extern int physical_Open(struct physical *, struct bundle *); extern int physical_Raw(struct physical *); @@ -132,3 +135,4 @@ extern int physical_RemoveFromSet(struct physical *, fd_set *, fd_set *, extern int physical_SetMode(struct physical *, int); extern void physical_DeleteQueue(struct physical *); extern void physical_SetupStack(struct physical *, int); +extern void physical_StopDeviceTimer(struct physical *); |