Deleted Added
full compact
command.c (36928) command.c (36934)
1/*
2 * PPP User command processing module
3 *
4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
5 *
6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the Internet Initiative Japan, Inc. The name of the
14 * IIJ may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
1/*
2 * PPP User command processing module
3 *
4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
5 *
6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the Internet Initiative Japan, Inc. The name of the
14 * IIJ may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
20 * $Id: command.c,v 1.139 1998/06/10 00:16:06 brian Exp $
20 * $Id: command.c,v 1.140 1998/06/12 17:45:08 brian Exp $
21 *
22 */
23#include <sys/types.h>
24#include <netinet/in_systm.h>
25#include <netinet/in.h>
26#include <netinet/ip.h>
27#include <arpa/inet.h>
28#include <sys/socket.h>

--- 90 unchanged lines hidden (view full) ---

119#define NEG_PPPDDEFLATE 45
120#define NEG_PRED1 46
121#define NEG_PROTOCOMP 47
122#define NEG_SHORTSEQ 48
123#define NEG_VJCOMP 49
124#define NEG_DNS 50
125
126const char Version[] = "2.0-beta";
21 *
22 */
23#include <sys/types.h>
24#include <netinet/in_systm.h>
25#include <netinet/in.h>
26#include <netinet/ip.h>
27#include <arpa/inet.h>
28#include <sys/socket.h>

--- 90 unchanged lines hidden (view full) ---

119#define NEG_PPPDDEFLATE 45
120#define NEG_PRED1 46
121#define NEG_PROTOCOMP 47
122#define NEG_SHORTSEQ 48
123#define NEG_VJCOMP 49
124#define NEG_DNS 50
125
126const char Version[] = "2.0-beta";
127const char VersionDate[] = "$Date: 1998/06/10 00:16:06 $";
127const char VersionDate[] = "$Date: 1998/06/12 17:45:08 $";
128
129static int ShowCommand(struct cmdargs const *);
130static int TerminalCommand(struct cmdargs const *);
131static int QuitCommand(struct cmdargs const *);
132static int OpenCommand(struct cmdargs const *);
133static int CloseCommand(struct cmdargs const *);
134static int DownCommand(struct cmdargs const *);
135static int AllowCommand(struct cmdargs const *);
136static int SetCommand(struct cmdargs const *);
137static int LinkCommand(struct cmdargs const *);
138static int AddCommand(struct cmdargs const *);
139static int DeleteCommand(struct cmdargs const *);
140static int NegotiateCommand(struct cmdargs const *);
128
129static int ShowCommand(struct cmdargs const *);
130static int TerminalCommand(struct cmdargs const *);
131static int QuitCommand(struct cmdargs const *);
132static int OpenCommand(struct cmdargs const *);
133static int CloseCommand(struct cmdargs const *);
134static int DownCommand(struct cmdargs const *);
135static int AllowCommand(struct cmdargs const *);
136static int SetCommand(struct cmdargs const *);
137static int LinkCommand(struct cmdargs const *);
138static int AddCommand(struct cmdargs const *);
139static int DeleteCommand(struct cmdargs const *);
140static int NegotiateCommand(struct cmdargs const *);
141static int ClearCommand(struct cmdargs const *);
141#ifndef NOALIAS
142static int AliasCommand(struct cmdargs const *);
143static int AliasEnable(struct cmdargs const *);
144static int AliasOption(struct cmdargs const *);
145#endif
146
147static const char *
148showcx(struct cmdtab const *cmd)

--- 290 unchanged lines hidden (view full) ---

439#ifndef NOALIAS
440 {"alias", NULL, AliasCommand, LOCAL_AUTH,
441 "alias control", "alias option [yes|no]"},
442#endif
443 {"allow", "auth", AllowCommand, LOCAL_AUTH,
444 "Allow ppp access", "allow users|modes ...."},
445 {"bg", "!bg", BgShellCommand, LOCAL_AUTH,
446 "Run a background command", "[!]bg command"},
142#ifndef NOALIAS
143static int AliasCommand(struct cmdargs const *);
144static int AliasEnable(struct cmdargs const *);
145static int AliasOption(struct cmdargs const *);
146#endif
147
148static const char *
149showcx(struct cmdtab const *cmd)

