Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / lib / DtSvc / DtUtil1 / CmdInv.h
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 librararies 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
36 #ifndef _CmdInv_h
37 #define _CmdInv_h
38
39 #include <X11/Xlib.h>
40 #include <Dt/Message.h>
41 #include <Dt/Spc.h>
42
43 /******************************************************************************
44  *
45  * DtCmdInvExecuteProc - This type is is used to define the parameters
46  *   needed in the callback functions for success and failure notification 
47  *   of a Command Invoker execution call. 
48  *
49  *****************************************************************************/
50
51 typedef void (*DtCmdInvExecuteProc) (
52         char *message,          /* NULL if the request is successful.  
53                                  * Otherwise an error message. */
54         void *client_data
55 );
56
57 /******************************************************************************
58  *
59  * Function:  void _DtInitializeCommandInvoker (
60  *      Display *display,
61  *      char *toolClass,
62  *      char *applicationClass,
63  *      DtSvcReceiveProc reloadDBHandler,
64  *      XtAppContext appContext)
65  *
66  * Parameters:          
67  *
68  *      display          - The X server display connection.
69  *                      
70  *      toolClass        - The BMS tool class of the client.
71  *
72  *      applicationClass - The application class of the client (see 
73  *                         XtInitialize).  This is needed to add the 
74  *                         Command Invoker's resources to the client's
75  *                         resources.
76  *                      
77  *      reloadDBHandler  - Function to be called if a RELOAD-TYPES-DB 
78  *                         request is made.  If the client does not read
79  *                         DT action and/or filetype databases, NULL must
80  *                         be used.
81  *
82  *      appContext       - The client's application context.  Must be NULL
83  *                         if the client does not use an application 
84  *                         context.
85  *
86  * Purpose:             
87  *
88  *      This function allows a client to internalize the functionality
89  *      of the DT "Command Invoker".  By using this library and the
90  *      Action Library, requests for the Command Invoker will be done
91  *      internally instead of sending a request to a separate Command
92  *      Invoker process.
93  *
94  *      For local execution, the "fork" and "execvp" system calls are
95  *      used.  For remote execution, the "SPCD" is used.
96  *                      
97  *****************************************************************************/
98
99 extern void
100 _DtInitializeCommandInvoker(
101         Display *display,
102         char *toolClass,
103         char *applicationClass,
104         DtSvcReceiveProc reloadDBHandler,
105         XtAppContext appContext);
106
107 /******************************************************************************
108  *
109  * Function:  void _DtCommandInvokerExecute (
110  *      char *request_name,
111  *      char *context_host,
112  *      char *context_dir,
113  *      char *context_file,
114  *      char *exec_parameters,
115  *      char *exec_host,
116  *      char *exec_string,
117  *      DtCmdInvExecProc success_proc,
118  *      void *success_data,
119  *      DtCmdInvExecProc failure_proc,
120  *      void *failure_data)
121  *
122  * Parameters:          
123  *
124  *      request_name    - The request name (defined in "CommandM.h").
125  *                      
126  *      context_host    - Name of the host where request is executed from.  If
127  *                        NULL, the "exec_host" parameter is used.  Note: this
128  *                        should not be confused with execution host, described
129  *                        below.
130  *
131  *      context_dir     - Directory where the request should be executed.  If
132  *                        NULL, the HOME directory is used.
133  *
134  *      context_file    - Not currently used by the Command Invoker.
135  *
136  *      exec_parameters - Command Invoker execution parameters.  See External
137  *                        Specification for more information.
138  *                        If set to NULL, "-" is used.
139  *
140  *      exec_host       - Name of the host where the request is executed.
141  *
142  *      exec_string     - The command line to execute.
143  *
144  *      success_proc    - The function to be invoked if the request is 
145  *                        successfully executed.
146  *
147  *      success_data    - Client data for successful execution.
148  *
149  *      failure_proc    - The function to be invoked if an attempt to exeucte
150  *                        the request fails.
151  *
152  *      failure_data    - Client data for unsuccessful execution.
153  *
154  * Purpose:             
155  *
156  *      This function allows a client to use the DT "Command Invoker"
157  *      Library for its' process execution.  This function is intended
158  *      for processes which do not use the Action Library.
159  *
160  *      For local execution, the "fork" and "execvp" system calls are
161  *      used.  For remote execution, the "SPCD" is used.
162  *
163  * Notes:
164  *
165  *      This function must be preceeded by a call to 
166  *      "_DtInitializeCommandInvoker".
167  *                      
168  *****************************************************************************/
169
170 extern void
171 _DtCommandInvokerExecute(
172         char *request_name,
173         char *context_host,
174         char *context_dir,
175         char *context_file,
176         char *exec_parameters,
177         char *exec_host,
178         char *exec_string,
179         DtCmdInvExecuteProc success_proc,
180         void *success_data,
181         DtCmdInvExecuteProc failure_proc,
182         void *failure_data);
183
184 extern SPC_Channel_Ptr _DtSPCOpen( char *hostname,
185          int iomode,
186          char *errorMessage);                           /* MODIFIED */
187
188 extern int _DtSPCSpawn(
189         char                    *path,
190         char                    *context,
191         char                    **args,
192         char                    **env,
193         SPC_Channel_Ptr         chan,
194         char                    *execHost,
195         char                    *contextHost,
196         char                    *contextDir,
197         char                    *errorMessage);         /* MODIFIED */
198
199 #endif /* _CmdInv_h */