565e35e50e
o Shuffle things that live at the datalink level into ``show link'' rather than ``show modem''. o Make both ``show'' commands prettier and more consistent, and display carrier status, link type and our name in ``show modem''. o Show redial and reconnect information in ``show link'' and remove ``show redial'' and ``show reconnect''. o Down the correct link in bundle_LinkLost(). o Remove stale -direct and -background links at the end of our main loop, not when we know they're going. This prevents unexpected pointer-invalidations... o If we ``set server'' with the same values twice, notice and don't moan about failure. o Record dial script despite our link mode. The mode may be changed later (next mod) :-) We never run scripts in -direct and -dedicated modes. o Make ``set server none'' functional again. o Correct datalink state array so that we don't report an ``unknown'' state. o Pass struct ipcp to IpcpCleanInterface, not struct fsm. o Create TUN_PREFIX define rather than hard-coding in main.c o prompt_TtyInit now handles a NULL prompt for -direct mode rather than having to create one then destroy it uncleanly. o Mention our mode in the "PPP Started" LogPHASE message. o Bring all auto links up when we have something to send. o Remove some redundant Physical_*() functions. o Show which connection is running a command when logging commands. o Initialise throughput uptime correctly.
102 lines
3.8 KiB
C
102 lines
3.8 KiB
C
/*
|
|
* 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.
|
|
*
|
|
* $Id: physical.h,v 1.1.2.19 1998/04/07 00:54:14 brian Exp $
|
|
*
|
|
*/
|
|
|
|
struct bundle;
|
|
|
|
struct physical {
|
|
struct link link;
|
|
struct descriptor desc;
|
|
int type; /* What sort of link are we ? */
|
|
struct async async; /* Our async state */
|
|
struct hdlc hdlc; /* Our hdlc state */
|
|
int fd; /* File descriptor for this device */
|
|
int mbits; /* Current DCD status */
|
|
unsigned dev_is_modem : 1; /* Is the device an actual modem?
|
|
Faked for sync devices, though...
|
|
(Possibly this should be
|
|
dev_is_not_tcp?) XXX-ML */
|
|
|
|
struct mbuf *out; /* mbuf that suffered a short write */
|
|
int connect_count;
|
|
struct datalink *dl; /* my owner */
|
|
|
|
struct {
|
|
char full[40];
|
|
char *base;
|
|
} name;
|
|
|
|
unsigned Utmp : 1; /* Are we in utmp ? */
|
|
|
|
/* 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 */
|
|
char devlist[LINE_LEN]; /* Comma-separated list of devices */
|
|
} cfg;
|
|
|
|
struct termios ios; /* To be able to reset from raw mode */
|
|
};
|
|
|
|
#define field2phys(fp, name) \
|
|
((struct physical *)((char *)fp - (int)(&((struct physical *)0)->name)))
|
|
|
|
#define physical2link(p) (&(p)->link)
|
|
#define link2physical(l) \
|
|
((l)->type == PHYSICAL_LINK ? field2phys(l, link) : NULL)
|
|
|
|
#define physical2descriptor(p) (&(p)->desc)
|
|
#define descriptor2physical(d) \
|
|
((d)->type == PHYSICAL_DESCRIPTOR ? field2phys(d, desc) : NULL)
|
|
|
|
int Physical_GetFD(struct physical *);
|
|
int Physical_IsATTY(struct physical *);
|
|
int Physical_IsSync(struct physical *);
|
|
const char *Physical_GetDevice(struct physical *);
|
|
|
|
|
|
void Physical_SetDeviceList(struct physical *, const char *);
|
|
int /* Was this speed OK? */
|
|
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. */
|
|
void Physical_SetSync(struct physical *);
|
|
|
|
int /* Can this be set? (Might not be a relevant attribute for this
|
|
device, for instance) */
|
|
Physical_SetRtsCts(struct physical *, int);
|
|
|
|
void Physical_DupAndClose(struct physical *);
|
|
ssize_t Physical_Read(struct physical *, void *, size_t);
|
|
ssize_t Physical_Write(struct physical *, const void *, size_t);
|
|
int Physical_UpdateSet(struct descriptor *, fd_set *, fd_set *, fd_set *,
|
|
int *, int);
|
|
int Physical_IsSet(struct descriptor *, const fd_set *);
|
|
void Physical_DescriptorWrite(struct descriptor *, struct bundle *,
|
|
const fd_set *);
|
|
|
|
void Physical_Login(struct physical *, const char *);
|
|
void Physical_Logout(struct physical *);
|