diff options
author | gmcdonald | 2010-02-13 01:32:03 +0000 |
---|---|---|
committer | gmcdonald | 2010-02-13 01:32:03 +0000 |
commit | 0425aadc78680e53000fd0108b540d6eca048516 (patch) | |
tree | 8ec7ab8e015d454c5ec586dfc91e05a2dce1cfc0 /src/core/addr | |
download | axis2c-0425aadc78680e53000fd0108b540d6eca048516.tar.gz axis2c-0425aadc78680e53000fd0108b540d6eca048516.tar.bz2 |
Moving axis svn, part of TLP move INFRA-2441
git-svn-id: http://svn.apache.org/repos/asf/axis/axis2/c/core/trunk@909681 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/core/addr')
-rw-r--r-- | src/core/addr/Makefile.am | 13 | ||||
-rw-r--r-- | src/core/addr/any_content_type.c | 120 | ||||
-rw-r--r-- | src/core/addr/endpoint_ref.c | 375 | ||||
-rw-r--r-- | src/core/addr/msg_info_headers.c | 448 | ||||
-rw-r--r-- | src/core/addr/relates_to.c | 164 | ||||
-rw-r--r-- | src/core/addr/svc_name.c | 151 |
6 files changed, 1271 insertions, 0 deletions
diff --git a/src/core/addr/Makefile.am b/src/core/addr/Makefile.am new file mode 100644 index 0000000..1f7512f --- /dev/null +++ b/src/core/addr/Makefile.am @@ -0,0 +1,13 @@ +noinst_LTLIBRARIES = libaxis2_addr.la + +libaxis2_addr_la_SOURCES = relates_to.c \ + svc_name.c \ + any_content_type.c \ + endpoint_ref.c \ + msg_info_headers.c + + +INCLUDES = -I$(top_builddir)/include \ + -I$(top_builddir)/src/core/engine \ + -I$(top_builddir)/util/include \ + -I$(top_builddir)/axiom/include diff --git a/src/core/addr/any_content_type.c b/src/core/addr/any_content_type.c new file mode 100644 index 0000000..1a9e6a1 --- /dev/null +++ b/src/core/addr/any_content_type.c @@ -0,0 +1,120 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <axis2_any_content_type.h> +#include <axutil_string.h> + +struct axis2_any_content_type +{ + + /** map of values in the any content type */ + axutil_hash_t *value_map; +}; + +AXIS2_EXTERN axis2_any_content_type_t *AXIS2_CALL +axis2_any_content_type_create( + const axutil_env_t * env) +{ + axis2_any_content_type_t *any_content_type = NULL; + + AXIS2_ENV_CHECK(env, NULL); + + any_content_type = AXIS2_MALLOC(env->allocator, sizeof(axis2_any_content_type_t)); + if(!any_content_type) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + return NULL; + } + + any_content_type->value_map = NULL; + + any_content_type->value_map = axutil_hash_make(env); + + if(!(any_content_type->value_map)) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + axis2_any_content_type_free(any_content_type, env); + return NULL; + } + + return any_content_type; +} + +AXIS2_EXTERN axis2_status_t AXIS2_CALL +axis2_any_content_type_add_value( + axis2_any_content_type_t * any_content_type, + const axutil_env_t * env, + const axutil_qname_t * qname, + const axis2_char_t * value) +{ + axis2_char_t *temp = NULL; + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + + if(any_content_type->value_map) + { + axis2_char_t *name = NULL; + + name = axutil_qname_to_string((axutil_qname_t *)qname, env); + axutil_hash_set(any_content_type->value_map, name, AXIS2_HASH_KEY_STRING, value); + + temp = axutil_hash_get(any_content_type->value_map, name, AXIS2_HASH_KEY_STRING); + if(temp) + return AXIS2_SUCCESS; + } + return AXIS2_FAILURE; +} + +AXIS2_EXTERN const axis2_char_t *AXIS2_CALL +axis2_any_content_type_get_value( + const axis2_any_content_type_t * any_content_type, + const axutil_env_t * env, + const axutil_qname_t * qname) +{ + if(any_content_type->value_map) + { + axis2_char_t *name = NULL; + + name = axutil_qname_to_string((axutil_qname_t *)qname, env); + return axutil_hash_get(any_content_type->value_map, name, AXIS2_HASH_KEY_STRING); + } + return NULL; +} + +AXIS2_EXTERN axutil_hash_t *AXIS2_CALL +axis2_any_content_type_get_value_map( + const axis2_any_content_type_t * any_content_type, + const axutil_env_t * env) +{ + return any_content_type->value_map; +} + +AXIS2_EXTERN void AXIS2_CALL +axis2_any_content_type_free( + axis2_any_content_type_t * any_content_type, + const axutil_env_t * env) +{ + AXIS2_ENV_CHECK(env, void); + + if(any_content_type->value_map) + { + axutil_hash_free(any_content_type->value_map, env); + } + + AXIS2_FREE(env->allocator, any_content_type); + + return; +} diff --git a/src/core/addr/endpoint_ref.c b/src/core/addr/endpoint_ref.c new file mode 100644 index 0000000..dd351f0 --- /dev/null +++ b/src/core/addr/endpoint_ref.c @@ -0,0 +1,375 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <axis2_endpoint_ref.h> +#include <axutil_string.h> +#include <axutil_array_list.h> + +struct axis2_endpoint_ref +{ + + /** endpoint address */ + axis2_char_t *address; + + /** interface qname */ + axutil_qname_t *interface_qname; + + /** reference parameters */ + axutil_array_list_t *ref_param_list; + + /** meta data */ + axutil_array_list_t *metadata_list; + + /** reference parameter attribute list */ + axutil_array_list_t *ref_attribute_list; + + /** meta data attribute list */ + axutil_array_list_t *meta_attribute_list; + + /** extensible element list */ + axutil_array_list_t *extension_list; + + /** service name */ + axis2_svc_name_t *svc_name; +}; + +axis2_endpoint_ref_t *AXIS2_CALL +axis2_endpoint_ref_create( + const axutil_env_t * env, + const axis2_char_t * address) +{ + axis2_endpoint_ref_t *endpoint_ref = NULL; + + AXIS2_ENV_CHECK(env, NULL); + + endpoint_ref = AXIS2_MALLOC(env->allocator, sizeof(axis2_endpoint_ref_t)); + if(!endpoint_ref) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + return NULL; + } + + endpoint_ref->address = NULL; + endpoint_ref->interface_qname = NULL; + endpoint_ref->ref_param_list = NULL; + endpoint_ref->metadata_list = NULL; + endpoint_ref->ref_attribute_list = NULL; + endpoint_ref->meta_attribute_list = NULL; + endpoint_ref->extension_list = NULL; + endpoint_ref->svc_name = NULL; + + if(address) + { + endpoint_ref->address = axutil_strdup(env, address); + if(!(endpoint_ref->address)) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + axis2_endpoint_ref_free(endpoint_ref, env); + return NULL; + } + } + + return endpoint_ref; +} + +const axis2_char_t *AXIS2_CALL +axis2_endpoint_ref_get_address( + const axis2_endpoint_ref_t * endpoint_ref, + const axutil_env_t * env) +{ + return endpoint_ref->address; +} + +axis2_status_t AXIS2_CALL +axis2_endpoint_ref_set_address( + axis2_endpoint_ref_t * endpoint_ref, + const axutil_env_t * env, + const axis2_char_t * address) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + if(endpoint_ref->address) + { + AXIS2_FREE(env->allocator, endpoint_ref->address); + } + + endpoint_ref->address = axutil_strdup(env, address); + return AXIS2_SUCCESS; +} + +const axutil_qname_t *AXIS2_CALL +axis2_endpoint_ref_get_interface_qname( + const axis2_endpoint_ref_t * endpoint_ref, + const axutil_env_t * env) +{ + return endpoint_ref->interface_qname; +} + +axis2_status_t AXIS2_CALL +axis2_endpoint_ref_set_interface_qname( + axis2_endpoint_ref_t * endpoint_ref, + const axutil_env_t * env, + const axutil_qname_t * interface_qname) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + endpoint_ref->interface_qname = axutil_qname_clone((axutil_qname_t *)interface_qname, env); + return AXIS2_SUCCESS; +} + +axis2_svc_name_t *AXIS2_CALL +axis2_endpoint_ref_get_svc_name( + const axis2_endpoint_ref_t * endpoint_ref, + const axutil_env_t * env) +{ + return endpoint_ref->svc_name; +} + +axis2_status_t AXIS2_CALL +axis2_endpoint_ref_set_svc_name( + axis2_endpoint_ref_t * endpoint_ref, + const axutil_env_t * env, + axis2_svc_name_t * svc_name) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + endpoint_ref->svc_name = svc_name; + return AXIS2_SUCCESS; +} + +void AXIS2_CALL +axis2_endpoint_ref_free_void_arg( + void *endpoint_ref, + const axutil_env_t * env) +{ + axis2_endpoint_ref_t *endpoint_ref_l = NULL; + + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + + endpoint_ref_l = (axis2_endpoint_ref_t *)endpoint_ref; + axis2_endpoint_ref_free(endpoint_ref_l, env); + return; +} + +void AXIS2_CALL +axis2_endpoint_ref_free( + axis2_endpoint_ref_t * endpoint_ref, + const axutil_env_t * env) +{ + AXIS2_ENV_CHECK(env, void); + + if(endpoint_ref->address) + { + AXIS2_FREE(env->allocator, endpoint_ref->address); + } + + if(endpoint_ref->ref_param_list) + { + axutil_array_list_free(endpoint_ref->ref_param_list, env); + } + + if(endpoint_ref->metadata_list) + { + axutil_array_list_free(endpoint_ref->metadata_list, env); + } + + if(endpoint_ref->ref_attribute_list) + { + axutil_array_list_free(endpoint_ref->ref_attribute_list, env); + } + + if(endpoint_ref->meta_attribute_list) + { + axutil_array_list_free(endpoint_ref->meta_attribute_list, env); + } + + if(endpoint_ref->extension_list) + { + axutil_array_list_free(endpoint_ref->extension_list, env); + } + + AXIS2_FREE(env->allocator, endpoint_ref); + + return; +} + +axutil_array_list_t *AXIS2_CALL +axis2_endpoint_ref_get_ref_param_list( + const axis2_endpoint_ref_t * endpoint_ref, + const axutil_env_t * env) +{ + return endpoint_ref->ref_param_list; +} + +axutil_array_list_t *AXIS2_CALL +axis2_endpoint_ref_get_metadata_list( + const axis2_endpoint_ref_t * endpoint_ref, + const axutil_env_t * env) +{ + return endpoint_ref->metadata_list; +} + +axis2_status_t AXIS2_CALL +axis2_endpoint_ref_add_ref_param( + axis2_endpoint_ref_t * endpoint_ref, + const axutil_env_t * env, + axiom_node_t * ref_param_node) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + + if(!(endpoint_ref->ref_param_list)) + { + endpoint_ref->ref_param_list = axutil_array_list_create(env, 0); + if(!(endpoint_ref->ref_param_list)) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + return AXIS2_FAILURE; + } + } + + if(endpoint_ref->ref_param_list && ref_param_node) + { + return axutil_array_list_add(endpoint_ref->ref_param_list, env, ref_param_node); + } + + return AXIS2_FAILURE; +} + +axis2_status_t AXIS2_CALL +axis2_endpoint_ref_add_metadata( + axis2_endpoint_ref_t * endpoint_ref, + const axutil_env_t * env, + axiom_node_t * meta_data_node) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + + if(!(endpoint_ref->metadata_list)) + { + endpoint_ref->metadata_list = axutil_array_list_create(env, 0); + if(!(endpoint_ref->metadata_list)) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + return AXIS2_FAILURE; + } + } + + if(endpoint_ref->metadata_list && meta_data_node) + { + return axutil_array_list_add(endpoint_ref->metadata_list, env, meta_data_node); + } + + return AXIS2_FAILURE; +} + +axutil_array_list_t *AXIS2_CALL +axis2_endpoint_ref_get_ref_attribute_list( + const axis2_endpoint_ref_t * endpoint_ref, + const axutil_env_t * env) +{ + return endpoint_ref->ref_attribute_list; +} + +axutil_array_list_t *AXIS2_CALL +axis2_endpoint_ref_get_metadata_attribute_list( + const axis2_endpoint_ref_t * endpoint_ref, + const axutil_env_t * env) +{ + return endpoint_ref->meta_attribute_list; +} + +axutil_array_list_t *AXIS2_CALL +axis2_endpoint_ref_get_extension_list( + const axis2_endpoint_ref_t * endpoint_ref, + const axutil_env_t * env) +{ + return endpoint_ref->extension_list; +} + +axis2_status_t AXIS2_CALL +axis2_endpoint_ref_add_ref_attribute( + axis2_endpoint_ref_t * endpoint_ref, + const axutil_env_t * env, + axiom_attribute_t * attr) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + + if(!(endpoint_ref->ref_attribute_list)) + { + endpoint_ref->ref_attribute_list = axutil_array_list_create(env, 0); + if(!(endpoint_ref->ref_attribute_list)) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + return AXIS2_FAILURE; + } + } + + if(endpoint_ref->ref_attribute_list && attr) + { + return axutil_array_list_add(endpoint_ref->ref_attribute_list, env, attr); + } + + return AXIS2_FAILURE; +} + +axis2_status_t AXIS2_CALL +axis2_endpoint_ref_add_metadata_attribute( + axis2_endpoint_ref_t * endpoint_ref, + const axutil_env_t * env, + axiom_attribute_t * attr) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + + if(!(endpoint_ref->meta_attribute_list)) + { + endpoint_ref->meta_attribute_list = axutil_array_list_create(env, 0); + if(!(endpoint_ref->meta_attribute_list)) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + return AXIS2_FAILURE; + } + } + + if(endpoint_ref->meta_attribute_list && attr) + { + return axutil_array_list_add(endpoint_ref->meta_attribute_list, env, attr); + } + + return AXIS2_FAILURE; +} + +axis2_status_t AXIS2_CALL +axis2_endpoint_ref_add_extension( + axis2_endpoint_ref_t * endpoint_ref, + const axutil_env_t * env, + axiom_node_t * extension_node) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + + if(!(endpoint_ref->extension_list)) + { + endpoint_ref->extension_list = axutil_array_list_create(env, 0); + if(!(endpoint_ref->extension_list)) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + return AXIS2_FAILURE; + } + } + + if(endpoint_ref->extension_list && extension_node) + { + return axutil_array_list_add(endpoint_ref->extension_list, env, extension_node); + } + + return AXIS2_FAILURE; +} diff --git a/src/core/addr/msg_info_headers.c b/src/core/addr/msg_info_headers.c new file mode 100644 index 0000000..8d61c5b --- /dev/null +++ b/src/core/addr/msg_info_headers.c @@ -0,0 +1,448 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <axis2_msg_info_headers.h> +#include <axutil_string.h> + +struct axis2_msg_info_headers +{ + + /** The address of the intended receiver of the message. This is mandatory */ + axis2_endpoint_ref_t *to; + + /** Reference of the endpoint where the message originated from */ + axis2_endpoint_ref_t *from; + + /** Pair of values that indicate how this message relate to another message */ + axis2_relates_to_t *relates_to; + + /** Identifies the intended receiver for replies to the message, + if this is set, none and anonymous settings are ignored */ + axis2_endpoint_ref_t *reply_to; + + /** reply to should be none */ + axis2_bool_t reply_to_none; + + /** reply to should be anonymous, this is overridden by none*/ + axis2_bool_t reply_to_anonymous; + + /** identifies the intended receiver for faults related to the message + if this is set, none and anonymous settings are ignored */ + axis2_endpoint_ref_t *fault_to; + + /** fault to should be none */ + axis2_bool_t fault_to_none; + + /** fault to should be anonymous, this is overridden by none*/ + axis2_bool_t fault_to_anonymous; + + /** action */ + axis2_char_t *action; + + /** message Id */ + axis2_char_t *message_id; + + /** reference parameters */ + axutil_array_list_t *ref_params; +}; + +AXIS2_EXTERN axis2_msg_info_headers_t *AXIS2_CALL +axis2_msg_info_headers_create( + const axutil_env_t * env, + axis2_endpoint_ref_t * to, + const axis2_char_t * action) +{ + axis2_msg_info_headers_t *msg_info_headers = NULL; + + msg_info_headers = AXIS2_MALLOC(env->allocator, sizeof(axis2_msg_info_headers_t)); + + if(!msg_info_headers) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + return NULL; + } + + msg_info_headers->to = NULL; + msg_info_headers->from = NULL; + msg_info_headers->relates_to = NULL; + msg_info_headers->reply_to_none = AXIS2_FALSE; + msg_info_headers->reply_to_anonymous = AXIS2_FALSE; + msg_info_headers->reply_to = NULL; + msg_info_headers->fault_to_none = AXIS2_FALSE; + msg_info_headers->fault_to_anonymous = AXIS2_FALSE; + msg_info_headers->fault_to = NULL; + msg_info_headers->action = NULL; + msg_info_headers->message_id = NULL; + msg_info_headers->ref_params = NULL; + + if(to) + { + msg_info_headers->to = to; + } + + if(action) + { + msg_info_headers->action = axutil_strdup(env, action); + if(!(msg_info_headers->action)) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + axis2_msg_info_headers_free(msg_info_headers, env); + return NULL; + } + } + + return msg_info_headers; +} + +/** + * Method getTo + * + * @return + */ +AXIS2_EXTERN axis2_endpoint_ref_t *AXIS2_CALL +axis2_msg_info_headers_get_to( + const axis2_msg_info_headers_t * msg_info_headers, + const axutil_env_t * env) +{ + return msg_info_headers->to; +} + +AXIS2_EXTERN axis2_status_t AXIS2_CALL +axis2_msg_info_headers_set_to( + struct axis2_msg_info_headers * msg_info_headers, + const axutil_env_t * env, + axis2_endpoint_ref_t * to) +{ + if(msg_info_headers->to && to) /* if the incoming to is NULL, + we consider that to be a reset, + so don't free */ + { + axis2_endpoint_ref_free(msg_info_headers->to, env); + msg_info_headers->to = NULL; + } + msg_info_headers->to = to; + return AXIS2_SUCCESS; +} + +AXIS2_EXTERN axis2_endpoint_ref_t *AXIS2_CALL +axis2_msg_info_headers_get_from( + const axis2_msg_info_headers_t * msg_info_headers, + const axutil_env_t * env) +{ + return msg_info_headers->from; +} + +AXIS2_EXTERN axis2_status_t AXIS2_CALL +axis2_msg_info_headers_set_from( + struct axis2_msg_info_headers * msg_info_headers, + const axutil_env_t * env, + axis2_endpoint_ref_t * from) +{ + msg_info_headers->from = from; + return AXIS2_SUCCESS; +} + +AXIS2_EXTERN axis2_endpoint_ref_t *AXIS2_CALL +axis2_msg_info_headers_get_reply_to( + const axis2_msg_info_headers_t * msg_info_headers, + const axutil_env_t * env) +{ + return msg_info_headers->reply_to; +} + +AXIS2_EXTERN axis2_status_t AXIS2_CALL +axis2_msg_info_headers_set_reply_to( + struct axis2_msg_info_headers * msg_info_headers, + const axutil_env_t * env, + axis2_endpoint_ref_t * reply_to) +{ + msg_info_headers->reply_to = reply_to; + return AXIS2_SUCCESS; +} + +AXIS2_EXTERN axis2_endpoint_ref_t *AXIS2_CALL +axis2_msg_info_headers_get_fault_to( + const axis2_msg_info_headers_t * msg_info_headers, + const axutil_env_t * env) +{ + return msg_info_headers->fault_to; +} + +AXIS2_EXTERN axis2_status_t AXIS2_CALL +axis2_msg_info_headers_set_fault_to( + struct axis2_msg_info_headers * msg_info_headers, + const axutil_env_t * env, + axis2_endpoint_ref_t * fault_to) +{ + msg_info_headers->fault_to = fault_to; + return AXIS2_SUCCESS; +} + +AXIS2_EXTERN const axis2_char_t *AXIS2_CALL +axis2_msg_info_headers_get_action( + const axis2_msg_info_headers_t * msg_info_headers, + const axutil_env_t * env) +{ + return msg_info_headers->action; +} + +AXIS2_EXTERN axis2_status_t AXIS2_CALL +axis2_msg_info_headers_set_action( + struct axis2_msg_info_headers * msg_info_headers, + const axutil_env_t * env, + const axis2_char_t * action) +{ + if(msg_info_headers->action) + { + AXIS2_FREE(env->allocator, msg_info_headers->action); + msg_info_headers->action = NULL; + } + if(action) + { + msg_info_headers->action = axutil_strdup(env, action); + } + return AXIS2_SUCCESS; +} + +AXIS2_EXTERN const axis2_char_t *AXIS2_CALL +axis2_msg_info_headers_get_message_id( + const axis2_msg_info_headers_t * msg_info_headers, + const axutil_env_t * env) +{ + return msg_info_headers->message_id; +} + +AXIS2_EXTERN axis2_status_t AXIS2_CALL +axis2_msg_info_headers_set_message_id( + struct axis2_msg_info_headers * msg_info_headers, + const axutil_env_t * env, + const axis2_char_t * message_id) +{ + if(msg_info_headers->message_id) + { + AXIS2_FREE(env->allocator, msg_info_headers->message_id); + msg_info_headers->message_id = NULL; + } + + if(message_id) + { + msg_info_headers->message_id = axutil_stracat(env, AXIS2_MESSAGE_ID_PREFIX, message_id); + if(!(msg_info_headers->message_id)) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + return AXIS2_FAILURE; + } + } + + return AXIS2_SUCCESS; +} + +AXIS2_EXTERN axis2_status_t AXIS2_CALL +axis2_msg_info_headers_set_in_message_id( + struct axis2_msg_info_headers * msg_info_headers, + const axutil_env_t * env, + const axis2_char_t * message_id) +{ + if(msg_info_headers->message_id) + { + AXIS2_FREE(env->allocator, msg_info_headers->message_id); + msg_info_headers->message_id = NULL; + } + + if(message_id) + { + msg_info_headers->message_id = axutil_strdup(env, message_id); + + if(!(msg_info_headers->message_id)) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + return AXIS2_FAILURE; + } + } + + return AXIS2_SUCCESS; +} + +AXIS2_EXTERN axis2_relates_to_t *AXIS2_CALL +axis2_msg_info_headers_get_relates_to( + const axis2_msg_info_headers_t * msg_info_headers, + const axutil_env_t * env) +{ + return msg_info_headers->relates_to; +} + +AXIS2_EXTERN axis2_status_t AXIS2_CALL +axis2_msg_info_headers_set_relates_to( + struct axis2_msg_info_headers * msg_info_headers, + const axutil_env_t * env, + axis2_relates_to_t * relates_to) +{ + if(msg_info_headers->relates_to) + { + axis2_relates_to_free(msg_info_headers->relates_to, env); + } + msg_info_headers->relates_to = relates_to; + return AXIS2_SUCCESS; +} + +AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL +axis2_msg_info_headers_get_all_ref_params( + const axis2_msg_info_headers_t * msg_info_headers, + const axutil_env_t * env) +{ + return msg_info_headers->ref_params; +} + +AXIS2_EXTERN axis2_status_t AXIS2_CALL +axis2_msg_info_headers_add_ref_param( + struct axis2_msg_info_headers * msg_info_headers, + const axutil_env_t * env, + axiom_node_t * ref_param) +{ + if(!(msg_info_headers->ref_params)) + { + msg_info_headers->ref_params = axutil_array_list_create(env, 10); + if(!(msg_info_headers->ref_params)) + return AXIS2_FAILURE; + } + + if(ref_param) + { + return axutil_array_list_add(msg_info_headers->ref_params, env, ref_param); + } + + return AXIS2_SUCCESS; +} + +AXIS2_EXTERN void AXIS2_CALL +axis2_msg_info_headers_free( + struct axis2_msg_info_headers *msg_info_headers, + const axutil_env_t * env) +{ + if(msg_info_headers->to) + { + axis2_endpoint_ref_free(msg_info_headers->to, env); + } + if(msg_info_headers->from) + { + axis2_endpoint_ref_free(msg_info_headers->from, env); + } + if(msg_info_headers->reply_to) + { + axis2_endpoint_ref_free(msg_info_headers->reply_to, env); + } + if(msg_info_headers->relates_to) + { + axis2_relates_to_free(msg_info_headers->relates_to, env); + } + + if(msg_info_headers->fault_to) + { + axis2_endpoint_ref_free(msg_info_headers->fault_to, env); + } + + if(msg_info_headers->ref_params) + { + axutil_array_list_free(msg_info_headers->ref_params, env); + } + if(msg_info_headers->action) + { + AXIS2_FREE(env->allocator, msg_info_headers->action); + } + if(msg_info_headers->message_id) + { + AXIS2_FREE(env->allocator, msg_info_headers->message_id); + } + + AXIS2_FREE(env->allocator, msg_info_headers); + + return; +} + +AXIS2_EXTERN axis2_status_t AXIS2_CALL +axis2_msg_info_headers_set_reply_to_none( + struct axis2_msg_info_headers * msg_info_headers, + const axutil_env_t * env, + const axis2_bool_t none) +{ + msg_info_headers->reply_to_none = none; + return AXIS2_SUCCESS; +} + +AXIS2_EXTERN axis2_bool_t AXIS2_CALL +axis2_msg_info_headers_get_reply_to_none( + const axis2_msg_info_headers_t * msg_info_headers, + const axutil_env_t * env) +{ + return msg_info_headers->reply_to_none; +} + +AXIS2_EXTERN axis2_status_t AXIS2_CALL +axis2_msg_info_headers_set_reply_to_anonymous( + struct axis2_msg_info_headers * msg_info_headers, + const axutil_env_t * env, + const axis2_bool_t anonymous) +{ + msg_info_headers->reply_to_anonymous = anonymous; + return AXIS2_SUCCESS; +} + +AXIS2_EXTERN axis2_bool_t AXIS2_CALL +axis2_msg_info_headers_get_reply_to_anonymous( + const axis2_msg_info_headers_t * msg_info_headers, + const axutil_env_t * env) +{ + return msg_info_headers->reply_to_anonymous; +} + +AXIS2_EXTERN axis2_status_t AXIS2_CALL +axis2_msg_info_headers_set_fault_to_none( + struct axis2_msg_info_headers * msg_info_headers, + const axutil_env_t * env, + const axis2_bool_t none) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + msg_info_headers->fault_to_none = none; + return AXIS2_SUCCESS; +} + +AXIS2_EXTERN axis2_bool_t AXIS2_CALL +axis2_msg_info_headers_get_fault_to_none( + const axis2_msg_info_headers_t * msg_info_headers, + const axutil_env_t * env) +{ + return msg_info_headers->fault_to_none; +} + +AXIS2_EXTERN axis2_status_t AXIS2_CALL +axis2_msg_info_headers_set_fault_to_anonymous( + struct axis2_msg_info_headers * msg_info_headers, + const axutil_env_t * env, + const axis2_bool_t anonymous) +{ + msg_info_headers->fault_to_anonymous = anonymous; + return AXIS2_SUCCESS; +} + +AXIS2_EXTERN axis2_bool_t AXIS2_CALL +axis2_msg_info_headers_get_fault_to_anonymous( + const axis2_msg_info_headers_t * msg_info_headers, + const axutil_env_t * env) +{ + return msg_info_headers->fault_to_anonymous; +} + diff --git a/src/core/addr/relates_to.c b/src/core/addr/relates_to.c new file mode 100644 index 0000000..e28df54 --- /dev/null +++ b/src/core/addr/relates_to.c @@ -0,0 +1,164 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <axis2_relates_to.h> +#include <axutil_string.h> + +struct axis2_relates_to +{ + + /** value string */ + axis2_char_t *value; + + /** relationship type string */ + axis2_char_t *relationship_type; +}; + +axis2_relates_to_t *AXIS2_CALL +axis2_relates_to_create( + const axutil_env_t * env, + const axis2_char_t * value, + const axis2_char_t * relationship_type) +{ + axis2_relates_to_t *relates_to = NULL; + + AXIS2_ENV_CHECK(env, NULL); + + relates_to = AXIS2_MALLOC(env->allocator, sizeof(axis2_relates_to_t)); + if(!relates_to) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + return NULL; + } + + relates_to->value = NULL; + relates_to->relationship_type = NULL; + + if(value) + { + relates_to->value = axutil_strdup(env, value); + if(!(relates_to->value)) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + axis2_relates_to_free(relates_to, env); + return NULL; + } + } + + if(relationship_type) + { + relates_to->relationship_type = axutil_strdup(env, relationship_type); + if(!(relates_to->relationship_type)) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + axis2_relates_to_free(relates_to, env); + return NULL; + } + } + + return relates_to; +} + +const axis2_char_t *AXIS2_CALL +axis2_relates_to_get_value( + const axis2_relates_to_t * relates_to, + const axutil_env_t * env) +{ + return relates_to->value; +} + +axis2_status_t AXIS2_CALL +axis2_relates_to_set_value( + struct axis2_relates_to * relates_to, + const axutil_env_t * env, + const axis2_char_t * value) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + + if(relates_to->value) + { + AXIS2_FREE(env->allocator, relates_to->value); + } + + if(value) + { + relates_to->value = (axis2_char_t *)axutil_strdup(env, value); + if(!(relates_to->value)) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + return AXIS2_FAILURE; + } + } + + return AXIS2_SUCCESS; +} + +const axis2_char_t *AXIS2_CALL +axis2_relates_to_get_relationship_type( + const axis2_relates_to_t * relates_to, + const axutil_env_t * env) +{ + return relates_to->relationship_type; +} + +axis2_status_t AXIS2_CALL +axis2_relates_to_set_relationship_type( + struct axis2_relates_to * relates_to, + const axutil_env_t * env, + const axis2_char_t * relationship_type) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + + if(relates_to->relationship_type) + { + AXIS2_FREE(env->allocator, relates_to->relationship_type); + } + + if(relationship_type) + { + relates_to->relationship_type = (axis2_char_t *)axutil_strdup(env, relationship_type); + if(!(relates_to->relationship_type)) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + return AXIS2_FAILURE; + } + } + + return AXIS2_SUCCESS; +} + +void AXIS2_CALL +axis2_relates_to_free( + struct axis2_relates_to *relates_to, + const axutil_env_t * env) +{ + AXIS2_ENV_CHECK(env, void); + + if(relates_to->value) + { + AXIS2_FREE(env->allocator, relates_to->value); + } + + if(relates_to->relationship_type) + { + AXIS2_FREE(env->allocator, relates_to->relationship_type); + } + + AXIS2_FREE(env->allocator, relates_to); + + return; +} diff --git a/src/core/addr/svc_name.c b/src/core/addr/svc_name.c new file mode 100644 index 0000000..0aa34ab --- /dev/null +++ b/src/core/addr/svc_name.c @@ -0,0 +1,151 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <axis2_svc_name.h> +#include <axutil_string.h> + +struct axis2_svc_name +{ + + /** service QName */ + axutil_qname_t *qname; + + /** service endpoint name */ + axis2_char_t *endpoint_name; +}; + +axis2_svc_name_t *AXIS2_CALL +axis2_svc_name_create( + const axutil_env_t * env, + const axutil_qname_t * qname, + const axis2_char_t * endpoint_name) +{ + axis2_svc_name_t *svc_name = NULL; + + svc_name = AXIS2_MALLOC(env->allocator, sizeof(axis2_svc_name_t)); + if(!svc_name) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + return NULL; + } + + svc_name->qname = NULL; + svc_name->endpoint_name = NULL; + + if(qname) + { + svc_name->qname = axutil_qname_clone((axutil_qname_t *)qname, env); + if(!(svc_name->qname)) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + axis2_svc_name_free(svc_name, env); + return NULL; + } + } + + if(endpoint_name) + { + svc_name->endpoint_name = axutil_strdup(env, endpoint_name); + if(!(svc_name->endpoint_name)) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + axis2_svc_name_free(svc_name, env); + return NULL; + } + } + + return svc_name; +} + +const axutil_qname_t *AXIS2_CALL +axis2_svc_name_get_qname( + const axis2_svc_name_t * svc_name, + const axutil_env_t * env) +{ + return svc_name->qname; +} + +axis2_status_t AXIS2_CALL +axis2_svc_name_set_qname( + struct axis2_svc_name * svc_name, + const axutil_env_t * env, + const axutil_qname_t * qname) +{ + if(svc_name->qname) + { + axutil_qname_free(svc_name->qname, env); + } + + if(qname) + { + svc_name->qname = axutil_qname_clone((axutil_qname_t *)qname, env); + if(!(svc_name->qname)) + return AXIS2_FAILURE; + } + + return AXIS2_SUCCESS; +} + +const axis2_char_t *AXIS2_CALL +axis2_svc_name_get_endpoint_name( + const axis2_svc_name_t * svc_name, + const axutil_env_t * env) +{ + return svc_name->endpoint_name; +} + +axis2_status_t AXIS2_CALL +axis2_svc_name_set_endpoint_name( + struct axis2_svc_name * svc_name, + const axutil_env_t * env, + const axis2_char_t * endpoint_name) +{ + if(svc_name->endpoint_name) + { + AXIS2_FREE(env->allocator, svc_name->endpoint_name); + } + + if(endpoint_name) + { + svc_name->endpoint_name = axutil_strdup(env, endpoint_name); + if(!(svc_name->endpoint_name)) + return AXIS2_FAILURE; + } + + return AXIS2_SUCCESS; +} + +void AXIS2_CALL +axis2_svc_name_free( + struct axis2_svc_name *svc_name, + const axutil_env_t * env) +{ + if(svc_name->qname) + { + axutil_qname_free(svc_name->qname, env); + } + + if(svc_name->endpoint_name) + { + AXIS2_FREE(env->allocator, svc_name->endpoint_name); + } + + AXIS2_FREE(env->allocator, svc_name); + + return; +} + |