1998-01-29 00:49:32 +00:00
|
|
|
/*
|
|
|
|
* Written by Eivind Eklund <eivind@yes.no>
|
|
|
|
* for Yes Interactive
|
|
|
|
*
|
|
|
|
* Copyright (C) 1998, Yes Interactive. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in any form is permitted. Redistribution in
|
|
|
|
* source form should include the above copyright and this set of
|
|
|
|
* conditions, because large sections american law seems to have been
|
|
|
|
* created by a bunch of jerks on drugs that are now illegal, forcing
|
|
|
|
* me to include this copyright-stuff instead of placing this in the
|
|
|
|
* public domain. The name of of 'Yes Interactive' or 'Eivind Eklund'
|
|
|
|
* 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.
|
|
|
|
*
|
1999-01-10 01:26:30 +00:00
|
|
|
* $Id: physical.h,v 1.4 1998/08/25 17:48:43 brian Exp $
|
1998-01-29 00:49:32 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
1998-04-07 00:54:26 +00:00
|
|
|
struct bundle;
|
|
|
|
|
1998-01-29 00:49:32 +00:00
|
|
|
struct physical {
|
1998-01-30 19:46:07 +00:00
|
|
|
struct link link;
|
1998-02-09 19:21:11 +00:00
|
|
|
struct descriptor desc;
|
1998-05-01 19:26:12 +00:00
|
|
|
int type; /* What sort of PHYS_* link are we ? */
|
1998-02-02 19:33:40 +00:00
|
|
|
struct async async; /* Our async state */
|
1998-02-18 19:35:59 +00:00
|
|
|
struct hdlc hdlc; /* Our hdlc state */
|
1998-01-30 19:46:07 +00:00
|
|
|
int fd; /* File descriptor for this device */
|
|
|
|
int mbits; /* Current DCD status */
|
1999-01-10 01:26:30 +00:00
|
|
|
unsigned isatty : 1;
|
1998-03-10 03:06:07 +00:00
|
|
|
struct mbuf *out; /* mbuf that suffered a short write */
|
1998-01-30 19:46:07 +00:00
|
|
|
int connect_count;
|
1998-03-13 00:44:51 +00:00
|
|
|
struct datalink *dl; /* my owner */
|
1998-01-29 00:49:32 +00:00
|
|
|
|
1998-03-06 00:34:47 +00:00
|
|
|
struct {
|
|
|
|
char full[40];
|
|
|
|
char *base;
|
|
|
|
} name;
|
|
|
|
|
1998-03-10 03:06:07 +00:00
|
|
|
unsigned Utmp : 1; /* Are we in utmp ? */
|
1998-05-29 18:33:10 +00:00
|
|
|
pid_t session_owner; /* HUP this when closing the link */
|
1998-03-10 03:06:07 +00:00
|
|
|
|
1998-01-30 19:46:07 +00:00
|
|
|
/* XXX-ML Most of the below is device specific, and probably do not
|
1998-01-29 00:49:32 +00:00
|
|
|
belong in the generic physical struct. It comes from modem.c. */
|
1998-02-17 19:29:03 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
unsigned rts_cts : 1; /* Is rts/cts enabled? */
|
1998-04-07 00:54:26 +00:00
|
|
|
unsigned parity; /* What parity is enabled? (TTY flags) */
|
|
|
|
unsigned speed; /* Modem speed */
|
1998-03-06 00:34:47 +00:00
|
|
|
char devlist[LINE_LEN]; /* Comma-separated list of devices */
|
1998-02-17 19:29:03 +00:00
|
|
|
} cfg;
|
|
|
|
|
1998-01-30 19:46:07 +00:00
|
|
|
struct termios ios; /* To be able to reset from raw mode */
|
1998-04-20 00:20:41 +00:00
|
|
|
|
|
|
|
struct pppTimer Timer; /* CD checks */
|
1998-01-29 00:49:32 +00:00
|
|
|
};
|
|
|
|
|
1998-02-09 19:21:11 +00:00
|
|
|
#define field2phys(fp, name) \
|
|
|
|
((struct physical *)((char *)fp - (int)(&((struct physical *)0)->name)))
|
|
|
|
|
|
|
|
#define link2physical(l) \
|
|
|
|
((l)->type == PHYSICAL_LINK ? field2phys(l, link) : NULL)
|
|
|
|
|
|
|
|
#define descriptor2physical(d) \
|
|
|
|
((d)->type == PHYSICAL_DESCRIPTOR ? field2phys(d, desc) : NULL)
|
1998-01-30 19:46:07 +00:00
|
|
|
|
1998-05-01 19:26:12 +00:00
|
|
|
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 int physical_SetSpeed(struct physical *, int);
|
1998-01-29 00:49:32 +00:00
|
|
|
|
1998-05-01 19:26:12 +00:00
|
|
|
/*
|
|
|
|
* XXX-ML I'm not certain this is the right way to handle this, but we
|
|
|
|
* can solve that later.
|
|
|
|
*/
|
|
|
|
extern void physical_SetSync(struct physical *);
|
1998-01-29 00:49:32 +00:00
|
|
|
|
1998-05-01 19:26:12 +00:00
|
|
|
/*
|
|
|
|
* Can this be set? (Might not be a relevant attribute for this
|
|
|
|
* device, for instance)
|
|
|
|
*/
|
|
|
|
extern int physical_SetRtsCts(struct physical *, int);
|
|
|
|
|
|
|
|
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_IsSet(struct descriptor *, const fd_set *);
|
|
|
|
extern void physical_Login(struct physical *, const char *);
|
|
|
|
extern void physical_Logout(struct physical *);
|
1998-05-15 18:21:45 +00:00
|
|
|
extern int physical_RemoveFromSet(struct physical *, fd_set *, fd_set *,
|
|
|
|
fd_set *);
|
1998-05-15 23:58:30 +00:00
|
|
|
extern int physical_SetMode(struct physical *, int);
|
1998-08-25 17:48:43 +00:00
|
|
|
extern void physical_DeleteQueue(struct physical *);
|