/** * This function destroys a globus_gsi_callback_data_t. * @ingroup globus_gsi_callback_data * * @param callback_data * The structure to be destroyed * * @return * GLOBUS_SUCCESS unless an error occurred, in which case, * a globus error object ID is returned */ globus_result_t globus_gsi_callback_data_destroy( globus_gsi_callback_data_t callback_data) { globus_result_t result = GLOBUS_SUCCESS; static char * _function_name_ = "globus_gsi_callback_data_destroy"; GLOBUS_I_GSI_CALLBACK_DEBUG_ENTER; if(!callback_data) { goto exit; } if(callback_data->cert_chain) { sk_X509_pop_free(callback_data->cert_chain, X509_free); } if(callback_data->cert_dir) { globus_libc_free(callback_data->cert_dir); } /* extension_oids have to be free independantly */ globus_object_free(globus_error_get(callback_data->error)); globus_libc_free(callback_data); exit: GLOBUS_I_GSI_CALLBACK_DEBUG_EXIT; return result; }
/* * Function: globus_handle_table_destroy() * * Description: Destroy a handle table * * Parameters: * * Returns: */ int globus_handle_table_destroy( globus_handle_table_t * e_handle_table) { int i; globus_l_handle_entry_t ** table; globus_l_handle_entry_t * inactive; globus_l_handle_entry_t * save; globus_handle_destructor_t destructor; globus_l_handle_table_t * handle_table; if(!e_handle_table) { return GLOBUS_FAILURE; } handle_table = *e_handle_table; if(!handle_table) { return GLOBUS_FAILURE; } /* first free all active handles */ table = handle_table->table; destructor = handle_table->destructor; i = handle_table->next_slot; while(--i > GLOBUS_NULL_HANDLE) { if(table[i]) { if(destructor) { destructor(table[i]->value); } globus_libc_free(table[i]); } } /* then free inactive handles */ inactive = handle_table->inactive; while(inactive) { save = inactive->pnext; globus_libc_free(inactive); inactive = save; } /* free the table */ globus_libc_free(table); /* free the table handle */ globus_libc_free(handle_table); /* finally, invalidate the handle */ *e_handle_table = NULL; return GLOBUS_SUCCESS; }
/** * Create Attr Finalize */ static int ngislCreateAttrFinalize( ngisiContext_t *context, ngisiCreateAttr_t *attr, int *error) { int i; /* Check the arguments */ assert(context != NULL); assert(attr != NULL); if (attr->ngisca_nAttrs > 0) { assert(attr->ngisca_attrs != NULL); for (i = 0; i < attr->ngisca_nAttrs; i++) { assert(attr->ngisca_attrs[i].ngisce_name != NULL); globus_libc_free(attr->ngisca_attrs[i].ngisce_name); attr->ngisca_attrs[i].ngisce_name = NULL; if (attr->ngisca_attrs[i].ngisce_value != NULL) { globus_libc_free(attr->ngisca_attrs[i].ngisce_value); } attr->ngisca_attrs[i].ngisce_value = NULL; } globus_libc_free(attr->ngisca_attrs); attr->ngisca_attrs = NULL; } ngislCreateAttrInitializeMember(attr); /* Success */ return 1; }
/** * Destroy an HTTP handle * @ingroup globus_i_xio_http_handle * * Frees all storage associated with an HTTP handle. The handle must * not be used after this function returns. * * @param http_handle * Handle to be destroyed. * * @return void */ void globus_i_xio_http_handle_destroy( globus_i_xio_http_handle_t * http_handle) { int i; globus_mutex_destroy(&http_handle->mutex); globus_i_xio_http_request_destroy(&http_handle->request_info); globus_i_xio_http_response_destroy(&http_handle->response_info); globus_i_xio_http_target_destroy_internal(&http_handle->target_info); if (http_handle->header_iovec != NULL) { for (i = 0; i < http_handle->header_iovcnt; i++) { globus_libc_free(http_handle->header_iovec[i].iov_base); } globus_libc_free(http_handle->header_iovec); } if (http_handle->read_buffer.iov_base != NULL) { globus_libc_free(http_handle->read_buffer.iov_base); } if (http_handle->close_operation != NULL) { globus_xio_driver_operation_destroy(http_handle->close_operation); } }
/** * Callback for writing event to scheduler. * * @param handle * @param result * @param iovec * @param count * @param nbytes * @param data_desc * @param user_arg */ static void globus_l_seg_writev_callback( globus_xio_handle_t handle, globus_result_t result, globus_xio_iovec_t * iovec, int count, globus_size_t nbytes, globus_xio_data_descriptor_t data_desc, void * user_arg) { int i; globus_bool_t trigger_fault = GLOBUS_FALSE; globus_bool_t reregister_write = GLOBUS_FALSE; int do_shutdown = 0; for (i = 0; i < count; i++) { globus_libc_free(iovec[i].iov_base); } globus_libc_free(iovec); globus_mutex_lock(&globus_l_seg_mutex); globus_l_seg_write_registered = GLOBUS_FALSE; if (result != GLOBUS_SUCCESS) { trigger_fault = GLOBUS_TRUE; } else if (!globus_fifo_empty(&globus_l_seg_buffers)) { reregister_write = GLOBUS_TRUE; } else if (globus_l_seg_shutdown) { do_shutdown = 1; } if (trigger_fault) { globus_scheduler_event_generator_fault(result); } if (reregister_write) { globus_l_seg_register_write(NULL); } if (do_shutdown) { globus_l_seg_shutdown = 2; globus_cond_signal(&globus_l_seg_cond); } globus_mutex_unlock(&globus_l_seg_mutex); }
/** * Free the instance data of a Globus Errno Error object. * @ingroup globus_errno_error_object * * @param data * The instance data * @return * void */ static void globus_l_error_free_errno( void * data) { globus_libc_free(data); }/* globus_l_error_free_errno */
/** * Destroy a restart marker. * @ingroup globus_ftp_client_restart_marker * * @param marker * Restart marker. This marker must be initialized by either * calling globus_ftp_client_restart_marker_init() or * globus_ftp_client_restart_marker_copy() * * @see globus_ftp_client_restart_marker_t, * globus_ftp_client_restart_marker_init(), * globus_ftp_client_restart_marker_copy() */ globus_result_t globus_ftp_client_restart_marker_destroy( globus_ftp_client_restart_marker_t * marker) { GlobusFuncName(globus_ftp_client_restart_marker_destroy); if(marker == GLOBUS_NULL) { return globus_error_put( GLOBUS_I_FTP_CLIENT_ERROR_NULL_PARAMETER("marker")); } switch(marker->type) { case GLOBUS_FTP_CLIENT_RESTART_EXTENDED_BLOCK: while(!globus_fifo_empty(&marker->extended_block.ranges)) { globus_i_ftp_client_range_t * range; range = (globus_i_ftp_client_range_t *) globus_fifo_dequeue(&marker->extended_block.ranges); globus_libc_free(range); } globus_fifo_destroy(&marker->extended_block.ranges); /* FALLSTHROUGH */ case GLOBUS_FTP_CLIENT_RESTART_NONE: case GLOBUS_FTP_CLIENT_RESTART_STREAM: memset(marker, '\0', sizeof(globus_ftp_client_restart_marker_t)); marker->type = GLOBUS_FTP_CLIENT_RESTART_NONE; break; } return GLOBUS_SUCCESS; }
/** * Free the instance data of a Globus GSSAPI Error object. * @ingroup globus_gssapi_error_object * * @param data * The instance data * @return * void */ static void globus_l_error_free_gssapi( void * data) { globus_libc_free(data); }/* globus_l_error_free_gssapi */
/** * debug free */ void ngiDebugFree(void *addr) { void *realAddr, *ckBufAddr; void **realAddrPtr; size_t *sizePtr; size_t size; int result; realAddrPtr = (void **)addr - 1; realAddr = *realAddrPtr; sizePtr = (size_t *)((void **)addr - 2); size = *sizePtr; ckBufAddr = realAddr; result = nglDebugMallocCheckAreaCheck(ckBufAddr); assert(result == 1); ckBufAddr = (char *)realAddr + NGCLL_CHECK_BUFFER_SIZE + sizeof(size_t) + sizeof(void *) + size; result = nglDebugMallocCheckAreaCheck(ckBufAddr); assert(result == 1); globus_libc_free(realAddr); }
static void data_cb( void * user_arg, globus_ftp_client_handle_t * handle, globus_object_t * err, globus_byte_t * buffer, globus_size_t length, globus_off_t offset, globus_bool_t eof) { if(!eof) { int rc; globus_mutex_lock(&lock); rc = read(0, buffer, MYSIZE); globus_ftp_client_register_write( handle, buffer, rc, global_offset, rc == 0, data_cb, 0); global_offset += rc; globus_mutex_unlock(&lock); } else { globus_libc_free(buffer); } }
/** * @brief Destroy a GRAM client attribute * @ingroup globus_gram_client_attr * * @details * The globus_gram_client_attr_destroy() function destroys and frees * a GRAM client attribute. After this function returns, the value pointed * to by @a attr is no longer valid and must not be used. * * @param attr * A pointer to the attribute to destroy. All data associated with * the attribute will be freed and it will be an invalid attribute. * * @return * Upon success, globus_gram_client_attr_destroy() destroys the * attribute pointed to by the @a attr parameter and sets it to an invalid * state. If an error occurs, globus_gram_client_attr_destroy() * returns an integer error code and value of @a attr is unchanged. * * @retval GLOBUS_SUCCESS * Success * @retval GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR * Invalid attribute * * @see globus_gram_client_attr_init() */ int globus_gram_client_attr_destroy( globus_gram_client_attr_t * attr) { int rc = GLOBUS_SUCCESS; globus_i_gram_client_attr_t * iattr; if (attr == NULL) { rc = GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR; goto out; } iattr = (globus_i_gram_client_attr_t *) *attr; if (iattr == NULL) { rc = GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR; goto out; } globus_libc_free(iattr); *attr = NULL; out: return rc; }
static void restart_marker_plugin_get_cb( globus_ftp_client_plugin_t * plugin, void * plugin_specific, globus_ftp_client_handle_t * handle, const char * url, const globus_ftp_client_operationattr_t * attr, globus_bool_t restart) { restart_marker_plugin_info_t * ps; ps = (restart_marker_plugin_info_t *) plugin_specific; if(ps->error_obj) { globus_object_free(ps->error_obj); ps->error_obj = GLOBUS_NULL; } if(ps->error_url) { globus_libc_free(ps->error_url); ps->error_url = GLOBUS_NULL; } if(restart) { /* we have been restarted.. previous fault disregarded */ return; } ps->use_data = GLOBUS_TRUE; ps->last_time = 0; if(ps->begin_cb) { restart = ps->begin_cb( ps->user_arg, handle, url, GLOBUS_NULL, &ps->restart_marker); } if(restart) { globus_ftp_client_plugin_restart_get( handle, url, attr, &ps->restart_marker, GLOBUS_NULL); } else { globus_ftp_client_restart_marker_init(&ps->restart_marker); } }
static void globus_l_ftp_client_restart_plugin_destroy( globus_ftp_client_plugin_t * plugin, void * plugin_specific) { globus_ftp_client_restart_plugin_destroy(plugin); globus_libc_free(plugin); }
struct dirent* GridFTPListReader::readdirpp(struct stat* st) { std::string line; std::istream in(stream_buffer); if (!std::getline(in, line)) return NULL; if (trim(line).empty()) return NULL; globus_gass_copy_glob_stat_t gl_stat; char* unparsed = strdup(line.c_str()); if (parse_mlst_line(unparsed, &gl_stat, dbuffer.d_name, sizeof(dbuffer.d_name)) != GLOBUS_SUCCESS) { free(unparsed); throw Glib::Error(GridftpListReaderQuark, EINVAL, Glib::ustring("Error parsing GridFTP line: '").append(line).append("\'")); } free(unparsed); // Workaround for LCGUTIL-295 // Some endpoints return the absolute path when listing an empty directory if (dbuffer.d_name[0] == '/') return NULL; memset(st, 0, sizeof(*st)); st->st_mode = (mode_t) ((gl_stat.mode != -1)?gl_stat.mode:0); st->st_mode |= (gl_stat.type == GLOBUS_GASS_COPY_GLOB_ENTRY_DIR)?(S_IFDIR):(S_IFREG); st->st_size = (off_t) gl_stat.size; st->st_mtime = (time_t) (gl_stat.mdtm != -1)?(gl_stat.mdtm):0; if (S_ISDIR(st->st_mode)) dbuffer.d_type = DT_DIR; else if (S_ISLNK(st->st_mode)) dbuffer.d_type = DT_LNK; else dbuffer.d_type = DT_REG; globus_libc_free(gl_stat.unique_id); globus_libc_free(gl_stat.symlink_target); return &dbuffer; }
/** * Deallocate */ int ngiNetCommunicatorFree(NET_Communicator *netComm, ngLog_t *log, int *error) { /* Check the arguments */ assert(netComm != NULL); /* Deallocate */ globus_libc_free(netComm); /* Success */ return 1; }
static void globus_l_ftp_client_restart_plugin_genericify( globus_l_ftp_client_restart_plugin_t * d) { if(d->source_url) { globus_libc_free(d->source_url); d->source_url = NULL; globus_ftp_client_operationattr_destroy(&d->source_attr); } if(d->dest_url) { globus_libc_free(d->dest_url); d->dest_url = NULL; globus_ftp_client_operationattr_destroy(&d->dest_attr); } d->operation = GLOBUS_FTP_CLIENT_IDLE; d->abort_pending = GLOBUS_FALSE; }
void globus_print_error( globus_result_t error_result) { globus_object_t * error_obj = NULL; char * error_string = NULL; error_obj = globus_error_get(error_result); error_string = globus_error_print_chain(error_obj); globus_libc_fprintf(stderr, "%s\n", error_string); globus_libc_free(error_string); globus_object_free(error_obj); }
/** * Destroy an HTTP attribute * @ingroup globus_i_xio_http_attr * * Frees all storage associated with an HTTP attribute. No further * handle controls may be called on this attribute. This is called by the XIO * driver via globus_xio_attr_destroy(). * * @param driver_attr * Void pointer to a #globus_i_xio_http_attr_t structure to be destroyed. * * @return This function always returns GLOBUS_SUCCESS. * * @see globus_i_xio_http_attr_init() */ globus_result_t globus_i_xio_http_attr_destroy( void * driver_attr) { globus_i_xio_http_attr_t * attr = driver_attr; GlobusXIOName(globus_i_xio_http_attr_destroy); globus_i_xio_http_request_destroy(&attr->request); globus_i_xio_http_response_destroy(&attr->response); globus_libc_free(attr); return GLOBUS_SUCCESS; }
/** Copy an HTTP attribute * @ingroup globus_i_xio_http_attr * * Copies all values associated with the @a src http attribute to * a newly allocated attribute in @a dst. If this function returns a * failure, then the @a dst should be considered uninitiailized. This is * called by the XIO driver via globus_xio_attr_copy(). * * @param dst * Void ** which will be set to point to a newly allocated attribute * with equivalent values to those in @a src. * @param src * Void * pointing to a #globus_i_xio_http_attr_t which contains the * attributes we want to copy. * * @return * This function returns GLOBUS_SUCCESS or GLOBUS_XIO_ERROR_MEMORY itself. * Other errors generated by globus_i_xio_http_request_copy() may be * returned as well. * * @retval GLOBUS_SUCCESS * Attribute successfully copied. * @retval GLOBUS_XIO_ERROR_MEMORY * Attribute copy failed due to memory constraints. */ globus_result_t globus_i_xio_http_attr_copy( void ** dst, void * src) { globus_result_t result; globus_i_xio_http_attr_t * http_dst; globus_i_xio_http_attr_t * http_src = src; GlobusXIOName(globus_i_xio_http_attr_copy); /* * Don't use globus_i_xio_http_request_init() here or the call to * globus_i_xio_http_request_copy() below will leak. */ http_dst = globus_libc_malloc(sizeof(globus_i_xio_http_attr_t)); if (http_dst == NULL) { result = GlobusXIOErrorMemory(dst); goto error_exit; } /* Copy request attrs */ result = globus_i_xio_http_request_copy( &http_dst->request, &http_src->request); if (result != GLOBUS_SUCCESS) { goto free_http_dst_exit; } /* Copy response attrs */ result = globus_i_xio_http_response_copy( &http_dst->response, &http_src->response); if (result != GLOBUS_SUCCESS) { goto free_http_dst_request_exit; } http_dst->delay_write_header = http_src->delay_write_header; *dst = http_dst; return GLOBUS_SUCCESS; free_http_dst_request_exit: globus_i_xio_http_request_destroy(&http_dst->request); free_http_dst_exit: globus_libc_free(http_dst); error_exit: return result; }
/** * @brief Destroy credential handle attributes * @ingroup globus_gsi_cred_handle_attrs * @details * Destroy the Credential Handle Attributes. This function * does some cleanup and deallocation of the handle attributes. * * @param handle_attrs * The handle attributes to destroy * * @return * GLOBUS_SUCCESS */ globus_result_t globus_gsi_cred_handle_attrs_destroy( globus_gsi_cred_handle_attrs_t handle_attrs) { static char * _function_name_ = "globus_gsi_cred_handle_attrs_destroy"; GLOBUS_I_GSI_CRED_DEBUG_ENTER; if(handle_attrs != NULL) { if(handle_attrs->search_order != NULL) { globus_libc_free(handle_attrs->search_order); } globus_libc_free(handle_attrs); } GLOBUS_I_GSI_CRED_DEBUG_EXIT; return GLOBUS_SUCCESS; }
/** * Get total bytes accounted for in restart marker * @ingroup globus_ftp_client_restart_marker * * This funtion will return the sum of all bytes accounted for in * a restart marker. If this restart marker contains a stream offset * then this value is the same as the offset (not the ascii offset) * that it was set with. If it is a range list, it a sum of all the * bytes in the ranges. * * @param marker * A previously initialized or copied restart marker * * @param total_bytes * pointer to storage for total bytes in marker * * @return * - Error on NULL marker or total bytes * - <possible return> */ globus_result_t globus_ftp_client_restart_marker_get_total( globus_ftp_client_restart_marker_t * marker, globus_off_t * total_bytes) { GlobusFuncName(globus_ftp_client_restart_marker_get_total); if(marker == GLOBUS_NULL) { return globus_error_put( GLOBUS_I_FTP_CLIENT_ERROR_NULL_PARAMETER("marker")); } if(total_bytes == GLOBUS_NULL) { return globus_error_put( GLOBUS_I_FTP_CLIENT_ERROR_NULL_PARAMETER("total_bytes")); } *total_bytes = 0; if(marker->type == GLOBUS_FTP_CLIENT_RESTART_STREAM) { *total_bytes = marker->stream.offset; } else if(marker->type == GLOBUS_FTP_CLIENT_RESTART_EXTENDED_BLOCK && !globus_fifo_empty(&marker->extended_block.ranges)) { globus_fifo_t * tmp; globus_off_t total; globus_i_ftp_client_range_t * range; tmp = globus_fifo_copy(&marker->extended_block.ranges); total = 0; while((!globus_fifo_empty(tmp))) { range = (globus_i_ftp_client_range_t *) globus_fifo_dequeue(tmp); total += range->end_offset - range->offset; } *total_bytes = total; globus_fifo_destroy(tmp); globus_libc_free(tmp); } return GLOBUS_SUCCESS; }
/** * Deallocate */ int ngiSessionInformationFree( ngSessionInformation_t *info, ngLog_t *log, int *error) { /* Check the arguments */ assert(info != NULL); /* Deallocate */ globus_libc_free(info); /* Success */ return 1; }
/** * Destroy an HTTP response * @ingroup globus_i_xio_http_response * * All fields of this response will be freed. * * @param response * Response structure to destroy. * * @return void */ void globus_i_xio_http_response_destroy( globus_i_xio_http_response_t * response) { response->status_code = 0; if (response->reason_phrase != NULL) { globus_libc_free(response->reason_phrase); response->reason_phrase = NULL; } response->http_version = GLOBUS_XIO_HTTP_VERSION_UNSET; globus_i_xio_http_header_info_destroy(&response->headers); }
/** * ObserveItem: Deallocate */ static int ngcllObserveItemFree( ngclContext_t *context, ngcliObserveItem_t *observeItem, int *error) { /* Check the arguments */ assert(context != NULL); assert(observeItem != NULL); /* Deallocate */ globus_libc_free(observeItem); /* Success */ return 1; }
/** * Copy the contents of an HTTP response * @ingroup globus_i_xio_http_response * * All values associated with the @a src response will be copied * to the corresponding fields of the @a dest response. If this function * returns a failure, then the @a dest should be considered uninitialized. * * @param dest * Response to be initialized with values from src. This should * not be initialized before this is called, or memory may be * leaked. * @param src * Response containing known values. * * @retval GLOBUS_SUCCESS * Response successfully copied. * @retval GLOBUS_XIO_ERROR_MEMORY * Response copy failed due to memory constraints. */ globus_result_t globus_i_xio_http_response_copy( globus_i_xio_http_response_t * dest, const globus_i_xio_http_response_t *src) { globus_result_t res = GLOBUS_SUCCESS; GlobusXIOName(globus_i_xio_http_response_copy); dest->status_code = src->status_code; if (src->reason_phrase == NULL) { dest->reason_phrase = NULL; } else { dest->reason_phrase = globus_libc_strdup(src->reason_phrase); if (dest->reason_phrase == NULL) { res = GlobusXIOErrorMemory("reason_phrase"); goto error_exit; } } dest->http_version = src->http_version; res = globus_i_xio_http_header_info_copy( &dest->headers, &src->headers); if (res != GLOBUS_SUCCESS) { goto free_reason_phrase_exit; } return res; free_reason_phrase_exit: if (dest->reason_phrase != NULL) { globus_libc_free(dest->reason_phrase); dest->reason_phrase = NULL; } error_exit: return res; }
static globus_ftp_client_plugin_t * globus_l_ftp_client_restart_plugin_copy( globus_ftp_client_plugin_t * plugin_template, void * plugin_specific) { globus_ftp_client_plugin_t * newguy; globus_l_ftp_client_restart_plugin_t * d; globus_l_ftp_client_restart_plugin_t * newd; globus_result_t result; d = (globus_l_ftp_client_restart_plugin_t *) plugin_specific; newguy = globus_libc_malloc(sizeof(globus_ftp_client_plugin_t)); if(newguy == GLOBUS_NULL) { goto error_exit; } result = globus_ftp_client_restart_plugin_init(newguy, d->max_retries, &d->interval, &d->deadline); if(result != GLOBUS_SUCCESS) { goto free_exit; } result = globus_ftp_client_plugin_get_plugin_specific(newguy, (void **) &newd); if(result != GLOBUS_SUCCESS) { goto destroy_exit; } newd->backoff = d->backoff; newd->stall_timeout = d->stall_timeout; return newguy; destroy_exit: globus_ftp_client_restart_plugin_destroy(newguy); free_exit: globus_libc_free(newguy); error_exit: return GLOBUS_NULL; }
globus_result_t globus_ftp_client_restart_marker_plugin_destroy( globus_ftp_client_plugin_t * plugin) { globus_result_t result; restart_marker_plugin_info_t * ps; GlobusFuncName(globus_ftp_client_restart_marker_plugin_destroy); if(plugin == GLOBUS_NULL) { return globus_error_put(globus_error_construct_string( GLOBUS_FTP_CLIENT_MODULE, GLOBUS_NULL, "[%s] NULL plugin at %s\n", GLOBUS_FTP_CLIENT_MODULE->module_name, _globus_func_name)); } result = globus_ftp_client_plugin_get_plugin_specific( plugin, (void **) (void *) &ps); if(result != GLOBUS_SUCCESS) { return result; } if(ps->error_obj) { globus_object_free(ps->error_obj); ps->error_obj = GLOBUS_NULL; } if(ps->error_url) { globus_libc_free(ps->error_url); ps->error_url = GLOBUS_NULL; } globus_mutex_destroy(&ps->lock); globus_free(ps); return globus_ftp_client_plugin_destroy(plugin); }
static void done_cb( void * user_arg, globus_ftp_client_handle_t * handle, globus_object_t * err) { char * tmpstr; if(err) { tmpstr = globus_object_printable_to_string(err); printf("done with error: %s\n", tmpstr); error = GLOBUS_TRUE; globus_libc_free(tmpstr); } globus_mutex_lock(&lock); done = GLOBUS_TRUE; globus_cond_signal(&cond); globus_mutex_unlock(&lock); }
/** * Allocate and initialize an HTTP attribute * @ingroup globus_i_xio_http_attr * * Creates a new attribute with default values. This is called by the XIO * driver via globus_xio_attr_init(). * * @param out_attr * Pointer value will be set to point to a * newly allocated and initilized #globus_i_xio_http_attr_t * structure. * * @retval GLOBUS_SUCCESS * Attribute successfully initialized. * @retval GLOBUS_XIO_ERROR_MEMORY * Initialization failed due to memory constraints. * * @see globus_i_xio_http_attr_destroy() */ globus_result_t globus_i_xio_http_attr_init( void ** out_attr) { globus_result_t res; globus_i_xio_http_attr_t * attr; GlobusXIOName(globus_i_xio_http_attr_init); attr = globus_libc_malloc(sizeof(globus_i_xio_http_attr_t)); if (attr == NULL) { res = GlobusXIOErrorMemory("attr"); goto error_exit; } res = globus_i_xio_http_request_init(&attr->request); if (res != GLOBUS_SUCCESS) { goto free_attr_exit; } res = globus_i_xio_http_response_init(&attr->response); if (res != GLOBUS_SUCCESS) { goto free_request_exit; } attr->delay_write_header = GLOBUS_FALSE; *out_attr = attr; return GLOBUS_SUCCESS; free_request_exit: globus_i_xio_http_request_destroy(&attr->request); free_attr_exit: globus_libc_free(attr); error_exit: return res; }
/** * Server-side connection open callback * @ingroup globus_i_xio_http_server * * Called as a result of open at the transport level. If this was successful, * we will finish the open operation. If an error happens, this function will * close the * handle internally and call globus_xio_driver_finished_open() to * propagate the error. * * @param op * Operation associated with the open. * @param result * Result from the transport's attempt to open the new connection. * @param user_arg * Void * pointing to a #globus_i_xio_http_handle_t associated with * this open. * * @return void */ void globus_i_xio_http_server_open_callback( globus_xio_operation_t op, globus_result_t result, void * user_arg) { globus_i_xio_http_handle_t * http_handle = user_arg; GlobusXIOName(globus_i_xio_http_server_open_callback); if (result != GLOBUS_SUCCESS) { globus_i_xio_http_handle_destroy(http_handle); globus_libc_free(http_handle); http_handle = NULL; } globus_xio_driver_finished_open( http_handle, op, result); return; }