summaryrefslogtreecommitdiffstats
path: root/tinyXCAP/include
diff options
context:
space:
mode:
authorbossiel <bossiel@yahoo.fr>2011-08-10 22:59:15 +0000
committerbossiel <bossiel@yahoo.fr>2011-08-10 22:59:15 +0000
commit1ebf5a5fcda0c9154e22ed02404fd46525a7fd9f (patch)
tree4b6214a7142ab1035cb0e47444e88af38e712421 /tinyXCAP/include
downloaddoubango-1.0.zip
doubango-1.0.tar.gz
Move deprecated v1.0 from trunk to branches1.0
Diffstat (limited to 'tinyXCAP/include')
-rw-r--r--tinyXCAP/include/tinyxcap.h38
-rw-r--r--tinyXCAP/include/tinyxcap/txcap_action.h311
-rw-r--r--tinyXCAP/include/tinyxcap/txcap_auid.h159
-rw-r--r--tinyXCAP/include/tinyxcap/txcap_document.h43
-rw-r--r--tinyXCAP/include/tinyxcap/txcap_node.h100
-rw-r--r--tinyXCAP/include/tinyxcap/txcap_selector.h43
-rw-r--r--tinyXCAP/include/tinyxcap_config.h78
-rw-r--r--tinyXCAP/include/txcap.h245
8 files changed, 1017 insertions, 0 deletions
diff --git a/tinyXCAP/include/tinyxcap.h b/tinyXCAP/include/tinyxcap.h
new file mode 100644
index 0000000..5df320d
--- /dev/null
+++ b/tinyXCAP/include/tinyxcap.h
@@ -0,0 +1,38 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+/**@file tinyxcap.h
+ * @brief API functions.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#include "txcap.h"
+
+/* TINYHTTP */
+#include "tinyhttp.h"
+
+#include "tinyxcap/txcap_selector.h"
+#include "tinyxcap/txcap_document.h"
+#include "tinyxcap/txcap_node.h"
+#include "tinyxcap/txcap_action.h"
+
diff --git a/tinyXCAP/include/tinyxcap/txcap_action.h b/tinyXCAP/include/tinyxcap/txcap_action.h
new file mode 100644
index 0000000..0fc892f
--- /dev/null
+++ b/tinyXCAP/include/tinyxcap/txcap_action.h
@@ -0,0 +1,311 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+/**@file txcap_action.h
+ * @brief XCAP actions.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#ifndef TINYXCAP_TXCAP_ACTION_H
+#define TINYXCAP_TXCAP_ACTION_H
+
+#include "tinyxcap_config.h"
+
+#include "txcap.h"
+
+#include "tinyhttp/thttp_action.h"
+
+TXCAP_BEGIN_DECLS
+
+#define TXCAP_MIME_TYPE_ELEMENT "application/xcap-el+xml" /**< as per rfc 4825 subclause 15.2.1 */
+#define TXCAP_MIME_TYPE_ATTRIBUTE "application/xcap-att+xml" /**< as per rfc 4825 subclause 15.2.2 */
+#define TXCAP_MIME_TYPE_NS "application/xcap-ns+xml" /**< as per rfc 4825 subclause 15.2.3 */
+#define TXCAP_MIME_TYPE_ERROR "application/xcap-error+xml" /**< as per rfc 4825 subclause 15.2.4 */
+
+/** List of all supported types.
+*/
+typedef enum txcap_action_type_e
+{
+ txcap_atp_create,
+ txcap_atp_replace,
+ txcap_atp_fetch,
+ txcap_atp_delete
+}
+txcap_action_type_t;
+
+/** List of all supported targets.
+*/
+typedef enum txcap_action_target_e
+{
+ txcap_atg_element,
+ txcap_atg_document,
+ txcap_atg_attribute
+}
+txcap_action_target_t;
+
+/** List of all supported options.
+* To pass an option to the sesion, use @ref TXCAP_ACTION_SET_OPTION() macro.
+*/
+typedef enum txcap_action_option_e
+{
+ TXCAP_ACTION_OPTION_TIMEOUT = THTTP_ACTION_OPTION_TIMEOUT,
+
+ //TXCAP_ACTION_OPTION_*** = 0xFF,
+ //TXCAP_ACTION_OPTION_****,
+}
+txcap_action_option_t;
+
+typedef enum txcap_action_param_type_e
+{
+ txcap_apt_null = 0,
+
+ txcap_apt_option,
+ txcap_apt_header,
+ txcap_apt_payload,
+ txcap_apt_selector,
+ txcap_apt_urlstring
+}
+txcap_action_param_type_t;
+
+/**@ingroup txcap_action_group
+* @def TXCAP_ACTION_SET_OPTION
+* Adds or updates an option.
+* This is a helper macro for @a txcap_action_*() functions.
+* @param ID_INT The id of the option to add/update (@ref txcap_action_option_t).
+* @param VALUE_STR The new value of the option (<i>const char*</i>).
+*
+* @code
+int ret = txcap_action_fetch_document(stack,
+ // action-level options
+ TXCAP_ACTION_SET_OPTION(TXCAP_ACTION_OPTION_TIMEOUT, "6000"),
+ // selector
+ TXCAP_ACTION_SET_SELECTOR("resource-lists",
+ TXCAP_SELECTOR_NODE_SET_NULL()),
+ // ends parameters
+ TXCAP_ACTION_SET_NULL()
+ );
+* @endcode
+*/
+/**@ingroup txcap_action_group
+* @def TXCAP_ACTION_SET_HEADER
+* Adds new XCAP headers to the request.
+* This is a helper macro for @a txcap_action_*() functions.
+* @param NAME_STR The name of the header (<i>const char*</i>).
+* @param VALUE_STR The value of the header (<i>const char*</i>). Should not contains the trailing CRLF.
+*
+* @code
+int ret = txcap_action_fetch_element(stack,
+ // action-level headers
+ TXCAP_ACTION_SET_HEADER("Pragma", "No-Cache"),
+ // selector
+ TXCAP_ACTION_SET_SELECTOR("resource-lists",
+ TXCAP_SELECTOR_NODE_SET_ATTRIBUTE("list", "name", "rcs"),
+ TXCAP_SELECTOR_NODE_SET_NULL()),
+ // ends parameters
+ TXCAP_ACTION_SET_NULL()
+ );
+* @endcode
+*
+* @sa @ref TXCAP_STACK_SET_HEADER
+*/
+/**@ingroup txcap_action_group
+* @def TXCAP_ACTION_SET_PAYLOAD
+* Adds a content (or payload) to the request. You should also add a content-type header by using
+* @ref TXCAP_ACTION_SET_HEADER() macro. You should not add the content-length header.
+* This is a helper macro for @a txcap_action_*() functions.
+* @param PAY_PTR A pointer to the payload (<i>const void*</i>).
+* @param PAY_SIZE The size of the payload (<i>size_t</i>).
+*
+* @code
+const char* PAYLOAD = "....";
+int ret = txcap_action_create_element(stack,
+ // selector
+ TXCAP_ACTION_SET_SELECTOR("resource-lists",
+ TXCAP_SELECTOR_NODE_SET_ATTRIBUTE("list", "name", "newlist"),
+ TXCAP_SELECTOR_NODE_SET_NULL()),
+ // payload
+ TXCAP_ACTION_SET_PAYLOAD(PAYLOAD, strlen(PAYLOAD)),
+ // ends parameters
+ TXCAP_ACTION_SET_NULL()
+ );
+* @endcode
+*/
+/**@ingroup txcap_action_group
+* @def TXCAP_ACTION_SET_SELECTOR
+* Helps building the XCAP Request-URI. You should use @ref TXCAP_ACTION_SET_REQUEST_URI if you want to provide
+* your own URI.
+* @param AUID_STR The AUID (<i>const char*</i>) to use. You should use @ref TXCAP_STACK_SET_AUID macro to register the the AUID
+* if it's missing. This parameter is mandatory.
+* @param ... Node selection steps. You must use @a TXCAP_SELECTOR_NODE_SET_*() macros to set these parameters.
+* MUST always ends with @ref TXCAP_SELECTOR_NODE_SET_NULL.
+*
+* @code
+int ret = txcap_action_fetch_attribute(stack,
+ // action-level options
+ TXCAP_ACTION_SET_OPTION(TXCAP_ACTION_OPTION_TIMEOUT, "6000"),
+ // headers
+ TXCAP_ACTION_SET_HEADER("Pragma", "No-Cache"),
+ // action-level selector
+ TXCAP_ACTION_SET_SELECTOR("resource-lists",
+ TXCAP_SELECTOR_NODE_SET_ATTRIBUTE("list", "name", "rcs"),
+ TXCAP_SELECTOR_NODE_SET_POS("entry", 1),
+ TXCAP_SELECTOR_NODE_SET_NAME("display-name"),
+ TXCAP_SELECTOR_NODE_SET_NULL()),
+ // ends parameters
+ TXCAP_ACTION_SET_NULL()
+ );
+* @endcode
+*
+* @sa @ref TXCAP_ACTION_SET_REQUEST_URI
+*/
+/**@ingroup txcap_action_group
+* @def TXCAP_ACTION_SET_REQUEST_URI
+* Sets the request URI. This macro is useful if you want to provide your own request URI instead of using @ref TXCAP_ACTION_SET_SELECTOR.
+* @param URI_STR Fully Qualified HTTP/HTTPS URI.
+*
+* @code
+const char* PAYLOAD = "....";
+int ret = txcap_action_create_element(stack,
+ // custom Request URI
+ TXCAP_ACTION_SET_REQUEST_URI("http://doubango.org:8080/services/mycustom/uri"),
+ // payload
+ TXCAP_ACTION_SET_PAYLOAD(PAYLOAD, strlen(PAYLOAD)),
+ // ends parameters
+ TXCAP_ACTION_SET_NULL()
+ );
+ getchar();
+* @endcode
+*
+* @sa @ref TXCAP_ACTION_SET_SELECTOR
+*/
+/**@ingroup txcap_action_group
+* @def TXCAP_ACTION_SET_NULL
+* Ends action parameters. Must always be the last one.
+*/
+#define TXCAP_ACTION_SET_OPTION(ID_INT, VALUE_STR) txcap_apt_option, (thttp_action_option_t)ID_INT, (const char*)VALUE_STR
+#define TXCAP_ACTION_SET_HEADER(NAME_STR, VALUE_STR) txcap_apt_header, (const char*)NAME_STR, (const char*)VALUE_STR
+#define TXCAP_ACTION_UNSET_HEADER(NAME_STR) TXCAP_ACTION_SET_HEADER(NAME_STR, (const char*)-1)
+#define TXCAP_ACTION_SET_PAYLOAD(PAY_PTR, PAY_SIZE) txcap_apt_payload, (const void*)PAY_PTR, (size_t)PAY_SIZE
+#define TXCAP_ACTION_SET_SELECTOR(AUID_STR, ...) txcap_apt_selector, (const char*)AUID_STR, ##__VA_ARGS__
+#define TXCAP_ACTION_SET_REQUEST_URI(URI_STR) txcap_apt_urlstring, (const char*)URI_STR
+#define TXCAP_ACTION_SET_NULL() txcap_apt_null
+
+
+/**@ingroup txcap_action_group
+* @def txcap_action_create_element
+* Creates new element by sending a <i>HTTP/HTTPS PUT</i> request.
+* The default Content-Type will be "application/xcap-el+xml", unless you provide your own Content-Type by using @ref TXCAP_ACTION_SET_HEADER().
+* @param stack The HTTP/HTTPS stack created using @ref txcap_stack_create().
+* @param ... Any @a TXCAP_ACTION_SET_*() macros. MUST ends with @ref TXCAP_ACTION_SET_NULL().
+*/
+/**@ingroup txcap_action_group
+* @def txcap_action_create_document
+* Creates new document by sending a <i>HTTP/HTTPS PUT</i> request.
+* The default Content-Type will be the one associated with the AUID of the document, unless you provide your own Content-Type by using @ref TXCAP_ACTION_SET_HEADER().
+* @param stack The HTTP/HTTPS stack created using @ref txcap_stack_create().
+* @param ... Any @a TXCAP_ACTION_SET_*() macros. MUST ends with @ref TXCAP_ACTION_SET_NULL().
+*/
+/**@ingroup txcap_action_group
+* @def txcap_action_create_attribute
+* Creates new attribute by sending a <i>HTTP/HTTPS PUT</i> request.
+* The default Content-Type will be "application/xcap-att+xml", unless you provide your own Content-Type by using @ref TXCAP_ACTION_SET_HEADER().
+* @param stack The HTTP/HTTPS stack created using @ref txcap_stack_create().
+* @param ... Any @a TXCAP_ACTION_SET_*() macros. MUST ends with @ref TXCAP_ACTION_SET_NULL().
+*/
+/**@ingroup txcap_action_group
+* @def txcap_action_replace_element
+* Replaces an element by sending a <i>HTTP/HTTPS PUT</i> request.
+* The default Content-Type will be "application/xcap-el+xml", unless you provide your own Content-Type by using @ref TXCAP_ACTION_SET_HEADER().
+* @param stack The HTTP/HTTPS stack created using @ref txcap_stack_create().
+* @param ... Any @a TXCAP_ACTION_SET_*() macros. MUST ends with @ref TXCAP_ACTION_SET_NULL().
+*/
+/**@ingroup txcap_action_group
+* @def txcap_action_replace_document
+* Replaces a document by sending a <i>HTTP/HTTPS PUT</i> request.
+* The default Content-Type will be the one associated with the AUID of the document, unless you provide your own Content-Type by using @ref TXCAP_ACTION_SET_HEADER().
+* @param stack The HTTP/HTTPS stack created using @ref txcap_stack_create().
+* @param ... Any @a TXCAP_ACTION_SET_*() macros. MUST ends with @ref TXCAP_ACTION_SET_NULL().
+*/
+/**@ingroup txcap_action_group
+* @def txcap_action_replace_attribute
+* Replaces an attribute by sending a <i>HTTP/HTTPS PUT</i> request.
+* The default Content-Type will be "application/xcap-att+xml", unless you provide your own Content-Type by using @ref TXCAP_ACTION_SET_HEADER().
+* @param stack The HTTP/HTTPS stack created using @ref txcap_stack_create().
+* @param ... Any @a TXCAP_ACTION_SET_*() macros. MUST ends with @ref TXCAP_ACTION_SET_NULL().
+*/
+/**@ingroup txcap_action_group
+* @def txcap_action_fetch_element
+* Retrieves an element from the XDMS by sending a <i>HTTP/HTTPS GET</i> request.
+* The default Content-Type will be "application/xcap-el+xml", unless you provide your own Content-Type by using @ref TXCAP_ACTION_SET_HEADER().
+* @param stack The HTTP/HTTPS stack created using @ref txcap_stack_create().
+* @param ... Any @a TXCAP_ACTION_SET_*() macros. MUST ends with @ref TXCAP_ACTION_SET_NULL().
+*/
+/**@ingroup txcap_action_group
+* @def txcap_action_fetch_document
+* Retrieves a document from the XDMS sending a <i>HTTP/HTTPS GET</i> request.
+* The default Content-Type will be the one associated with the AUID of the document, unless you provide your own Content-Type by using @ref TXCAP_ACTION_SET_HEADER().
+* @param stack The HTTP/HTTPS stack created using @ref txcap_stack_create().
+* @param ... Any @a TXCAP_ACTION_SET_*() macros. MUST ends with @ref TXCAP_ACTION_SET_NULL().
+*/
+/**@ingroup txcap_action_group
+* @def txcap_action_fetch_attribute
+* Retrieves an attribute from the XDMS by sending a <i>HTTP/HTTPS GET</i> request.
+* The default Content-Type will be "application/xcap-att+xml", unless you provide your own Content-Type by using @ref TXCAP_ACTION_SET_HEADER().
+* @param stack The HTTP/HTTPS stack created using @ref txcap_stack_create().
+* @param ... Any @a TXCAP_ACTION_SET_*() macros. MUST ends with @ref TXCAP_ACTION_SET_NULL().
+*/
+/**@ingroup txcap_action_group
+* @def txcap_action_delete_element
+* Deletes an element from the XDMS by sending a <i>HTTP/HTTPS DELETE</i> request.
+* @param stack The HTTP/HTTPS stack created using @ref txcap_stack_create().
+* @param ... Any @a TXCAP_ACTION_SET_*() macros. MUST ends with @ref TXCAP_ACTION_SET_NULL().
+*/
+/**@ingroup txcap_action_group
+* @def txcap_action_delete_document
+* Deletes a document from the XDMS sending a <i>HTTP/HTTPS DELETE</i> request.
+* @param stack The HTTP/HTTPS stack created using @ref txcap_stack_create().
+* @param ... Any @a TXCAP_ACTION_SET_*() macros. MUST ends with @ref TXCAP_ACTION_SET_NULL().
+*/
+/**@ingroup txcap_action_group
+* @def txcap_action_delete_attribute
+* Deletes an attribute from the XDMS by sending a <i>HTTP/HTTPS DELETE</i> request.
+* @param stack The HTTP/HTTPS stack created using @ref txcap_stack_create().
+* @param ... Any @a TXCAP_ACTION_SET_*() macros. MUST ends with @ref TXCAP_ACTION_SET_NULL().
+*/
+TINYXCAP_API int txcap_action_perform(txcap_stack_handle_t* stack, txcap_action_type_t type, txcap_action_target_t target, ...);
+#define txcap_action_create_element(stack, ...) txcap_action_perform(stack, txcap_atp_create, txcap_atg_element, __VA_ARGS__)
+#define txcap_action_create_document(stack, ...) txcap_action_perform(stack, txcap_atp_create, txcap_atg_document, __VA_ARGS__)
+#define txcap_action_create_attribute(stack, ...) txcap_action_perform(stack, txcap_atp_create, txcap_atg_attribute, __VA_ARGS__)
+#define txcap_action_replace_element(stack, ...) txcap_action_perform(stack, txcap_atp_replace, txcap_atg_element, __VA_ARGS__)
+#define txcap_action_replace_document(stack, ...) txcap_action_perform(stack, txcap_atp_replace, txcap_atg_document, __VA_ARGS__)
+#define txcap_action_replace_attribute(stack, ...) txcap_action_perform(stack, txcap_atp_replace, txcap_atg_attribute, __VA_ARGS__)
+#define txcap_action_fetch_element(stack, ...) txcap_action_perform(stack, txcap_atp_fetch, txcap_atg_element, __VA_ARGS__)
+#define txcap_action_fetch_document(stack, ...) txcap_action_perform(stack, txcap_atp_fetch, txcap_atg_document, __VA_ARGS__)
+#define txcap_action_fetch_attribute(stack, ...) txcap_action_perform(stack, txcap_atp_fetch, txcap_atg_attribute, __VA_ARGS__)
+#define txcap_action_delete_element(stack, ...) txcap_action_perform(stack, txcap_atp_delete, txcap_atg_element, __VA_ARGS__)
+#define txcap_action_delete_document(stack, ...) txcap_action_perform(stack, txcap_atp_delete, txcap_atg_document, __VA_ARGS__)
+#define txcap_action_delete_attribute(stack, ...) txcap_action_perform(stack, txcap_atp_delete, txcap_atg_attribute, __VA_ARGS__)
+
+TXCAP_END_DECLS
+
+#endif /* TINYXCAP_TXCAP_ACTION_H */
diff --git a/tinyXCAP/include/tinyxcap/txcap_auid.h b/tinyXCAP/include/tinyxcap/txcap_auid.h
new file mode 100644
index 0000000..735a5a9
--- /dev/null
+++ b/tinyXCAP/include/tinyxcap/txcap_auid.h
@@ -0,0 +1,159 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+/**@file txcap_auid.h
+ * @brief XCAP AUID manager.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#ifndef TINYXCAP_TXCAP_AUID_H
+#define TINYXCAP_TXCAP_AUID_H
+
+#include "tinyxcap_config.h"
+
+#include "tsk_list.h"
+
+TXCAP_BEGIN_DECLS
+
+/*== xcap-caps ==*/
+#define TXCAP_AUID_IETF_XCAP_CAPS_ID "xcap-caps"
+#define TXCAP_AUID_IETF_XCAP_CAPS_MIME_TYPE "application/xcap-caps+xml"
+#define TXCAP_AUID_IETF_XCAP_CAPS_NS "urn:ietf:params:xml:ns:xcap-caps"
+#define TXCAP_AUID_IETF_XCAP_CAPS_DOC "index"
+
+/*== resource-lists ==*/
+#define TXCAP_AUID_IETF_RESOURCE_LISTS_ID "resource-lists"
+#define TXCAP_AUID_IETF_RESOURCE_LISTS_MIME_TYPE "application/resource-lists+xml"
+#define TXCAP_AUID_IETF_RESOURCE_LISTS_NS "urn:ietf:params:xml:ns:resource-lists"
+#define TXCAP_AUID_IETF_RESOURCE_LISTS_DOC "index"
+
+/*== rls-services ==*/
+#define TXCAP_AUID_IETF_RLS_SERVICES_ID "rls-services"
+#define TXCAP_AUID_IETF_RLS_SERVICES_MIME_TYPE "application/rls-services+xml"
+#define TXCAP_AUID_IETF_RLS_SERVICES_NS "urn:ietf:params:xml:ns:resource-lists"
+#define TXCAP_AUID_IETF_RLS_SERVICES_DOC "index"
+
+/*== pres-rules ==*/
+#define TXCAP_AUID_IETF_PRES_RULES_ID "pres-rules"
+#define TXCAP_AUID_IETF_PRES_RULES_MIME_TYPE "application/auth-policy+xml"
+#define TXCAP_AUID_IETF_PRES_RULES_NS "urn:ietf:params:xml:ns:pres-rules"
+#define TXCAP_AUID_IETF_PRES_RULES_DOC "index"
+
+/*== pidf-manipulation ==*/
+#define TXCAP_AUID_IETF_PIDF_MANIPULATION_ID "pidf-manipulation"
+#define TXCAP_AUID_IETF_PIDF_MANIPULATION_MIME_TYPE "application/pidf+xml"
+#define TXCAP_AUID_IETF_PIDF_MANIPULATION_NS "urn:ietf:params:xml:ns:pidf"
+#define TXCAP_AUID_IETF_PIDF_MANIPULATION_DOC "index"
+
+/*== org.openmobilealliance.pres-rules ==*/
+#define TXCAP_AUID_OMA_PRES_RULES_ID "org.openmobilealliance.pres-rules"
+#define TXCAP_AUID_OMA_PRES_RULES_MIME_TYPE "application/auth-policy+xml"
+#define TXCAP_AUID_OMA_PRES_RULES_NS "urn:ietf:params:xml:ns:common-policy"
+#define TXCAP_AUID_OMA_PRES_RULES_DOC "pres-rules"
+
+/*== directory ==*/
+#define TXCAP_AUID_IETF_DIRECTORY_ID "directory"
+#define TXCAP_AUID_IETF_DIRECTORY_MIME_TYPE "application/directory+xml"
+#define TXCAP_AUID_IETF_DIRECTORY_NS "urn:ietf:params:xml:ns:xcap-directory"
+#define TXCAP_AUID_IETF_DIRECTORY_DOC "directory.xml"
+
+/*== org.openmobilealliance.xcap-directory ==*/
+#define TXCAP_AUID_OMA_DIRECTORY_ID "org.openmobilealliance.xcap-directory"
+#define TXCAP_AUID_OMA_DIRECTORY_MIME_TYPE "application/vnd.oma.xcap-directory+xml"
+#define TXCAP_AUID_OMA_DIRECTORY_NS "urn:oma:xml:xdm:xcap-directory"
+#define TXCAP_AUID_OMA_DIRECTORY_DOC "directory.xml"
+
+/*== org.openmobilealliance.pres-content ==*/
+#define TXCAP_AUID_OMA_PRES_CONTENT_ID "org.openmobilealliance.pres-content"
+#define TXCAP_AUID_OMA_PRES_CONTENT_MIME_TYPE "application/vnd.oma.pres-content+xml"
+#define TXCAP_AUID_OMA_PRES_CONTENT_NS "urn:oma:xml:prs:pres-content"
+#define TXCAP_AUID_OMA_PRES_CONTENT_DOC "oma_status-icon/rcs_status_icon"
+
+/*== org.openmobilealliance.conv-history ==*/
+#define TXCAP_AUID_OMA_CONV_HISTORY_ID "org.openmobilealliance.conv-history"
+#define TXCAP_AUID_OMA_CONV_HISTORY_MIME_TYPE "application/vnd.oma.im.history-list+xml"
+#define TXCAP_AUID_OMA_CONV_HISTORY_NS "urn:oma:xml:im:history-list"
+#define TXCAP_AUID_OMA_CONV_HISTORY_DOC "conv-history"
+
+/*== org.openmobilealliance.deferred-list ==*/
+#define TXCAP_AUID_OMA_DEFERRED_LIST_ID "org.openmobilealliance.deferred-list"
+#define TXCAP_AUID_OMA_DEFERRED_LIST_MIME_TYPE "application/vnd.oma.im.deferred-list+xml"
+#define TXCAP_AUID_OMA_DEFERRED_LIST_NS "urn:oma:xml:im:history-list"
+#define TXCAP_AUID_OMA_DEFERRED_LIST_DOC "deferred-list"
+
+/*== org.openmobilealliance.group-usage-list ==*/
+#define TXCAP_AUID_OMA_SHARED_GROUPS_ID "org.openmobilealliance.group-usage-list"
+#define TXCAP_AUID_OMA_SHARED_GROUPS_MIME_TYPE "application/vnd.oma.group-usage-list+xml"
+#define TXCAP_AUID_OMA_SHARED_GROUPS_NS "urn:ietf:params:xml:ns:resource-lists"
+#define TXCAP_AUID_OMA_SHARED_GROUPS_DOC "index"
+
+
+/** List of supported AUIDs.
+*/
+typedef enum txcap_auid_type_e
+{
+ tauid_dummy, /**< any auid */
+
+ tauid_ietf_xcap_caps, /**< xcap-caps */
+ tauid_ietf_resource_lists, /**< resource-lists */
+ tauid_ietf_rls_services, /**< rls-services */
+ tauid_ietf_pres_rules, /**< pres-rules */
+ tauid_ietf_directory, /**< directory */
+
+ tauid_oma_conv_history, /**< org.openmobilealliance.conv-history */
+ tauid_oma_pres_rules, /**< org.openmobilealliance.pres-rules */
+ tauid_oma_directory, /**< org.openmobilealliance.xcap-directory */
+ tauid_oma_deferred_list, /**< org.openmobilealliance.deferred-list */
+ tauid_oma_pres_content, /**< org.openmobilealliance.pres-content*/
+ tauid_oma_shared_groups /**< org.openmobilealliance.group-usage-list */
+}
+txcap_auid_type_t;
+
+/** XCAP AUID.
+*/
+typedef struct txcap_auid_s
+{
+ TSK_DECLARE_OBJECT;
+
+ txcap_auid_type_t type;
+ char* id; /**< The id of the AUID (e.g. 'xcap-caps' or 'rls-services' or 'resource-lists' or ...)*/
+ char* mime_type; /**< The default MIME-type of the document associated to this auid. */
+ char* ns; /**< The namespace associated to this auid. */
+ char* document_name; /**< The default name of the document associated to this auid. */
+ tsk_bool_t global; /**< Indicates the auid scope. */
+}
+txcap_auid_t;
+
+typedef tsk_list_t txcap_auids_L_t;
+
+TINYXCAP_API int txcap_auid_register(txcap_auids_L_t* auids, const char* id, const char* mime_type, const char* ns, const char* document_name, tsk_bool_t is_global);
+txcap_auid_t* txcap_auid_get_by_id(txcap_auids_L_t* auids, const char* id);
+int txcap_auids_init(txcap_auids_L_t** auids);
+
+
+TINYXCAP_GEXTERN const tsk_object_def_t *txcap_auid_def_t;
+
+TXCAP_END_DECLS
+
+#endif // TINYXCAP_TXCAP_AUID_H
+
diff --git a/tinyXCAP/include/tinyxcap/txcap_document.h b/tinyXCAP/include/tinyxcap/txcap_document.h
new file mode 100644
index 0000000..88fe2b0
--- /dev/null
+++ b/tinyXCAP/include/tinyxcap/txcap_document.h
@@ -0,0 +1,43 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+/**@file txcap_document.h
+ * @brief XCAP documents.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#ifndef TINYXCAP_TXCAP_DOCUMENT_H
+#define TINYXCAP_TXCAP_DOCUMENT_H
+
+#include "tinyxcap_config.h"
+
+#include "txcap.h"
+
+TXCAP_BEGIN_DECLS
+
+TINYXCAP_API char* txcap_selector_get_document(const txcap_stack_handle_t* stack, const char* auid_id);
+TINYXCAP_API char* txcap_selector_get_document_2(const char* xcap_root, const char* auid_id, const char* xui, const char* doc_name);
+
+TXCAP_END_DECLS
+
+#endif /* TINYXCAP_TXCAP_DOCUMENT_H */
diff --git a/tinyXCAP/include/tinyxcap/txcap_node.h b/tinyXCAP/include/tinyxcap/txcap_node.h
new file mode 100644
index 0000000..e1e8603
--- /dev/null
+++ b/tinyXCAP/include/tinyxcap/txcap_node.h
@@ -0,0 +1,100 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+/**@file txcap_node.h
+ * @brief XCAP nodes.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#ifndef TINYXCAP_TXCAP_NODE_H
+#define TINYXCAP_TXCAP_NODE_H
+
+#include "tinyxcap_config.h"
+
+#include "tsk_common.h"
+
+#include <stdarg.h> /* va_list* */
+
+TXCAP_BEGIN_DECLS
+
+typedef enum txcap_selector_param_type_e
+{
+ xcapp_node_null = 0,
+
+ xcapp_node_name,
+ xcapp_node_pos,
+ xcapp_node_attribute,
+ xcapp_node_pos_n_attribute,
+ xcapp_node_namespace
+}
+txcap_selector_param_type_t;
+
+/**@ingroup txcap_selector_group
+* @def TXCAP_SELECTOR_NODE_SET_NAME
+* Node selection step. Selects by name as per <a href="http://tools.ietf.org/html/rfc4825#section-6.3">RFC 4825 subclause 6.3</a>.
+* @param QNAME_STR The name of the node to select. The @a QName grammar is defined in the XML namespaces [<a href="http://tools.ietf.org/html/rfc4825#ref-3">3</a>] specification (<i>const char*</i>).
+*/
+/**@ingroup txcap_selector_group
+* @def TXCAP_SELECTOR_NODE_SET_POS
+* Node selection step. Selects by position as per <a href="http://tools.ietf.org/html/rfc4825#section-6.3">RFC 4825 subclause 6.3</a>.
+* @param QNAME_STR The name of the node to select. The @a QName grammar is defined in the XML namespaces [<a href="http://tools.ietf.org/html/rfc4825#ref-3">3</a>] specification.
+* @param POS_UINT The position of the node to select (1*DIGIT) (<i>unsigned int</i>).
+*/
+/**@ingroup txcap_selector_group
+* @def TXCAP_SELECTOR_NODE_SET_ATTRIBUTE
+* Node selection step. Selects by position and attribute as per <a href="http://tools.ietf.org/html/rfc4825#section-6.3">RFC 4825 subclause 6.3</a>.
+* @param QNAME_STR The name of the node to select. The @a QName grammar is defined in the XML namespaces [<a href="http://tools.ietf.org/html/rfc4825#ref-3">3</a>] specification (<i>const char*</i>).
+* @param ATT_QNAME_STR The name of the attribute (<i>const char*</i>).
+* @param ATT_VALUE_STR The value of the attribute. @a AttValue grammar is defined in the XML specification XML 1.0 [<a href="http://tools.ietf.org/html/rfc4825#ref-1">1</a>] (<i>const char*</i>).
+*/
+/**@ingroup txcap_selector_group
+* @def TXCAP_SELECTOR_NODE_SET_POS_ATTRIBUTE
+* Node selection step. Selects by position and attribute as per <a href="http://tools.ietf.org/html/rfc4825#section-6.3">RFC 4825 subclause 6.3</a>.
+* @param QNAME_STR The name of the node to select. The @a QName grammar is defined in the XML namespaces [<a href="http://tools.ietf.org/html/rfc4825#ref-3">3</a>] specification.
+* @param POS_UINT The position of the node to select (1*DIGIT) (<i>unsigned int</i>).
+* @param ATT_QNAME_STR The name of the attribute (<i>const char*</i>).
+* @param ATT_VALUE_STR The value of the attribute. @a AttValue grammar is defined in the XML specification XML 1.0 [<a href="http://tools.ietf.org/html/rfc4825#ref-1">1</a>] (<i>const char*</i>).
+*/
+/**@ingroup txcap_selector_group
+* @def TXCAP_SELECTOR_NODE_SET_NAMESPACE
+* Node selection step. Appends XML namespace("namespace::*") as per <a href="http://tools.ietf.org/html/rfc4825#section-6.3">RFC 4825 subclause 6.3</a>.
+* @param PREFIX_STR The prefix to use for this namespace (<i>const char*</i>).
+* @param VALUE_STR The value of the namespace (<i>const char*</i>).
+*/
+/**@ingroup txcap_selector_group
+* @def TXCAP_SELECTOR_NODE_SET_NULL
+* Ends node selection steps. Must always be present and should be the last one.
+*/
+#define TXCAP_SELECTOR_NODE_SET_NAME(QNAME_STR) xcapp_node_name, (const char*)QNAME_STR
+#define TXCAP_SELECTOR_NODE_SET_POS(QNAME_STR, POS_UINT) xcapp_node_pos, (const char*)QNAME_STR, (unsigned int)POS_UINT
+#define TXCAP_SELECTOR_NODE_SET_ATTRIBUTE(QNAME_STR, ATT_QNAME_STR, ATT_VALUE_STR) xcapp_node_attribute, (const char*)QNAME_STR, (const char*)ATT_QNAME_STR, (const char*)ATT_VALUE_STR
+#define TXCAP_SELECTOR_NODE_SET_POS_ATTRIBUTE(QNAME_STR, POS_UINT, ATT_QNAME_STR, ATT_VALUE_STR) xcapp_node_pos_n_attribute, (const char*)QNAME_STR, (unsigned int)POS_UINT, (const char*)ATT_QNAME_STR, (const char*)ATT_VALUE_STR
+#define TXCAP_SELECTOR_NODE_SET_NAMESPACE(PREFIX_STR, VALUE_STR) xcapp_node_namespace, (const char*)PREFIX_STR, (const char*)VALUE_STR
+#define TXCAP_SELECTOR_NODE_SET_NULL() xcapp_node_null
+
+TINYXCAP_API char* txcap_selector_get_node(const char* auid_id, ...);
+TINYXCAP_API char* txcap_selector_get_node_2(const char* auid_id, va_list* app);
+
+TXCAP_END_DECLS
+
+#endif /* TINYXCAP_TXCAP_NODE_H */
diff --git a/tinyXCAP/include/tinyxcap/txcap_selector.h b/tinyXCAP/include/tinyxcap/txcap_selector.h
new file mode 100644
index 0000000..e10bd4b
--- /dev/null
+++ b/tinyXCAP/include/tinyxcap/txcap_selector.h
@@ -0,0 +1,43 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+/**@file txcap_selector.h
+ * @brief XCAP selector.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#ifndef TINYXCAP_TXCAP_SELECTOR_H
+#define TINYXCAP_TXCAP_SELECTOR_H
+
+#include "tinyxcap_config.h"
+
+#include "txcap.h"
+
+TXCAP_BEGIN_DECLS
+
+TINYXCAP_API char* txcap_selector_get_url(const txcap_stack_handle_t* stack, const char* auid_id, ...);
+TINYXCAP_API char* txcap_selector_get_url_2(const char* xcap_root, const char* auid_id, const char* xui, const char* doc_name, ...);
+
+TXCAP_END_DECLS
+
+#endif /* TINYXCAP_TXCAP_SELECTOR_H */
diff --git a/tinyXCAP/include/tinyxcap_config.h b/tinyXCAP/include/tinyxcap_config.h
new file mode 100644
index 0000000..5e29b21
--- /dev/null
+++ b/tinyXCAP/include/tinyxcap_config.h
@@ -0,0 +1,78 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+
+#ifndef TINYXCAP_CONFIG_H
+#define TINYXCAP_CONFIG_H
+
+#ifdef __SYMBIAN32__
+#undef _WIN32 /* Because of WINSCW */
+#endif
+
+/* Windows (XP/Vista/7/CE and Windows Mobile) macro definition.
+*/
+#if defined(WIN32)|| defined(_WIN32) || defined(_WIN32_WCE)
+# define TXCAP_UNDER_WINDOWS 1
+#endif
+
+#if (TXCAP_UNDER_WINDOWS || defined(__SYMBIAN32__)) && defined(TINYXCAP_EXPORTS)
+# define TINYXCAP_API __declspec(dllexport)
+# define TINYXCAP_GEXTERN __declspec(dllexport)
+#elif (TXCAP_UNDER_WINDOWS || defined(__SYMBIAN32__)) /*&& defined(TINYXCAP_IMPORTS)*/
+# define TINYXCAP_API __declspec(dllimport)
+# define TINYXCAP_GEXTERN __declspec(dllimport)
+#else
+# define TINYXCAP_API
+# define TINYXCAP_GEXTERN extern
+#endif
+
+/* Guards against C++ name mangling
+*/
+#ifdef __cplusplus
+# define TXCAP_BEGIN_DECLS extern "C" {
+# define TXCAP_END_DECLS }
+#else
+# define TXCAP_BEGIN_DECLS
+# define TXCAP_END_DECLS
+#endif
+
+/* Disable some well-known warnings
+*/
+#ifdef _MSC_VER
+# define _CRT_SECURE_NO_WARNINGS
+#endif
+
+/* Detecting C99 compilers
+ */
+#if (__STDC_VERSION__ == 199901L) && !defined(__C99__)
+# define __C99__
+#endif
+
+#include <stdint.h>
+#ifdef __SYMBIAN32__
+#include <stdlib.h>
+#endif
+
+#if HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#endif // TINYXCAP_CONFIG_H
diff --git a/tinyXCAP/include/txcap.h b/tinyXCAP/include/txcap.h
new file mode 100644
index 0000000..8d6d503
--- /dev/null
+++ b/tinyXCAP/include/txcap.h
@@ -0,0 +1,245 @@
+/*
+* Copyright (C) 2009-2010 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+/**@file txcap.h
+ * @brief RFC 4825 (XCAP) implementation.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#ifndef TINYXCAP_TXCAP_H
+#define TINYXCAP_TXCAP_H
+
+#include "tinyxcap_config.h"
+
+#include "tinyxcap/txcap_auid.h"
+
+#include "tsk_options.h"
+
+#include "tinyhttp.h"
+
+TXCAP_BEGIN_DECLS
+
+typedef enum txcap_stack_option_e
+{
+ //! request timeout
+ TXCAP_STACK_OPTION_TIMEOUT,
+ //! time to live
+ TXCAP_STACK_OPTION_TTL,
+
+ //! xcap-root
+ TXCAP_STACK_OPTION_ROOT,
+ //! user's password
+ TXCAP_STACK_OPTION_PASSWORD,
+ //! xcap user indentifier (e.g. sip:bob@example.com)
+ TXCAP_STACK_OPTION_XUI,
+ //! local ip address
+ TXCAP_STACK_OPTION_LOCAL_IP,
+ //! local port
+ TXCAP_STACK_OPTION_LOCAL_PORT,
+}
+txcap_stack_option_t;
+
+typedef enum txcap_stack_param_type_e
+{
+ xcapp_null = 0,
+
+ xcapp_option,
+ xcapp_header,
+ xcapp_userdata,
+ xcapp_auid,
+}
+txcap_stack_param_type_t;
+
+/* For systems that support SIP applications, it is
+ RECOMMENDED that the XUI be equal to the Address-of-Record (AOR) for
+ the user (i.e., sip:joe@example.com) */
+
+/**@ingroup txcap_stack_group
+* @def TXCAP_STACK_SET_OPTION
+* Adds or updates an option.
+* This is a helper macro for @ref txcap_stack_create() and @ref txcap_stack_set().
+* @param ID_ENUM The id of the option to add/update (@ref txcap_stack_option_t).
+* @param VALUE_STR The new value of the option (<i>const char*</i>).
+*
+* @code
+int ret = txcap_stack_set(stack,
+ // stack-level options
+ TXCAP_STACK_SET_OPTION(TXCAP_STACK_OPTION_TIMEOUT, "6000"),
+ TXCAP_STACK_SET_NULL());
+* @endcode
+*/
+/**@ingroup txcap_stack_group
+* @def TXCAP_STACK_SET_PASSWORD
+* Sets or updates the user's password.
+* @param PASSWORD_STR The new password (<i>const char*</i>).
+*
+* @code
+int ret = txcap_stack_set(stack,
+ TXCAP_STACK_SET_PASSWORD("mysecret"),
+ TXCAP_STACK_SET_NULL());
+* @endcode
+*
+* @sa @ref TXCAP_STACK_OPTION_PASSWORD
+*/
+/**@ingroup txcap_stack_group
+* @def TXCAP_STACK_SET_ROOT
+* Sets or updates the xcap-root Url.
+* @param XCAP_ROOT_STR A valid Http Url(<i>const char*</i>).
+*
+* @code
+int ret = txcap_stack_set(stack,
+ TXCAP_STACK_SET_ROOT("http://192.168.0.10:8080/services"),
+ TXCAP_STACK_SET_NULL());
+* @endcode
+*
+* @sa @ref TXCAP_STACK_OPTION_ROOT
+*/
+/**@ingroup txcap_stack_group
+* @def TXCAP_STACK_SET_XUI
+* Sets or updates the user's identifier.
+* @param XUI_STR The new identifier (<i>const char*</i>).For systems that support SIP applications, it is
+* RECOMMENDED that the XUI be equal to the Address-of-Record (AOR) for the user (i.e., sip:bob@example.com).
+*
+* @code
+int ret = txcap_stack_set(stack,
+ TXCAP_STACK_SET_XUI("sip:bob@example.com"),
+ TXCAP_STACK_SET_NULL());
+* @endcode
+*
+* @sa @ref TXCAP_STACK_OPTION_PASSWORD
+*/
+/**@ingroup txcap_stack_group
+* @def TXCAP_STACK_SET_LOCAL_IP
+*/
+/**@ingroup txcap_stack_group
+* @def TXCAP_STACK_SET_LOCAL_PORT
+*/
+/**@ingroup txcap_stack_group
+* @def TXCAP_STACK_SET_HEADER
+* Adds new stack-level HTTP header. This header will be added to all outgoing requests.
+* If you want that the header only appear in the current outgoing request, then you should use
+* @ref TXCAP_ACTION_SET_HEADER().
+* @param NAME_STR The name of the header.
+* @param VALUE_STR The value of the header. Will be added "as is".
+*
+* @code
+int ret = txcap_stack_set(stack,
+ TXCAP_STACK_SET_HEADER("User-Agent", "XDM-client/OMA1.1"),
+ TXCAP_STACK_SET_NULL());
+* @endcode
+*
+* @sa @ref TXCAP_ACTION_SET_HEADER(), @ref TXCAP_STACK_UNSET_HEADER()
+*/
+/**@ingroup txcap_stack_group
+* @def TXCAP_STACK_UNSET_HEADER
+* Removes a stack-level HTTP header.
+* @param NAME_STR The name of the header.
+*
+* @code
+int ret = txcap_stack_set(stack,
+ TXCAP_STACK_UNSET_HEADER("User-Agent"),
+ TXCAP_STACK_SET_NULL());
+* @endcode
+*
+* @sa @ref TXCAP_ACTION_UNSET_HEADER(), @ref TXCAP_ACTION_SET_HEADER()
+*/
+/**@ingroup txcap_stack_group
+* @def TXCAP_STACK_SET_CONTEXT
+* Sets or updates the user's context. The context will be returned to the application layer
+* throught the callback function.
+* @param CTX_PTR A pointer to the context (<i>const void*</i>).
+*
+* @code
+const struct application_s context;
+int ret = txcap_stack_set(stack,
+ TXCAP_STACK_SET_CONTEXT(&context),
+ TXCAP_STACK_SET_NULL());
+* @endcode
+*/
+/**@ingroup txcap_stack_group
+* @def TXCAP_STACK_SET_AUID
+* Register or update an AUID.
+* @param ID_STR The identifier associated to this aplication usage (e.g. "xcap-caps").
+* @param MIME_TYPE_STR The mime-type (e.g. "application/xcap-caps+xml").
+* @param NS_STR The namespace (e.g. "urn:ietf:params:xml:ns:xcap-caps").
+* @param DOC_NAME_STR The document name (e.g. "index").
+* @param IS_GLOBAL_BOOL The scope (@a tsk_true or @a tsk_false).
+*
+* @code
+// the code below shows how to register two new AUIDs
+int ret = txcap_stack_set(stack,
+ TXCAP_STACK_SET_AUID("my-xcap-caps", "application/my-xcap-caps+xml", "urn:ietf:params:xml:ns:my-xcap-caps", "my-document", tsk_true),
+ TXCAP_STACK_SET_AUID("my-resource-lists", "application/my-resource-lists+xml", "urn:ietf:params:xml:ns:my-resource-lists", "my-document", tsk_false),
+ TXCAP_STACK_SET_NULL());
+* @endcode
+*/
+/**@ingroup txcap_stack_group
+* @def TXCAP_STACK_SET_NULL
+* Ends the stack parameters. Mandatory and should be the last one.
+*/
+
+#define TXCAP_STACK_SET_OPTION(ID_ENUM, VALUE_STR) xcapp_option, (txcap_stack_option_t)ID_ENUM, (const char*)VALUE_STR
+#define TXCAP_STACK_SET_TIMEOUT(TIMEOUT_STR) TXCAP_STACK_SET_OPTION(TXCAP_STACK_OPTION_TIMEOUT, TIMEOUT_STR)
+#define TXCAP_STACK_SET_ROOT(XCAP_ROOT_STR) TXCAP_STACK_SET_OPTION(TXCAP_STACK_OPTION_ROOT, XCAP_ROOT_STR)
+#define TXCAP_STACK_SET_PASSWORD(PASSWORD_STR) TXCAP_STACK_SET_OPTION(TXCAP_STACK_OPTION_PASSWORD, PASSWORD_STR)
+#define TXCAP_STACK_SET_XUI(XUI_STR) TXCAP_STACK_SET_OPTION(TXCAP_STACK_OPTION_XUI, XUI_STR)
+#define TXCAP_STACK_SET_LOCAL_IP(IP_STR) TXCAP_STACK_SET_OPTION(TXCAP_STACK_OPTION_LOCAL_IP, IP_STR)
+#define TXCAP_STACK_SET_LOCAL_PORT(PORT_STR) TXCAP_STACK_SET_OPTION(TXCAP_STACK_OPTION_LOCAL_PORT, PORT_STR)
+#define TXCAP_STACK_SET_HEADER(NAME_STR, VALUE_STR) xcapp_header, (const char*)NAME_STR, (const char*)VALUE_STR
+#define TXCAP_STACK_UNSET_HEADER(NAME_STR) TXCAP_STACK_SET_HEADER(NAME_STR, (const char*)-1)
+#define TXCAP_STACK_SET_USERDATA(CTX_PTR) xcapp_userdata, (const void*)CTX_PTR
+#define TXCAP_STACK_SET_AUID(ID_STR, MIME_TYPE_STR, NS_STR, DOC_NAME_STR, IS_GLOBAL_BOOL) xcapp_auid, (const char*)ID_STR, (const char*)MIME_TYPE_STR, (const char*)NS_STR, (const char*)DOC_NAME_STR, (tsk_bool_t)IS_GLOBAL_BOOL
+
+#define TXCAP_STACK_SET_NULL() xcapp_null
+
+
+typedef struct txcap_stack_s
+{
+ TSK_DECLARE_OBJECT;
+
+ char* xui; /**< user's name as per RFC 4825 subclause 4.Also used to fill @b "X-3GPP-Intended-Identity" header.*/
+ char* password; /**< user's password used to authenticate to the XDMS . */
+ char* xcap_root; /**< xcap-root URI as per RFC 4825 subclause 6.1. MUST be a valid HTPP/HTTPS URL and will be used to build all request-uris. */
+
+ thttp_session_handle_t* http_session;
+ thttp_stack_handle_t* http_stack; /**< http/https stack */
+
+ tsk_options_L_t *options; /**< list of user options */
+ const void* context; /**< user's context */
+ txcap_auids_L_t* auids; /**< user's auids */
+
+ TSK_DECLARE_SAFEOBJ;
+}
+txcap_stack_t;
+typedef void txcap_stack_handle_t;/**< Pointer to a XCAP stack. Should be created using @ref txcap_stack_create().*/
+
+TINYXCAP_API txcap_stack_handle_t* txcap_stack_create(thttp_stack_callback_f callback, const char* xui, const char* password, const char* xcap_root, ...);
+TINYXCAP_API int txcap_stack_start(txcap_stack_handle_t* self);
+TINYXCAP_API int txcap_stack_set(txcap_stack_handle_t* self, ...);
+TINYXCAP_API int txcap_stack_stop(txcap_stack_handle_t* self);
+
+TINYXCAP_GEXTERN const tsk_object_def_t *txcap_stack_def_t;
+
+TXCAP_END_DECLS
+
+#endif // TINYXCAP_CONFIG_H
OpenPOWER on IntegriCloud