xref: /freebsd/usr.sbin/ppp/command.h (revision 23f282aa31e9b6fceacd449020e936e98d6f2298)
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  * $FreeBSD$
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   int argn;				/* Argument to start processing from */
33   char const *const *argv;		/* Arguments */
34   struct bundle *bundle;		/* Our bundle */
35   struct datalink *cx;			/* Our context */
36   struct prompt *prompt;		/* Who executed us */
37 };
38 
39 struct cmdtab {
40   const char *name;
41   const char *alias;
42   int (*func) (struct cmdargs const *);
43   u_char lauth;
44   const char *helpmes;
45   const char *syntax;
46   const void *args;
47 };
48 
49 #define NEG_ACCEPTED (1)
50 #define NEG_ENABLED (2)
51 #define IsAccepted(x) ((x) & NEG_ACCEPTED)
52 #define IsEnabled(x) ((x) & NEG_ENABLED)
53 
54 extern const char Version[];
55 
56 extern void command_Expand(char **, int, char const *const *, struct bundle *,
57                            int, pid_t);
58 extern int command_Expand_Interpret(char *, int, char *vector[MAXARGS], int);
59 extern int command_Interpret(char *, int, char *vector[MAXARGS]);
60 extern void command_Run(struct bundle *, int, char const *const *,
61                         struct prompt *, const char *, struct datalink *);
62 extern int command_Decode(struct bundle *, char *, int, struct prompt *,
63                            const char *);
64 extern struct link *command_ChooseLink(struct cmdargs const *);
65 extern const char *command_ShowNegval(unsigned);
66 
67