globus_i_gass_transfer.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 
00026 #ifndef GLOBUS_I_GASS_TRANSFER_H
00027 #define GLOBUS_I_GASS_TRANSFER_H
00028 
00029 #include "globus_gass_transfer.h"
00030 #include "globus_gass_transfer_proto.h"
00031 #include "globus_i_gass_transfer_keyvalue.h"
00032 
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036 
00037 extern globus_hashtable_t globus_i_gass_transfer_protocols;
00038 extern globus_handle_table_t globus_i_gass_transfer_request_handles;
00039 extern globus_handle_table_t globus_i_gass_transfer_listener_handles;
00040 extern globus_list_t * globus_i_gass_transfer_requests;
00041 extern globus_list_t * globus_i_gass_transfer_listeners;
00042 extern globus_bool_t globus_i_gass_transfer_deactivating;
00043 
00044 /* Default implemented protocols */
00045 extern globus_module_descriptor_t globus_i_gass_transfer_http_module;
00046 #define GLOBUS_I_GASS_TRANSFER_HTTP_MODULE (&globus_i_gass_transfer_http_module)
00047 extern globus_module_descriptor_t globus_i_gass_transfer_ftp_module;
00048 #define GLOBUS_I_GASS_TRANSFER_FTP_MODULE (&globus_i_gass_transfer_ftp_module)
00049 
00050 extern globus_gass_transfer_proto_descriptor_t
00051     globus_i_gass_transfer_http_descriptor;
00052 extern globus_gass_transfer_proto_descriptor_t
00053     globus_i_gass_transfer_https_descriptor;
00054 extern globus_gass_transfer_proto_descriptor_t
00055     globus_i_gass_transfer_ftp_descriptor;
00056 extern globus_gass_transfer_proto_descriptor_t
00057     globus_i_gass_transfer_gsiftp_descriptor;
00058 /*
00059  * The request status structure. This should only be accessed
00060  * through the functions globus_gass_transfer_request_get_*()
00061  */
00062 typedef struct 
00063 {
00064     char *                                      url;
00065     globus_gass_transfer_request_type_t         type;
00066     globus_gass_transfer_request_status_t       status;
00067 
00068     globus_bool_t                               client_side;
00069 
00070     globus_size_t                               length;
00071     globus_size_t                               handled_length;
00072     globus_size_t                               posted_length;
00073 
00074     char **                                     referral_url;
00075     globus_size_t                               referral_count;
00076 
00077     globus_gass_transfer_callback_t             callback;
00078     void *                                      callback_arg;
00079 
00080     globus_gass_transfer_callback_t             fail_callback;
00081     void *                                      fail_callback_arg;
00082 
00083     /* subject of peer */
00084     char *                                      subject;
00085 
00086     /* queue of byte arrays to be sent or received */
00087     globus_fifo_t                               pending_data;
00088 
00089     /* Denial reasons */
00090     int                                         denial_reason;
00091     char *                                      denial_message;
00092 
00093     globus_object_t *                           attr;
00094 
00095     struct globus_gass_transfer_request_proto_s *
00096                                                 proto;
00097     void *                                      user_pointer;
00098 } globus_gass_transfer_request_struct_t;
00099 
00100 /*
00101  * The listener status structure. This should only be accessed
00102  * through the functions globus_gass_transfer_listener_get_*()
00103  */
00104 typedef struct 
00105 {
00106     char *                                      base_url;
00107     globus_gass_transfer_listener_status_t      status;
00108     struct globus_gass_transfer_listener_proto_s *
00109                                                 proto;
00110 
00111     globus_gass_transfer_listen_callback_t      listen_callback;
00112     void *                                      listen_callback_arg;
00113 
00114     globus_gass_transfer_close_callback_t       close_callback;
00115     void *                                      close_callback_arg;
00116     void *                                      user_pointer;
00117 } globus_gass_transfer_listener_struct_t;
00118 
00119 /* the pending_data fifo in the request structure is one of these */
00120 typedef struct
00121 {
00122     globus_bool_t                               last_data;
00123     globus_size_t                               length;
00124     globus_size_t                               wait_for_length;
00125     globus_gass_transfer_request_t              request;
00126 
00127     /*
00128      * True when this pending block has been passed to the protocol
00129      * module
00130      */
00131     globus_bool_t                               pending;
00132 
00133     globus_byte_t *                             bytes;
00134     globus_gass_transfer_bytes_callback_t       callback;
00135     void *                                      callback_arg;
00136 } globus_gass_transfer_pending_t;
00137 
00138 /* implemented in globus_gass_transfer_request.c */
00139 void
00140 globus_i_gass_transfer_request_init(
00141     globus_gass_transfer_request_t *            request,
00142     globus_gass_transfer_requestattr_t *        attr,
00143     char *                                      url,
00144     globus_gass_transfer_request_type_t         type,
00145     globus_gass_transfer_callback_t             callback,
00146     void *                                      user_arg);
00147 
00148 int
00149 globus_i_gass_transfer_request_destroy(
00150     globus_gass_transfer_request_t              request);
00151 
00152 void
00153 globus_gass_transfer_request_set_length(
00154     globus_gass_transfer_request_t              request,
00155     globus_size_t                               length);
00156 
00157 /* implemented in globus_gass_transfer_server.c */
00158 int
00159 globus_i_gass_transfer_listener_destroy(
00160     globus_gass_transfer_listener_t             listener);
00161 
00162 /* implemented in globus_gass_transfer_client.c */
00163 int
00164 globus_i_gass_transfer_client_request(
00165     globus_gass_transfer_request_t *            request);
00166 
00167 /* implemented in globus_gass_transfer_send_recv.c */
00168 typedef void
00169 (* globus_gass_transfer_dispatch_func_t) (
00170     globus_gass_transfer_request_t              request);
00171 
00172 void
00173 globus_i_gass_transfer_send_dispatcher(
00174     globus_gass_transfer_request_t              request);
00175 
00176 void
00177 globus_i_gass_transfer_recv_dispatcher(
00178     globus_gass_transfer_request_t              request);
00179 
00180 int
00181 globus_i_gass_transfer_fail(
00182     globus_gass_transfer_request_t              request,
00183     globus_gass_transfer_request_struct_t *     req,
00184     globus_gass_transfer_callback_t             callback,
00185     void *                                      callback_arg);
00186 
00187 extern globus_cond_t globus_i_gass_transfer_shutdown_cond;
00188 extern globus_mutex_t globus_i_gass_transfer_mutex;
00189 
00190 #if defined(GLOBUS_DEBUG_GASS_TRANSFER)
00191 #define globus_i_gass_transfer_lock()   \
00192         thread_print(_GTSL("locking mutex at %s:%d\n"), __FILE__, __LINE__), \
00193         globus_mutex_lock(&globus_i_gass_transfer_mutex)
00194 #define globus_i_gass_transfer_unlock() \
00195         thread_print(_GTSL("unlocking mutex at %s:%d\n"), __FILE__, __LINE__), \
00196         globus_mutex_unlock(&globus_i_gass_transfer_mutex)
00197 #else
00198 #define globus_i_gass_transfer_lock()   \
00199         globus_mutex_lock(&globus_i_gass_transfer_mutex)
00200 #define globus_i_gass_transfer_unlock() \
00201         globus_mutex_unlock(&globus_i_gass_transfer_mutex)
00202 #endif
00203 
00204 int
00205 globus_i_gass_transfer_close_listener(
00206     globus_gass_transfer_listener_t             listener,
00207     globus_gass_transfer_listener_struct_t *    l,
00208     globus_gass_transfer_close_callback_t       callback,
00209     void *                                      user_arg);
00210 
00211 void
00212 globus_i_gass_transfer_deactivate_callback(
00213     void *                                      user_arg,
00214     globus_gass_transfer_request_t              request);
00215 
00216 #ifdef __cplusplus
00217 }
00218 #endif
00219 
00220 #endif /* GLOBUS_I_GASS_TRANSFER_H */
00221 
00222 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */

Generated on 27 Oct 2014 for globus_gass_transfer by  doxygen 1.4.7