| 1 | /* | |
| 2 | * Copyright 1999-2006 University of Chicago | |
| 3 | * | |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | * See the License for the specific language governing permissions and | |
| 14 | * limitations under the License. | |
| 15 | */ | |
| 16 | ||
| 17 | #include "globus_i_service_engine.h" | |
| 18 | ||
| 19 | /** | |
| 20 | * Get contact information for a given service engine | |
| 21 | * @ingroup globus_service_engine | |
| 22 | * | |
| 23 | * Returns a copy of the string which can be used to construct references | |
| 24 | * to services running in the engine. The caller must free the contact string. | |
| 25 | * | |
| 26 | * @param engine | |
| 27 | * A service engine reference to get the contact stirng from. | |
| 28 | * @param contact | |
| 29 | * A pointer which will be set to a copy of the engine's contact string. | |
| 30 | * | |
| 31 | * @retval GLOBUS_SUCCESS | |
| 32 | * Contact string successfully copied. | |
| 33 | * @retval GLOBUS_SOAP_MESSAGE_ERROR_TYPE_NULL_PARAM | |
| 34 | * One of @a engine or @a contact or is NULL. | |
| 35 | * @retval GLOBUS_SERVICE_ENGINE_ERROR_TYPE_OUT_OF_MEMORY | |
| 36 | * Insufficient memory to copy contact string. | |
| 37 | */ | |
| 38 | globus_result_t | |
| 39 | globus_service_engine_get_contact( | |
| 40 | const globus_service_engine_t engine, | |
| 41 | char ** contact) | |
| 42 | 629 | { |
| 43 | 629 | globus_result_t result = GLOBUS_SUCCESS; |
| 44 | 629 | char * contact_string = NULL; |
| 45 | ||
| 46 | 629 | if (contact == NULL) |
| 47 | { | |
| 48 | 0 | result = GlobusSoapMessageErrorNullParam; |
| 49 | ||
| 50 | 0 | goto out; |
| 51 | } | |
| 52 | 629 | if (engine == NULL) |
| 53 | { | |
| 54 | 0 | result = GlobusSoapMessageErrorNullParam; |
| 55 | ||
| 56 | 0 | goto contact_out; |
| 57 | } | |
| 58 | 629 | contact_string = globus_libc_strdup(engine->contact); |
| 59 | ||
| 60 | 629 | if (contact_string == NULL) |
| 61 | { | |
| 62 | 0 | result = GlobusServiceEngineErrorOutOfMemory; |
| 63 | ||
| 64 | 0 | goto contact_out; |
| 65 | } | |
| 66 | ||
| 67 | 629 | contact_out: |
| 68 | 629 | *contact = contact_string; |
| 69 | 629 | out: |
| 70 | 629 | return result; |
| 71 | } |