Grid Community Toolkit  6.2.1541705016
globus_gram_protocol.h
Go to the documentation of this file.
1 /*
2  * Copyright 1999-2006 University of Chicago
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #if !defined(GLOBUS_GRAM_PROTOCOL_H)
18 #define GLOBUS_GRAM_PROTOCOL_H
19 
25 #ifndef GLOBUS_GLOBAL_DOCUMENT_SET
26 
30 #endif
31 
49 #include "globus_io.h"
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
56 enum { GLOBUS_GRAM_PROTOCOL_VERSION = 2 };
57 enum { GLOBUS_GRAM_PROTOCOL_MAX_MSG_SIZE = 64000 };
58 enum { GLOBUS_GRAM_PROTOCOL_PARAM_SIZE = 1024 };
72 typedef unsigned long globus_gram_protocol_handle_t;
73 
83 typedef struct globus_gram_protocol_hash_entry_s
84 {
86  char * attribute;
88  char * value;
89 }
91 
92 typedef void (*globus_gram_protocol_callback_t)(
93  void * arg,
95  globus_byte_t * message,
96  globus_size_t msgsize,
97  int errorcode,
98  char * uri);
99 
100 typedef void (*globus_gram_protocol_delegation_callback_t)(
101  void * arg,
103  gss_cred_id_t credential,
104  int errorcode);
105 #define GLOBUS_GRAM_PROTOCOL_MODULE (&globus_i_gram_protocol_module)
106 
107 extern globus_module_descriptor_t globus_i_gram_protocol_module;
108 
109 extern gss_cred_id_t globus_i_gram_protocol_credential;
110 
111 /*
112  * creates a default set of TCP attributes (authentication with self, SSL
113  * wrappers around messages)
114  */
115 int
117  globus_io_attr_t * attr);
118 
119 
120 /*
121  * authorizes the remote party if the remote party is the same as the
122  * local party
123  */
124 
127  gss_ctx_id_t context);
128 
129 
130 /*
131  * replaces all credentials used in this module with the given ones
132  */
133 int
134 globus_gram_protocol_set_credentials(gss_cred_id_t new_credentials);
135 
136 
137 /*
138  * sets up and registers a listener. returns port and host. user_ptr
139  * must contain the read callback to be used.
140  */
141 int
143  char ** url,
144  globus_gram_protocol_callback_t callback,
145  void * callback_arg);
146 
147 /*
148  * kills the listener at the specified URL.
149  */
150 int
152  char * url);
153 
154 
155 /* Frame and send a GRAM protocol message. */
156 int
158  const char * url,
160  globus_io_attr_t * attr,
161  globus_byte_t * message,
162  globus_size_t message_size,
163  globus_gram_protocol_callback_t callback,
164  void * callback_arg);
165 
166 /* Frame and send a GRAM protocol message, following up an ok reply with
167  * a GSSAPI delegation handshake.
168  */
169 int
171  const char * url,
173  globus_io_attr_t * attr,
174  globus_byte_t * message,
175  globus_size_t message_size,
176  gss_cred_id_t cred_handle,
177  gss_OID_set restriction_oids,
178  gss_buffer_set_t restriction_buffers,
179  OM_uint32 req_flags,
180  OM_uint32 time_req,
181  globus_gram_protocol_callback_t callback,
182  void * callback_arg);
183 
184 /* Frame and send a GRAM protocol reply. */
185 int
188  int code,
189  globus_byte_t * message,
190  globus_size_t message_size);
191 
192 /* Frame and send a GRAM protocol reply indicating that we will
193  * accept a delegated credential now. Call back when the delegation
194  * is completed.
195  *
196  * After delegation is complete, the user must call
197  * globus_gram_protocol_reply to indicate the status after the delegation.
198  */
199 int
202  gss_OID_set restriction_oids,
203  gss_buffer_set_t restriction_bufers,
204  OM_uint32 req_flags,
205  OM_uint32 time_req,
206  globus_gram_protocol_delegation_callback_t
207  callback,
208  void * arg);
209 /* Frame a GRAM protocol message */
210 int
212  const char * url,
213  const globus_byte_t * msg,
214  globus_size_t msgsize,
215  globus_byte_t ** framedmsg,
216  globus_size_t * framedsize);
217 
218 /* Frame a GRAM protocol reply */
219 int
221  int code,
222  const globus_byte_t * msg,
223  globus_size_t msgsize,
224  globus_byte_t ** framedmsg,
225  globus_size_t * framedsize);
226 
227 /************************ "HTTP" pack/unpack functions *********************/
228 
229 int
231  int job_state_mask,
232  const char * callback_url,
233  const char * rsl,
234  globus_byte_t ** query,
235  globus_size_t * querysize);
236 
237 
238 int
240  const globus_byte_t * query,
241  globus_size_t querysize,
242  int * job_state_mask,
243  char ** callback_url,
244  char ** description);
245 
246 
247 int
249  int status,
250  const char * job_contact, /* may be null */
251  globus_byte_t ** reply,
252  globus_size_t * replysize);
253 
254 
255 int
257  const globus_byte_t * reply,
258  globus_size_t replysize,
259  int * status,
260  char ** job_contact);
261 
262 int
264  int status,
265  const char * job_contact, /* may be null */
266  globus_hashtable_t * extensions,
267  globus_byte_t ** reply,
268  globus_size_t * replysize);
269 
270 
271 int
273  const globus_byte_t * reply,
274  globus_size_t replysize,
275  int * status,
276  char ** job_contact,
277  globus_hashtable_t * extensions);
278 
279 int
281  const char * status_request,
282  globus_byte_t ** query,
283  globus_size_t * querysize);
284 
285 
286 int
288  const globus_byte_t * query,
289  globus_size_t querysize,
290  char ** status_requst);
291 
292 
293 int
295  int job_status,
296  int failure_code,
297  int job_failure_code,
298  globus_byte_t ** reply,
299  globus_size_t * replysize);
300 
301 int
303  int job_status,
304  int failure_code,
305  int job_failure_code,
306  globus_hashtable_t * extensions,
307  globus_byte_t ** reply,
308  globus_size_t * replysize);
309 
310 int
312  const globus_byte_t * reply,
313  globus_size_t replysize,
314  int * job_status,
315  int * failure_code,
316  int * job_failure_code);
317 
318 int
320  const globus_byte_t * reply,
321  globus_size_t replysize,
322  globus_hashtable_t * extensions);
323 
324 int
326  char * job_contact,
327  int status,
328  int failure_code,
329  globus_byte_t ** reply,
330  globus_size_t * replysize);
331 
332 
333 int
335  const globus_byte_t * reply,
336  globus_size_t replysize,
337  char ** job_contact,
338  int * status,
339  int * failure_code);
340 
341 int
343  char * job_contact,
344  int status,
345  int failure_code,
346  globus_hashtable_t * extensions,
347  globus_byte_t ** reply,
348  globus_size_t * replysize);
349 
350 int
352  const globus_byte_t * reply,
353  globus_size_t replysize,
354  globus_hashtable_t * message_hash);
355 
356 int
357 globus_gram_protocol_unpack_message(
358  const char * message,
359  size_t message_length,
360  globus_hashtable_t * message_attributes);
361 
362 int
364  char ** request,
365  size_t * requestsize);
366 
367 void
369  globus_hashtable_t * message_hash);
370 
373  const char * attribute,
374  const char * format,
375  ...);
376 
377 int
380  gss_ctx_id_t * context);
381 
382 const char *
383 globus_gram_protocol_error_string(int error_code);
384 
385 /* To be used only by the GRAM client API */
386 void
388 void
390 
391 /*
392  * RSL Parameters
393  */
394 #define GLOBUS_GRAM_PROTOCOL_EXECUTABLE_PARAM "executable"
395 #define GLOBUS_GRAM_PROTOCOL_ARGUMENTS_PARAM "arguments"
396 #define GLOBUS_GRAM_PROTOCOL_ENVIRONMENT_PARAM "environment"
397 #define GLOBUS_GRAM_PROTOCOL_DIR_PARAM "directory"
398 #define GLOBUS_GRAM_PROTOCOL_COUNT_PARAM "count"
399 #define GLOBUS_GRAM_PROTOCOL_STDIN_PARAM "stdin"
400 #define GLOBUS_GRAM_PROTOCOL_STDOUT_PARAM "stdout"
401 #define GLOBUS_GRAM_PROTOCOL_STDERR_PARAM "stderr"
402 #define GLOBUS_GRAM_PROTOCOL_MAX_WALL_TIME_PARAM "maxwalltime"
403 #define GLOBUS_GRAM_PROTOCOL_MAX_CPU_TIME_PARAM "maxcputime"
404 #define GLOBUS_GRAM_PROTOCOL_MAX_TIME_PARAM "maxtime"
405 #define GLOBUS_GRAM_PROTOCOL_PARADYN_PARAM "paradyn"
406 #define GLOBUS_GRAM_PROTOCOL_JOB_TYPE_PARAM "jobtype"
407 #define GLOBUS_GRAM_PROTOCOL_MYJOB_PARAM "grammyjob"
408 #define GLOBUS_GRAM_PROTOCOL_QUEUE_PARAM "queue"
409 #define GLOBUS_GRAM_PROTOCOL_PROJECT_PARAM "project"
410 #define GLOBUS_GRAM_PROTOCOL_HOST_COUNT_PARAM "hostcount"
411 #define GLOBUS_GRAM_PROTOCOL_DRY_RUN_PARAM "dryrun"
412 #define GLOBUS_GRAM_PROTOCOL_MIN_MEMORY_PARAM "minmemory"
413 #define GLOBUS_GRAM_PROTOCOL_MAX_MEMORY_PARAM "maxmemory"
414 #define GLOBUS_GRAM_PROTOCOL_START_TIME_PARAM "starttime"
415 #define GLOBUS_GRAM_PROTOCOL_RESERVATION_HANDLE_PARAM "reservationhandle"
416 #define GLOBUS_GRAM_PROTOCOL_STDOUT_POSITION_PARAM "stdoutposition"
417 #define GLOBUS_GRAM_PROTOCOL_STDERR_POSITION_PARAM "stderrposition"
418 #define GLOBUS_GRAM_PROTOCOL_SAVE_STATE_PARAM "savestate"
419 #define GLOBUS_GRAM_PROTOCOL_RESTART_PARAM "restart"
420 #define GLOBUS_GRAM_PROTOCOL_TWO_PHASE_COMMIT_PARAM "twophase"
421 #define GLOBUS_GRAM_PROTOCOL_REMOTE_IO_URL_PARAM "remoteiourl"
422 #define GLOBUS_GRAM_PROTOCOL_FILE_STAGE_IN_PARAM "filestagein"
423 #define GLOBUS_GRAM_PROTOCOL_FILE_STAGE_IN_SHARED_PARAM "filestageinshared"
424 #define GLOBUS_GRAM_PROTOCOL_FILE_STAGE_OUT_PARAM "filestageout"
425 #define GLOBUS_GRAM_PROTOCOL_FILE_CLEANUP_PARAM "filecleanup"
426 #define GLOBUS_GRAM_PROTOCOL_SCRATCHDIR_PARAM "scratchdir"
427 #define GLOBUS_GRAM_PROTOCOL_GASS_CACHE_PARAM "gasscache"
428 #define GLOBUS_GRAM_PROTOCOL_PROXY_TIMEOUT_PARAM "proxytimeout"
429 #define GLOBUS_GRAM_PROTOCOL_USER_NAME "username"
430 
431 #define GLOBUS_GRAM_PROTOCOL_DEFAULT_STDIN "/dev/null"
432 #define GLOBUS_GRAM_PROTOCOL_DEFAULT_STDOUT "/dev/null"
433 #define GLOBUS_GRAM_PROTOCOL_DEFAULT_STDERR "/dev/null"
434 #define GLOBUS_GRAM_PROTOCOL_DEFAULT_MYJOB "collective"
435 #define GLOBUS_GRAM_PROTOCOL_DEFAULT_JOBTYPE "multiple"
436 #define GLOBUS_GRAM_PROTOCOL_DEFAULT_DRYRUN "no"
437 #define GLOBUS_GRAM_PROTOCOL_DEFAULT_START_TIME "none"
438 
439 #ifdef __cplusplus
440 }
441 #endif
442 
443 #endif
444 
int globus_gram_protocol_frame_request(const char *url, const globus_byte_t *msg, globus_size_t msgsize, globus_byte_t **framedmsg, globus_size_t *framedsize)
Create a HTTP-framed copy of a GRAM request.
Definition: globus_gram_protocol_frame.c:92
struct globus_gram_protocol_hash_entry_s globus_gram_protocol_extension_t
GRAM protocol extension attribute-value pair.
int globus_gram_protocol_unpack_job_request(const globus_byte_t *query, globus_size_t querysize, int *job_state_mask, char **callback_url, char **description)
Unpack a GRAM Job Request.
Definition: globus_gram_protocol_pack.c:201
int globus_gram_protocol_unpack_job_request_reply(const globus_byte_t *reply, globus_size_t replysize, int *status, char **job_contact)
Unpack a GRAM reply message.
Definition: globus_gram_protocol_pack.c:417
int globus_gram_protocol_frame_reply(int code, const globus_byte_t *msg, globus_size_t msgsize, globus_byte_t **framedmsg, globus_size_t *framedsize)
Create a HTTP-framed copy of a GRAM reply.
Definition: globus_gram_protocol_frame.c:222
void globus_gram_protocol_hash_destroy(globus_hashtable_t *message_hash)
Definition: globus_gram_protocol_pack.c:1988
int globus_gram_protocol_pack_status_request(const char *status_request, globus_byte_t **query, globus_size_t *querysize)
Pack a GRAM query message.
Definition: globus_gram_protocol_pack.c:824
int globus_bool_t
Boolean type.
Definition: globus_types.h:93
int globus_gram_protocol_pack_job_request_reply_with_extensions(int status, const char *job_contact, globus_hashtable_t *extensions, globus_byte_t **reply, globus_size_t *replysize)
Pack a GRAM reply message with extension attributes.
Definition: globus_gram_protocol_pack.c:535
int globus_gram_protocol_pack_status_update_message_with_extensions(char *job_contact, int status, int failure_code, globus_hashtable_t *extensions, globus_byte_t **reply, globus_size_t *replysize)
Pack a GRAM status update message with extensions.
Definition: globus_gram_protocol_pack.c:1516
int globus_gram_protocol_get_sec_context(globus_gram_protocol_handle_t handle, gss_ctx_id_t *context)
Get a reference to the GSSAPI security context associated with a GRAM protocol handle.
Definition: globus_gram_protocol_io.c:894
unsigned long globus_gram_protocol_handle_t
Unique GRAM protocol identifier.
Definition: globus_gram_protocol.h:72
int globus_gram_protocol_setup_attr(globus_io_attr_t *attr)
Create default I/O attribute for GRAM.
Definition: globus_gram_protocol.c:223
globus_bool_t globus_gram_protocol_authorize_self(gss_ctx_id_t context)
Determine if a GSSAPI context has the same source and target identities.
Definition: globus_gram_protocol.c:308
int globus_gram_protocol_reply(globus_gram_protocol_handle_t handle, int code, globus_byte_t *message, globus_size_t message_size)
Reply to a GRAM protocol message.
Definition: globus_gram_protocol_io.c:745
int globus_gram_protocol_unpack_status_reply(const globus_byte_t *reply, globus_size_t replysize, int *job_status, int *failure_code, int *job_failure_code)
Unpack a GRAM query reply.
Definition: globus_gram_protocol_pack.c:1081
int globus_gram_protocol_pack_version_request(char **request, size_t *requestsize)
Pack a GRAM version request message.
Definition: globus_gram_protocol_pack.c:2264
int globus_gram_protocol_unpack_status_update_message(const globus_byte_t *reply, globus_size_t replysize, char **job_contact, int *status, int *failure_code)
Unpack a GRAM status update message.
Definition: globus_gram_protocol_pack.c:1653
int globus_gram_protocol_pack_status_reply(int job_status, int failure_code, int job_failure_code, globus_byte_t **reply, globus_size_t *replysize)
Pack a GRAM query reply message.
Definition: globus_gram_protocol_pack.c:1004
int globus_gram_protocol_unpack_status_request(const globus_byte_t *query, globus_size_t querysize, char **status_requst)
Unpack a GRAM query message.
Definition: globus_gram_protocol_pack.c:892
int globus_gram_protocol_unpack_status_reply_with_extensions(const globus_byte_t *reply, globus_size_t replysize, globus_hashtable_t *extensions)
Unpack a GRAM query reply with extensions.
Definition: globus_gram_protocol_pack.c:1304
size_t globus_size_t
Standard size of memory objectThe globus_size_t is the size of a memory object. It is identical to si...
Definition: globus_types.h:48
int globus_gram_protocol_pack_status_reply_with_extensions(int job_status, int failure_code, int job_failure_code, globus_hashtable_t *extensions, globus_byte_t **reply, globus_size_t *replysize)
Pack a GRAM query reply message with extensions.
Definition: globus_gram_protocol_pack.c:1176
unsigned char globus_byte_t
Unsigned byte datatypeThis is used for byte-addressable arrays of arbitrary data which is not subject...
Definition: globus_types.h:85
int globus_gram_protocol_post(const char *url, globus_gram_protocol_handle_t *handle, globus_io_attr_t *attr, globus_byte_t *message, globus_size_t message_size, globus_gram_protocol_callback_t callback, void *callback_arg)
Post a GRAM protocol request to a GRAM server.
Definition: globus_gram_protocol_io.c:535
const char * globus_gram_protocol_error_string(int error_code)
Get a description of a a GRAM error code.
Definition: globus_gram_protocol_error.c:238
int globus_gram_protocol_unpack_status_update_message_with_extensions(const globus_byte_t *reply, globus_size_t replysize, globus_hashtable_t *message_hash)
Unpack a GRAM status update message with extensions.
Definition: globus_gram_protocol_pack.c:1758
int globus_gram_protocol_accept_delegation(globus_gram_protocol_handle_t handle, gss_OID_set restriction_oids, gss_buffer_set_t restriction_bufers, OM_uint32 req_flags, OM_uint32 time_req, globus_gram_protocol_delegation_callback_t callback, void *arg)
Perform the server-side of the GSSAPI delegation handshake to receive a new delegated credential...
Definition: globus_gram_protocol_io.c:827
int globus_gram_protocol_callback_disallow(char *url)
Stop a GASS protocol listener from handling new requests.
Definition: globus_gram_protocol_io.c:400
int globus_gram_protocol_pack_job_request_reply(int status, const char *job_contact, globus_byte_t **reply, globus_size_t *replysize)
Pack a GRAM reply message.
Definition: globus_gram_protocol_pack.c:338
int globus_gram_protocol_unpack_job_request_reply_with_extensions(const globus_byte_t *reply, globus_size_t replysize, int *status, char **job_contact, globus_hashtable_t *extensions)
Unpack a GRAM reply message, parsing all extensions.
Definition: globus_gram_protocol_pack.c:689
void globus_gram_protocol_error_7_hack_replace_message(const char *message)
Replace the error message associated with error 7 with a custom message.
Definition: globus_gram_protocol_error.c:297
globus_gram_protocol_extension_t * globus_gram_protocol_create_extension(const char *attribute, const char *format,...)
Definition: globus_gram_protocol_pack.c:2025
int globus_gram_protocol_pack_status_update_message(char *job_contact, int status, int failure_code, globus_byte_t **reply, globus_size_t *replysize)
Pack a GRAM status update message.
Definition: globus_gram_protocol_pack.c:1435
void globus_gram_protocol_error_10_hack_replace_message(const char *message)
Replace the error message associated with error 10 with a custom message.
Definition: globus_gram_protocol_error.c:335
int globus_gram_protocol_post_delegation(const char *url, globus_gram_protocol_handle_t *handle, globus_io_attr_t *attr, globus_byte_t *message, globus_size_t message_size, gss_cred_id_t cred_handle, gss_OID_set restriction_oids, gss_buffer_set_t restriction_buffers, OM_uint32 req_flags, OM_uint32 time_req, globus_gram_protocol_callback_t callback, void *callback_arg)
Post a GRAM protocol delegation request to a GRAM server.
Definition: globus_gram_protocol_io.c:667
int globus_gram_protocol_pack_job_request(int job_state_mask, const char *callback_url, const char *rsl, globus_byte_t **query, globus_size_t *querysize)
Pack a GRAM Job Request.
Definition: globus_gram_protocol_pack.c:116
int globus_gram_protocol_allow_attach(char **url, globus_gram_protocol_callback_t callback, void *callback_arg)
Create a GRAM protocol service listener.
Definition: globus_gram_protocol_io.c:258
Module Descriptor.
Definition: globus_module.h:69