/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. #ifndef _HAVE_RCMD_H
  27. #define _HAVE_RCMD_H
  28. #include "opt.h"
  29. struct rcmd_options {
  30. bool resolve_hosts;
  31. };
  32. #define RCMD_OPT_RESOLVE_HOSTS 0x1
  33. struct rcmd_info {
  34. int fd;
  35. int efd;
  36. struct rcmd_module *rmod;
  37. struct rcmd_options *opts;
  38. char *ruser;
  39. void *arg;
  40. };
  41. /*
  42. * Register default rcmd parameters for hosts in hostlist string "hosts."
  43. * rcmd_type - if non-NULL set default rcmd connect module for "hosts."
  44. * user - if non-NULL set default remote username for "hosts."
  45. *
  46. * The first call to this function "wins," i.e. later calls to register
  47. * will not override existing defaults. This is done because currently
  48. * in pdsh, command line options are processed *before* configuration
  49. * type files (i.e. genders) since these files are processed by pdsh
  50. * modules.
  51. */
  52. int rcmd_register_defaults (char *hosts, char *rcmd_type, char *user);
  53. /*
  54. * Register default rcmd type
  55. */
  56. int rcmd_register_default_rcmd (char *rcmd_name);
  57. /*
  58. * Return default rcmd module name.
  59. */
  60. char * rcmd_get_default_module (void);
  61. /*
  62. * Create and rcmd_info object for specified host
  63. */
  64. struct rcmd_info * rcmd_create (char *host);
  65. /*
  66. * Connect using rcmd_info rcmd
  67. */
  68. int rcmd_connect (struct rcmd_info *rcmd, char *host, char *addr,
  69. char *locuser, char *remuser, char *cmd, int nodeid,
  70. bool err);
  71. /*
  72. * Destroy rcmd connections
  73. */
  74. int rcmd_destroy (struct rcmd_info *);
  75. /*
  76. * Send a signal over the specified remote connection
  77. */
  78. int rcmd_signal (struct rcmd_info *, int signum);
  79. int rcmd_init (opt_t *opt);
  80. /*
  81. * Free all rcmd module information.
  82. */
  83. int rcmd_exit (void);
  84. /*
  85. * Called by rcmd module during "init" function to set various
  86. * rcmd-specific options. (see rcmd_options structure above)
  87. *
  88. * Returns -1 with errno set to ESRCH if called from anywhere but
  89. * module's rcmd_init function.
  90. */
  91. int rcmd_opt_set (int id, void * value);
  92. #endif /* !_HAVE_RCMD_H */