globus_gram_protocol.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 1999-2006 University of Chicago
00003  * 
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  * 
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
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 
00049 #include "globus_io.h"
00050 #include "globus_gram_protocol_constants.h"
00051 
00052 #ifdef __cplusplus
00053 extern "C" {
00054 #endif
00055 
00056 enum { GLOBUS_GRAM_PROTOCOL_VERSION = 2 };
00057 enum { GLOBUS_GRAM_PROTOCOL_MAX_MSG_SIZE = 64000 };
00058 enum { GLOBUS_GRAM_PROTOCOL_PARAM_SIZE = 1024 };
00072 typedef unsigned long globus_gram_protocol_handle_t;
00073 
00083 typedef struct globus_gram_protocol_hash_entry_s
00084 {
00086     char *                              attribute;
00088     char *                              value;
00089 }
00090 globus_gram_protocol_extension_t;
00091 
00092 typedef void (*globus_gram_protocol_callback_t)(
00093     void  *                             arg,
00094     globus_gram_protocol_handle_t       handle,
00095     globus_byte_t *                     message,
00096     globus_size_t                       msgsize,
00097     int                                 errorcode,
00098     char *                              uri);
00099 
00100 typedef void (*globus_gram_protocol_delegation_callback_t)(
00101     void  *                             arg,
00102     globus_gram_protocol_handle_t       handle,
00103     gss_cred_id_t                       credential,
00104     int                                 errorcode);
00105 #define GLOBUS_GRAM_PROTOCOL_MODULE     (&globus_i_gram_protocol_module)
00106 
00107 extern globus_module_descriptor_t       globus_i_gram_protocol_module;
00108 
00109 extern gss_cred_id_t                    globus_i_gram_protocol_credential;
00110 
00111 /*
00112  * creates a default set of TCP attributes (authentication with self, SSL
00113  * wrappers around messages)
00114  */
00115 int
00116 globus_gram_protocol_setup_attr(
00117     globus_io_attr_t *                  attr);
00118 
00119 
00120 /*
00121  * authorizes the remote party if the remote party is the same as the
00122  * local party
00123  */
00124 
00125 globus_bool_t
00126 globus_gram_protocol_authorize_self(
00127     gss_ctx_id_t                        context);
00128 
00129 
00130 /*
00131  * replaces all credentials used in this module with the given ones
00132  */
00133 int
00134 globus_gram_protocol_set_credentials(gss_cred_id_t new_credentials);
00135 
00136 
00137 /* 
00138  * sets up and registers a listener. returns port and host. user_ptr
00139  * must contain the read callback to be used. 
00140  */
00141 int
00142 globus_gram_protocol_allow_attach(
00143     char **                             url,
00144     globus_gram_protocol_callback_t     callback,
00145     void *                              callback_arg);
00146 
00147 /*
00148  * kills the listener at the specified URL.
00149  */
00150 int
00151 globus_gram_protocol_callback_disallow(
00152     char *                              url);
00153 
00154 
00155 /* Frame and send a GRAM protocol message. */
00156 int
00157 globus_gram_protocol_post(
00158     const char *                        url,
00159     globus_gram_protocol_handle_t *     handle,
00160     globus_io_attr_t *                  attr,
00161     globus_byte_t *                     message,
00162     globus_size_t                       message_size,
00163     globus_gram_protocol_callback_t     callback,
00164     void *                              callback_arg);
00165 
00166 /* Frame and send a GRAM protocol message, following up an ok reply with
00167  * a GSSAPI delegation handshake.
00168  */
00169 int
00170 globus_gram_protocol_post_delegation(
00171     const char *                        url,
00172     globus_gram_protocol_handle_t *     handle,
00173     globus_io_attr_t *                  attr,
00174     globus_byte_t *                     message,
00175     globus_size_t                       message_size,
00176     gss_cred_id_t                       cred_handle,
00177     gss_OID_set                         restriction_oids,
00178     gss_buffer_set_t                    restriction_buffers,
00179     OM_uint32                           req_flags,
00180     OM_uint32                           time_req,
00181     globus_gram_protocol_callback_t     callback,
00182     void *                              callback_arg);
00183 
00184 /* Frame and send a GRAM protocol reply. */
00185 int
00186 globus_gram_protocol_reply(
00187     globus_gram_protocol_handle_t       handle,
00188     int                                 code,
00189     globus_byte_t *                     message,
00190     globus_size_t                       message_size);
00191 
00192 /* Frame and send a GRAM protocol reply indicating that we will 
00193  * accept a delegated credential now. Call back when the delegation
00194  * is completed.
00195  *
00196  * After delegation is complete, the user must call
00197  * globus_gram_protocol_reply to indicate the status after the delegation.
00198  */
00199 int
00200 globus_gram_protocol_accept_delegation(
00201     globus_gram_protocol_handle_t       handle,
00202     gss_OID_set                         restriction_oids,
00203     gss_buffer_set_t                    restriction_bufers,
00204     OM_uint32                           req_flags,
00205     OM_uint32                           time_req,
00206     globus_gram_protocol_delegation_callback_t
00207                                         callback,
00208     void *                              arg);
00209 /* Frame a GRAM protocol message */
00210 int
00211 globus_gram_protocol_frame_request(
00212     const char *                        url,
00213     const globus_byte_t *               msg,
00214     globus_size_t                       msgsize,
00215     globus_byte_t **                    framedmsg,
00216     globus_size_t *                     framedsize);
00217 
00218 /* Frame a GRAM protocol reply */
00219 int
00220 globus_gram_protocol_frame_reply(
00221     int                                 code,
00222     const globus_byte_t *               msg,
00223     globus_size_t                       msgsize,
00224     globus_byte_t **                    framedmsg,
00225     globus_size_t *                     framedsize);
00226 
00227 /************************ "HTTP" pack/unpack functions *********************/
00228 
00229 int
00230 globus_gram_protocol_pack_job_request(
00231     int                                 job_state_mask,
00232     const char *                        callback_url,
00233     const char *                        rsl,
00234     globus_byte_t **                    query,
00235     globus_size_t *                     querysize);
00236 
00237 
00238 int
00239 globus_gram_protocol_unpack_job_request(
00240     const globus_byte_t *               query,
00241     globus_size_t                       querysize,
00242     int  *                              job_state_mask,
00243     char **                             callback_url,
00244     char **                             description);
00245 
00246 
00247 int
00248 globus_gram_protocol_pack_job_request_reply(
00249     int                                 status,
00250     const char *                        job_contact,    /* may be null */
00251     globus_byte_t **                    reply,
00252     globus_size_t *                     replysize);
00253 
00254 
00255 int
00256 globus_gram_protocol_unpack_job_request_reply(
00257     const globus_byte_t *               reply,
00258     globus_size_t                       replysize,
00259     int *                               status,
00260     char **                             job_contact);
00261 
00262 int
00263 globus_gram_protocol_pack_job_request_reply_with_extensions(
00264     int                                 status,
00265     const char *                        job_contact,    /* may be null */
00266     globus_hashtable_t *                extensions,
00267     globus_byte_t **                    reply,
00268     globus_size_t *                     replysize);
00269 
00270 
00271 int
00272 globus_gram_protocol_unpack_job_request_reply_with_extensions(
00273     const globus_byte_t *               reply,
00274     globus_size_t                       replysize,
00275     int *                               status,
00276     char **                             job_contact,
00277     globus_hashtable_t *                extensions);
00278 
00279 int
00280 globus_gram_protocol_pack_status_request(
00281     const char *                        status_request,
00282     globus_byte_t **                    query,
00283     globus_size_t *                     querysize);
00284 
00285 
00286 int
00287 globus_gram_protocol_unpack_status_request(
00288     const globus_byte_t *               query,
00289     globus_size_t                       querysize,
00290     char **                             status_requst);
00291 
00292 
00293 int
00294 globus_gram_protocol_pack_status_reply(
00295     int                                 job_status,
00296     int                                 failure_code,
00297     int                                 job_failure_code,
00298     globus_byte_t **                    reply,
00299     globus_size_t *                     replysize);
00300 
00301 int
00302 globus_gram_protocol_pack_status_reply_with_extensions(
00303     int                                 job_status,
00304     int                                 failure_code,
00305     int                                 job_failure_code,
00306     globus_hashtable_t *                extensions,
00307     globus_byte_t **                    reply,
00308     globus_size_t *                     replysize);
00309 
00310 int
00311 globus_gram_protocol_unpack_status_reply(
00312     const globus_byte_t *               reply,
00313     globus_size_t                       replysize,
00314     int *                               job_status,
00315     int *                               failure_code,
00316     int *                               job_failure_code);
00317 
00318 int
00319 globus_gram_protocol_unpack_status_reply_with_extensions(
00320     const globus_byte_t *               reply,
00321     globus_size_t                       replysize,
00322     globus_hashtable_t *                extensions);
00323 
00324 int
00325 globus_gram_protocol_pack_status_update_message(   
00326     char *                              job_contact,
00327     int                                 status,            
00328     int                                 failure_code,
00329     globus_byte_t **                    reply,
00330     globus_size_t *                     replysize);
00331 
00332 
00333 int
00334 globus_gram_protocol_unpack_status_update_message(
00335     const globus_byte_t *               reply,
00336     globus_size_t                       replysize,
00337     char **                             job_contact,
00338     int *                               status,
00339     int *                               failure_code);
00340 
00341 int
00342 globus_gram_protocol_pack_status_update_message_with_extensions(
00343     char *                              job_contact,
00344     int                                 status,
00345     int                                 failure_code,
00346     globus_hashtable_t *                extensions,
00347     globus_byte_t **                    reply,
00348     globus_size_t *                     replysize);
00349 
00350 int
00351 globus_gram_protocol_unpack_status_update_message_with_extensions(
00352     const globus_byte_t *               reply,
00353     globus_size_t                       replysize,
00354     globus_hashtable_t *                message_hash);
00355 
00356 int
00357 globus_gram_protocol_unpack_message(
00358     const char *                        message,
00359     size_t                              message_length,
00360     globus_hashtable_t *                message_attributes);
00361 
00362 int
00363 globus_gram_protocol_pack_version_request(
00364     char **                             request,
00365     size_t *                            requestsize);
00366 
00367 void
00368 globus_gram_protocol_hash_destroy(
00369     globus_hashtable_t *                message_hash);
00370 
00371 globus_gram_protocol_extension_t *
00372 globus_gram_protocol_create_extension(
00373     const char *                        attribute,
00374     const char *                        format,
00375     ...);
00376 
00377 int
00378 globus_gram_protocol_get_sec_context(
00379     globus_gram_protocol_handle_t       handle,
00380     gss_ctx_id_t *                      context);
00381 
00382 const char *
00383 globus_gram_protocol_error_string(int error_code);
00384 
00385 /* To be used only by the GRAM client API */
00386 void
00387 globus_gram_protocol_error_7_hack_replace_message(const char * message);
00388 void
00389 globus_gram_protocol_error_10_hack_replace_message(const char * message);
00390 
00391 /*
00392  * RSL Parameters
00393  */
00394 #define GLOBUS_GRAM_PROTOCOL_EXECUTABLE_PARAM               "executable"
00395 #define GLOBUS_GRAM_PROTOCOL_ARGUMENTS_PARAM                "arguments"
00396 #define GLOBUS_GRAM_PROTOCOL_ENVIRONMENT_PARAM              "environment"
00397 #define GLOBUS_GRAM_PROTOCOL_DIR_PARAM                      "directory"
00398 #define GLOBUS_GRAM_PROTOCOL_COUNT_PARAM                    "count"
00399 #define GLOBUS_GRAM_PROTOCOL_STDIN_PARAM                    "stdin"
00400 #define GLOBUS_GRAM_PROTOCOL_STDOUT_PARAM                   "stdout"
00401 #define GLOBUS_GRAM_PROTOCOL_STDERR_PARAM                   "stderr"
00402 #define GLOBUS_GRAM_PROTOCOL_MAX_WALL_TIME_PARAM            "maxwalltime"
00403 #define GLOBUS_GRAM_PROTOCOL_MAX_CPU_TIME_PARAM             "maxcputime"
00404 #define GLOBUS_GRAM_PROTOCOL_MAX_TIME_PARAM                 "maxtime"
00405 #define GLOBUS_GRAM_PROTOCOL_PARADYN_PARAM                  "paradyn"
00406 #define GLOBUS_GRAM_PROTOCOL_JOB_TYPE_PARAM                 "jobtype"
00407 #define GLOBUS_GRAM_PROTOCOL_MYJOB_PARAM                    "grammyjob"
00408 #define GLOBUS_GRAM_PROTOCOL_QUEUE_PARAM                    "queue"
00409 #define GLOBUS_GRAM_PROTOCOL_PROJECT_PARAM                  "project"
00410 #define GLOBUS_GRAM_PROTOCOL_HOST_COUNT_PARAM               "hostcount"
00411 #define GLOBUS_GRAM_PROTOCOL_DRY_RUN_PARAM                  "dryrun"
00412 #define GLOBUS_GRAM_PROTOCOL_MIN_MEMORY_PARAM               "minmemory"
00413 #define GLOBUS_GRAM_PROTOCOL_MAX_MEMORY_PARAM               "maxmemory"
00414 #define GLOBUS_GRAM_PROTOCOL_START_TIME_PARAM               "starttime"
00415 #define GLOBUS_GRAM_PROTOCOL_RESERVATION_HANDLE_PARAM       "reservationhandle"
00416 #define GLOBUS_GRAM_PROTOCOL_STDOUT_POSITION_PARAM          "stdoutposition"
00417 #define GLOBUS_GRAM_PROTOCOL_STDERR_POSITION_PARAM          "stderrposition"
00418 #define GLOBUS_GRAM_PROTOCOL_SAVE_STATE_PARAM               "savestate"
00419 #define GLOBUS_GRAM_PROTOCOL_RESTART_PARAM                  "restart"
00420 #define GLOBUS_GRAM_PROTOCOL_TWO_PHASE_COMMIT_PARAM         "twophase"
00421 #define GLOBUS_GRAM_PROTOCOL_REMOTE_IO_URL_PARAM            "remoteiourl"
00422 #define GLOBUS_GRAM_PROTOCOL_FILE_STAGE_IN_PARAM            "filestagein"
00423 #define GLOBUS_GRAM_PROTOCOL_FILE_STAGE_IN_SHARED_PARAM     "filestageinshared"
00424 #define GLOBUS_GRAM_PROTOCOL_FILE_STAGE_OUT_PARAM           "filestageout"
00425 #define GLOBUS_GRAM_PROTOCOL_FILE_CLEANUP_PARAM             "filecleanup"
00426 #define GLOBUS_GRAM_PROTOCOL_SCRATCHDIR_PARAM               "scratchdir"
00427 #define GLOBUS_GRAM_PROTOCOL_GASS_CACHE_PARAM               "gasscache"
00428 #define GLOBUS_GRAM_PROTOCOL_PROXY_TIMEOUT_PARAM            "proxytimeout"
00429 #define GLOBUS_GRAM_PROTOCOL_USER_NAME                      "username"
00430 
00431 #define GLOBUS_GRAM_PROTOCOL_DEFAULT_STDIN                  "/dev/null"
00432 #define GLOBUS_GRAM_PROTOCOL_DEFAULT_STDOUT                 "/dev/null"
00433 #define GLOBUS_GRAM_PROTOCOL_DEFAULT_STDERR                 "/dev/null"
00434 #define GLOBUS_GRAM_PROTOCOL_DEFAULT_MYJOB                  "collective"
00435 #define GLOBUS_GRAM_PROTOCOL_DEFAULT_JOBTYPE                "multiple"
00436 #define GLOBUS_GRAM_PROTOCOL_DEFAULT_DRYRUN                 "no"
00437 #define GLOBUS_GRAM_PROTOCOL_DEFAULT_START_TIME             "none"
00438 
00439 #ifdef __cplusplus
00440 }
00441 #endif
00442 
00443 #endif
00444 

Generated on 5 Nov 2016 for globus_gram_protocol by  doxygen 1.4.7