1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
|
/**
*
* VOPKG.C -- Task and package management.
*
* This file provides the introspection methods for a callable package.
* These routines are used to call a package binary to get the metadata
* for packages, tasks and parameters.
*
*
* Package/Task Management:
* ------------------------
*
* vo_setPkgDir (path) # set package dir
* path = vo_getPkgDir () # get package dir
*
* pkg = vo_pkgList (pattern) # Get available packages
* len = vo_pkgLen (pkg)
* pkg = vo_pkgNext (pkg)
* str = vo_pkgAttr (pkg, attr)
*
* pp = vo_pkgParams (pkg)
* pp = vo_taskParams (pkgName, taskName) # Input param defs
* ( see parameter handling below )
*
* task = vo_taskList (taskName) # Get tasks in package
* len = vo_taskLen (task)
* str = vo_taskNext (task)
* task = vo_taskAttr (task, attr)
*
*
* xml = vo_pkgListXML (pattern) # XML serializations (opt)
* xml = vo_taskListXML (pkgName)
* xml = vo_paramListXML (pkgName, taskName)
*
*
* @file voPkg.c
* @author Mike Fitzpatrick
* @date 9/24/12
*
* @brief Package and task management methods
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <stdarg.h>
#include <setjmp.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/select.h>
#include <sys/time.h>
#include <sys/types.h>
#include "voTask.h"
/**************************************************************************/
/*** Package Introspection Methods ***/
/**************************************************************************/
/**
* VO_SETPKGDIR -- Set the working package directory.
*
* @brief Set the working package directory.
* @fn vo_setPkgDir (char *path)
*
* @param path Path to current working package directory
* @returns nothing
*/
void
vo_setPkgDir (char *path)
{
}
/**
* VO_GETPKGDIR -- Get the working package directory.
*
* @brief Get the working package directory.
* @fn path = vo_getPkgDir (void)
*
* @returns path to current working package directory
*/
char *
vo_getPkgDir (void)
{
}
/**************************************************************************/
/*** Package Management ***/
/**************************************************************************/
/**
* VO_PKGLIST -- List packages available in the working directory..
*
* @brief List packages available in the working directory.
* @fn xml = vo_pkgList (char *pattern)
*
* @param pattern Package executable filename pattern (or NULL for all)
* @returns XML description of the package list.
*/
handle_t
vo_pkgList (char *pattern)
{
return (NULL);
}
/**
* VO_PKGLIST -- List packages available in the working directory..
*
* @brief List packages available in the working directory.
* @fn xml = vo_pkgList (char *pattern)
*
* @param pattern Package executable filename pattern (or NULL for all)
* @returns XML description of the package list.
*/
int
vo_pkgLen (handle_t pkg)
{
Package *pkgP = (Package *) task_H2P (pkg);
return ( (pkgP ? pkgP->npkgs : 0) );
}
/**
* VO_PKGNEXT -- Get the next package in the list.
*
* @brief Get the next package in the list.
* @fn pkg = vo_pkgNext (handle_t pkg)
*
* @param pkg Handle to package
* @returns Handle to next package in the list (0 at end of list)
*/
handle_t
vo_pkgNext (handle_t pkg)
{
Package *pkgP = (Package *) task_H2P (pkg);
return ( (pkgP ? task_P2H (pkgP->next) : 0) );
}
/**
* VO_PKGATTR -- Get a package metadata by attribute name.
*
* @brief Get a package metadata by attribute name.
* @fn pkg = vo_pkgAttr (handle_t pkg, char *attr)
*
* @param pattern Package executable filename pattern (or NULL for all)
* @returns Requested attribute string (or NULL if not found)
*/
char *
vo_pkgAttr (handle_t pkg, char *attr)
{
Package *pkgP = (Package *) task_H2P (pkg);
return (NULL);
}
/**************************************************************************/
/*** Task Management ***/
/**************************************************************************/
/**
* VO_TASKLIST -- List tasks in package.
*
* @brief List tasks in package.
* @fn handle = vo_taskList (char *pkgName)
*
* @param pkgName Package name
* @returns XML description of the task list
*/
char *
vo_taskList (char *pkgName)
{
return (NULL);
}
/**
* VO_TASKLEN -- Get length of task list.
*
* @brief Get length of task list.
* @fn len = vo_taskLen (handle_t task)
*
* @param task Handle to task descriptor
* @returns Number of tasks in the list.
*/
int
vo_taskLen (handle_t task)
{
Package *taskP = (Package *) task_H2P (task);
return ( (taskP ? taskP->ntasks : 0) );
}
/**
* VO_TASKNEXT -- Get the next task in the list.
*
* @brief Get the next task in the list.
* @fn task = vo_taskNext (handle_t task)
*
* @param task Handle to task
* @returns Handle to next task in the list (0 at end of list)
*/
handle_t
vo_taskNext (handle_t task)
{
Package *taskP = (Package *) task_H2P (task);
return ( (taskP ? task_P2H (taskP->next) : 0) );
}
/**
* VO_TASKATTR -- Get a task metadata by attribute name.
*
* @brief Get a task metadata by attribute name.
* @fn task = vo_taskAttr (handle_t task, char *attr)
*
* @param task Handle to task
* @param attr Attribute to retrieve
* @returns Requested attribute string (or NULL if not found)
*/
char *
vo_taskAttr (handle_t task, char *attr)
{
Package *taskP = (Package *) task_H2P (task);
return (NULL);
}
/**************************************************************************/
/*** Task and Package Parameters ***/
/**************************************************************************/
/**
* VO_PKGPARAMS -- List parameters for a package.
*
* @brief List parameters for a package.
* @fn xml = vo_pkgParams (handle_t pkg)
*
* @param pkg Package handle
* @returns XML description of the parameter list
*/
handle_t
vo_pkgParams (handle_t pkg)
{
return (0);
}
/**
* VO_TASKPARAMS -- List parameters for a task.
*
* @brief List parameters for a task.
* @fn xml = vo_taskParams (char *pkgName, char *taskName)
*
* @param pkgName Package name
* @param taskName Task name
* @returns XML description of the parameter list
*/
handle_t
vo_taskParams (char *pkgName, char *taskName)
{
return (0);
}
/**************************************************************************/
/*** XML Serializations ***/
/**************************************************************************/
/**
* VO_PKGLISTXML -- Get the package list as an XML document.
*
* @brief Get the package list as an XML document.
* @fn xml = vo_pkgListXML (char *pattern)
*
* @param pattern Package executable pattern
* @returns XML description of the available packages.
*/
char *
vo_pkgListXML (char *pattern)
{
}
/**
* VO_TASKLISTXML -- Get the task list as an XML document.
*
* @brief Get the task list as an XML document.
* @fn xml = vo_taskListXML (char *pkgName)
*
* @param pkgName Package name
* @returns XML description of the tasks in a package.
*/
char *
vo_taskListXML (char *pkgName)
{
}
/**
* VO_PARAMLISTXML -- Get the task parameter list as an XML document.
*
* @brief Get the task parameter list as an XML document.
* @fn xml = vo_paramListXML (char *pkgName, char *taskName)
*
* @param pkgName Package name
* @param taskName Task name
* @returns XML description of the task parameters.
*/
char *
vo_paramListXML (char *pkgName, char *taskName)
{
}
|