Author: kaushalye
Date: Mon Oct  8 22:07:14 2007
New Revision: 583049

URL: http://svn.apache.org/viewvc?rev=583049&view=rev
Log:
Introducing
1. <wsc:Nonce>
2. <wsc:Length>
3.  <wsc:Offset> tokens
As per the WS-Secure Conversation specification


Added:
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_length.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_nonce.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_offset.c
Modified:
    webservices/rampart/trunk/c/include/oxs_tokens.h

Modified: webservices/rampart/trunk/c/include/oxs_tokens.h
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/oxs_tokens.h?rev=583049&r1=583048&r2=583049&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/oxs_tokens.h (original)
+++ webservices/rampart/trunk/c/include/oxs_tokens.h Mon Oct  8 22:07:14 2007
@@ -502,6 +502,49 @@
         axis2_char_t * id,
         axis2_char_t * algo);
 
+    /**
+     * Creates <wsc:Length> element
+     */
+    AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+    oxs_token_build_length_element(const axutil_env_t *env,
+                                     axiom_node_t *parent,
+                                     axis2_char_t* length_val);
+       /**
+        * Gets value from <wsc:Length> element
+        */
+    AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+    oxs_token_get_length_value(const axutil_env_t *env,
+                           axiom_node_t *length_node);
+    /**
+     * Creates <wsc:Offset> element
+     */
+    AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+    oxs_token_build_offset_element(const axutil_env_t *env,
+                                     axiom_node_t *parent,
+                                     axis2_char_t* offset_val);
+       /**
+        * Gets value from <wsc:Offset> element
+        */
+    AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+    oxs_token_get_offset_value(const axutil_env_t *env,
+                           axiom_node_t *offset_node);
+    /**
+     * Creates <wsc:Nonce> element
+     */
+    AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+    oxs_token_build_nonce_element(const axutil_env_t *env,
+                                     axiom_node_t *parent,
+                                     axis2_char_t* nonce_val);
+       /**
+        * Gets value from <wsc:Nonce> element
+        */
+    AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+    oxs_token_get_nonce_value(const axutil_env_t *env,
+                           axiom_node_t *nonce_node);
+
+
+
+
     /** @} */
 
 #ifdef __cplusplus

Added: webservices/rampart/trunk/c/src/omxmlsec/tokens/token_length.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/tokens/token_length.c?rev=583049&view=auto
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/tokens/token_length.c (added)
+++ webservices/rampart/trunk/c/src/omxmlsec/tokens/token_length.c Mon Oct  8 
22:07:14 2007
@@ -0,0 +1,66 @@
+/*
+ * 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 <stdio.h>
+#include <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_tokens.h>
+#include <axiom_element.h>
+#include <oxs_axiom.h>
+
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+oxs_token_get_length_value(const axutil_env_t *env,
+                           axiom_node_t *length_node)
+{
+    axis2_char_t *value = NULL;
+    value = (axis2_char_t*)oxs_axiom_get_node_content(env, length_node);
+    return value;
+
+}
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_length_element(const axutil_env_t *env,
+                                     axiom_node_t *parent,
+                                     axis2_char_t* length_val
+                                    )
+{
+    axiom_node_t *length_node = NULL;
+    axiom_element_t *length_ele = NULL;
+    axis2_status_t ret;
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create(env, OXS_WSC_NS,
+                                    OXS_WSC);
+
+    length_ele = axiom_element_create(env, parent, OXS_NODE_LENGTH, ns_obj, 
&length_node);
+    if (!length_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error creating %s element", 
OXS_NODE_LENGTH);
+        return NULL;
+    }
+
+    if (length_val)
+    {
+        ret  = axiom_element_set_text(length_ele, env, length_val, 
length_node);
+    }
+
+    return length_node;
+
+}
+

Added: webservices/rampart/trunk/c/src/omxmlsec/tokens/token_nonce.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/tokens/token_nonce.c?rev=583049&view=auto
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/tokens/token_nonce.c (added)
+++ webservices/rampart/trunk/c/src/omxmlsec/tokens/token_nonce.c Mon Oct  8 
22:07:14 2007
@@ -0,0 +1,66 @@
+/*
+ * 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 <stdio.h>
+#include <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_tokens.h>
+#include <axiom_element.h>
+#include <oxs_axiom.h>
+
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+oxs_token_get_nonce_value(const axutil_env_t *env,
+                           axiom_node_t *nonce_node)
+{
+    axis2_char_t *value = NULL;
+    value = (axis2_char_t*)oxs_axiom_get_node_content(env, nonce_node);
+    return value;
+
+}
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_nonce_element(const axutil_env_t *env,
+                                     axiom_node_t *parent,
+                                     axis2_char_t* nonce_val
+                                    )
+{
+    axiom_node_t *nonce_node = NULL;
+    axiom_element_t *nonce_ele = NULL;
+    axis2_status_t ret;
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create(env, OXS_WSC_NS,
+                                    OXS_WSC);
+
+    nonce_ele = axiom_element_create(env, parent, OXS_NODE_NONCE, ns_obj, 
&nonce_node);
+    if (!nonce_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error creating %s element", 
OXS_NODE_NONCE);
+        return NULL;
+    }
+
+    if (nonce_val)
+    {
+        ret  = axiom_element_set_text(nonce_ele, env, nonce_val, nonce_node);
+    }
+
+    return nonce_node;
+
+}
+

Added: webservices/rampart/trunk/c/src/omxmlsec/tokens/token_offset.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/tokens/token_offset.c?rev=583049&view=auto
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/tokens/token_offset.c (added)
+++ webservices/rampart/trunk/c/src/omxmlsec/tokens/token_offset.c Mon Oct  8 
22:07:14 2007
@@ -0,0 +1,66 @@
+/*
+ * 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 <stdio.h>
+#include <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_tokens.h>
+#include <axiom_element.h>
+#include <oxs_axiom.h>
+
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+oxs_token_get_offset_value(const axutil_env_t *env,
+                           axiom_node_t *offset_node)
+{
+    axis2_char_t *value = NULL;
+    value = (axis2_char_t*)oxs_axiom_get_node_content(env, offset_node);
+    return value;
+
+}
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_offset_element(const axutil_env_t *env,
+                                     axiom_node_t *parent,
+                                     axis2_char_t* offset_val
+                                    )
+{
+    axiom_node_t *offset_node = NULL;
+    axiom_element_t *offset_ele = NULL;
+    axis2_status_t ret;
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create(env, OXS_WSC_NS,
+                                    OXS_WSC);
+
+    offset_ele = axiom_element_create(env, parent, OXS_NODE_OFFSET, ns_obj, 
&offset_node);
+    if (!offset_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error creating %s element", 
OXS_NODE_OFFSET);
+        return NULL;
+    }
+
+    if (offset_val)
+    {
+        ret  = axiom_element_set_text(offset_ele, env, offset_val, 
offset_node);
+    }
+
+    return offset_node;
+
+}
+


Reply via email to