1 /* 2 * Written by Toshiharu OHNO (tony-o@iij.ad.jp) 3 * 4 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. 5 * 6 * Redistribution and use in source and binary forms are permitted 7 * provided that the above copyright notice and this paragraph are 8 * duplicated in all such forms and that any documentation, 9 * advertising materials, and other materials related to such 10 * distribution and use acknowledge that the software was developed 11 * by the Internet Initiative Japan. The name of the 12 * IIJ may not be used to endorse or promote products derived 13 * from this software without specific prior written permission. 14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 15 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 16 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 17 * 18 * $Id: command.h,v 1.12.2.8 1998/04/03 19:25:26 brian Exp $ 19 * 20 * TODO: 21 */ 22 23 struct cmdtab; 24 struct bundle; 25 struct datalink; 26 struct prompt; 27 28 struct cmdargs { 29 struct cmdtab const *cmdtab; /* The entire command table */ 30 struct cmdtab const *cmd; /* This command entry */ 31 int argc; /* Number of arguments (excluding cmd */ 32 char const *const *argv; /* Arguments */ 33 struct bundle *bundle; /* Our bundle */ 34 struct datalink *cx; /* Our context */ 35 struct prompt *prompt; /* Who executed us */ 36 }; 37 38 struct cmdtab { 39 const char *name; 40 const char *alias; 41 int (*func) (struct cmdargs const *); 42 u_char lauth; 43 const char *helpmes; 44 const char *syntax; 45 const void *args; 46 }; 47 48 #define VAR_AUTHKEY 0 49 #define VAR_DIAL 1 50 #define VAR_LOGIN 2 51 #define VAR_AUTHNAME 3 52 #define VAR_WINSIZE 4 53 #define VAR_DEVICE 5 54 #define VAR_ACCMAP 6 55 #define VAR_MRU 7 56 #define VAR_MTU 8 57 #define VAR_OPENMODE 9 58 #define VAR_PHONE 10 59 #define VAR_HANGUP 11 60 #define VAR_ENC 12 61 #define VAR_IDLETIMEOUT 13 62 #define VAR_LQRPERIOD 14 63 #define VAR_LCPRETRY 15 64 #define VAR_CHAPRETRY 16 65 #define VAR_PAPRETRY 17 66 #define VAR_CCPRETRY 18 67 #define VAR_IPCPRETRY 19 68 69 extern int IsInteractive(struct prompt *); 70 extern void InterpretCommand(char *, int, int *, char ***); 71 extern void RunCommand(struct bundle *, int, char const *const *, 72 struct prompt *, const char *); 73 extern void DecodeCommand(struct bundle *, char *, int, struct prompt *, 74 const char *); 75 extern struct link *ChooseLink(struct cmdargs const *); 76