2
0

CmdInv.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: CmdInv.h /main/6 1996/01/23 10:41:03 barstow $ */
  24. /***************************************************************************
  25. *
  26. * File: CmdInv.h
  27. * Description: Public header for the command invocation system.
  28. * Language: C
  29. *
  30. ** (c) Copyright 1993, 1994 Hewlett-Packard Company
  31. ** (c) Copyright 1993, 1994 International Business Machines Corp.
  32. ** (c) Copyright 1993, 1994 Sun Microsystems, Inc.
  33. ** (c) Copyright 1993, 1994 Novell, Inc.
  34. ***************************************************************************/
  35. #ifndef _CmdInv_h
  36. #define _CmdInv_h
  37. #include <X11/Xlib.h>
  38. #include <Dt/Message.h>
  39. #include <Dt/Spc.h>
  40. /******************************************************************************
  41. *
  42. * DtCmdInvExecuteProc - This type is is used to define the parameters
  43. * needed in the callback functions for success and failure notification
  44. * of a Command Invoker execution call.
  45. *
  46. *****************************************************************************/
  47. typedef void (*DtCmdInvExecuteProc) (
  48. char *message, /* NULL if the request is successful.
  49. * Otherwise an error message. */
  50. void *client_data
  51. );
  52. /******************************************************************************
  53. *
  54. * Function: void _DtInitializeCommandInvoker (
  55. * Display *display,
  56. * char *toolClass,
  57. * char *applicationClass,
  58. * DtSvcReceiveProc reloadDBHandler,
  59. * XtAppContext appContext)
  60. *
  61. * Parameters:
  62. *
  63. * display - The X server display connection.
  64. *
  65. * toolClass - The BMS tool class of the client.
  66. *
  67. * applicationClass - The application class of the client (see
  68. * XtInitialize). This is needed to add the
  69. * Command Invoker's resources to the client's
  70. * resources.
  71. *
  72. * reloadDBHandler - Function to be called if a RELOAD-TYPES-DB
  73. * request is made. If the client does not read
  74. * DT action and/or filetype databases, NULL must
  75. * be used.
  76. *
  77. * appContext - The client's application context. Must be NULL
  78. * if the client does not use an application
  79. * context.
  80. *
  81. * Purpose:
  82. *
  83. * This function allows a client to internalize the functionality
  84. * of the DT "Command Invoker". By using this library and the
  85. * Action Library, requests for the Command Invoker will be done
  86. * internally instead of sending a request to a separate Command
  87. * Invoker process.
  88. *
  89. * For local execution, the "fork" and "execvp" system calls are
  90. * used. For remote execution, the "SPCD" is used.
  91. *
  92. *****************************************************************************/
  93. extern void
  94. _DtInitializeCommandInvoker(
  95. Display *display,
  96. char *toolClass,
  97. char *applicationClass,
  98. DtSvcReceiveProc reloadDBHandler,
  99. XtAppContext appContext);
  100. /******************************************************************************
  101. *
  102. * Function: void _DtCommandInvokerExecute (
  103. * char *request_name,
  104. * char *context_host,
  105. * char *context_dir,
  106. * char *context_file,
  107. * char *exec_parameters,
  108. * char *exec_host,
  109. * char *exec_string,
  110. * DtCmdInvExecProc success_proc,
  111. * void *success_data,
  112. * DtCmdInvExecProc failure_proc,
  113. * void *failure_data)
  114. *
  115. * Parameters:
  116. *
  117. * request_name - The request name (defined in "CommandM.h").
  118. *
  119. * context_host - Name of the host where request is executed from. If
  120. * NULL, the "exec_host" parameter is used. Note: this
  121. * should not be confused with execution host, described
  122. * below.
  123. *
  124. * context_dir - Directory where the request should be executed. If
  125. * NULL, the HOME directory is used.
  126. *
  127. * context_file - Not currently used by the Command Invoker.
  128. *
  129. * exec_parameters - Command Invoker execution parameters. See External
  130. * Specification for more information.
  131. * If set to NULL, "-" is used.
  132. *
  133. * exec_host - Name of the host where the request is executed.
  134. *
  135. * exec_string - The command line to execute.
  136. *
  137. * success_proc - The function to be invoked if the request is
  138. * successfully executed.
  139. *
  140. * success_data - Client data for successful execution.
  141. *
  142. * failure_proc - The function to be invoked if an attempt to exeucte
  143. * the request fails.
  144. *
  145. * failure_data - Client data for unsuccessful execution.
  146. *
  147. * Purpose:
  148. *
  149. * This function allows a client to use the DT "Command Invoker"
  150. * Library for its' process execution. This function is intended
  151. * for processes which do not use the Action Library.
  152. *
  153. * For local execution, the "fork" and "execvp" system calls are
  154. * used. For remote execution, the "SPCD" is used.
  155. *
  156. * Notes:
  157. *
  158. * This function must be preceded by a call to
  159. * "_DtInitializeCommandInvoker".
  160. *
  161. *****************************************************************************/
  162. extern void
  163. _DtCommandInvokerExecute(
  164. char *request_name,
  165. char *context_host,
  166. char *context_dir,
  167. char *context_file,
  168. char *exec_parameters,
  169. char *exec_host,
  170. char *exec_string,
  171. DtCmdInvExecuteProc success_proc,
  172. void *success_data,
  173. DtCmdInvExecuteProc failure_proc,
  174. void *failure_data);
  175. extern SPC_Channel_Ptr _DtSPCOpen( char *hostname,
  176. int iomode,
  177. char *errorMessage); /* MODIFIED */
  178. extern int _DtSPCSpawn(
  179. char *path,
  180. char *context,
  181. char **args,
  182. char **env,
  183. SPC_Channel_Ptr chan,
  184. char *execHost,
  185. char *contextHost,
  186. char *contextDir,
  187. char *errorMessage); /* MODIFIED */
  188. #endif /* _CmdInv_h */