1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-06 13:09:50 +00:00

Create struct async' and make it part of struct physical'.

This structure contains the asynchronous state of the physical
link.
Unfortunately, just about every .h file is included in every .c
file now.  Fixing this can be one of the last jobs.
This commit is contained in:
Brian Somers 1998-02-02 19:33:40 +00:00
parent 820de6eb8e
commit 6140ba1177
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/cvs2svn/branches/MP/; revision=33032
17 changed files with 113 additions and 90 deletions

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: async.c,v 1.15.2.2 1998/01/30 19:45:25 brian Exp $ * $Id: async.c,v 1.15.2.3 1998/02/02 19:32:00 brian Exp $
* *
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -44,49 +44,34 @@
#include "link.h" #include "link.h"
#include "physical.h" #include "physical.h"
#define HDLCSIZE (MAX_MRU*2+6)
static struct async_state {
int mode;
int length;
u_char hbuff[HDLCSIZE]; /* recv buffer */
u_char xbuff[HDLCSIZE]; /* xmit buffer */
u_long my_accmap;
u_long his_accmap;
} AsyncState;
#define MODE_HUNT 0x01 #define MODE_HUNT 0x01
#define MODE_ESC 0x02 #define MODE_ESC 0x02
void void
AsyncInit() async_Init(struct async *async)
{ {
struct async_state *stp = &AsyncState; async->mode = MODE_HUNT;
async->length = 0;
stp->mode = MODE_HUNT; async->my_accmap = async->his_accmap = 0xffffffff;
stp->length = 0;
stp->my_accmap = stp->his_accmap = 0xffffffff;
} }
void void
SetLinkParams(struct lcpstate *lcp) async_SetLinkParams(struct async *async, struct lcpstate *lcp)
{ {
struct async_state *stp = &AsyncState; async->my_accmap = lcp->want_accmap;
async->his_accmap = lcp->his_accmap;
stp->my_accmap = lcp->want_accmap;
stp->his_accmap = lcp->his_accmap;
} }
/* /*
* Encode into async HDLC byte code if necessary * Encode into async HDLC byte code if necessary
*/ */
static void static void
HdlcPutByte(u_char **cp, u_char c, int proto) HdlcPutByte(struct async *async, u_char **cp, u_char c, int proto)
{ {
u_char *wp; u_char *wp;
wp = *cp; wp = *cp;
if ((c < 0x20 && (proto == PROTO_LCP || (AsyncState.his_accmap & (1 << c)))) if ((c < 0x20 && (proto == PROTO_LCP || (async->his_accmap & (1 << c))))
|| (c == HDLC_ESC) || (c == HDLC_SYN)) { || (c == HDLC_ESC) || (c == HDLC_SYN)) {
*wp++ = HDLC_ESC; *wp++ = HDLC_ESC;
c ^= HDLC_XOR; c ^= HDLC_XOR;
@ -100,9 +85,8 @@ HdlcPutByte(u_char **cp, u_char c, int proto)
} }
void void
AsyncOutput(int pri, struct mbuf *bp, int proto, struct link *l) async_Output(int pri, struct mbuf *bp, int proto, struct physical *physical)
{ {
struct async_state *hs = &AsyncState;
u_char *cp, *sp, *ep; u_char *cp, *sp, *ep;
struct mbuf *wp; struct mbuf *wp;
int cnt; int cnt;
@ -111,14 +95,14 @@ AsyncOutput(int pri, struct mbuf *bp, int proto, struct link *l)
pfree(bp); pfree(bp);
return; return;
} }
cp = hs->xbuff; cp = physical->async.xbuff;
ep = cp + HDLCSIZE - 10; ep = cp + HDLCSIZE - 10;
wp = bp; wp = bp;
*cp++ = HDLC_SYN; *cp++ = HDLC_SYN;
while (wp) { while (wp) {
sp = MBUF_CTOP(wp); sp = MBUF_CTOP(wp);
for (cnt = wp->cnt; cnt > 0; cnt--) { for (cnt = wp->cnt; cnt > 0; cnt--) {
HdlcPutByte(&cp, *sp++, proto); HdlcPutByte(&physical->async, &cp, *sp++, proto);
if (cp >= ep) { if (cp >= ep) {
pfree(bp); pfree(bp);
return; return;
@ -128,59 +112,58 @@ AsyncOutput(int pri, struct mbuf *bp, int proto, struct link *l)
} }
*cp++ = HDLC_SYN; *cp++ = HDLC_SYN;
cnt = cp - hs->xbuff; cnt = cp - physical->async.xbuff;
LogDumpBuff(LogASYNC, "WriteModem", hs->xbuff, cnt); LogDumpBuff(LogASYNC, "WriteModem", physical->async.xbuff, cnt);
link_Write(l, pri, (char *)hs->xbuff, cnt); link_Write(physical2link(physical), pri, (char *)physical->async.xbuff, cnt);
link_AddOutOctets(l, cnt); link_AddOutOctets(physical2link(physical), cnt);
pfree(bp); pfree(bp);
} }
static struct mbuf * static struct mbuf *
AsyncDecode(u_char c) async_Decode(struct async *async, u_char c)
{ {
struct async_state *hs = &AsyncState;
struct mbuf *bp; struct mbuf *bp;
if ((hs->mode & MODE_HUNT) && c != HDLC_SYN) if ((async->mode & MODE_HUNT) && c != HDLC_SYN)
return NULL; return NULL;
switch (c) { switch (c) {
case HDLC_SYN: case HDLC_SYN:
hs->mode &= ~MODE_HUNT; async->mode &= ~MODE_HUNT;
if (hs->length) { /* packet is ready. */ if (async->length) { /* packet is ready. */
bp = mballoc(hs->length, MB_ASYNC); bp = mballoc(async->length, MB_ASYNC);
mbwrite(bp, hs->hbuff, hs->length); mbwrite(bp, async->hbuff, async->length);
hs->length = 0; async->length = 0;
return bp; return bp;
} }
break; break;
case HDLC_ESC: case HDLC_ESC:
if (!(hs->mode & MODE_ESC)) { if (!(async->mode & MODE_ESC)) {
hs->mode |= MODE_ESC; async->mode |= MODE_ESC;
break; break;
} }
/* Fall into ... */ /* Fall into ... */
default: default:
if (hs->length >= HDLCSIZE) { if (async->length >= HDLCSIZE) {
/* packet is too large, discard it */ /* packet is too large, discard it */
LogPrintf(LogERROR, "Packet too large (%d), discarding.\n", hs->length); LogPrintf(LogERROR, "Packet too large (%d), discarding.\n", async->length);
hs->length = 0; async->length = 0;
hs->mode = MODE_HUNT; async->mode = MODE_HUNT;
break; break;
} }
if (hs->mode & MODE_ESC) { if (async->mode & MODE_ESC) {
c ^= HDLC_XOR; c ^= HDLC_XOR;
hs->mode &= ~MODE_ESC; async->mode &= ~MODE_ESC;
} }
hs->hbuff[hs->length++] = c; async->hbuff[async->length++] = c;
break; break;
} }
return NULL; return NULL;
} }
void void
AsyncInput(struct bundle *bundle, u_char *buff, int cnt, async_Input(struct bundle *bundle, u_char *buff, int cnt,
struct physical *physical) struct physical *physical)
{ {
struct mbuf *bp; struct mbuf *bp;
@ -193,7 +176,7 @@ AsyncInput(struct bundle *bundle, u_char *buff, int cnt,
HdlcInput(bundle, bp, physical); HdlcInput(bundle, bp, physical);
} else { } else {
while (cnt > 0) { while (cnt > 0) {
bp = AsyncDecode(*buff++); bp = async_Decode(&physical->async, *buff++);
if (bp) if (bp)
HdlcInput(bundle, bp, physical); HdlcInput(bundle, bp, physical);
cnt--; cnt--;

View File

@ -23,10 +23,21 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: async.h,v 1.2.4.2 1998/01/30 19:45:25 brian Exp $ * $Id: async.h,v 1.2.4.3 1998/02/02 19:32:00 brian Exp $
*/ */
extern void AsyncInit(void); #define HDLCSIZE (MAX_MRU*2+6)
extern void SetLinkParams(struct lcpstate *);
extern void AsyncOutput(int, struct mbuf *, int, struct link *); struct async {
extern void AsyncInput(struct bundle *, u_char *, int, struct physical *); int mode;
int length;
u_char hbuff[HDLCSIZE]; /* recv buffer */
u_char xbuff[HDLCSIZE]; /* xmit buffer */
u_long my_accmap;
u_long his_accmap;
};
extern void async_Init(struct async *);
extern void async_SetLinkParams(struct async *, struct lcpstate *);
extern void async_Output(int, struct mbuf *, int, struct physical *);
extern void async_Input(struct bundle *, u_char *, int, struct physical *);

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: auth.c,v 1.27.2.3 1998/01/30 19:45:26 brian Exp $ * $Id: auth.c,v 1.27.2.4 1998/02/02 19:32:00 brian Exp $
* *
* TODO: * TODO:
* o Implement check against with registered IP addresses. * o Implement check against with registered IP addresses.
@ -28,6 +28,7 @@
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <termios.h>
#include <unistd.h> #include <unistd.h>
#include "command.h" #include "command.h"
@ -43,6 +44,10 @@
#include "auth.h" #include "auth.h"
#include "chat.h" #include "chat.h"
#include "systems.h" #include "systems.h"
#include "lcp.h"
#include "hdlc.h"
#include "async.h"
#include "link.h"
#include "physical.h" #include "physical.h"
void void

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: chap.c,v 1.28.2.4 1998/01/31 02:48:15 brian Exp $ * $Id: chap.c,v 1.28.2.5 1998/02/02 19:32:03 brian Exp $
* *
* TODO: * TODO:
*/ */
@ -32,6 +32,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <termios.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#ifdef __OpenBSD__ #ifdef __OpenBSD__
@ -56,6 +57,9 @@
#include "loadalias.h" #include "loadalias.h"
#include "vars.h" #include "vars.h"
#include "auth.h" #include "auth.h"
#include "async.h"
#include "throughput.h"
#include "link.h"
#include "physical.h" #include "physical.h"
static const char *chapcodes[] = { static const char *chapcodes[] = {

View File

@ -18,7 +18,7 @@
* Columbus, OH 43221 * Columbus, OH 43221
* (614)451-1883 * (614)451-1883
* *
* $Id: chat.c,v 1.44 1998/01/21 02:15:13 brian Exp $ * $Id: chat.c,v 1.44.2.1 1998/01/29 00:49:14 brian Exp $
* *
* TODO: * TODO:
* o Support more UUCP compatible control sequences. * o Support more UUCP compatible control sequences.
@ -50,6 +50,12 @@
#include "vars.h" #include "vars.h"
#include "chat.h" #include "chat.h"
#include "modem.h" #include "modem.h"
#include "hdlc.h"
#include "throughput.h"
#include "fsm.h"
#include "lcp.h"
#include "link.h"
#include "async.h"
#include "physical.h" #include "physical.h"
#ifndef isblank #ifndef isblank

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: command.c,v 1.131.2.5 1998/02/02 19:32:04 brian Exp $ * $Id: command.c,v 1.131.2.6 1998/02/02 19:32:30 brian Exp $
* *
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -74,6 +74,7 @@
#include "ip.h" #include "ip.h"
#include "slcompress.h" #include "slcompress.h"
#include "auth.h" #include "auth.h"
#include "async.h"
#include "link.h" #include "link.h"
#include "physical.h" #include "physical.h"

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: fsm.c,v 1.27.2.3 1998/01/31 02:48:18 brian Exp $ * $Id: fsm.c,v 1.27.2.4 1998/02/02 19:32:05 brian Exp $
* *
* TODO: * TODO:
* o Refer loglevel for log output * o Refer loglevel for log output
@ -45,6 +45,7 @@
#include "loadalias.h" #include "loadalias.h"
#include "vars.h" #include "vars.h"
#include "throughput.h" #include "throughput.h"
#include "async.h"
#include "link.h" #include "link.h"
#include "physical.h" #include "physical.h"

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: hdlc.c,v 1.28.2.4 1998/01/31 02:48:19 brian Exp $ * $Id: hdlc.c,v 1.28.2.5 1998/02/02 19:32:06 brian Exp $
* *
* TODO: * TODO:
*/ */
@ -237,7 +237,7 @@ HdlcOutput(struct link *l, int pri, u_short proto, struct mbuf *bp)
if (Physical_IsSync(p)) if (Physical_IsSync(p))
link_Output(l, pri, mhp); /* Send it raw */ link_Output(l, pri, mhp); /* Send it raw */
else else
AsyncOutput(pri, mhp, proto, l); async_Output(pri, mhp, proto, p);
} }
/* Check out the latest ``Assigned numbers'' rfc (rfc1700.txt) */ /* Check out the latest ``Assigned numbers'' rfc (rfc1700.txt) */

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: ipcp.c,v 1.50.2.5 1998/02/02 19:32:08 brian Exp $ * $Id: ipcp.c,v 1.50.2.6 1998/02/02 19:32:31 brian Exp $
* *
* TODO: * TODO:
* o More RFC1772 backwoard compatibility * o More RFC1772 backwoard compatibility
@ -33,6 +33,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <termios.h>
#include <unistd.h> #include <unistd.h>
#include "command.h" #include "command.h"
@ -56,6 +57,7 @@
#include "route.h" #include "route.h"
#include "filter.h" #include "filter.h"
#include "hdlc.h" #include "hdlc.h"
#include "async.h"
#include "link.h" #include "link.h"
#include "physical.h" #include "physical.h"
@ -252,6 +254,7 @@ IpcpInit(struct bundle *bundle, struct link *l)
IpcpInfo.VJInitComp; IpcpInfo.VJInitComp;
else else
IpcpInfo.want_compproto = 0; IpcpInfo.want_compproto = 0;
VjInit(IpcpInfo.VJInitSlots - 1);
IpcpInfo.heis1172 = 0; IpcpInfo.heis1172 = 0;
IpcpInfo.fsm.maxconfig = 10; IpcpInfo.fsm.maxconfig = 10;

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: lcp.c,v 1.55.2.5 1998/01/31 02:48:21 brian Exp $ * $Id: lcp.c,v 1.55.2.6 1998/02/02 19:32:09 brian Exp $
* *
* TODO: * TODO:
* o Limit data field length by MRU * o Limit data field length by MRU
@ -200,6 +200,7 @@ LcpInit(struct bundle *bundle, struct physical *physical)
/* Initialise ourselves */ /* Initialise ourselves */
FsmInit(&LcpInfo.fsm, bundle, physical2link(physical)); FsmInit(&LcpInfo.fsm, bundle, physical2link(physical));
HdlcInit(); HdlcInit();
async_Init(&physical->async);
LcpInfo.his_mru = DEF_MRU; LcpInfo.his_mru = DEF_MRU;
LcpInfo.his_accmap = 0xffffffff; LcpInfo.his_accmap = 0xffffffff;
@ -436,9 +437,9 @@ LcpLayerUp(struct fsm *fp)
struct physical *p = link2physical(fp->link); struct physical *p = link2physical(fp->link);
LogPrintf(LogLCP, "LcpLayerUp\n"); LogPrintf(LogLCP, "LcpLayerUp\n");
SetLinkParams(&LcpInfo);
if (p) { if (p) {
async_SetLinkParams(&p->async, &LcpInfo);
NewPhase(fp->bundle, p, PHASE_AUTHENTICATE); NewPhase(fp->bundle, p, PHASE_AUTHENTICATE);
StartLqm(p); StartLqm(p);
} else } else

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: lqr.c,v 1.22.2.3 1998/01/30 19:45:51 brian Exp $ * $Id: lqr.c,v 1.22.2.4 1998/01/31 02:48:23 brian Exp $
* *
* o LQR based on RFC1333 * o LQR based on RFC1333
* *
@ -29,6 +29,7 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <stdio.h> #include <stdio.h>
#include <termios.h>
#include "command.h" #include "command.h"
#include "mbuf.h" #include "mbuf.h"
@ -37,10 +38,13 @@
#include "timer.h" #include "timer.h"
#include "fsm.h" #include "fsm.h"
#include "lcpproto.h" #include "lcpproto.h"
#include "lcp.h"
#include "hdlc.h"
#include "async.h"
#include "throughput.h"
#include "link.h"
#include "physical.h" #include "physical.h"
#include "lqr.h" #include "lqr.h"
#include "hdlc.h"
#include "lcp.h"
#include "loadalias.h" #include "loadalias.h"
#include "vars.h" #include "vars.h"

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: main.c,v 1.121.2.4 1998/01/31 02:48:25 brian Exp $ * $Id: main.c,v 1.121.2.5 1998/02/02 19:32:10 brian Exp $
* *
* TODO: * TODO:
* o Add commands for traffic summary, version display, etc. * o Add commands for traffic summary, version display, etc.
@ -578,8 +578,6 @@ PacketMode(struct bundle *bundle, int delay)
LogPrintf(LogWARN, "PacketMode: Not connected.\n"); LogPrintf(LogWARN, "PacketMode: Not connected.\n");
return; return;
} }
AsyncInit();
VjInit(15);
LcpInit(bundle, pppVars.physical); LcpInit(bundle, pppVars.physical);
IpcpInit(bundle, physical2link(pppVars.physical)); IpcpInit(bundle, physical2link(pppVars.physical));
CcpInit(bundle, physical2link(pppVars.physical)); CcpInit(bundle, physical2link(pppVars.physical));
@ -1052,7 +1050,7 @@ DoLoop(struct bundle *bundle)
} }
} else { } else {
if (n > 0) if (n > 0)
AsyncInput(bundle, rbuff, n, pppVars.physical); async_Input(bundle, rbuff, n, pppVars.physical);
} }
} }
if (bundle->tun_fd >= 0 && FD_ISSET(bundle->tun_fd, &rfds)) { if (bundle->tun_fd >= 0 && FD_ISSET(bundle->tun_fd, &rfds)) {

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: modem.c,v 1.77.2.2 1998/01/30 19:45:57 brian Exp $ * $Id: modem.c,v 1.77.2.3 1998/02/02 19:32:11 brian Exp $
* *
* TODO: * TODO:
*/ */
@ -59,12 +59,11 @@
#include "main.h" #include "main.h"
#include "chat.h" #include "chat.h"
#include "throughput.h" #include "throughput.h"
#include "async.h"
#undef mode #undef mode
/* We're defining a physical device, and thus need the real /* We're defining a physical device, and thus need the real headers. */
headers. */
#define PHYSICAL_DEVICE
#include "link.h" #include "link.h"
#include "physical.h" #include "physical.h"
@ -93,6 +92,7 @@ struct physical phys_modem = {
ModemIsActive, ModemIsActive,
ModemHangup ModemHangup
}, },
{ 0 },
-1 -1
}; };

