globus_i_gram_protocol.h

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 #ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
00018 
00024 #include "globus_common.h"
00025 #include "globus_gram_protocol.h"
00026 #include "globus_io.h"
00027 
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031 
00032 /* Strings used in protocol framing, packing, unframing, and unpacking */
00033 
00034 #define CRLF             "\015\012"
00035 #define GLOBUS_GRAM_HTTP_REQUEST_LINE \
00036                         "POST %s HTTP/1.1" CRLF
00037 
00038 #define GLOBUS_GRAM_HTTP_HOST_LINE \
00039                         "Host: %s" CRLF
00040 
00041 #define GLOBUS_GRAM_HTTP_CONTENT_TYPE_LINE \
00042                         "Content-Type: application/x-globus-gram" CRLF
00043 
00044 #define GLOBUS_GRAM_HTTP_CONTENT_LENGTH_LINE \
00045                         "Content-Length: %ld" CRLF
00046 
00047 #define GLOBUS_GRAM_HTTP_REPLY_LINE \
00048                         "HTTP/1.1 %3d %s" CRLF
00049 #define GLOBUS_GRAM_HTTP_PARSE_REPLY_LINE \
00050                         "HTTP/1.1 %3d %[^" CRLF "]" CRLF
00051 #define GLOBUS_GRAM_HTTP_CONNECTION_LINE \
00052                         "Connection: Close" CRLF
00053 
00054 #define GLOBUS_GRAM_HTTP_PACK_PROTOCOL_VERSION_LINE \
00055                         "protocol-version: %d" CRLF
00056 
00057 #define GLOBUS_GRAM_HTTP_PACK_JOB_STATE_MASK_LINE \
00058                         "job-state-mask: %d" CRLF
00059 
00060 #define GLOBUS_GRAM_HTTP_PACK_CALLBACK_URL_LINE \
00061                         "callback-url: %s" CRLF
00062 
00063 #define GLOBUS_GRAM_HTTP_PACK_STATUS_LINE \
00064                         "status: %d" CRLF
00065 
00066 #define GLOBUS_GRAM_HTTP_PACK_FAILURE_CODE_LINE \
00067                         "failure-code: %d" CRLF
00068 
00069 #define GLOBUS_GRAM_HTTP_PACK_JOB_FAILURE_CODE_LINE \
00070                         "job-failure-code: %d" CRLF
00071 
00072 #define GLOBUS_GRAM_HTTP_PACK_JOB_MANAGER_URL_LINE \
00073                         "job-manager-url: %s" CRLF
00074 
00075 #define GLOBUS_GRAM_HTTP_PACK_CLIENT_REQUEST_LINE \
00076                         "%s" CRLF
00077 
00078 #define GLOBUS_GRAM_ATTR_PROTOCOL_VERSION "protocol-version"
00079 #define GLOBUS_GRAM_ATTR_JOB_STATE_MASK "job-state-mask"
00080 #define GLOBUS_GRAM_ATTR_CALLBACK_URL "callback-url"
00081 #define GLOBUS_GRAM_ATTR_RSL "rsl"
00082 #define GLOBUS_GRAM_ATTR_STATUS "status"
00083 #define GLOBUS_GRAM_ATTR_JOB_MANAGER_URL "job-manager-url"
00084 #define GLOBUS_GRAM_ATTR_FAILURE_CODE "failure-code"
00085 typedef enum
00086 {
00087     GLOBUS_GRAM_PROTOCOL_REQUEST,
00088     GLOBUS_GRAM_PROTOCOL_REPLY
00089 }
00090 globus_gram_protocol_read_type_t;
00091 
00092 typedef struct
00093 {
00094     unsigned short                      port;
00095     globus_bool_t                       allow_attach;
00096     globus_io_handle_t *                handle;
00097     globus_gram_protocol_callback_t     callback;
00098     void *                              callback_arg;
00099     volatile int                        connection_count;
00100     globus_cond_t                       cond;
00101     globus_bool_t                       listen_registered;
00102 }
00103 globus_i_gram_protocol_listener_t;
00104 
00105 typedef struct
00106 {
00107     globus_bool_t                       got_header;
00108     globus_bool_t                       accepting;
00109     globus_byte_t *                     buf;
00110     globus_size_t                       bufsize;
00111     globus_gram_protocol_read_type_t    read_type;
00112     globus_size_t                       payload_length;
00113     globus_size_t                       n_read;
00114     globus_gram_protocol_callback_t     callback;
00115     void *                              callback_arg;
00116     globus_byte_t *                     replybuf;
00117     globus_size_t                       replybufsize;
00118 
00119     globus_io_handle_t *                io_handle;
00120     globus_gram_protocol_handle_t       handle;
00121     globus_i_gram_protocol_listener_t * listener;
00122     int                                 rc;
00123     char *                              uri;
00124 
00125     /* added for delegation support */
00126     globus_bool_t                       keep_open;
00127     globus_size_t                       token_length;
00128     globus_gram_protocol_delegation_callback_t
00129                                         delegation_callback;
00130     OM_uint32                           delegation_major_status;
00131     OM_uint32                           delegation_minor_status;
00132     void *                              delegation_arg;
00133     gss_cred_id_t                       delegation_cred;
00134     gss_OID_set                         delegation_restriction_oids;
00135     gss_buffer_set_t                    delegation_restriction_buffers;
00136     OM_uint32                           delegation_req_flags;
00137     OM_uint32                           delegation_time_req;
00138     gss_buffer_desc                     delegation_input_token;
00139     gss_buffer_desc                     delegation_output_token;
00140 
00141     /* added for gram authz callout support */
00142     
00143     gss_ctx_id_t                        context;
00144 }
00145 globus_i_gram_protocol_connection_t;
00146 
00147 int
00148 globus_i_gram_protocol_callback_disallow(
00149     globus_i_gram_protocol_listener_t * listener);
00150 
00151 void
00152 globus_i_gram_protocol_error_hack_replace_message(
00153     int                                 error_code,
00154     const char *                        message);
00155 
00156 void
00157 globus_i_gram_protocol_error_destroy(
00158     void *                              arg);
00159 
00160 extern globus_mutex_t                   globus_i_gram_protocol_mutex;
00161 extern globus_cond_t                    globus_i_gram_protocol_cond;
00162 
00163 extern globus_list_t *                  globus_i_gram_protocol_listeners;
00164 extern globus_list_t *                  globus_i_gram_protocol_connections;
00165 extern globus_list_t *                  globus_i_gram_protocol_old_creds;
00166 extern globus_bool_t                    globus_i_gram_protocol_shutdown_called;
00167 extern globus_io_attr_t                 globus_i_gram_protocol_default_attr;
00168 extern int                              globus_i_gram_protocol_num_connects;
00169 extern int                              globus_i_gram_protocol_max_concurrency;
00170 extern globus_gram_protocol_handle_t    globus_i_gram_protocol_handle;
00171 extern globus_thread_key_t              globus_i_gram_protocol_error_key;
00172 
00173 #ifdef __cplusplus
00174 }
00175 #endif
00176 
00177 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */

Generated on 14 Nov 2014 for globus_gram_protocol by  doxygen 1.4.7