--- 290 unchanged lines hidden (view full) ---

440#ifndef NOALIAS
441 {"alias", NULL, AliasCommand, LOCAL_AUTH,
442 "alias control", "alias option [yes|no]"},
443#endif
444 {"allow", "auth", AllowCommand, LOCAL_AUTH,
445 "Allow ppp access", "allow users|modes ...."},
446 {"bg", "!bg", BgShellCommand, LOCAL_AUTH,
447 "Run a background command", "[!]bg command"},
448 {"clear", NULL, ClearCommand, LOCAL_AUTH | LOCAL_CX_OPT,
449 "Clear throughput statistics", "clear ipcp|modem [current|overall|peak]..."},
447 {"clone", NULL, CloneCommand, LOCAL_AUTH | LOCAL_CX,
448 "Clone a link", "clone newname..."},
449 {"close", NULL, CloseCommand, LOCAL_AUTH | LOCAL_CX_OPT,
450 "Close an FSM", "close [lcp|ccp]"},
451 {"delete", NULL, DeleteCommand, LOCAL_AUTH,
452 "delete route", "delete dest", NULL},
453 {NULL, "delete!", DeleteCommand, LOCAL_AUTH,
454 "delete a route if it exists", "delete! dest", (void *)1},

--- 1570 unchanged lines hidden (view full) ---

2025{
2026 switch (val&3) {
2027 case 1: return "disabled & accepted";
2028 case 2: return "enabled & denied";
2029 case 3: return "enabled & accepted";
2030 }
2031 return "disabled & denied";
2032}
450 {"clone", NULL, CloneCommand, LOCAL_AUTH | LOCAL_CX,
451 "Clone a link", "clone newname..."},
452 {"close", NULL, CloseCommand, LOCAL_AUTH | LOCAL_CX_OPT,
453 "Close an FSM", "close [lcp|ccp]"},
454 {"delete", NULL, DeleteCommand, LOCAL_AUTH,
455 "delete route", "delete dest", NULL},
456 {NULL, "delete!", DeleteCommand, LOCAL_AUTH,
457 "delete a route if it exists", "delete! dest", (void *)1},

--- 1570 unchanged lines hidden (view full) ---

2028{
2029 switch (val&3) {
2030 case 1: return "disabled & accepted";
2031 case 2: return "enabled & denied";
2032 case 3: return "enabled & accepted";
2033 }
2034 return "disabled & denied";
2035}
2036
2037static int
2038ClearCommand(struct cmdargs const *arg)
2039{
2040 struct pppThroughput *t;
2041 struct datalink *cx;
2042 int i, clear_type;
2043
2044 if (arg->argc < arg->argn + 1)
2045 return -1;
2046
2047 if (strcasecmp(arg->argv[arg->argn], "modem") == 0) {
2048 cx = arg->cx;
2049 if (!cx)
2050 cx = bundle2datalink(arg->bundle, NULL);
2051 if (!cx) {
2052 log_Printf(LogWARN, "A link must be specified for ``clear modem''\n");
2053 return 1;
2054 }
2055 t = &cx->physical->link.throughput;
2056 } else if (strcasecmp(arg->argv[arg->argn], "ipcp") == 0)
2057 t = &arg->bundle->ncp.ipcp.throughput;
2058 else
2059 return -1;
2060
2061 if (arg->argc > arg->argn + 1) {
2062 clear_type = 0;
2063 for (i = arg->argn + 1; i < arg->argc; i++)
2064 if (strcasecmp(arg->argv[i], "overall") == 0)
2065 clear_type |= THROUGHPUT_OVERALL;
2066 else if (strcasecmp(arg->argv[i], "current") == 0)
2067 clear_type |= THROUGHPUT_CURRENT;
2068 else if (strcasecmp(arg->argv[i], "peak") == 0)
2069 clear_type |= THROUGHPUT_PEAK;
2070 else
2071 return -1;
2072 } else
2073 clear_type = THROUGHPUT_ALL;
2074
2075 throughput_clear(t, clear_type, arg->prompt);
2076 return 0;
2077}