View File

@ -18,7 +18,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: pap.c,v 1.20.2.4 1998/01/31 02:48:27 brian Exp $ * $Id: pap.c,v 1.20.2.5 1998/02/02 19:32:12 brian Exp $
* *
* TODO: * TODO:
*/ */
@ -29,6 +29,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <termios.h>
#include <unistd.h> #include <unistd.h>
#ifdef __OpenBSD__ #ifdef __OpenBSD__
#include <util.h> #include <util.h>
@ -51,6 +52,9 @@
#include "lcpproto.h" #include "lcpproto.h"
#include "phase.h" #include "phase.h"
#include "auth.h" #include "auth.h"
#include "async.h"
#include "throughput.h"
#include "link.h"
#include "physical.h" #include "physical.h"
static const char *papcodes[] = { "???", "REQUEST", "ACK", "NAK" }; static const char *papcodes[] = { "???", "REQUEST", "ACK", "NAK" };

View File

@ -16,7 +16,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: physical.c,v 1.1.2.1 1998/01/29 00:49:29 brian Exp $ * $Id: physical.c,v 1.1.2.2 1998/01/30 19:46:02 brian Exp $
* *
*/ */
@ -44,12 +44,13 @@
#include "hdlc.h" #include "hdlc.h"
#include "timer.h" #include "timer.h"
#include "throughput.h" #include "throughput.h"
#include "fsm.h"
#include "lcp.h"
#include "async.h"
#include "link.h" #include "link.h"
#define PHYSICAL_DEVICE
#include "physical.h" #include "physical.h"
#include "vars.h" #include "vars.h"
/* External calls - should possibly be moved inline */ /* External calls - should possibly be moved inline */

