diff options
author | brian <brian@FreeBSD.org> | 1999-05-08 11:07:56 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1999-05-08 11:07:56 +0000 |
commit | ab7d88ae2d8ea955c6193cc242b9cee4d58f8fd4 (patch) | |
tree | e79816f983bd5a5be86a78fe0aafbd00a13ac2db /usr.sbin/ppp/physical.h | |
parent | 713dd62834d401cc7b9b394a4b916ab9e5e3d4d5 (diff) | |
download | FreeBSD-src-ab7d88ae2d8ea955c6193cc242b9cee4d58f8fd4.zip FreeBSD-src-ab7d88ae2d8ea955c6193cc242b9cee4d58f8fd4.tar.gz |
o Redesign the layering mechanism and make the aliasing code part of
the layering.
We now ``stack'' layers as soon as we open the device (when we figure
out what we're dealing with). A static set of `dispatch' routines are
also declared for dealing with incoming packets after they've been
`pulled' up through the stacked layers.
Physical devices are now assigned handlers based on the device type
when they're opened. For the moment there are three device types;
ttys, execs and tcps.
o Increment version number to 2.2
o Make an entry in [uw]tmp for non-tty -direct invocations (after
pap/chap authentication).
o Make throughput counters quad_t's
o Account for the absolute number of mbuf malloc()s and free()s in
``show mem''.
o ``show modem'' becomes ``show physical''.
Diffstat (limited to 'usr.sbin/ppp/physical.h')
-rw-r--r-- | usr.sbin/ppp/physical.h | 78 |
1 files changed, 52 insertions, 26 deletions
diff --git a/usr.sbin/ppp/physical.h b/usr.sbin/ppp/physical.h index b6f95bb..bad8926 100644 --- a/usr.sbin/ppp/physical.h +++ b/usr.sbin/ppp/physical.h @@ -16,11 +16,34 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: physical.h,v 1.7 1999/04/03 11:54:00 brian Exp $ + * $Id: physical.h,v 1.8 1999/04/27 00:23:57 brian Exp $ * */ +struct datalink; struct bundle; +struct iovec; +struct physical; +struct bundle; +struct ccp; +struct cmdargs; + +#define TTY_DEVICE 1 +#define TCP_DEVICE 2 +#define EXEC_DEVICE 3 + +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 *); + int (*speed)(struct physical *); + const char *(*openinfo)(struct physical *); +}; struct physical { struct link link; @@ -30,7 +53,6 @@ struct physical { struct hdlc hdlc; /* Our hdlc state */ int fd; /* File descriptor for this device */ int mbits; /* Current DCD status */ - unsigned isatty : 1; struct mbuf *out; /* mbuf that suffered a short write */ int connect_count; struct datalink *dl; /* my owner */ @@ -41,20 +63,18 @@ struct physical { } input; struct { - char full[40]; + char full[40]; /* Our current device name */ char *base; } name; unsigned Utmp : 1; /* Are we in utmp ? */ pid_t session_owner; /* HUP this when closing the link */ - /* XXX-ML Most of the below is device specific, and probably do not - belong in the generic physical struct. It comes from modem.c. */ - struct { - unsigned rts_cts : 1; /* Is rts/cts enabled? */ - unsigned parity; /* What parity is enabled? (TTY flags) */ - unsigned speed; /* Modem speed */ + unsigned rts_cts : 1; /* Is rts/cts enabled ? */ + unsigned parity; /* What parity is enabled? (tty flags) */ + unsigned speed; /* tty speed */ + char devlist[LINE_LEN]; /* NUL separated list of devices */ int ndev; /* number of devices in list */ struct { @@ -66,6 +86,8 @@ struct physical { 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) \ @@ -77,32 +99,36 @@ struct physical { #define descriptor2physical(d) \ ((d)->type == PHYSICAL_DESCRIPTOR ? field2phys(d, desc) : NULL) -extern int physical_GetFD(struct physical *); -extern int physical_IsSync(struct physical *); -extern const char *physical_GetDevice(struct physical *); -extern void physical_SetDeviceList(struct physical *, int, const char *const *); +extern struct physical *physical_Create(struct datalink *, int); +extern int physical_Open(struct physical *, struct bundle *); +extern int physical_Raw(struct physical *); +extern int physical_GetSpeed(struct physical *); extern int physical_SetSpeed(struct physical *, int); - -/* - * XXX-ML I'm not certain this is the right way to handle this, but we - * can solve that later. - */ +extern int physical_SetParity(struct physical *, const char *); +extern int physical_SetRtsCts(struct physical *, int); extern void physical_SetSync(struct physical *); +extern int physical_ShowStatus(struct cmdargs const *); +extern void physical_Offline(struct physical *); +extern void physical_Close(struct physical *); +extern void physical_Destroy(struct physical *); +extern struct physical *iov2physical(struct datalink *, struct iovec *, int *, + int, int); +extern int physical2iov(struct physical *, struct iovec *, int *, int, pid_t); +extern void physical_ChangedPid(struct physical *, pid_t); -/* - * Can this be set? (Might not be a relevant attribute for this - * device, for instance) - */ -extern int physical_SetRtsCts(struct physical *, int); +extern int physical_IsSync(struct physical *); +extern const char *physical_GetDevice(struct physical *); +extern void physical_SetDeviceList(struct physical *, int, const char *const *); +extern void physical_SetDevice(struct physical *, const char *); extern ssize_t physical_Read(struct physical *, void *, size_t); extern ssize_t physical_Write(struct physical *, const void *, size_t); -extern int physical_UpdateSet(struct descriptor *, fd_set *, fd_set *, - fd_set *, int *, int); +extern int physical_doUpdateSet(struct descriptor *, fd_set *, fd_set *, + fd_set *, int *, int); extern int physical_IsSet(struct descriptor *, const fd_set *); extern void physical_Login(struct physical *, const char *); -extern void physical_Logout(struct physical *); extern int physical_RemoveFromSet(struct physical *, fd_set *, fd_set *, fd_set *); extern int physical_SetMode(struct physical *, int); extern void physical_DeleteQueue(struct physical *); +extern void physical_SetupStack(struct physical *, int); |