mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-11 09:50:12 +00:00
Remove static phys_modem
This commit is contained in:
parent
ecd5172a68
commit
6f1bc4e5da
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/cvs2svn/branches/MP/; revision=33126
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: link.c,v 1.1.2.1 1998/01/30 19:45:49 brian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -146,6 +146,12 @@ link_Close(struct link *l, int dedicated_force)
|
||||
(*l->Close)(l, dedicated_force);
|
||||
}
|
||||
|
||||
void
|
||||
link_Destroy(struct link *l)
|
||||
{
|
||||
(*l->Destroy)(l);
|
||||
}
|
||||
|
||||
static struct protostatheader {
|
||||
u_short number;
|
||||
const char *name;
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: link.h,v 1.1.2.1 1998/01/30 19:45:50 brian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
struct link {
|
||||
int type; /* _LINK type */
|
||||
const char *name; /* unique id per link type */
|
||||
char *name; /* unique id per link type */
|
||||
int len; /* full size of parent struct */
|
||||
struct pppThroughput throughput; /* Link throughput statistics */
|
||||
struct pppTimer Timer; /* inactivity timeout */
|
||||
@ -49,6 +49,7 @@ struct link {
|
||||
void (*StartOutput)(struct link *); /* send the queued data */
|
||||
int (*IsActive)(struct link *); /* Are we active ? */
|
||||
void (*Close)(struct link *, int); /* Close the link */
|
||||
void (*Destroy)(struct link *); /* Destructor */
|
||||
};
|
||||
|
||||
extern void link_AddInOctets(struct link *, int);
|
||||
@ -68,3 +69,4 @@ extern void link_ReportProtocolStatus(struct link *);
|
||||
|
||||
extern int link_IsActive(struct link *);
|
||||
extern void link_Close(struct link *, int);
|
||||
extern void link_Destroy(struct link *);
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: main.c,v 1.121.2.6 1998/02/02 19:33:38 brian Exp $
|
||||
* $Id: main.c,v 1.121.2.7 1998/02/06 02:22:17 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Add commands for traffic summary, version display, etc.
|
||||
@ -202,6 +202,7 @@ Cleanup(int excode)
|
||||
}
|
||||
LogPrintf(LogPHASE, "PPP Terminated (%s).\n", ex_desc(excode));
|
||||
TtyOldMode();
|
||||
link_Destroy(physical2link(pppVars.physical));
|
||||
LogClose();
|
||||
|
||||
exit(excode);
|
||||
@ -371,6 +372,12 @@ main(int argc, char **argv)
|
||||
name = strrchr(argv[0], '/');
|
||||
LogOpen(name ? name + 1 : argv[0]);
|
||||
|
||||
pppVars.physical = modem_Create("modem");
|
||||
if (pppVars.physical == NULL) {
|
||||
LogPrintf(LogERROR, "Cannot create modem device: %s\n", strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
tcgetattr(STDIN_FILENO, &oldtio); /* Save original tty mode */
|
||||
|
||||
argc--;
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: modem.c,v 1.77.2.4 1998/02/02 19:33:38 brian Exp $
|
||||
* $Id: modem.c,v 1.77.2.5 1998/02/06 02:22:21 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -77,24 +77,27 @@
|
||||
static void modem_StartOutput(struct link *);
|
||||
static int modem_IsActive(struct link *);
|
||||
static void modem_Hangup(struct link *, int);
|
||||
static void modem_Destroy(struct link *);
|
||||
|
||||
struct physical phys_modem = {
|
||||
{
|
||||
PHYSICAL_LINK,
|
||||
"modem",
|
||||
sizeof(struct physical),
|
||||
{ 0 }, /* throughput */
|
||||
{ 0 }, /* timer */
|
||||
{ { 0 } }, /* queues */
|
||||
{ 0 }, /* proto_in */
|
||||
{ 0 }, /* proto_out */
|
||||
modem_StartOutput,
|
||||
modem_IsActive,
|
||||
modem_Hangup
|
||||
},
|
||||
{ 0 },
|
||||
-1
|
||||
};
|
||||
struct physical *
|
||||
modem_Create(const char *name)
|
||||
{
|
||||
struct physical *p;
|
||||
|
||||
p = (struct physical *)malloc(sizeof(struct physical));
|
||||
if (!p)
|
||||
return NULL;
|
||||
memset(p, '\0', sizeof *p);
|
||||
p->link.type = PHYSICAL_LINK;
|
||||
p->link.name = strdup(name);
|
||||
p->link.len = sizeof *p;
|
||||
p->link.StartOutput = modem_StartOutput;
|
||||
p->link.IsActive = modem_IsActive;
|
||||
p->link.Close = modem_Hangup;
|
||||
p->link.Destroy = modem_Destroy;
|
||||
p->fd = -1;
|
||||
return p;
|
||||
}
|
||||
|
||||
/* XXX-ML this should probably change when we add support for other
|
||||
types of devices */
|
||||
@ -773,6 +776,18 @@ modem_Hangup(struct link *l, int dedicated_force)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
modem_Destroy(struct link *l)
|
||||
{
|
||||
struct physical *p;
|
||||
|
||||
p = link2physical(l);
|
||||
if (p->fd != -1)
|
||||
modem_Hangup(l, 1);
|
||||
free(l->name);
|
||||
free(p);
|
||||
}
|
||||
|
||||
static void
|
||||
modem_LogicalClose(struct physical *modem)
|
||||
{
|
||||
|
@ -15,7 +15,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: modem.h,v 1.16.2.3 1998/02/02 19:32:12 brian Exp $
|
||||
* $Id: modem.h,v 1.16.2.4 1998/02/06 02:22:23 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -23,6 +23,7 @@
|
||||
struct physical;
|
||||
|
||||
extern int modem_Raw(struct physical *);
|
||||
extern struct physical *modem_Create(const char *);
|
||||
extern int modem_Open(struct physical *, struct bundle *);
|
||||
extern int modem_Speed(struct physical *);
|
||||
extern int modem_Dial(struct physical *, struct bundle *);
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: vars.c,v 1.45.2.2 1998/02/02 19:32:16 brian Exp $
|
||||
* $Id: vars.c,v 1.45.2.3 1998/02/02 19:33:40 brian Exp $
|
||||
*
|
||||
*/
|
||||
#include <sys/param.h>
|
||||
@ -44,7 +44,7 @@
|
||||
#include "physical.h"
|
||||
|
||||
char VarVersion[] = "PPP Version 1.90";
|
||||
char VarLocalVersion[] = "$Date: 1998/02/02 19:32:16 $";
|
||||
char VarLocalVersion[] = "$Date: 1998/02/02 19:33:40 $";
|
||||
int Utmp = 0;
|
||||
int ipKeepAlive = 0;
|
||||
int reconnectState = RECON_UNKNOWN;
|
||||
@ -71,13 +71,11 @@ struct confdesc pppConfs[] = {
|
||||
{NULL},
|
||||
};
|
||||
|
||||
extern struct physical phys_modem;
|
||||
|
||||
struct pppvars pppVars = {
|
||||
DEF_MRU, DEF_MTU, 0, MODEM_SPEED, CS8, MODEM_CTSRTS, 180, 30, 3,
|
||||
RECONNECT_TIMER, RECONNECT_TRIES, REDIAL_PERIOD,
|
||||
NEXT_REDIAL_PERIOD, 1, 1, MODEM_DEV, "", BASE_MODEM_DEV,
|
||||
1, LOCAL_NO_AUTH, 0, &phys_modem
|
||||
1, LOCAL_NO_AUTH
|
||||
};
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user