View File

@ -16,13 +16,13 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: physical.h,v 1.1.2.1 1998/01/29 00:49:30 brian Exp $ * $Id: physical.h,v 1.1.2.2 1998/01/30 19:46:03 brian Exp $
* *
*/ */
#ifdef PHYSICAL_DEVICE
struct physical { struct physical {
struct link link; struct link link;
struct async async; /* Our async state */
int fd; /* File descriptor for this device */ int fd; /* File descriptor for this device */
int mbits; /* Current DCD status */ int mbits; /* Current DCD status */
unsigned dev_is_modem : 1; /* Is the device an actual modem? unsigned dev_is_modem : 1; /* Is the device an actual modem?
@ -42,9 +42,6 @@ struct physical {
unsigned int speed; /* Modem speed */ unsigned int speed; /* Modem speed */
struct termios ios; /* To be able to reset from raw mode */ struct termios ios; /* To be able to reset from raw mode */
}; };
#else
struct physical;
#endif
#define physical2link(p) ((struct link *)p) #define physical2link(p) ((struct link *)p)
#define link2physical(l) (l->type == PHYSICAL_LINK ? (struct physical *)l : 0) #define link2physical(l) (l->type == PHYSICAL_LINK ? (struct physical *)l : 0)

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: vars.c,v 1.45.2.1 1998/01/29 00:49:31 brian Exp $ * $Id: vars.c,v 1.45.2.2 1998/02/02 19:32:16 brian Exp $
* *
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -37,10 +37,14 @@
#include "loadalias.h" #include "loadalias.h"
#include "vars.h" #include "vars.h"
#include "auth.h" #include "auth.h"
#include "lcp.h"
#include "async.h"
#include "throughput.h"
#include "link.h"
#include "physical.h" #include "physical.h"
char VarVersion[] = "PPP Version 1.90"; char VarVersion[] = "PPP Version 1.90";
char VarLocalVersion[] = "$Date: 1998/01/29 00:49:31 $"; char VarLocalVersion[] = "$Date: 1998/02/02 19:32:16 $";
int Utmp = 0; int Utmp = 0;
int ipKeepAlive = 0; int ipKeepAlive = 0;
int reconnectState = RECON_UNKNOWN; int reconnectState = RECON_UNKNOWN;