File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / mpd / src / command.h
Revision 1.1.1.3 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Mar 17 00:39:23 2021 UTC (3 years, 9 months ago) by misho
Branches: mpd, MAIN
CVS tags: v5_9p16, v5_9, HEAD
mpd 5.9


/*
 * command.h
 *
 * Written by Archie Cobbs <archie@freebsd.org>
 * Copyright (c) 1995-1999 Whistle Communications, Inc. All rights reserved.
 * See ``COPYRIGHT.whistle''
 */

#ifndef _COMMAND_H_
#define _COMMAND_H_

#include "vars.h"

/*
 * DEFINITIONS
 */

  #define CMD_SUBMENU	((int (*)(Context ctx, int ac, const char *const av[], const void *arg)) 1)
  
  #define CMD_ERR_USAGE	-1
  #define CMD_ERR_UNDEF	-2
  #define CMD_ERR_AMBIG	-3
  #define CMD_ERR_RECUR	-4
  #define CMD_ERR_UNFIN	-5
  #define CMD_ERR_NOCTX	-6
  #define CMD_ERR_OTHER	-7

  /* Configuration options */
  enum {
#ifdef USE_WRAP
    GLOBAL_CONF_TCPWRAPPER,	/* enable tcp-wrapper */
#endif
    GLOBAL_CONF_ONESHOT,	/* enable OneShot mode */
    GLOBAL_CONF_AGENT_CID,	/* enable display Agent CID in show session */
    GLOBAL_CONF_SESS_TIME	/* enable display uptime in show session */
  };

  struct globalconf {
    struct optinfo	options;
  };

  struct cmdtab;
  typedef const struct cmdtab	*CmdTab;
  struct cmdtab
  {
    const char	*name;
    const char	*desc;
    int		(*func)(Context ctx, int ac, const char *const av[], const void *arg);
    int		(*admit)(Context ctx, CmdTab cmd);
    int		priv;
    const void	*arg;
  };

  extern const struct cmdtab gCommands[];

/*
 * FUNCTIONS
 */

  extern int	DoConsole(void);
  extern int	DoCommand(Context ctx, int ac, const char *const av[], const char *file, int line);
  extern int	DoCommandTab(Context ctx, CmdTab cmdlist, int ac, const char *const av[]);
  extern int	HelpCommand(Context ctx, int ac, const char *const av[], const void *arg);
  extern int	FindCommand(Context ctx, CmdTab cmds, const char* str, CmdTab *cp);
  extern int	AdmitBund(Context ctx, CmdTab cmd);
  extern int	AdmitLink(Context ctx, CmdTab cmd);
  extern int	AdmitRep(Context ctx, CmdTab cmd);
  extern int	AdmitPhys(Context ctx, CmdTab cmd);
  extern int	AdmitDev(Context ctx, CmdTab cmd);

#endif


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>