CmdInvP.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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. /* $TOG: CmdInvP.h /main/5 1998/07/30 12:10:30 mgreess $ */
  24. /***************************************************************************
  25. *
  26. * File: CmdInvP.h
  27. * Description: Command execution system private externs and includes
  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 _CmdInvP_h
  36. #define _CmdInvP_h
  37. #include <stdio.h>
  38. #include <string.h>
  39. #include <stdlib.h>
  40. #include <unistd.h>
  41. #include <sys/param.h> /* MAXPATHNAMELEN */
  42. #include <X11/Intrinsic.h>
  43. #include <Dt/DtP.h>
  44. #include <Dt/DtNlUtils.h>
  45. #include <Dt/Message.h>
  46. #include <bms/SbEvent.h>
  47. #include <bms/XeUserMsg.h>
  48. #include <Dt/Spc.h>
  49. #include <Dt/CmdInv.h>
  50. #include <Dt/ActionP.h>
  51. #include <Dt/Connect.h>
  52. #ifndef CDE_INSTALLATION_TOP
  53. #define CDE_INSTALLATION_TOP "/opt/dt"
  54. #endif
  55. /*
  56. * Resource names and classes for the Command Invoker.
  57. */
  58. #define DtLOCAL_TERMINAL_NAME "localTerminal"
  59. #define DtLOCAL_TERMINAL_CLASS "LocalTerminal"
  60. #define DtREMOTE_TERMINALS_NAME "remoteTerminals"
  61. #define DtREMOTE_TERMINALS_CLASS "RemoteTerminals"
  62. #define DtWAIT_TIME_NAME "waitTime"
  63. #define DtWAIT_TIME_CLASS "WaitTime"
  64. #define DtDTEXEC_PATH_NAME "dtexecPath"
  65. #define DtDTEXEC_PATH_CLASS "DtexecPath"
  66. #define DtEXECUTION_HOST_LOGGING_NAME "executionHostLogging"
  67. #define DtEXECUTION_HOST_LOGGING_CLASS "ExecutionHostLogging"
  68. /*
  69. * Structure for saving the "state" of a remote request that is
  70. * queued while waiting for a remote subprocess to terminate.
  71. */
  72. typedef struct _Cmd_RequestQueue {
  73. SPC_Channel_Ptr channel;
  74. char *context;
  75. char *exec_host;
  76. char *exec_string;
  77. char **argv;
  78. int winType;
  79. unsigned long request_num;
  80. DtSvcMsgContext replyContext;
  81. DtCmdInvExecuteProc success_proc;
  82. void *success_data;
  83. DtCmdInvExecuteProc failure_proc;
  84. void *failure_data;
  85. struct _Cmd_RequestQueue *next;
  86. } Cmd_RequestQueue;
  87. /*
  88. * Command invocation resources.
  89. */
  90. typedef struct {
  91. char *localTerminal;
  92. char **remoteHosts;
  93. char **remoteTerminals;
  94. int waitTime;
  95. char *dtexecPath;
  96. Boolean executionHostLogging;
  97. } Cmd_Resources;
  98. /*
  99. * Command invocation global variables.
  100. */
  101. typedef struct {
  102. Boolean terminal_ok;
  103. Boolean subprocess_ok;
  104. XtAppContext app_context;
  105. char **path_list;
  106. char *error_directory_name_map;
  107. char *error_subprocess;
  108. char *error_terminal;
  109. } Cmd_Globals;
  110. /*
  111. * Defaults for the Resources.
  112. */
  113. #define DtWAIT_TIME_DEFAULT 3 /* In seconds. */
  114. #define DtTERMINAL_DEFAULT "dtterm"
  115. #define DtCMD_INV_SUB_PROCESS CDE_INSTALLATION_TOP "/bin/dtexec"
  116. /*
  117. * Temporary buffer size.
  118. */
  119. #define MAX_BUF_SIZE 1024
  120. /*
  121. * Window types:
  122. */
  123. #define NO_STDIO 0
  124. #define TERMINAL 1
  125. #define PERM_TERMINAL 2
  126. /*
  127. * Command execution return status:
  128. */
  129. #define _CMD_EXECUTE_SUCCESS 1
  130. #define _CMD_EXECUTE_FAILURE 2
  131. #define _CMD_EXECUTE_QUEUED 3
  132. #define _CMD_EXECUTE_FATAL 4
  133. /*
  134. * External declarations for the global Command Invoker variables.
  135. */
  136. extern Cmd_Resources cmd_Resources;
  137. extern Cmd_Globals cmd_Globals;
  138. /*
  139. ******* Public Function Declarations for CmdSpc.c *******
  140. */
  141. extern SbInputId _DtCmdSPCAddInputHandler (
  142. int fd,
  143. SbInputCallbackProc proc,
  144. void *data);
  145. extern SbInputId _DtCmdSPCAddExceptionHandler (
  146. int fd,
  147. SbInputCallbackProc proc,
  148. void *data);
  149. extern void _DtCmdLogErrorMessage(
  150. char *message) ;
  151. /*
  152. ******* Public Function Declarations for CmdProcess.c *******
  153. */
  154. extern void _DtCmdCreateTerminalCommand(
  155. char **theCommand,
  156. int windowType,
  157. char *execString,
  158. char *execParms,
  159. char *execHost,
  160. char *procId,
  161. char *tmpFiles) ;
  162. extern Boolean _DtCmdCheckForExecutable(
  163. char *fileName) ;
  164. extern Boolean _DtCmdValidDir(
  165. char *clientHost,
  166. char *contextDir,
  167. char *contextHost) ;
  168. extern void _DtCmdGetResources(
  169. Display *display);
  170. /*
  171. ******* Public Function Declarations for CmdUtilityP.c *******
  172. */
  173. extern void _DtCmdBuildPathList( void ) ;
  174. /******** End Public Function Declarations ********/
  175. #endif /* _CmdInvP_h */