152419Sjulian 252419Sjulian/* 352419Sjulian * ngctl.h 452419Sjulian * 552419Sjulian * Copyright (c) 1996-1999 Whistle Communications, Inc. 652419Sjulian * All rights reserved. 752419Sjulian * 852419Sjulian * Subject to the following obligations and disclaimer of warranty, use and 952419Sjulian * redistribution of this software, in source or object code forms, with or 1052419Sjulian * without modifications are expressly permitted by Whistle Communications; 1152419Sjulian * provided, however, that: 1252419Sjulian * 1. Any and all reproductions of the source or object code must include the 1352419Sjulian * copyright notice above and the following disclaimer of warranties; and 1452419Sjulian * 2. No rights are granted, in any manner or form, to use Whistle 1552419Sjulian * Communications, Inc. trademarks, including the mark "WHISTLE 1652419Sjulian * COMMUNICATIONS" on advertising, endorsements, or otherwise except as 1752419Sjulian * such appears in the above copyright notice or in the software. 1852419Sjulian * 1952419Sjulian * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND 2052419Sjulian * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO 2152419Sjulian * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, 2252419Sjulian * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF 2352419Sjulian * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. 2452419Sjulian * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY 2552419Sjulian * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS 2652419Sjulian * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE. 2752419Sjulian * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES 2852419Sjulian * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING 2952419Sjulian * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 3052419Sjulian * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR 3152419Sjulian * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY 3252419Sjulian * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3352419Sjulian * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 3452419Sjulian * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY 3552419Sjulian * OF SUCH DAMAGE. 3652419Sjulian * 3752419Sjulian * $FreeBSD$ 3852419Sjulian */ 3952419Sjulian 4053913Sarchie#define MAX_CMD_ALIAS 8 4153913Sarchie 4252419Sjulian/* Command descriptors */ 4352419Sjulianstruct ngcmd { 4453913Sarchie int (*func)(int ac, char **av); /* command function */ 4553913Sarchie const char *cmd; /* command usage */ 4653913Sarchie const char *desc; /* description */ 4753913Sarchie const char *help; /* help text */ 4853913Sarchie const char *aliases[MAX_CMD_ALIAS]; /* command aliases */ 4952419Sjulian}; 5052419Sjulian 5152419Sjulian/* Command return values */ 5252419Sjulian#define CMDRTN_OK 0 5352419Sjulian#define CMDRTN_USAGE 1 5452419Sjulian#define CMDRTN_ERROR 2 5552419Sjulian#define CMDRTN_QUIT 3 5652419Sjulian 5752419Sjulian/* Available commands */ 5874390Sphkextern const struct ngcmd config_cmd; 5952419Sjulianextern const struct ngcmd connect_cmd; 6052419Sjulianextern const struct ngcmd debug_cmd; 61124271Sgreenextern const struct ngcmd dot_cmd; 6252419Sjulianextern const struct ngcmd help_cmd; 6352419Sjulianextern const struct ngcmd list_cmd; 6452419Sjulianextern const struct ngcmd mkpeer_cmd; 6553913Sarchieextern const struct ngcmd msg_cmd; 6652419Sjulianextern const struct ngcmd name_cmd; 6752419Sjulianextern const struct ngcmd read_cmd; 6852419Sjulianextern const struct ngcmd rmhook_cmd; 6952419Sjulianextern const struct ngcmd show_cmd; 7052419Sjulianextern const struct ngcmd shutdown_cmd; 7152419Sjulianextern const struct ngcmd status_cmd; 7252419Sjulianextern const struct ngcmd types_cmd; 7389674Sarchieextern const struct ngcmd write_cmd; 7452419Sjulianextern const struct ngcmd quit_cmd; 7552419Sjulian 7652419Sjulian/* Data and control sockets */ 7752419Sjulianextern int csock, dsock; 7852419Sjulian 7961880Sarchie/* Misc functions */ 8061880Sarchieextern void MsgRead(void); 8161880Sarchieextern void DumpAscii(const u_char *buf, int len); 8261880Sarchie 83