3b0f8d2ed6
o Remove bundle2lcp(), bundle2ccp() and bundle2link(). They're too resource-hungry and we have `owner pointers' to do their job. o Make our FSM understand LCPs that are always ST_OPENED (with a minimum code that != 1). o Send FSM code rejects for invalid codes. o Make our bundle fsm_parent deal with multiple links. o Make timer diagnostics pretty and allow access via ~t in `term' mode (not just when logging debug) and `show timers'. Only show timers every second in debug mode, otherwise we get too many diagnostics to be useful (we probably still do). Also, don't restrict ~m in term mode to depend on debug logging. o Rationalise our bundles' phases. o Create struct mp (multilink protocol). This is both an NCP and a type of struct link. It feeds off other NCPs for output, passing fragmented packets into the queues of available datalinks. It also gets PROTO_MP input, reassembles the fragments into ppp frames, and passes them back to the HDLC layer that the fragments were passed from. ** It's not yet possible to enter multilink mode :-( ** o Add `set weight' (requires context) for deciding on a links weighting in multilink mode. Weighting is simplistic (and probably badly implemented) for now. o Remove the function pointers in struct link. They ended up only applying to physical links. o Configure our tun device with an MTU equal to the MRU from struct mp's LCP and a speed equal to the sum of our link speeds. o `show {lcp,ccp,proto}' and `set deflate' now have optional context and use ChooseLink() to decide on which `struct link' to use. This allows behaviour as before when in non-multilink mode, and allows access to the MP logical link in multilink mode. o Ignore reconnect and redial values when in -direct mode and when cleaning up. Always redial when in -ddial or -dedicated mode (unless cleaning up). o Tell our links to `staydown' when we close them due to a signal. o Remove remaining `#ifdef SIGALRM's (ppp doesn't function without alarms). o Don't bother strdup()ing our physical link name. o Various other cosmetic changes.
109 lines
4.2 KiB
C
109 lines
4.2 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.17 1998/03/20 19:48:18 brian Exp $
|
|
*
|
|
*/
|
|
|
|
struct physical {
|
|
struct link link;
|
|
struct descriptor desc;
|
|
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 is_dedicated : 1; /* Dedicated mode? XXX-ML - not yet used */
|
|
unsigned is_direct : 1; /* Direct mode? XXX-ML - not yet used */
|
|
unsigned rts_cts : 1; /* Is rts/cts enabled? */
|
|
unsigned int parity; /* What parity is enabled? (TTY flags) */
|
|
unsigned int 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 *);
|
|
int Physical_IsDedicated(struct physical *phys);
|
|
int Physical_IsDirect(struct physical *phys);
|
|
const char *Physical_GetDevice(struct physical *);
|
|
|
|
|
|
void Physical_SetDeviceList(struct physical *, const char *);
|
|
int /* Was this speed OK? */
|
|
Physical_SetSpeed(struct physical *phys, int speed);
|
|
|
|
/* 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 *phys);
|
|
|
|
int /* Can this be set? (Might not be a relevant attribute for this
|
|
device, for instance) */
|
|
Physical_SetRtsCts(struct physical *phys, int enable);
|
|
|
|
void Physical_SetDedicated(struct physical *phys, int enable);
|
|
void Physical_SetDirect(struct physical *phys, int enable);
|
|
|
|
void Physical_FD_SET(struct physical *, fd_set *);
|
|
int Physical_FD_ISSET(struct physical *, fd_set *);
|
|
|
|
void Physical_DupAndClose(struct physical *);
|
|
ssize_t Physical_Read(struct physical *phys, void *buf, size_t nbytes);
|
|
ssize_t Physical_Write(struct physical *phys, const void *buf, size_t nbytes);
|
|
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 *);
|