PageRenderTime 19ms CodeModel.GetById 14ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/src/pdsh/rcmd.h

https://code.google.com/
C++ Header | 110 lines | 28 code | 18 blank | 64 comment | 0 complexity | 3e69d2d61150be7b50593687db213857 MD5 | raw file
  1/*****************************************************************************\
  2 *  $Id$
  3 *****************************************************************************
  4 *  Copyright (C) 2001-2006 The Regents of the University of California.
  5 *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
  6 *  Written by Mark Grondona <mgrondona@llnl.gov>.
  7 *  UCRL-CODE-2003-005.
  8 *  
  9 *  This file is part of Pdsh, a parallel remote shell program.
 10 *  For details, see <http://www.llnl.gov/linux/pdsh/>.
 11 *  
 12 *  Pdsh is free software; you can redistribute it and/or modify it under
 13 *  the terms of the GNU General Public License as published by the Free
 14 *  Software Foundation; either version 2 of the License, or (at your option)
 15 *  any later version.
 16 *  
 17 *  Pdsh is distributed in the hope that it will be useful, but WITHOUT ANY
 18 *  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 19 *  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 20 *  details.
 21 *  
 22 *  You should have received a copy of the GNU General Public License along
 23 *  with Pdsh; if not, write to the Free Software Foundation, Inc.,
 24 *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
 25\*****************************************************************************/
 26
 27#ifndef _HAVE_RCMD_H
 28#define _HAVE_RCMD_H
 29
 30#include "opt.h"
 31
 32struct rcmd_options {
 33	bool resolve_hosts;
 34};
 35
 36#define RCMD_OPT_RESOLVE_HOSTS 0x1
 37
 38struct rcmd_info {
 39	int                   fd;
 40	int                   efd;
 41	struct rcmd_module   *rmod;
 42	struct rcmd_options  *opts;
 43	char                 *ruser;
 44	void                 *arg;
 45};
 46
 47
 48/*
 49 *  Register default rcmd parameters for hosts in hostlist string "hosts." 
 50 *    rcmd_type - if non-NULL set default rcmd connect module for "hosts."
 51 *    user      - if non-NULL set default remote username for "hosts."
 52 *
 53 *  The first call to this function "wins," i.e. later calls to register
 54 *   will not override existing defaults. This is done because currently
 55 *   in pdsh, command line options are processed *before* configuration
 56 *   type files (i.e. genders) since these files are processed by pdsh
 57 *   modules.
 58 */
 59int rcmd_register_defaults (char *hosts, char *rcmd_type, char *user);
 60
 61/*
 62 *  Register default rcmd type
 63 */
 64int rcmd_register_default_rcmd (char *rcmd_name);
 65
 66/*
 67 *  Return default rcmd module name.
 68 */
 69char * rcmd_get_default_module (void);
 70
 71
 72/*
 73 *  Create and rcmd_info object for specified host
 74 */
 75struct rcmd_info * rcmd_create (char *host);
 76
 77/*
 78 *  Connect using rcmd_info rcmd 
 79 */
 80int rcmd_connect (struct rcmd_info *rcmd, char *host, char *addr, 
 81                  char *locuser, char *remuser, char *cmd, int nodeid, 
 82		  bool err);
 83
 84/*
 85 *  Destroy rcmd connections
 86 */
 87int rcmd_destroy (struct rcmd_info *);
 88
 89/*
 90 *  Send a signal over the specified remote connection
 91 */
 92int rcmd_signal (struct rcmd_info *, int signum);
 93
 94int rcmd_init (opt_t *opt);
 95
 96/*
 97 *  Free all rcmd module information.
 98 */
 99int rcmd_exit (void);
100
101/*
102 *  Called by rcmd module during "init" function to set various 
103 *   rcmd-specific options. (see rcmd_options structure above)
104 *  
105 *  Returns -1 with errno set to ESRCH if called from anywhere but
106 *   module's rcmd_init function. 
107 */
108int rcmd_opt_set (int id, void * value);
109
110#endif /* !_HAVE_RCMD_H */