xref: /f-stack/tools/ngctl/ngctl.h (revision d4a07e70)
13b2bd0f6Slogwang 
23b2bd0f6Slogwang /*
33b2bd0f6Slogwang  * ngctl.h
43b2bd0f6Slogwang  *
53b2bd0f6Slogwang  * Copyright (c) 1996-1999 Whistle Communications, Inc.
63b2bd0f6Slogwang  * All rights reserved.
73b2bd0f6Slogwang  *
83b2bd0f6Slogwang  * Subject to the following obligations and disclaimer of warranty, use and
93b2bd0f6Slogwang  * redistribution of this software, in source or object code forms, with or
103b2bd0f6Slogwang  * without modifications are expressly permitted by Whistle Communications;
113b2bd0f6Slogwang  * provided, however, that:
123b2bd0f6Slogwang  * 1. Any and all reproductions of the source or object code must include the
133b2bd0f6Slogwang  *    copyright notice above and the following disclaimer of warranties; and
143b2bd0f6Slogwang  * 2. No rights are granted, in any manner or form, to use Whistle
153b2bd0f6Slogwang  *    Communications, Inc. trademarks, including the mark "WHISTLE
163b2bd0f6Slogwang  *    COMMUNICATIONS" on advertising, endorsements, or otherwise except as
173b2bd0f6Slogwang  *    such appears in the above copyright notice or in the software.
183b2bd0f6Slogwang  *
193b2bd0f6Slogwang  * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
203b2bd0f6Slogwang  * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
213b2bd0f6Slogwang  * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
223b2bd0f6Slogwang  * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
233b2bd0f6Slogwang  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
243b2bd0f6Slogwang  * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
253b2bd0f6Slogwang  * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
263b2bd0f6Slogwang  * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
273b2bd0f6Slogwang  * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
283b2bd0f6Slogwang  * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
293b2bd0f6Slogwang  * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
303b2bd0f6Slogwang  * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
313b2bd0f6Slogwang  * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
323b2bd0f6Slogwang  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
333b2bd0f6Slogwang  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
343b2bd0f6Slogwang  * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
353b2bd0f6Slogwang  * OF SUCH DAMAGE.
363b2bd0f6Slogwang  *
373b2bd0f6Slogwang  * $FreeBSD$
383b2bd0f6Slogwang  */
393b2bd0f6Slogwang 
40*d4a07e70Sfengbojiang #ifdef FSTACK
41*d4a07e70Sfengbojiang #ifndef __unused
42*d4a07e70Sfengbojiang #define __unused __attribute__((__unused__))
43*d4a07e70Sfengbojiang #endif
44*d4a07e70Sfengbojiang #endif
45*d4a07e70Sfengbojiang 
463b2bd0f6Slogwang #define MAX_CMD_ALIAS	8
473b2bd0f6Slogwang 
483b2bd0f6Slogwang /* Command descriptors */
493b2bd0f6Slogwang struct ngcmd {
503b2bd0f6Slogwang 	  int		(*func)(int ac, char **av);	/* command function */
513b2bd0f6Slogwang 	  const char	*cmd;				/* command usage */
523b2bd0f6Slogwang 	  const char	*desc;				/* description */
533b2bd0f6Slogwang 	  const char	*help;				/* help text */
543b2bd0f6Slogwang 	  const char	*aliases[MAX_CMD_ALIAS];	/* command aliases */
553b2bd0f6Slogwang };
563b2bd0f6Slogwang 
573b2bd0f6Slogwang /* Command return values */
583b2bd0f6Slogwang #define CMDRTN_OK		0
593b2bd0f6Slogwang #define CMDRTN_USAGE		1
603b2bd0f6Slogwang #define CMDRTN_ERROR		2
613b2bd0f6Slogwang #define CMDRTN_QUIT		3
623b2bd0f6Slogwang 
633b2bd0f6Slogwang /* Available commands */
643b2bd0f6Slogwang extern const struct ngcmd config_cmd;
653b2bd0f6Slogwang extern const struct ngcmd connect_cmd;
663b2bd0f6Slogwang extern const struct ngcmd debug_cmd;
673b2bd0f6Slogwang extern const struct ngcmd dot_cmd;
683b2bd0f6Slogwang extern const struct ngcmd help_cmd;
693b2bd0f6Slogwang extern const struct ngcmd list_cmd;
703b2bd0f6Slogwang extern const struct ngcmd mkpeer_cmd;
713b2bd0f6Slogwang extern const struct ngcmd msg_cmd;
723b2bd0f6Slogwang extern const struct ngcmd name_cmd;
733b2bd0f6Slogwang extern const struct ngcmd read_cmd;
743b2bd0f6Slogwang extern const struct ngcmd rmhook_cmd;
753b2bd0f6Slogwang extern const struct ngcmd show_cmd;
763b2bd0f6Slogwang extern const struct ngcmd shutdown_cmd;
773b2bd0f6Slogwang extern const struct ngcmd status_cmd;
783b2bd0f6Slogwang extern const struct ngcmd types_cmd;
793b2bd0f6Slogwang extern const struct ngcmd write_cmd;
803b2bd0f6Slogwang extern const struct ngcmd quit_cmd;
813b2bd0f6Slogwang 
823b2bd0f6Slogwang /* Data and control sockets */
833b2bd0f6Slogwang extern int	csock, dsock;
843b2bd0f6Slogwang 
853b2bd0f6Slogwang /* Misc functions */
863b2bd0f6Slogwang extern void	MsgRead(void);
873b2bd0f6Slogwang extern void	DumpAscii(const u_char *buf, int len);
883b2bd0f6Slogwang 
89