00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #if !defined(GLOBUS_GRAM_PROTOCOL_H)
00018 #define GLOBUS_GRAM_PROTOCOL_H
00019
00025 #ifndef GLOBUS_GLOBAL_DOCUMENT_SET
00026
00030 #endif
00031
00050 #include "globus_io.h"
00051 #include "globus_gram_protocol_constants.h"
00052
00053 #ifdef __cplusplus
00054 extern "C" {
00055 #endif
00056
00057 enum { GLOBUS_GRAM_PROTOCOL_VERSION = 2 };
00058 enum { GLOBUS_GRAM_PROTOCOL_MAX_MSG_SIZE = 64000 };
00059 enum { GLOBUS_GRAM_PROTOCOL_PARAM_SIZE = 1024 };
00073 typedef unsigned long globus_gram_protocol_handle_t;
00074
00084 typedef struct globus_gram_protocol_hash_entry_s
00085 {
00087 char * attribute;
00089 char * value;
00090 }
00091 globus_gram_protocol_extension_t;
00092
00093 typedef void (*globus_gram_protocol_callback_t)(
00094 void * arg,
00095 globus_gram_protocol_handle_t handle,
00096 globus_byte_t * message,
00097 globus_size_t msgsize,
00098 int errorcode,
00099 char * uri);
00100
00101 typedef void (*globus_gram_protocol_delegation_callback_t)(
00102 void * arg,
00103 globus_gram_protocol_handle_t handle,
00104 gss_cred_id_t credential,
00105 int errorcode);
00106 #define GLOBUS_GRAM_PROTOCOL_MODULE (&globus_i_gram_protocol_module)
00107
00108 extern globus_module_descriptor_t globus_i_gram_protocol_module;
00109
00110 extern gss_cred_id_t globus_i_gram_protocol_credential;
00111
00112
00113
00114
00115
00116 int
00117 globus_gram_protocol_setup_attr(
00118 globus_io_attr_t * attr);
00119
00120
00121
00122
00123
00124
00125
00126 globus_bool_t
00127 globus_gram_protocol_authorize_self(
00128 gss_ctx_id_t context);
00129
00130
00131
00132
00133
00134 int
00135 globus_gram_protocol_set_credentials(gss_cred_id_t new_credentials);
00136
00137
00138
00139
00140
00141
00142 int
00143 globus_gram_protocol_allow_attach(
00144 char ** url,
00145 globus_gram_protocol_callback_t callback,
00146 void * callback_arg);
00147
00148
00149
00150
00151 int
00152 globus_gram_protocol_callback_disallow(
00153 char * url);
00154
00155
00156
00157 int
00158 globus_gram_protocol_post(
00159 const char * url,
00160 globus_gram_protocol_handle_t * handle,
00161 globus_io_attr_t * attr,
00162 globus_byte_t * message,
00163 globus_size_t message_size,
00164 globus_gram_protocol_callback_t callback,
00165 void * callback_arg);
00166
00167
00168
00169
00170 int
00171 globus_gram_protocol_post_delegation(
00172 const char * url,
00173 globus_gram_protocol_handle_t * handle,
00174 globus_io_attr_t * attr,
00175 globus_byte_t * message,
00176 globus_size_t message_size,
00177 gss_cred_id_t cred_handle,
00178 gss_OID_set restriction_oids,
00179 gss_buffer_set_t restriction_buffers,
00180 OM_uint32 req_flags,
00181 OM_uint32 time_req,
00182 globus_gram_protocol_callback_t callback,
00183 void * callback_arg);
00184
00185
00186 int
00187 globus_gram_protocol_reply(
00188 globus_gram_protocol_handle_t handle,
00189 int code,
00190 globus_byte_t * message,
00191 globus_size_t message_size);
00192
00193
00194
00195
00196
00197
00198
00199
00200 int
00201 globus_gram_protocol_accept_delegation(
00202 globus_gram_protocol_handle_t handle,
00203 gss_OID_set restriction_oids,
00204 gss_buffer_set_t restriction_bufers,
00205 OM_uint32 req_flags,
00206 OM_uint32 time_req,
00207 globus_gram_protocol_delegation_callback_t
00208 callback,
00209 void * arg);
00210
00211 int
00212 globus_gram_protocol_frame_request(
00213 const char * url,
00214 const globus_byte_t * msg,
00215 globus_size_t msgsize,
00216 globus_byte_t ** framedmsg,
00217 globus_size_t * framedsize);
00218
00219
00220 int
00221 globus_gram_protocol_frame_reply(
00222 int code,
00223 const globus_byte_t * msg,
00224 globus_size_t msgsize,
00225 globus_byte_t ** framedmsg,
00226 globus_size_t * framedsize);
00227
00228
00229
00230 int
00231 globus_gram_protocol_pack_job_request(
00232 int job_state_mask,
00233 const char * callback_url,
00234 const char * rsl,
00235 globus_byte_t ** query,
00236 globus_size_t * querysize);
00237
00238
00239 int
00240 globus_gram_protocol_unpack_job_request(
00241 const globus_byte_t * query,
00242 globus_size_t querysize,
00243 int * job_state_mask,
00244 char ** callback_url,
00245 char ** description);
00246
00247
00248 int
00249 globus_gram_protocol_pack_job_request_reply(
00250 int status,
00251 const char * job_contact,
00252 globus_byte_t ** reply,
00253 globus_size_t * replysize);
00254
00255
00256 int
00257 globus_gram_protocol_unpack_job_request_reply(
00258 const globus_byte_t * reply,
00259 globus_size_t replysize,
00260 int * status,
00261 char ** job_contact);
00262
00263 int
00264 globus_gram_protocol_pack_job_request_reply_with_extensions(
00265 int status,
00266 const char * job_contact,
00267 globus_hashtable_t * extensions,
00268 globus_byte_t ** reply,
00269 globus_size_t * replysize);
00270
00271
00272 int
00273 globus_gram_protocol_unpack_job_request_reply_with_extensions(
00274 const globus_byte_t * reply,
00275 globus_size_t replysize,
00276 int * status,
00277 char ** job_contact,
00278 globus_hashtable_t * extensions);
00279
00280 int
00281 globus_gram_protocol_pack_status_request(
00282 const char * status_request,
00283 globus_byte_t ** query,
00284 globus_size_t * querysize);
00285
00286
00287 int
00288 globus_gram_protocol_unpack_status_request(
00289 const globus_byte_t * query,
00290 globus_size_t querysize,
00291 char ** status_requst);
00292
00293
00294 int
00295 globus_gram_protocol_pack_status_reply(
00296 int job_status,
00297 int failure_code,
00298 int job_failure_code,
00299 globus_byte_t ** reply,
00300 globus_size_t * replysize);
00301
00302 int
00303 globus_gram_protocol_pack_status_reply_with_extensions(
00304 int job_status,
00305 int failure_code,
00306 int job_failure_code,
00307 globus_hashtable_t * extensions,
00308 globus_byte_t ** reply,
00309 globus_size_t * replysize);
00310
00311 int
00312 globus_gram_protocol_unpack_status_reply(
00313 const globus_byte_t * reply,
00314 globus_size_t replysize,
00315 int * job_status,
00316 int * failure_code,
00317 int * job_failure_code);
00318
00319 int
00320 globus_gram_protocol_unpack_status_reply_with_extensions(
00321 const globus_byte_t * reply,
00322 globus_size_t replysize,
00323 globus_hashtable_t * extensions);
00324
00325 int
00326 globus_gram_protocol_pack_status_update_message(
00327 char * job_contact,
00328 int status,
00329 int failure_code,
00330 globus_byte_t ** reply,
00331 globus_size_t * replysize);
00332
00333
00334 int
00335 globus_gram_protocol_unpack_status_update_message(
00336 const globus_byte_t * reply,
00337 globus_size_t replysize,
00338 char ** job_contact,
00339 int * status,
00340 int * failure_code);
00341
00342 int
00343 globus_gram_protocol_pack_status_update_message_with_extensions(
00344 char * job_contact,
00345 int status,
00346 int failure_code,
00347 globus_hashtable_t * extensions,
00348 globus_byte_t ** reply,
00349 globus_size_t * replysize);
00350
00351 int
00352 globus_gram_protocol_unpack_status_update_message_with_extensions(
00353 const globus_byte_t * reply,
00354 globus_size_t replysize,
00355 globus_hashtable_t * message_hash);
00356
00357 int
00358 globus_gram_protocol_unpack_message(
00359 const char * message,
00360 size_t message_length,
00361 globus_hashtable_t * message_attributes);
00362
00363 int
00364 globus_gram_protocol_pack_version_request(
00365 char ** request,
00366 size_t * requestsize);
00367
00368 void
00369 globus_gram_protocol_hash_destroy(
00370 globus_hashtable_t * message_hash);
00371
00372 globus_gram_protocol_extension_t *
00373 globus_gram_protocol_create_extension(
00374 const char * attribute,
00375 const char * format,
00376 ...);
00377
00378 int
00379 globus_gram_protocol_get_sec_context(
00380 globus_gram_protocol_handle_t handle,
00381 gss_ctx_id_t * context);
00382
00383 const char *
00384 globus_gram_protocol_error_string(int error_code);
00385
00386
00387 void
00388 globus_gram_protocol_error_7_hack_replace_message(const char * message);
00389 void
00390 globus_gram_protocol_error_10_hack_replace_message(const char * message);
00391
00392
00393
00394
00395 #define GLOBUS_GRAM_PROTOCOL_EXECUTABLE_PARAM "executable"
00396 #define GLOBUS_GRAM_PROTOCOL_ARGUMENTS_PARAM "arguments"
00397 #define GLOBUS_GRAM_PROTOCOL_ENVIRONMENT_PARAM "environment"
00398 #define GLOBUS_GRAM_PROTOCOL_DIR_PARAM "directory"
00399 #define GLOBUS_GRAM_PROTOCOL_COUNT_PARAM "count"
00400 #define GLOBUS_GRAM_PROTOCOL_STDIN_PARAM "stdin"
00401 #define GLOBUS_GRAM_PROTOCOL_STDOUT_PARAM "stdout"
00402 #define GLOBUS_GRAM_PROTOCOL_STDERR_PARAM "stderr"
00403 #define GLOBUS_GRAM_PROTOCOL_MAX_WALL_TIME_PARAM "maxwalltime"
00404 #define GLOBUS_GRAM_PROTOCOL_MAX_CPU_TIME_PARAM "maxcputime"
00405 #define GLOBUS_GRAM_PROTOCOL_MAX_TIME_PARAM "maxtime"
00406 #define GLOBUS_GRAM_PROTOCOL_PARADYN_PARAM "paradyn"
00407 #define GLOBUS_GRAM_PROTOCOL_JOB_TYPE_PARAM "jobtype"
00408 #define GLOBUS_GRAM_PROTOCOL_MYJOB_PARAM "grammyjob"
00409 #define GLOBUS_GRAM_PROTOCOL_QUEUE_PARAM "queue"
00410 #define GLOBUS_GRAM_PROTOCOL_PROJECT_PARAM "project"
00411 #define GLOBUS_GRAM_PROTOCOL_HOST_COUNT_PARAM "hostcount"
00412 #define GLOBUS_GRAM_PROTOCOL_DRY_RUN_PARAM "dryrun"
00413 #define GLOBUS_GRAM_PROTOCOL_MIN_MEMORY_PARAM "minmemory"
00414 #define GLOBUS_GRAM_PROTOCOL_MAX_MEMORY_PARAM "maxmemory"
00415 #define GLOBUS_GRAM_PROTOCOL_START_TIME_PARAM "starttime"
00416 #define GLOBUS_GRAM_PROTOCOL_RESERVATION_HANDLE_PARAM "reservationhandle"
00417 #define GLOBUS_GRAM_PROTOCOL_STDOUT_POSITION_PARAM "stdoutposition"
00418 #define GLOBUS_GRAM_PROTOCOL_STDERR_POSITION_PARAM "stderrposition"
00419 #define GLOBUS_GRAM_PROTOCOL_SAVE_STATE_PARAM "savestate"
00420 #define GLOBUS_GRAM_PROTOCOL_RESTART_PARAM "restart"
00421 #define GLOBUS_GRAM_PROTOCOL_TWO_PHASE_COMMIT_PARAM "twophase"
00422 #define GLOBUS_GRAM_PROTOCOL_REMOTE_IO_URL_PARAM "remoteiourl"
00423 #define GLOBUS_GRAM_PROTOCOL_FILE_STAGE_IN_PARAM "filestagein"
00424 #define GLOBUS_GRAM_PROTOCOL_FILE_STAGE_IN_SHARED_PARAM "filestageinshared"
00425 #define GLOBUS_GRAM_PROTOCOL_FILE_STAGE_OUT_PARAM "filestageout"
00426 #define GLOBUS_GRAM_PROTOCOL_FILE_CLEANUP_PARAM "filecleanup"
00427 #define GLOBUS_GRAM_PROTOCOL_SCRATCHDIR_PARAM "scratchdir"
00428 #define GLOBUS_GRAM_PROTOCOL_GASS_CACHE_PARAM "gasscache"
00429 #define GLOBUS_GRAM_PROTOCOL_PROXY_TIMEOUT_PARAM "proxytimeout"
00430 #define GLOBUS_GRAM_PROTOCOL_USER_NAME "username"
00431
00432 #define GLOBUS_GRAM_PROTOCOL_DEFAULT_STDIN "/dev/null"
00433 #define GLOBUS_GRAM_PROTOCOL_DEFAULT_STDOUT "/dev/null"
00434 #define GLOBUS_GRAM_PROTOCOL_DEFAULT_STDERR "/dev/null"
00435 #define GLOBUS_GRAM_PROTOCOL_DEFAULT_MYJOB "collective"
00436 #define GLOBUS_GRAM_PROTOCOL_DEFAULT_JOBTYPE "multiple"
00437 #define GLOBUS_GRAM_PROTOCOL_DEFAULT_DRYRUN "no"
00438 #define GLOBUS_GRAM_PROTOCOL_DEFAULT_START_TIME "none"
00439
00440 #ifdef __cplusplus
00441 }
00442 #endif
00443
00444 #endif
00445