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.157 1998/07/29 18:21:13 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> --- 88 unchanged lines hidden (view full) --- 117#define NEG_PPPDDEFLATE 45 118#define NEG_PRED1 46 119#define NEG_PROTOCOMP 47 120#define NEG_SHORTSEQ 48 121#define NEG_VJCOMP 49 122#define NEG_DNS 50 123 124const char Version[] = "2.0"; |
125const char VersionDate[] = "$Date: 1998/07/29 18:21:13 $"; |
126 127static int ShowCommand(struct cmdargs const *); 128static int TerminalCommand(struct cmdargs const *); 129static int QuitCommand(struct cmdargs const *); 130static int OpenCommand(struct cmdargs const *); 131static int CloseCommand(struct cmdargs const *); 132static int DownCommand(struct cmdargs const *); 133static int AllowCommand(struct cmdargs const *); --- 167 unchanged lines hidden (view full) --- 301 log_Printf(LogWARN, "Manual dial is only available for auto and" 302 " interactive links\n"); 303 return 1; 304 } 305 306 if (arg->argc > arg->argn && (res = LoadCommand(arg)) != 0) 307 return res; 308 |
309 bundle_Open(arg->bundle, arg->cx ? arg->cx->name : NULL, PHYS_ALL, 1); |
310 311 return 0; 312} 313 314static int 315ShellCommand(struct cmdargs const *arg, int bg) 316{ 317 const char *shell; --- 134 unchanged lines hidden (view full) --- 452 {"delete", NULL, DeleteCommand, LOCAL_AUTH, 453 "delete route", "delete dest", NULL}, 454 {NULL, "delete!", DeleteCommand, LOCAL_AUTH, 455 "delete a route if it exists", "delete! dest", (void *)1}, 456 {"deny", NULL, NegotiateCommand, LOCAL_AUTH | LOCAL_CX_OPT, 457 "Deny option request", "deny option .."}, 458 {"dial", "call", DialCommand, LOCAL_AUTH | LOCAL_CX_OPT, 459 "Dial and login", "dial|call [remote]", NULL}, |
460 {"disable", NULL, NegotiateCommand, LOCAL_AUTH | LOCAL_CX_OPT, 461 "Disable option", "disable option .."}, 462 {"down", NULL, DownCommand, LOCAL_AUTH | LOCAL_CX_OPT, 463 "Generate a down event", "down"}, 464 {"enable", NULL, NegotiateCommand, LOCAL_AUTH | LOCAL_CX_OPT, 465 "Enable option", "enable option .."}, 466 {"link", "datalink", LinkCommand, LOCAL_AUTH, 467 "Link specific commands", "link name command ..."}, 468 {"load", NULL, LoadCommand, LOCAL_AUTH | LOCAL_CX_OPT, 469 "Load settings", "load [remote]"}, 470 {"open", NULL, OpenCommand, LOCAL_AUTH | LOCAL_CX_OPT, |
471 "Open an FSM", "open! [lcp|ccp|ipcp]", (void *)1}, 472 {"passwd", NULL, PasswdCommand, LOCAL_NO_AUTH, 473 "Password for manipulation", "passwd LocalPassword"}, 474 {"quit", "bye", QuitCommand, LOCAL_AUTH | LOCAL_NO_AUTH, 475 "Quit PPP program", "quit|bye [all]"}, 476 {"remove", "rm", RemoveCommand, LOCAL_AUTH | LOCAL_CX, 477 "Remove a link", "remove"}, 478 {"rename", "mv", RenameCommand, LOCAL_AUTH | LOCAL_CX, --- 350 unchanged lines hidden (view full) --- 829 830 return 0; 831} 832 833static int 834OpenCommand(struct cmdargs const *arg) 835{ 836 if (arg->argc == arg->argn) |
837 bundle_Open(arg->bundle, arg->cx ? arg->cx->name : NULL, PHYS_ALL, 1); |
838 else if (arg->argc == arg->argn + 1) { 839 if (!strcasecmp(arg->argv[arg->argn], "lcp")) { 840 struct datalink *cx = arg->cx ? 841 arg->cx : bundle2datalink(arg->bundle, NULL); 842 if (cx) { 843 if (cx->physical->link.lcp.fsm.state == ST_OPENED) 844 fsm_Reopen(&cx->physical->link.lcp.fsm); 845 else |
846 bundle_Open(arg->bundle, cx->name, PHYS_ALL, 1); |
847 } else 848 log_Printf(LogWARN, "open lcp: You must specify a link\n"); 849 } else if (!strcasecmp(arg->argv[arg->argn], "ccp")) { 850 struct fsm *fp; 851 852 fp = &command_ChooseLink(arg)->ccp.fsm; 853 if (fp->link->lcp.fsm.state != ST_OPENED) 854 log_Printf(LogWARN, "open: LCP must be open before opening CCP\n"); --- 10 unchanged lines hidden (view full) --- 865 } 866 } 867 } else if (!strcasecmp(arg->argv[arg->argn], "ipcp")) { 868 if (arg->cx) 869 log_Printf(LogWARN, "open ipcp: You need not specify a link\n"); 870 if (arg->bundle->ncp.ipcp.fsm.state == ST_OPENED) 871 fsm_Reopen(&arg->bundle->ncp.ipcp.fsm); 872 else |
873 bundle_Open(arg->bundle, NULL, PHYS_ALL, 1); |
874 } else 875 return -1; 876 } else 877 return -1; 878 879 return 0; 880} 881 --- 1230 unchanged lines hidden --- |