ActionP.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849
  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: ActionP.h /main/3 1995/10/26 14:59:56 rswiston $ */
  24. /************************************<+>*************************************
  25. ****************************************************************************
  26. **
  27. ** File: ActionP.h
  28. **
  29. ** Project: DT
  30. **
  31. ** Description: Private include file for the Action Library.
  32. **
  33. **
  34. ** (c) Copyright 1993, 1994 Hewlett-Packard Company
  35. ** (c) Copyright 1993, 1994 International Business Machines Corp.
  36. ** (c) Copyright 1993, 1994 Sun Microsystems, Inc.
  37. ** (c) Copyright 1993, 1994 Novell, Inc.
  38. ****************************************************************************
  39. ************************************<+>*************************************/
  40. #ifndef _ActionP_h
  41. #define _ActionP_h
  42. #include <Dt/DtP.h>
  43. #include <Dt/DbReader.h>
  44. #include <Dt/ActionDb.h>
  45. #include <Dt/Action.h>
  46. #include <Tt/tttk.h>
  47. #include <Dt/DtShmDb.h>
  48. /*
  49. * Environment Variable Names
  50. */
  51. #define ENV_SESSION_SVR "SESSION_SVR"
  52. /*
  53. * Define maximum static buffer size for action code.
  54. */
  55. #define _DtAct_MAX_BUF_SIZE 1024
  56. /*
  57. * Data-type field which contains the template for producing filenames
  58. * of a given type.
  59. */
  60. #define _DtActNAME_TEMPLATE "NAME_TEMPLATE"
  61. #define _DtActIS_EXECUTABLE "IS_EXECUTABLE"
  62. /******************************************************************************
  63. *
  64. * MASK LAYOUT:
  65. *
  66. * The same layout is used for all the masks (defined herein);, independent of
  67. * the data structure in which they are defined. That is, all bit fields for
  68. * all masks are non-overlapping. In general, the mask in any given structure
  69. * should ONLY contain information in the field appropriate for that structure.
  70. *
  71. * The action bit mask is broken into the following fields
  72. *
  73. * --------------------------------------------------------------------------
  74. * |act'n |arg |arg |arg | win |args| request | object |treat| not |
  75. * |type |class|count|typ | type | | status | status | as | |
  76. * |bits |bits |bits |bit | bits |used| bits | bits |file |used |
  77. * --------------------------------------------------------------------------
  78. * 0 - 4,5 - 8,9 - 12, 13 ,14 - 17,18-19,20 ------- 22,23 ---- 28, 29 ,30-31
  79. * | | | | | |
  80. * |<-- action mask -->| |<- request->|<- obj. ->|< - >|
  81. * mask data |
  82. * mask msgCcomp.
  83. * mask
  84. ******************************************************************************/
  85. /*
  86. * generic bit manipulation macros
  87. */
  88. #define SET_ANY_BITS(mask,bits) ( mask |= (bits) )
  89. #define RESET_ANY_BITS(mask,bits) ( mask &= ~(bits) )
  90. #define TST_ANY_BITS(mask,bits) ( mask & (bits) )
  91. /*
  92. * Action type bits
  93. */
  94. #define _DtAct_CMD_BIT (1<<0)
  95. #define _DtAct_MAP_BIT (1<<1)
  96. #define _DtAct_TT_MSG_BIT (1<<2)
  97. #ifdef _DT_ALLOW_DT_MSGS
  98. #define _DtAct_DT_REQ_MSG_BIT (1<<3)
  99. #define _DtAct_DT_NTFY_MSG_BIT (1<<4)
  100. #endif /* _DT_ALLOW_DT_MSGS */
  101. /*
  102. * Action structure mask bits
  103. */
  104. #define _DtAct_ARG_CLASS_FILE_BIT (1<<5)
  105. #define _DtAct_ARG_CLASS_STRING_BIT (1<<6)
  106. #define _DtAct_ARG_CLASS_BUFFER_BIT (1<<7)
  107. #define _DtAct_ARG_CLASS_WILD_BIT (1<<8)
  108. #define _DtAct_ARG_COUNT_LT_BIT (1<<9)
  109. #define _DtAct_ARG_COUNT_GT_BIT (1<<10)
  110. #define _DtAct_ARG_COUNT_EQ_BIT (1<<11)
  111. #define _DtAct_ARG_COUNT_WILD_BIT (1<<12)
  112. #define _DtAct_ARG_TYPE_WILD_BIT (1<<13)
  113. #define _DtAct_NO_STDIO_BIT (1<<14)
  114. #define _DtAct_TERMINAL_BIT (1<<15)
  115. #define _DtAct_PERM_TERM_BIT (1<<16)
  116. /*
  117. * Defines which reflect the actual number
  118. * of %ARGn% instances found in the action definition
  119. * NOTE: Is this JUST in the EXEC_STRING? or the total number of %ARGn%'s
  120. * referenced in all parssed definitions?
  121. *
  122. */
  123. #define _DtAct_SINGLE_ARG_BIT (1<<18)
  124. #define _DtAct_MULTI_ARG_BIT (1<<19)
  125. #ifdef _DT_ALLOW_DT_MSGS
  126. #define _DtAct_ACTION_TYPE_BITS ( _DtAct_CMD_BIT \
  127. | _DtAct_MAP_BIT \
  128. | _DtAct_DT_NTFY_MSG_BIT \
  129. | _DtAct_DT_REQ_MSG_BIT \
  130. | _DtAct_TT_MSG_BIT )
  131. #else
  132. #define _DtAct_ACTION_TYPE_BITS ( _DtAct_CMD_BIT \
  133. | _DtAct_MAP_BIT \
  134. | _DtAct_TT_MSG_BIT )
  135. #endif /* _DT_ALLOW_DT_MSGS */
  136. #define _DtAct_ARG_CLASS_BITS ( _DtAct_ARG_CLASS_FILE_BIT \
  137. | _DtAct_ARG_CLASS_STRING_BIT\
  138. | _DtAct_ARG_CLASS_BUFFER_BIT \
  139. | _DtAct_ARG_CLASS_WILD_BIT )
  140. #define _DtAct_ARG_TYPE_BITS ( _DtAct_ARG_TYPE_WILD_BIT )
  141. #define _DtAct_ARG_COUNT_BITS ( _DtAct_ARG_COUNT_LT_BIT \
  142. | _DtAct_ARG_COUNT_GT_BIT \
  143. | _DtAct_ARG_COUNT_EQ_BIT \
  144. | _DtAct_ARG_COUNT_WILD_BIT )
  145. #define _DtAct_WINTYPE_BITS ( _DtAct_NO_STDIO_BIT \
  146. | _DtAct_TERMINAL_BIT \
  147. | _DtAct_PERM_TERM_BIT )
  148. #define _DtAct_ARGS_USED_BITS ( _DtAct_SINGLE_ARG \
  149. | _DtAct_MULTI_ARG )
  150. #define _DtAct_ACTION_BITS ( _DtAct_ACTION_TYPE_BITS \
  151. | _DtAct_ARG_CLASS_BITS \
  152. | _DtAct_ARG_TYPE_BITS \
  153. | _DtAct_ARG_COUNT_BITS \
  154. | _DtAct_WINTYPE_BITS \
  155. | _DtAct_ARGS_USED_BITS )
  156. #define IS_CMD(mask) ( mask & _DtAct_CMD_BIT )
  157. #define IS_MAP(mask) ( mask & _DtAct_MAP_BIT )
  158. #define IS_TT_MSG(mask) ( mask & _DtAct_TT_MSG_BIT )
  159. #ifdef _DT_ALLOW_DT_MSGS
  160. #define IS_DT_REQ_MSG(mask) ( mask & _DtAct_DT_REQ_MSG_BIT )
  161. #define IS_DT_NOTIFY_MSG(mask) ( mask & _DtAct_DT_NTFY_MSG_BIT )
  162. #endif /* _DT_ALLOW_DT_MSGS */
  163. #define SET_CMD_ACTION(mask) ( mask |= _DtAct_CMD_BIT )
  164. #define SET_MAP_ACTION(mask) ( mask |= _DtAct_MAP_BIT )
  165. #define SET_TT_MSG(mask) ( mask |= _DtAct_TT_MSG_BIT )
  166. #ifdef _DT_ALLOW_DT_MSGS
  167. #define SET_DT_REQUEST_MSG(mask) ( mask |= _DtAct_DT_REQ_MSG_BIT)
  168. #define SET_DT_NOTIFY_MSG(mask) ( mask |= _DtAct_DT_NTFY_MSG_BIT)
  169. #endif /* _DT_ALLOW_DT_MSGS */
  170. #define RESET_CMD_ACTION(mask) ( mask &= ~(_DtAct_CMD_BIT))
  171. #define RESET_MAP_ACTION(mask) ( mask &= ~(_DtAct_MAP_BIT))
  172. #define RESET_TT_MSG(mask) ( mask &= ~(_DtAct_TT_MSG_BIT))
  173. #ifdef _DT_ALLOW_DT_MSGS
  174. #define RESET_DT_REQ_MSG(mask) ( mask &= ~(_DtAct_DT_REQ_MSG_BIT))
  175. #define RESET_DT_NOTIFY_MSG(mask) ( mask &= ~(_DtAct_DT_NTFY_MSG_BIT))
  176. #endif /* _DT_ALLOW_DT_MSGS */
  177. #define IS_NO_STDIO(mask) ( mask & _DtAct_NO_STDIO_BIT )
  178. #define IS_TERMINAL(mask) ( mask & _DtAct_TERMINAL_BIT )
  179. #define IS_PERM_TERM(mask) ( mask & _DtAct_PERM_TERM_BIT)
  180. #define SET_NO_STDIO(mask) ( mask |= _DtAct_NO_STDIO_BIT )
  181. #define SET_TERMINAL(mask) ( mask |= _DtAct_TERMINAL_BIT )
  182. #define SET_PERM_TERM(mask) ( mask |= _DtAct_PERM_TERM_BIT )
  183. #define RESET_NO_STDIO(mask) ( mask &= ~(_DtAct_NO_STDIO_BIT ))
  184. #define RESET_TERMINAL(mask) ( mask &= ~(_DtAct_TERMINAL_BIT ))
  185. #define RESET_PERM_TERM(mask) ( mask &= ~(_DtAct_PERM_TERM_BIT ))
  186. #define IS_ARG_CLASS_FILE(mask) ( mask & _DtAct_ARG_CLASS_FILE_BIT )
  187. #define IS_ARG_CLASS_STRING(mask) ( mask & _DtAct_ARG_CLASS_STRING_BIT )
  188. #define IS_ARG_CLASS_BUFFER(mask) ( mask & _DtAct_ARG_CLASS_BUFFER_BIT )
  189. #define IS_ARG_CLASS_WILD(mask) ( mask & _DtAct_ARG_CLASS_WILD_BIT )
  190. #define SET_ARG_CLASS_FILE(mask) ( mask |= _DtAct_ARG_CLASS_FILE_BIT )
  191. #define SET_ARG_CLASS_STRING(mask) ( mask |= _DtAct_ARG_CLASS_STRING_BIT)
  192. #define SET_ARG_CLASS_BUFFER(mask) ( mask |= _DtAct_ARG_CLASS_BUFFER_BIT)
  193. #define SET_ARG_CLASS_WILD(mask) ( mask |= _DtAct_ARG_CLASS_WILD_BIT )
  194. #define RESET_ARG_CLASS_FILE(mask) (mask &= ~(_DtAct_ARG_CLASS_FILE_BIT))
  195. #define RESET_ARG_CLASS_STRING(mask) (mask &= ~(_DtAct_ARG_CLASS_STRING_BIT))
  196. #define RESET_ARG_CLASS_BUFFER(mask) (mask &= ~(_DtAct_ARG_CLASS_BUFFER_BIT))
  197. #define RESET_ARG_CLASS_WILD(mask) (mask &= ~(_DtAct_ARG_CLASS_WILD_BIT))
  198. #define IS_ARG_TYPE_WILD(mask) ( mask & _DtAct_ARG_TYPE_WILD_BIT )
  199. #define SET_ARG_TYPE_WILD(mask) ( mask |= _DtAct_ARG_TYPE_WILD_BIT )
  200. #define RESET_ARG_TYPE_WILD(mask) ( mask &= ~(_DtAct_ARG_TYPE_WILD_BIT))
  201. #define IS_ARG_COUNT_GT(mask) ( mask & _DtAct_ARG_COUNT_GT_BIT )
  202. #define IS_ARG_COUNT_LT(mask) ( mask & _DtAct_ARG_COUNT_LT_BIT )
  203. #define IS_ARG_COUNT_EQ(mask) ( mask & _DtAct_ARG_COUNT_EQ_BIT )
  204. #define IS_ARG_COUNT_WILD(mask) ( mask & _DtAct_ARG_COUNT_WILD_BIT )
  205. #define SET_ARG_COUNT_GT(mask) ( mask |= _DtAct_ARG_COUNT_GT_BIT )
  206. #define SET_ARG_COUNT_LT(mask) ( mask |= _DtAct_ARG_COUNT_LT_BIT )
  207. #define SET_ARG_COUNT_EQ(mask) ( mask |= _DtAct_ARG_COUNT_EQ_BIT )
  208. #define SET_ARG_COUNT_WILD(mask) ( mask |= _DtAct_ARG_COUNT_WILD_BIT )
  209. #define RESET_ARG_COUNT_GT(mask) ( mask &= ~(_DtAct_ARG_COUNT_GT_BIT ))
  210. #define RESET_ARG_COUNT_LT(mask) ( mask &= ~(_DtAct_ARG_COUNT_LT_BIT ))
  211. #define RESET_ARG_COUNT_EQ(mask) ( mask &= ~(_DtAct_ARG_COUNT_EQ_BIT ))
  212. #define RESET_ARG_COUNT_WILD(mask) ( mask &= ~(_DtAct_ARG_COUNT_WILD_BIT ))
  213. /*
  214. * Use of the logical "NOT" operator(!) instead of the bitwise negation
  215. * operator(~) is intentional in IS_ARG_NONE_FOUND.
  216. */
  217. #define IS_ARG_NONE_FOUND(mask) !( mask & ( _DtAct_SINGLE_ARG_BIT \
  218. | _DtAct_MULTI_ARG_BIT ))
  219. #define IS_ARG_SINGLE_ARG(mask) ( mask & _DtAct_SINGLE_ARG_BIT )
  220. #define IS_ARG_MULTI_ARG(mask) ( mask & _DtAct_MULTI_ARG_BIT )
  221. #define SET_ARG_NONE_FOUND(mask) ( mask &= ~( _DtAct_SINGLE_ARG_BIT \
  222. | _DtAct_MULTI_ARG_BIT ))
  223. #define SET_ARG_SINGLE_ARG(mask) ((mask |= _DtAct_SINGLE_ARG_BIT), \
  224. ( mask &= ~(_DtAct_MULTI_ARG_BIT)))
  225. #define SET_ARG_MULTI_ARG(mask) ((mask |= _DtAct_MULTI_ARG_BIT), \
  226. ( mask &= ~(_DtAct_SINGLE_ARG_BIT)))
  227. #define RESET_ARG_SINGLE_ARG(mask) ( mask &= ~(_DtAct_SINGLE_ARG_BIT))
  228. #define RESET_ARG_MULTI_ARG(mask) ( mask &= ~(_DtAct_MULTI_ARG_BIT))
  229. /*
  230. * ActionRequest structure mask bits
  231. */
  232. #define _DtAct_REPROCESSING_BIT (1<<20)
  233. #define _DtAct_TOO_MANY_MAPS_BIT (1<<21)
  234. #define _DtAct_CLONED_REQUEST_BIT (1<<22)
  235. #define _DtAct_ACTION_REQUEST_BITS ( _DtAct_REPROCESSING_BIT \
  236. | _DtAct_TOO_MANY_MAPS_BIT \
  237. | _DtAct_CLONED_REQUEST_BIT )
  238. #define IS_REPROCESSING(mask) ( mask & _DtAct_REPROCESSING_BIT )
  239. #define IS_TOO_MANY_MAPS(mask) ( mask & _DtAct_TOO_MANY_MAPS_BIT )
  240. #define IS_CLONED_REQUEST(mask) ( mask & _DtAct_CLONED_REQUEST_BIT )
  241. #define SET_REPROCESSING(mask) ( mask |= _DtAct_REPROCESSING_BIT )
  242. #define SET_TOO_MANY_MAPS(mask) ( mask |= _DtAct_TOO_MANY_MAPS_BIT )
  243. #define SET_CLONED_REQUEST(mask) ( mask |= _DtAct_CLONED_REQUEST_BIT )
  244. #define RESET_REPROCESSING(mask) ( mask &= ~(_DtAct_REPROCESSING_BIT))
  245. #define RESET_TOO_MANY_MAPS(mask) ( mask &= ~(_DtAct_TOO_MANY_MAPS_BIT))
  246. #define RESET_CLONED_REQUEST(mask) ( mask &= ~(_DtAct_CLONED_REQUEST_BIT))
  247. /*
  248. * ObjectData structure mask bits
  249. *
  250. */
  251. #define _DtAct_WRITE_OBJ_BIT (1<<23)
  252. #define _DtAct_FILE_OBJ_BIT (1<<24)
  253. #define _DtAct_BUFFER_OBJ_BIT (1<<25)
  254. #define _DtAct_STRING_OBJ_BIT (1<<26)
  255. #define _DtAct_DIR_OBJ_BIT (1<<27)
  256. #define _DtAct_UNKNOWN_IF_DIR_BIT (1<<28)
  257. #define _DtAct_OBJ_DATA_BITS ( _DtAct_WRITE_OBJ_BIT \
  258. | _DtAct_FILE_OBJ_BIT \
  259. | _DtAct_DIR_OBJ_BIT \
  260. | _DtAct_BUFFER_OBJ_BIT \
  261. | _DtAct_STRING_OBJ_BIT \
  262. | _DtAct_UNKNOWN_IF_DIR_BIT )
  263. #define IS_WRITE_OBJ(mask) ( mask & _DtAct_WRITE_OBJ_BIT )
  264. #define IS_FILE_OBJ(mask) ( mask & _DtAct_FILE_OBJ_BIT )
  265. #define IS_BUFFER_OBJ(mask) ( mask & _DtAct_BUFFER_OBJ_BIT )
  266. #define IS_STRING_OBJ(mask) ( mask & _DtAct_STRING_OBJ_BIT )
  267. #define IS_UNKNOWN_IF_DIR(mask) ( mask & _DtAct_UNKNOWN_IF_DIR_BIT )
  268. #define IS_DIR_OBJ(mask) ( mask & \
  269. ( _DtAct_UNKNOWN_IF_DIR_BIT \
  270. | _DtAct_DIR_OBJ_BIT ) \
  271. == _DtAct_DIR_OBJ_BIT)
  272. #define SET_WRITE_OBJ(mask) ( mask |= _DtAct_WRITE_OBJ_BIT )
  273. #define SET_FILE_OBJ(mask) ( mask |= _DtAct_FILE_OBJ_BIT )
  274. #define SET_BUFFER_OBJ(mask) ( mask |= _DtAct_BUFFER_OBJ_BIT )
  275. #define SET_STRING_OBJ(mask) ( mask |= _DtAct_STRING_OBJ_BIT )
  276. #define SET_DIR_OBJ(mask) ( mask |= _DtAct_DIR_OBJ_BIT )
  277. #define SET_UNKNOWN_IF_DIR(mask) ( mask |= _DtAct_UNKNOWN_IF_DIR_BIT)
  278. #define RESET_WRITE_OBJ(mask) ( mask &= ~(_DtAct_WRITE_OBJ_BIT))
  279. #define RESET_FILE_OBJ(mask) ( mask &= ~(_DtAct_FILE_OBJ_BIT))
  280. #define RESET_BUFFER_OBJ(mask) ( mask &= ~(_DtAct_BUFFER_OBJ_BIT))
  281. #define RESET_STRING_OBJ(mask) ( mask &= ~(_DtAct_STRING_OBJ_BIT))
  282. #define RESET_DIR_OBJ(mask) ( mask &= ~(_DtAct_DIR_OBJ_BIT))
  283. #define RESET_UNKNOWN_IF_DIR(mask) ( mask &= ~(_DtAct_UNKNOWN_IF_DIR_BIT))
  284. /*
  285. * MsgComponent structure mask bits (shared with Object Data?)
  286. */
  287. #define _DtAct_TREAT_AS_FILE_BIT (1<<29)
  288. #define _DtAct_MSG_COMP_BITS ( _DtAct_TREAT_AS_FILE_BIT )
  289. #define IS_TREAT_AS_FILE(mask) ( mask & _DtAct_TREAT_AS_FILE_BIT )
  290. #define SET_TREAT_AS_FILE(mask) ( mask |= _DtAct_TREAT_AS_FILE_BIT)
  291. #define RESET_TREAT_AS_FILE(mask) ( mask &= ~(_DtAct_TREAT_AS_FILE_BIT))
  292. /* Keyword defines */
  293. #define NO_KEYWORD -1
  294. #define LOCAL_HOST 0
  295. #define DATA_HOST 1
  296. #define DATABASE_HOST 2
  297. #define ARG 3
  298. #define DISPLAY_HOST 4
  299. #define LABEL 5
  300. #define SESSION_HOST 6
  301. /* Special argNum values */
  302. #define NO_ARG -1
  303. #define ALL_ARGS 0
  304. /*
  305. * ToolTalk base representation type ( tt_argn_rep_type ) values
  306. */
  307. #define DtACT_TT_REP_UNDEFINED 0
  308. #define DtACT_TT_REP_INT 1
  309. #define DtACT_TT_REP_BUFFER 2
  310. #define DtACT_TT_REP_STRING 3
  311. /*
  312. * Resource name and class for the EXEC-HOST resource.
  313. */
  314. #define DtEXEC_HOSTS_NAME "executionHosts"
  315. #define DtEXEC_HOSTS_CLASS "ExecutionHosts"
  316. #define DtEXEC_HOSTS_DEFAULT _DtACT_EXEC_HOST_DFLT
  317. /* Flags to force special processing of filenames */
  318. #define _DTAct_TT_VTYPE 1 << 0
  319. #define _DTAct_TT_ARG 1 << 1
  320. /* Structure used to hold the components of a message */
  321. typedef struct {
  322. char *precedingText;
  323. char *prompt;
  324. int keyword;
  325. int argNum;
  326. unsigned long mask; /* replaces isFile, isBuffer, isString boolean */
  327. } MsgComponent;
  328. typedef struct {
  329. MsgComponent *parsedMessage;
  330. int numMsgParts;
  331. char *compiledMessage;
  332. int msgLen;
  333. } parsedMsg;
  334. /******************************************************************************
  335. *
  336. * Structs used during the invocation of an action. Once DtActionInvoke()
  337. * exits, these structs are generally freed.
  338. *
  339. *****************************************************************************/
  340. typedef struct {
  341. /*int winMask; ---> moved into the action mask*/
  342. parsedMsg execString;
  343. parsedMsg termOpts;
  344. char *contextDir;
  345. char *contextHost;
  346. parsedMsg execHosts;
  347. char **execHostArray;
  348. int execHostCount;
  349. } cmdAttr;
  350. typedef struct {
  351. DtShmBoson map_action;
  352. } mapAttr;
  353. typedef struct {
  354. int tt_class;
  355. int tt_scope;
  356. parsedMsg tt_op;
  357. parsedMsg tt_file; /* must be a single file name */
  358. int *tt_argn_mode;
  359. int mode_count;
  360. parsedMsg *tt_argn_vtype;
  361. int vtype_count;
  362. parsedMsg *tt_argn_value;
  363. int value_count;
  364. int *tt_argn_rep_type; /* INT, STRING, BUFFER or UNDEFINED */
  365. int rep_type_count;
  366. } tt_msgAttr;
  367. #ifdef _DT_ALLOW_DT_MSGS
  368. typedef struct {
  369. parsedMsg service; /* ICCCM service name */
  370. parsedMsg request; /* request name string */
  371. parsedMsg *argn_value;
  372. int value_count;
  373. } dt_reqAttr;
  374. typedef struct {
  375. parsedMsg ngroup; /* ICCCM notification group */
  376. parsedMsg notify; /* notification to be sent */
  377. parsedMsg *argn_value;
  378. int value_count;
  379. } dt_notifyAttr;
  380. #endif /* _DT_ALLOW_DT_MSGS */
  381. typedef struct {
  382. DtShmBoson action; /* Might just use a char * here? */
  383. DtDbPathId file_name_id; /* id of file wherein the action is defined */
  384. char *label; /* localizable action label string */
  385. char *description;
  386. DtShmBoson *arg_types;
  387. int type_count;
  388. int arg_count; /* Number of arguments accepted by the action */
  389. unsigned long mask; /* action mask -- class/type/arg info */
  390. union { /* attributes for the different action kinds */
  391. cmdAttr cmd;
  392. mapAttr map;
  393. tt_msgAttr tt_msg;
  394. #ifdef _DT_ALLOW_DT_MSGS
  395. dt_reqAttr dt_req;
  396. dt_notifyAttr dt_notify;
  397. #endif /* _DT_ALLOW_DT_MSGS */
  398. } u;
  399. } Action, *ActionPtr; /* new action structure and pointer */
  400. /* Structure used to hold each of the object components */
  401. typedef struct {
  402. char * origFilename;
  403. char * baseFilename;
  404. char * origHostname;
  405. int hostIndex;
  406. int dirIndex;
  407. void * bp; /* pointer to original buffer -- tmp files only */
  408. int sizebp; /* size of original buf -- for tmp files only */
  409. } fileAttr;
  410. typedef struct {
  411. char * string;
  412. } stringAttr;
  413. typedef struct {
  414. int size;
  415. void *bp;
  416. } bufferAttr;
  417. typedef struct {
  418. DtShmBoson type;
  419. unsigned long mask;
  420. union {
  421. fileAttr file;
  422. stringAttr string;
  423. bufferAttr buffer;
  424. } u;
  425. } ObjectData;
  426. /*
  427. * Structure attached to the button callbacks in the
  428. * dialog used to collect missing parameters.
  429. *
  430. */
  431. typedef struct {
  432. char *actionName;
  433. int objOffset;
  434. int objsUsed;
  435. int numObjects;
  436. ObjectData *objects;
  437. int numPromptInputs;
  438. char **promptInputs;
  439. int numHostNames;
  440. char **hostNames;
  441. int numDirNames;
  442. char **dirNames;
  443. char *termOpts;
  444. char *cwdHost;
  445. char *cwdDir;
  446. ActionPtr clonedAction;
  447. unsigned long mask;
  448. char *badHostList;
  449. char *currentHost;
  450. int hostIndex;
  451. char *execHost;
  452. DtActionInvocationID invocId;
  453. unsigned long childId;
  454. } ActionRequest;
  455. /******************************************************************************
  456. *
  457. * Structs used to maintain information on invoked actions until they
  458. * exit. A few select elements of the ActionRequest and Action structs
  459. * will be copied into these strcuts.
  460. *
  461. *****************************************************************************/
  462. /******************************************************************************
  463. ******************************************************************************
  464. **
  465. ** Major data-structure diagram for the DtAction invocation layer:
  466. **
  467. ** _DtActInvRec <=== _DtActInvRecArray[ actInvRecArraySize ]
  468. ** ------------------
  469. ** | info per |
  470. ** | DtActionInvoke |
  471. ** |----------------|
  472. ** | numChildren |
  473. ** |----------------|
  474. ** | childRecs[] | ===> _DtActChildRec
  475. ** ------------------ ------------------
  476. ** | info per |
  477. ** | child request |
  478. ** |----------------|
  479. ** | *request | ===> ActionRequest
  480. ** ------------------ ------------------
  481. ** | info on users |
  482. ** | action request |
  483. ** |----------------|
  484. ** Action <=== | *clonedAction |
  485. ** ------------------ ------------------
  486. ** |info on matching|
  487. ** | actionDB entry |
  488. ** |----------------|
  489. ** | cmd/map/tt/dt |
  490. ** | attributes of |
  491. ** | resulting msg |
  492. ** ------------------
  493. **
  494. ** "ActionRequest" and "Action" were present in VUE 3.0, and have a
  495. ** scratch-pad like function within DtActionInvoke() to get actions
  496. ** started. They are not good long-term retainers of information.
  497. ** Action and ActionRequest are in fact freed when DtActionInvoke()
  498. ** exits.
  499. **
  500. ** "_DtActInvRec" and "_DtActChildRec" have been introduced to retain
  501. ** information for the entire life of the actions. Some of the
  502. ** information from ActionRequest and Action will be copied (mirrored)
  503. ** up to these structures.
  504. **
  505. ******************************************************************************
  506. *****************************************************************************/
  507. /******************************************************************************
  508. *
  509. * Child Status Macro Definitions -- These values are used in
  510. * the status word of the _DtActChildRec child record.
  511. *
  512. * ****** IMPORTANT NOTE *** IMPORTANT NOTE *** IMPORTANT NOTE ******
  513. *
  514. * The _DtActCHILD_ macros are also used in cde1/dtexec/Main.c
  515. * in the _DtActDtexecDone(Request) message, so in effect they
  516. * are also protocol constants that should *never* be changed.
  517. * If changed, libDtSvc and dtexec may mis-communicate status.
  518. *
  519. *****************************************************************************/
  520. #define _DtActCHILD_UNKNOWN (1<<0) /* 1 - child status unknown */
  521. #define _DtActCHILD_PENDING_START (1<<1) /* 2 - child start pending */
  522. #define _DtActCHILD_ALIVE_UNKNOWN (1<<2) /* 4 - child alive but unknown*/
  523. #define _DtActCHILD_ALIVE (1<<3) /* 8 - child alive and well */
  524. #define _DtActCHILD_DONE (1<<4) /* 16 - child done */
  525. #define _DtActCHILD_FAILED (1<<5) /* 32 - child failed */
  526. #define _DtActCHILD_CANCELED (1<<6) /* 64 - child canceled */
  527. #define _DtActCHILD_DONE_BITS ( (_DtActCHILD_DONE) | \
  528. (_DtActCHILD_FAILED) | \
  529. (_DtActCHILD_CANCELED) )
  530. /*** IMPORTANT NOTE ABOVE *** IMPORTANT NOTE ABOVE *** IMPORTANT NOTE ABOVE ***/
  531. #define ARE_CHILDREN_DONE(mask) ( (mask) & _DtActCHILD_DONE_BITS )
  532. #define IS_CHILD_UNKNOWN(mask) ( (mask) == _DtActCHILD_UNKNOWN )
  533. #define IS_CHILD_PENDING_START(mask) ( (mask) & _DtActCHILD_PENDING_START )
  534. #define IS_CHILD_DONE(mask) ( (mask) & _DtActCHILD_DONE)
  535. #define IS_CHILD_FAILED(mask) ( (mask) & _DtActCHILD_FAILED)
  536. #define IS_CHILD_CANCELED(mask) ( (mask) & _DtActCHILD_CANCELED)
  537. #define IS_CHILD_ALIVE(mask) ( (mask) & _DtActCHILD_ALIVE)
  538. #define IS_CHILD_ALIVE_UNKOWN(mask) ( (mask) & _DtActCHILD_ALIVE_UNKNOWN)
  539. /******************************************************************************
  540. *
  541. * Information per child of DtActionInvoke()
  542. *
  543. *****************************************************************************/
  544. /*
  545. * Structure useed to map returnable arguments to the child argument list.
  546. */
  547. typedef struct {
  548. int argN; /* Nth returned value (0 based for tooltalk) */
  549. int argIdx; /* Nth child argument */
  550. } _DtActArgMap;
  551. typedef struct {
  552. unsigned long childId; /* serial # with DtActInvId */
  553. unsigned long childState; /* child state */
  554. /*
  555. * Information cloned from "ActionRequest *req"
  556. */
  557. int numObjects; /* number of child args */
  558. _DtActArgMap *argMap; /* map of returnable args to chd args */
  559. /*
  560. * Information cloned from "ActionPtr clonedAction"
  561. */
  562. unsigned long mask; /* action type - IS_xxx() */
  563. /* a list of tmp file names 5/11/94 --tomg */
  564. union {
  565. struct { /* COMMAND elements */
  566. char *TTProcId; /* TT procID handle to child */
  567. Tt_message reqMessage; /* Initiator TT Request */
  568. Tt_pattern magic_cookie; /* dtexec to libDtSvc cookie */
  569. } cmd;
  570. struct { /* TT_MSG elements */
  571. char *TTProcId; /* TT procID handle to child */
  572. Tt_message reqMessage; /* Initiator TT Request */
  573. int isTtMedia; /* handled by ttmedia_load ? */
  574. Tttk_op TtMediaOp; /* if ttmedia_load, the op */
  575. Tt_pattern *subConPats; /* for subcontract_manage */
  576. } tt;
  577. } u;
  578. } _DtActChildRecT;
  579. /******************************************************************************
  580. *
  581. * Invocation Status Macro Definitions -- These values are used in
  582. * the state word of the _DtActInvRec invocation record.
  583. *
  584. *****************************************************************************/
  585. #define _DtActINV_UNKNOWN 0 /* unknown invocation status */
  586. #define _DtActINV_ERROR (1<<0) /* invocation error detected */
  587. #define _DtActINV_CANCEL (1<<1) /* trying to cancel invocation*/
  588. #define _DtActINV_PENDING (1<<2) /* invocation pending */
  589. #define _DtActINV_WORKING (1<<3) /* invocation in process */
  590. #define _DtActINV_DONE (1<<4) /* invocation step done */
  591. #define _DtActINV_COMPLETE (1<<5) /* invocation steps all done */
  592. #define _DtActINV_CB_CALLED (1<<6) /* invocation callback called */
  593. #define _DtActINV_ID_RETURNED (1<<7) /* invocation id has returned */
  594. #define _DtActINV_CMD_QUEUED (1<<8) /* command has been queued */
  595. #define _DtActINV_INDICATOR_ON (1<<9) /* busy indicator active bit */
  596. #define SET_INV_UNKNOWN(mask) (mask = 0)
  597. #define SET_INV_ERROR(mask) (mask |= _DtActINV_ERROR)
  598. #define SET_INV_CANCEL(mask) (mask |= _DtActINV_CANCEL)
  599. #define SET_INV_PENDING(mask) (mask |= _DtActINV_PENDING)
  600. #define SET_INV_WORKING(mask) (mask |= _DtActINV_WORKING)
  601. #define SET_INV_DONE(mask) (mask |= _DtActINV_DONE)
  602. #define SET_INV_COMPLETE(mask) (mask |= _DtActINV_COMPLETE)
  603. #define SET_INV_CB_CALLED(mask) (mask |= _DtActINV_CB_CALLED)
  604. #define SET_INV_ID_RETURNED(mask) (mask |= _DtActINV_ID_RETURNED)
  605. #define SET_INV_CMD_QUEUED(mask) (mask |= _DtActINV_CMD_QUEUED)
  606. #define SET_INV_INDICATOR_ON(mask) (mask |= _DtActINV_INDICATOR_ON)
  607. #define RESET_INV_ERROR(mask) (mask &= ~(_DtActINV_ERROR))
  608. #define RESET_INV_CANCEL(mask) (mask &= ~(_DtActINV_CANCEL))
  609. #define RESET_INV_PENDING(mask) (mask &= ~(_DtActINV_PENDING))
  610. #define RESET_INV_WORKING(mask) (mask &= ~(_DtActINV_WORKING))
  611. #define RESET_INV_COMPLETE(mask) (mask &= ~(_DtActINV_COMPLETE))
  612. #define RESET_INV_DONE(mask) (mask &= ~(_DtActINV_DONE))
  613. #define RESET_INV_CB_CALLED(mask) (mask &= ~(_DtActINV_CB_CALLED))
  614. #define RESET_INV_ID_RETURNED(mask) (mask &= ~(_DtActINV_ID_RETURNED))
  615. #define RESET_INV_CMD_QUEUED(mask) (mask &= ~(_DtActINV_CMD_QUEUED))
  616. #define RESET_INV_INDICATOR_ON(mask) (mask &= ~(_DtActINV_INDICATOR_ON))
  617. #define IS_INV_FINISHED(mask) ( !((mask) & _DtActINV_CMD_QUEUED) \
  618. && ((mask) & (_DtActINV_COMPLETE \
  619. | _DtActINV_CANCEL)) )
  620. #define IS_INV_UNKNOWN(mask) ( (mask) == _DtActINV_UNKNOWN )
  621. #define IS_INV_ERROR(mask) ((mask) & _DtActINV_ERROR )
  622. #define IS_INV_CANCEL(mask) ((mask) & _DtActINV_CANCEL )
  623. #define IS_INV_PENDING(mask) ((mask) & _DtActINV_PENDING )
  624. #define IS_INV_WORKING(mask) ((mask) & _DtActINV_WORKING )
  625. #define IS_INV_DONE(mask) ((mask) & _DtActINV_DONE )
  626. #define IS_INV_COMPLETE(mask) ((mask) & _DtActINV_COMPLETE )
  627. #define IS_INV_CB_CALLED(mask) ((mask) & _DtActINV_CB_CALLED )
  628. #define IS_INV_ID_RETURNED(mask) ((mask) & _DtActINV_ID_RETURNED )
  629. #define IS_INV_CMD_QUEUED(mask) ((mask) & _DtActINV_CMD_QUEUED )
  630. #define IS_INV_INDICATOR_ON(mask) ((mask) & _DtActINV_INDICATOR_ON )
  631. #define CALL_INV_CB(mask) ((IS_INV_FINISHED(mask)) && \
  632. (IS_INV_ID_RETURNED(mask)) && \
  633. !(IS_INV_CB_CALLED(mask)))
  634. /******************************************************************************
  635. *
  636. * Information per DtActionInvoke()
  637. *
  638. * Note: For TT_MSG(NOTICE)'s during CDE 1.0, this struct will disappear
  639. * immediately after the NOTICEs are sent.
  640. *
  641. *****************************************************************************/
  642. typedef struct {
  643. unsigned long mask; /* encodes object class and writable flag */
  644. int size; /* original size (buffers only) */
  645. char *type; /* original type (buffers only) */
  646. char *name; /* encodes (tmp) file name associated with the
  647. object (if any) */
  648. } _DtActArgInfo;
  649. typedef struct {
  650. DtActionStatus userStatus;
  651. DtActionArg *newArgp;
  652. int newArgc;
  653. } _DtActUpdateCache;
  654. typedef struct _DtActInvRec {
  655. unsigned long state; /* invocation state */
  656. DtActionInvocationID id; /* identifying invocation ID */
  657. Widget w; /* users widget id */
  658. DtActionCallbackProc cb; /* users callback */
  659. XtPointer client_data; /* users client data for cb */
  660. _DtActArgInfo *info; /* template w/ .argClass info */
  661. int ac; /* original # of arguments */
  662. int numChildren; /* number of childRec's. */
  663. _DtActChildRecT **childRec; /* array of child Rec's */
  664. int cachedUploadCnt;/* cached callback updates */
  665. _DtActUpdateCache *cachedUploads; /* data for */
  666. } _DtActInvRecT;
  667. /******************************************************************************
  668. *
  669. * Structs for dialogs/prompts
  670. *
  671. *****************************************************************************/
  672. /* Structure used to hold a prompt string destined for a dialog */
  673. typedef struct {
  674. int argIndex;
  675. char *prompt;
  676. } PromptEntry;
  677. /* Structure used to contain prompt dialog information */
  678. typedef struct {
  679. int argIndex;
  680. Widget promptWidget;
  681. } DialogPromptEntry;
  682. typedef struct {
  683. ActionRequest * request;
  684. Widget topLevel;
  685. Widget associatedWidget;
  686. int numPrompts;
  687. DialogPromptEntry * prompts;
  688. } PromptDialog;
  689. /* Structure used to contain abort/continue dialog information */
  690. typedef struct {
  691. ActionRequest * request;
  692. Widget topLevel;
  693. Widget associatedWidget;
  694. int numPrompts;
  695. PromptEntry * prompts;
  696. } ContinueDialog;
  697. /* Structure passed to request passed/failed callbacks */
  698. typedef struct {
  699. Widget associatedWidget;
  700. char *actionLabel;
  701. int offset;
  702. ActionPtr actionPtr; /* Ptr to the action that
  703. was invoked. */
  704. ActionRequest *requestPtr;
  705. DtActionInvocationID actInvId; /* A standard invocation id */
  706. unsigned long childId; /* An id to further identify
  707. children of actInvId */
  708. } CallbackData;
  709. /******************************************************************************
  710. *
  711. * Private External Function Declarations -- not for public consumption
  712. *
  713. ******************************************************************************/
  714. extern void _DtFreeActionStruct( ActionPtr action) ;
  715. #endif /* _ActionP_h */
  716. /* DON'T ADD ANYTHING AFTER THIS #endif */