Update tinyXcap project documentation and add new tests.

This commit is contained in:
bossiel 2009-11-12 02:38:31 +00:00
parent c26b49040b
commit e2e0153988
24 changed files with 787 additions and 230 deletions

View File

@ -49,18 +49,32 @@
* - @ref txc_xcap_caps_page
* - @ref txc_rlist_page
* - @ref txc_rls_page
* - @ref txc_ietf_pres_rules_page
* - @ref txc_oma_pres_rules_page
* - @ref txc_ietf_directory_page
* - @ref txc_oma_directory_page
* - @ref txc_gsma_rcs_page
* - @ref txc_oma_prescont_page
*
* @par Compliance
*
* - <a href="http://tools.ietf.org/html/rfc4825"> RFC 4825 - The Extensible Markup Language (XML) Configuration Access Protocol (XCAP)</a>
*==== <span style="text-decoration:underline;"> IETF</span> ====
*
* - <a href="http://www.ietf.org/rfc/rfc4745.txt"> RFC 4745 - Common Policy: A Document Format for Expressing Privacy Preferences </a>
* - <a href="http://www.ietf.org/rfc/rfc4825.txt"> RFC 4825 - The Extensible Markup Language (XML) Configuration Access Protocol (XCAP)</a>
* - <a href="http://www.ietf.org/rfc/rfc4826.txt"> RFC 4826 - Extensible Markup Language (XML) Formats for Representing Resource Lists</a>
* - <a href="http://www.ietf.org/rfc/rfc4827.txt"> RFC 4827 - An Extensible Markup Language (XML) Configuration Access Protocol (XCAP) Usage for Manipulating Presence Document Contents</a>
* - <a href="http://www.ietf.org/rfc/rfc5025.txt"> RFC 5025 - Presence Authorization Rules</a>
* -
*
*==== <span style="text-decoration:underline;"> OMA</span> ====
*
* - <a href="http://www.openmobilealliance.org/Technical/release_program/docs/XDM/V1_1-20080627-A/OMA-TS-XDM_Core-V1_1-20080627-A.pdf">OMA-TS-XDM_Core-V1_1-20080627-A</a>
* - <a href="http://www.openmobilealliance.org/Technical/release_program/docs/XDM_PRS_IMPL/V1_0-20080627-C/OMA-WP-XDM_1_1_Implementation_Guidelines-20080627-C.pdf"> OMA-WP-XDM_1_1_Implementation_Guidelines-20080627-C</a>
* - <a href="http://www.openmobilealliance.org/technical/release_program/docs/PresenceSIMPLE/V2_0-20081223-C/OMA-TS-Presence_SIMPLE_Content_XDM-V1_0-20081223-C.pdf"> OMA-TS-Presence-SIMPLE_Content_XDM-V1_0-20081223-C</a>
* -
* - <a href="http://www.openmobilealliance.org/Technical/release_program/docs/XDM_PRS_IMPL/V1_0-20080627-C/OMA-WP-XDM_1_1_Implementation_Guidelines-20080627-C.pdf">OMA-WP-XDM_1_1_Implementation_Guidelines-20080627-C</a>
* - <a href="http://www.openmobilealliance.org/technical/release_program/docs/PresenceSIMPLE/V2_0-20081223-C/OMA-TS-Presence_SIMPLE_Content_XDM-V1_0-20081223-C.pdf">OMA-TS-Presence-SIMPLE_Content_XDM-V1_0-20081223-C</a>
* - <a href="http://www.openmobilealliance.org/Technical/release_program/docs/PresenceSIMPLE/V1_1-20080627-A/OMA-TS-Presence_SIMPLE_XDM-V1_1-20080627-A.pdf">OMA-TS-Presence_SIMPLE_XDM-V1_1-20080627-A</a>
*
*====<span style="text-decoration:underline;"> GSMA RCS</span> ====
*
* - <a href="http://www.gsmworld.com/documents/rcs/rcs2_june09/R2_090831_RCS_Release_2_Technical_Realisation_v1_0.pdf">RCS Release 2 (Jun 09) - Technical Realisation v1.0</a>
* - <a href="http://www.gsmworld.com/documents/rcs/rcs1_updates/R1_090831_RCS_Release_1_Technical_Realisation_v1_1.pdf">RCS Release 1 Updates (Jun 09) - Technical Realisation v1.1</a>
* - <a href="http://www.gsmworld.com/documents/1_technical_real_v1.pdf">RCS Release 1 (Dec 08) - Technical Realisation v1.0</a>
@ -120,6 +134,9 @@
* - <a href="#faq4">4. How to create/deserialize an xcap-caps document received from the XDMS?</a>
* - <a href="#faq5">5. How to create/deserialize a resource-lists document received from the XDMS?</a>
* - <a href="#faq6">6. How to create/deserialize a rls-services document received from the XDMS?</a>
* - <a href="#faq7">7. How to create/deserialize an OMA XCAP directory document received from the XDMS?</a>
* - <a href="#faq20">20. How to create and serialize GSMA RCS documents?</a>
* - <a href="#faq20">21. How to parse an OMA pres-content (avatar) document received from the XDMS?</a>
*
* @anchor faq1
* @par 1. How to change default document name?
@ -145,6 +162,18 @@
* @anchor faq6
* @par 6. How to create/deserialize a rls-services document received from the XDMS?
* For more information about how to handle rls-services documents please refer to @ref txc_rls_page.
*
* @anchor faq7
* @par 7. How to create/deserialize an OMA XCAP directory document received from the XDMS?
* For more information about how to handle OMA XCAP directory documents please refer to @ref txc_oma_directory_page.
*
* @anchor faq20
* @par 20. How to create and serialize GSMA RCS documents?
* For more information about how to handle GSAM RCS documents please refer to @ref txc_gsma_rcs_page.
`*
* @anchor faq21
* @par 21. How to parse an OMA pres-content (avatar) document received from the XDMS?
* For more information about how to handle OMA Presence Content documents (Avatars) please refer to @ref txc_oma_prescont_page.
*/
#define PANIC_AND_JUMP(code, request)\

View File

@ -39,25 +39,46 @@
#define TXC_DOCUMENT_GLOBAL(auid_type) (auid_type == ietf_xcap_caps)
#define TXC_MIME_TYPE_ELEMENT "application/xcap-el+xml" /**< as per rfc 4825 subclause 15.2.1 */
#define TXC_MIME_TYPE_ATTRIBUTE "application/xcap-att+xml" /**< as per rfc 4825 subclause 15.2.2 */
#define TXC_MIME_TYPE_NS "application/xcap-ns+xml" /**< as per rfc 4825 subclause 15.2.3 */
#define TXC_MIME_TYPE_ERROR "application/xcap-error+xml" /**< as per rfc 4825 subclause 15.2.4 */
#define TXC_MIME_TYPE_CAPS "application/xcap-caps+xml" /**< as per rfc 4825 subclause 12.4 */
#define TXC_MIME_TYPE_RLIST "application/resource-lists+xml" /**< as per rfc 4826 subclause 3.4.2 */
#define TXC_MIME_TYPE_RLS "application/rls-services+xml" /**< as per rfc 4826 subclause 4.4.2 */
#define TXC_MIME_TYPE_ELEMENT "application/xcap-el+xml" /**< as per rfc 4825 subclause 15.2.1 */
#define TXC_MIME_TYPE_ATTRIBUTE "application/xcap-att+xml" /**< as per rfc 4825 subclause 15.2.2 */
#define TXC_MIME_TYPE_NS "application/xcap-ns+xml" /**< as per rfc 4825 subclause 15.2.3 */
#define TXC_MIME_TYPE_ERROR "application/xcap-error+xml" /**< as per rfc 4825 subclause 15.2.4 */
#define TXC_MIME_TYPE_CAPS "application/xcap-caps+xml" /**< as per rfc 4825 subclause 12.4 */
#define TXC_MIME_TYPE_RLIST "application/resource-lists+xml" /**< as per rfc 4826 subclause 3.4.2 */
#define TXC_MIME_TYPE_RLS "application/rls-services+xml" /**< as per rfc 4826 subclause 4.4.2 */
#define TXC_MIME_TYPE_IETF_PRESRULES "application/auth-policy+xml" /**< as per rfc 5025 subclause 9.4 */
#define TXC_MIME_TYPE_OMA_PRESRULES "application/auth-policy+xml" /**< as per [OMA-TS-Presence_SIMPLE_XDM-V1_1-20080627-A] subclause 5.1.1.5 */
#define TXC_MIME_TYPE_IETF_DIRECTORY "application/directory+xml" /**< as per draft-garcia-simple-xcap-directory-00 subclause 9.2 */
#define TXC_MIME_TYPE_OMA_DIRECTORY "application/vnd.oma.xcap-directory+xml" /**< as per [OMA-TS-XDM_Core-V1_1-20080627-A] subclause 6.7.2.2 */
#define TXC_MIME_TYPE_OMA_PRESCONT "application/vnd.oma.pres-content+xml" /**< as per [OMA-TS-Presence-SIMPLE_Content_XDM-V1_0-20081223-C] subclause 5.1.5 */
#define TXC_AUID_CAPS "xcap-caps" /**< as per rfc 4825 subclause 12.1 */
#define TXC_AUID_RLIST "resource-lists" /**< as per rfc 4826 subclause 3.4.1 */
#define TXC_AUID_RLS "rls-services" /**< as per rfc 4826 subclause 4.4.1 */
#define TXC_AUID_IETF_PRESRULES "pres-rules" /**< as per rfc 5025 subclause 9.1 */
#define TXC_AUID_OMA_PRESRULES "org.openmobilealliance.pres-rules" /**< as per [OMA-TS-Presence_SIMPLE_XDM-V1_1-20080627-A] subclause 5.1.1.2 */
#define TXC_AUID_IETF_DIRECTORY "directory" /**< as per draft-garcia-simple-xcap-directory-00 subclause 9.1 */
#define TXC_AUID_OMA_DIRECTORY "org.openmobilealliance.xcap-directory" /**< as per [OMA-TS-XDM_Core-V1_1-20080627-A subclause 6.7.2.1 */
#define TXC_AUID_OMA_PRESCONT "org.openmobilealliance.pres-content" /**< as per [OMA-TS-Presence-SIMPLE_Content_XDM-V1_0-20081223-C] subclause 5.1.2 */
#define TXC_DOCUMENT_CAPS "index" /**< as per rfc 4825 subclause 5.5 */
#define TXC_DOCUMENT_RLIST "index" /**< as per rfc 4826 subclause 3.4.7* */
#define TXC_DOCUMENT_RLS "index" /**< as per rfc 4826 subclause 4.4.7 */
#define TXC_DOCUMENT_CAPS "index" /**< as per rfc 4825 subclause 5.5 */
#define TXC_DOCUMENT_RLIST "index" /**< as per rfc 4826 subclause 3.4.7* */
#define TXC_DOCUMENT_RLS "index" /**< as per rfc 4826 subclause 4.4.7 */
#define TXC_DOCUMENT_IETF_PRESRULES "index" /**< as per rfc 5025 subclause 9.7 */
#define TXC_DOCUMENT_OMA_PRESRULES "pres-rules" /**< as per [OMA-TS-Presence_SIMPLE_XDM-V1_1-20080627-A] subclause 5.1.1.8 */
#define TXC_DOCUMENT_IETF_DIRECTORY "directory.xml" /**< as per draft-garcia-simple-xcap-directory-00 subclause 9.6 */
#define TXC_DOCUMENT_OMA_DIRECTORY "directory.xml" /**< as per [OMA-TS-XDM_Core-V1_1-20080627-A] subclause 6.7.2.7 */
#define TXC_DOCUMENT_OMA_PRESCONT "oma_status-icon/rcs_status_icon" /**< as per [R1_090831_RCS_Release_1_Technical_Realisation_v1_1] subclause 4.8.1 */
#define TXC_NS_CAPS "urn:ietf:params:xml:ns:xcap-caps" /**< as per rfc 4825 subclause 12.3*/
#define TXC_NS_RLIST "urn:ietf:params:xml:ns:resource-lists" /**< as per rfc 4826 subclause 3.4.4 */
#define TXC_NS_RLS "urn:ietf:params:xml:ns:rls-services" /**< as per rfc 4826 subclause 4.4.4 */
#define TXC_NS_IETF_PRESRULES "urn:ietf:params:xml:ns:pres-rules" /**< as per rfc 5025 subclause 9.3 */
#define TXC_NS_OMA_PRESRULES "urn:ietf:params:xml:ns:common-policy" /**< as per [OMA-TS-Presence_SIMPLE_XDM-V1_1-20080627-A] subclause 5.1.1.3 */
#define TXC_NS_IETF_DIRECTORY "urn:ietf:params:xml:ns:xcap-directory" /**< as per draft-garcia-simple-xcap-directory-00 subclause 6 */
#define TXC_NS_OMA_DIRECTORY "urn:oma:xml:xdm:xcap-directory" /**< as per [OMA-TS-XDM_Core-V1_1-20080627-A] subclause 6.7.2.3 */
#define TXC_NS_OMA_PRESCONT "urn:oma:xml:prs:pres-content" /**< as per [OMA-TS-Presence-SIMPLE_Content_XDM-V1_0-20081223-C] subclause 5.1.4 */
/* check context validity */
#define TXC_CONTEXT_CHECK(context, panic) \
@ -205,16 +226,16 @@ typedef txc_auid_t AUIDS_T[TXC_AUIDS_COUNT];
static const AUIDS_T txc_auids =
{
{ietf_xcap_caps, TXC_AUID_CAPS, "IETF server capabilities", TXC_MIME_TYPE_CAPS, TXC_DOCUMENT_CAPS, 1},
{ietf_resource_lists, TXC_AUID_RLIST, "IETF resource-list", TXC_MIME_TYPE_RLIST, TXC_DOCUMENT_RLIST, 0},
{ietf_rls_services, TXC_AUID_RLS, "IETF RLS service", TXC_MIME_TYPE_RLS, TXC_DOCUMENT_RLS, 0},
{ietf_pres_rules, "pres-rules", "IETF pres-rules", "application/auth-policy+xml", "pres-rules", 0},
{ietf_directory, "directory", "IETF xdm directory", "application/directory+xml", "directory.xml", 0},
{ietf_resource_lists, TXC_AUID_RLIST, "IETF resource-list", TXC_MIME_TYPE_RLIST, TXC_DOCUMENT_RLIST, 0},
{ietf_rls_services, TXC_AUID_RLS, "IETF RLS service", TXC_MIME_TYPE_RLS, TXC_DOCUMENT_RLS, 0},
{ietf_pres_rules, TXC_AUID_IETF_PRESRULES, "IETF pres-rules", TXC_MIME_TYPE_IETF_PRESRULES, TXC_DOCUMENT_IETF_PRESRULES, 0},
{ietf_directory, TXC_AUID_IETF_DIRECTORY, "IETF xdm directory", TXC_MIME_TYPE_IETF_DIRECTORY, TXC_DOCUMENT_IETF_DIRECTORY, 0},
{oma_conv_history, "org.openmobilealliance.conv-history", "OMA conversation history", "application/vnd.oma.im.history-list+xml", "conv-history", 0},
{oma_pres_rules, "org.openmobilealliance.pres-rules", "OMA presence rules", "application/auth-policy+xml", "pres-rules", 0},
{oma_directory, "org.openmobilealliance.xdm-directory", "OMA xdm directory", "application/vnd.oma.xdm-directory+xml", "directory.xml", 0},
{oma_pres_rules, TXC_AUID_OMA_PRESRULES, "OMA presence rules", TXC_MIME_TYPE_OMA_PRESRULES, TXC_DOCUMENT_OMA_PRESRULES, 0},
{oma_directory, TXC_AUID_OMA_DIRECTORY, "OMA xdm directory", TXC_MIME_TYPE_OMA_DIRECTORY, TXC_DOCUMENT_OMA_DIRECTORY, 0},
{oma_deferred_list, "org.openmobilealliance.deferred-list", "OMA deferred list", "application/vnd.oma.im.deferred-list+xml", "deferred-list", 0},
{oma_pres_content, "org.openmobilealliance.pres-content", "OMA presence content", "application/vnd.oma.pres-content+xml", "oma_status-icon", 0},
{oma_pres_content, TXC_AUID_OMA_PRESCONT, "OMA presence content", TXC_MIME_TYPE_OMA_PRESCONT, TXC_DOCUMENT_OMA_PRESCONT, 0},
{oma_shared_groups, "org.openmobilealliance.groups", "OMA shared groups", "application/vnd.oma.poc.groups+xml", "index"}
};

View File

@ -36,6 +36,7 @@
#include "txc_oma-prescont.h" /* urn:oma:xml:prs:pres-content */
#include "txc_gsma_rcs.h" /* both gsma rcs phase 1 and 2 */
#include "txc_oma.h" /* OMA functionalities */
#include "txc_oma-presrules.h" /* urn:ietf:params:xml:ns:pres-rules + urn:ietf:params:xml:ns:pres-rules*/
#include "txc_oma-presrules.h" /* urn:ietf:params:xml:ns:pres-rules + urn:ietf:params:xml:ns:pres-rules*/
#include "txc_ietf-pres-rules.h"/* urn:ietf:params:xml:ns:pres-rules */
#endif /* _TINYXCAP_TXC_API_H_ */

View File

@ -20,6 +20,14 @@
*
*/
/**@file txc_gsma_rcs.c
* @brief GSMA <a href="http://www.gsmworld.com/documents/rcs/rcs1_updates/R1_090831_RCS_Release_1_Technical_Realisation_v1_1.pdf">RCS 1</a> and <a href="http://www.gsmworld.com/documents/rcs/rcs2_june09/R2_090831_RCS_Release_2_Technical_Realisation_v1_0.pdf ">RCS 2</a> documents
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
/* both gsma rcs1 and rcs2 */
/* GSMA RCS2: http://www.gsmworld.com/documents/rcs/rcs2_june09/R2_090831_RCS_Release_2_Technical_Realisation_v1_0.pdf */
/* GSMA RCS1: http://www.gsmworld.com/documents/rcs/rcs1_updates/R1_090831_RCS_Release_1_Technical_Realisation_v1_1.pdf */
@ -32,6 +40,53 @@
#include "tsk_memory.h"
#include "tsk_macros.h"
/**@defgroup txc_gsma_rcs_group GSMA RCS phase 1 & 2
*/
/**@page txc_gsma_rcs_page GSMA RCS phase 1 & 2 Tutorial
*
* <H2>=== Create and serialize a GSMA RCS resource-lists, rls-services and pres-rules document ===</H2>
*
* @code
#include "txc_api.h"
txc_context_t* context = 0;
txc_rlist_list2_L_t *rlist2 = 0, *services;
char *rlist2_str = 0, *rls_str = 0, *oma_presrules_str = 0;
// create our xdm context
TXC_CONTEXT_CREATE(context);
// Initialize the context
context->user_agent = tsk_strdup2("XDM-client/OMA1.1");
context->xdm_root = tsk_strdup2("http://xcap.example.com/services");
context->password = tsk_strdup2("mysecret");
context->xui = tsk_strdup2("sip:doubango@example.com");
// Create an GSMA RCS2 resource-lists document object and serialize the document for test
rlist2 = txc_gsmarcs_create_rlist2(context);
rlist2_str = txc_rlist_list22_serialize(rlist2);
printf("rcs resource-lists: %s\n", rlist2_str);
TSK_SAFE_FREE2(rlist2_str);
TSK_LIST_SAFE_FREE(rlist2);
// Create an GSMA RCS2 rls-services document object and serialize the document for test
services = txc_gsmarcs_create_rls(context);
rls_str = txc_rls_services_serialize(services);
printf("rcs rls-services: %s\n", rls_str);
TSK_SAFE_FREE2(rls_str);
TSK_LIST_SAFE_FREE(services);
// Create an GSMA RCS2 pres-rules document as XML string
oma_presrules_str = txc_gsmarcs_create_oma_presrules(context);
printf("rcs oma pres-rules: %s\n", oma_presrules_str);
TSK_SAFE_FREE2(oma_presrules_str);
// free context
TXC_CONTEXT_SAFE_FREE(context);
* @endcode
*/
#define GSME_RCS_RLIST_ADD_ANCHOR(lname)\
tsk_sprintf(0, &anchor, \
"%s/~~/resource-lists/list%%5B@name=%%22%s%%22%%5D", \
@ -51,8 +106,14 @@
TSK_SAFE_FREE2(resource_list); \
TSK_SAFE_FREE2(uri);
/* create default list2 with all mandatory list as per GSMA RCS2. this include oma lists */
/* ATTENTION: use 'TSK_LIST_SAFE_FREE' function to free the returned object */
/**@ingroup txc_gsma_rcs_group
* Create a GSMA RCS2 resource-lists document.
* @param context The XCAP context from which to create the document.
* @retval The resource-list document as @ref txc_rlist_list2_L_t object.
* You MUST call @a TSK_LIST_SAFE_FREE to free the returned object.
* @sa @ref txc_gsmarcs_create_rls
*/
txc_rlist_list2_L_t* txc_gsmarcs_create_rlist2(const txc_context_t* context)
{
txc_rlist_list2_L_t* rlist = 0;
@ -117,8 +178,13 @@ bail:
return rlist;
}
/* create default rls with all mandatory services as per GSMA RCS1 */
/* ATTENTION: use 'TSK_LIST_SAFE_FREE' function to free the returned object */
/**@ingroup txc_gsma_rcs_group
* Create a GSMA RCS2 rls-services document.
* @param context The XCAP context from which to create the document.
* @retval The rls-services document as @ref txc_rls_service_L_t object.
* You MUST call @a TSK_LIST_SAFE_FREE to free the returned object.
* @sa @ref txc_gsmarcs_create_rlist2
*/
txc_rls_service_L_t* txc_gsmarcs_create_rls(const txc_context_t* context)
{
txc_rls_service_t *service = 0;
@ -149,8 +215,12 @@ txc_rls_service_L_t* txc_gsmarcs_create_rls(const txc_context_t* context)
return services;
}
/* create default oma pres-rules document */
/* ATTENTION: use 'TSK_SAFE_FREE2' function to free the returned string */
/**@ingroup txc_gsma_rcs_group
* Serialize the GSMA RCS2 pres-rules document as XML string.
* @param context The XCAP context from which to create the document.
* @retval The resource-list document as @ref txc_rls_service_L_t object.
* You MUST call @a TSK_SAFE_FREE2 to free the returned string.
*/
char* txc_gsmarcs_create_oma_presrules(const txc_context_t* context)
{
return txc_oma_presrules_serialize(context);

View File

@ -19,6 +19,15 @@
* along with DOUBANGO.
*
*/
/**@file txc_gsma_rcs.h
* @brief GSMA <a href="http://www.gsmworld.com/documents/rcs/rcs1_updates/R1_090831_RCS_Release_1_Technical_Realisation_v1_1.pdf">RCS 1</a> and <a href="http://www.gsmworld.com/documents/rcs/rcs2_june09/R2_090831_RCS_Release_2_Technical_Realisation_v1_0.pdf ">RCS 2</a> documents
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#ifndef _TINYXCAP_TXC_GSMA_RCS_H_
#define _TINYXCAP_TXC_GSMA_RCS_H_

View File

@ -19,4 +19,25 @@
* along with DOUBANGO.
*
*/
#include "txc_ietf-directory.h"
/**@file txc_ietf-directory.c
* @brief <a href="http://tools.ietf.org/html/draft-garcia-simple-xcap-directory-00">draft-garcia-simple-xcap-directory</a>
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "txc_ietf-directory.h"
/**@defgroup txc_ietf_directory_group IETF XCAP Directory
*/
/**@page txc_ietf_directory_page IETF XCAP Directory Tutorial (directory)
* @par Application Unique ID (AUID)
* - '<span style="text-decoration:underline;">directory</span>' as per draft-garcia-simple-xcap-directory-00 subclause 9.1
* @par Default Document Namespace
* - '<span style="text-decoration:underline;">urn:ietf:params:xml:ns:xcap-directory</span>' as per draft-garcia-simple-xcap-directory-00 subclause 6
* @par MIME Type
* - '<span style="text-decoration:underline;">application/directory+xml</span>' as per draft-garcia-simple-xcap-directory-00 subclause 9.2
* @par Default document name
* - '<span style="text-decoration:underline;">directory.xml</span>' as per draft-garcia-simple-xcap-directory-00 subclause 9.6
*/

View File

@ -20,6 +20,14 @@
*
*/
/**@file txc_ietf-directory.h
* @brief <a href="http://tools.ietf.org/html/draft-garcia-simple-xcap-directory-00">draft-garcia-simple-xcap-directory</a>
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#ifndef _TINYXCAP_TXC_IETF_DIRECTORY_H_
#define _TINYXCAP_TXC_IETF_DIRECTORY_H_

View File

@ -20,14 +20,20 @@
*
*/
/**@file txc_ietf-pres-rules.h
* @brief <a href="http://tools.ietf.org/html/rfc5025">RFC 5025 - IETF Presence Authorization Rules</a>
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinyxcap_config.h"
#include "txc.h"
#ifndef _TINYXCAP_IETF_PRES_RULES_H_
#define _TINYXCAP_IETF_PRES_RULES_H_
/* urn:ietf:params:xml:ns:pres-rules */
char* txc_ietf_presrules_serialize(const txc_context_t *context);
TINYXCAP_API char* txc_ietf_presrules_serialize(const txc_context_t *context);
#endif /* _TINYXCAP_IETF_PRES_RULES_H_ */

View File

@ -19,15 +19,32 @@
* along with DOUBANGO.
*
*/
/*
RFC 5025 - Presence Authorization Rules
*/
/**@file txc_ietf-presrules.c
* @brief <a href="http://tools.ietf.org/html/rfc5025">RFC 5025 - IETF Presence Authorization Rules</a>
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "txc_ietf-pres-rules.h"
#include "txc_document.h"
#include "txc_oma.h"
//static const char* txc_ietf_pres_rules_ns = "urn:ietf:params:xml:ns:pres-rules";
/**@defgroup txc_ietf_pres_rules_group IETF Presence Authorization Rules
*/
/**@page txc_ietf_pres_rules_page IETF Presence Authorization Rules Tutorial (pres-rules)
* @par Application Unique ID (AUID)
* - '<span style="text-decoration:underline;">pres-rules</span>' as per rfc 5025 subclause 9.1
* @par Default Document Namespace
* - '<span style="text-decoration:underline;">urn:ietf:params:xml:ns:pres-rules</span>' as per rfc 5025 subclause 9.3
* @par MIME Type
* - '<span style="text-decoration:underline;">application/auth-policy+xml</span>' as per rfc 5025 subclause 9.4
* @par Default document name
* - '<span style="text-decoration:underline;">index</span>' as per rfc 5025 subclause 9.7
*/
/* 1= owner uri ; 2=oma_grantedcontacts uri; 3=oma_blockedcontacts*/
#define TXC_IETF_PRESRULES_TEMPLATE "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" \
@ -121,8 +138,11 @@
"</cr:rule>" \
"</cr:ruleset>" \
/* will serialize a complete pres-rules whith xml header*/
/* ATTENTION: use 'TSK_SAFE_FREE2' macro to free the returned string */
/**@ingroup txc_ietf_pres_rules_group
* Used to create an initial IETF pres-rules document.
* @param context The xcap context for which to create the IETF pres-rules document.
* @retval The XML document to PUT to the XDMS. You MUST call @a TSK_SAFE_FREE2 to free the returned string.
*/
char* txc_ietf_presrules_serialize(const txc_context_t *context)
{
char *ietf_presrules_str = 0, *oma_grantedcontacts = 0, *oma_blockedcontacts = 0, *doc_sel = 0;

View File

@ -19,12 +19,80 @@
* along with DOUBANGO.
*
*/
/**@file txc_oma-directory.c
* @brief <a href="http://www.openmobilealliance.org/Technical/release_program/docs/XDM/V1_1-20080627-A/OMA-TS-XDM_Core-V1_1-20080627-A.pdf">[OMA-TS-XDM_Core-V1_1-20080627-A] - OMA XCAP directory subclause 6.7.2</a>
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "txc_oma-directory.h"
#include "txc_macros.h"
#include "tsk_macros.h"
//static const char* txc_oma_directory_ns = "urn:oma:xml:xdm:xcap-directory";
/**@defgroup txc_oma_directory_group OMA XCAP directory
*/
/**@page txc_oma_directory_page OMA XCAP directory Tutorial (org.openmobilealliance.xcap-directory)
* @par Application Unique ID (AUID)
* - '<span style="text-decoration:underline;">org.openmobilealliance.xcap-directory</span>' as per [OMA-TS-XDM_Core-V1_1-20080627-A] subclause 6.7.2.1
* @par Default Document Namespace
* - '<span style="text-decoration:underline;">urn:oma:xml:xdm:xcap-directory</span>' as per [OMA-TS-XDM_Core-V1_1-20080627-A] subclause 6.7.2.3
* @par MIME Type
* - '<span style="text-decoration:underline;">application/vnd.oma.xcap-directory+xml</span>' as per [OMA-TS-XDM_Core-V1_1-20080627-A] subclause 6.7.2.2
* @par Default document name
* - '<span style="text-decoration:underline;">directory.xml</span>' as per [OMA-TS-XDM_Core-V1_1-20080627-A] subclause 6.7.2.7
*
* <H2>=== Create/deserialize an OMA XCAP directory document received from the XDMS ===</H2>
*
* @code
#include "txc_api.h"
char* entry_str = 0;
txc_omadir_t* omadir = 0;
txc_omadir_folder_L_t* list = 0;
tsk_list_item_t* item = 0;
printf("\n---\nTEST OMA XCAP-DIRECTORY\n---\n");
{
// create oma xcap directory context
omadir = txc_omadir_create(buffer, size);
// get all folders
printf("\nget all folders\n");
if(list = txc_omadir_get_all_folders(omadir))
{
tsk_list_foreach(item, list)
{
txc_omadir_folder_t *folder = ((txc_omadir_folder_t*)item->data);
printf("auid: \"%s\"\n", folder->auid);
}
TSK_LIST_SAFE_FREE(list);
}
// get all entries in the folder with auid 'groups'
printf("\nget all entries in the folder with auid 'groups'\n");
if(list = txc_omadir_get_entries_by_folder(omadir, "groups"))
{
tsk_list_foreach(item, list)
{
txc_rlist_entry_t *entry = ((txc_rlist_entry_t*)item->data);
printf("folder's auid:\"%s\" uri:\"%s\" display-name=\"%s\" etag\"%s\"\n", entry->list, entry->uri, entry->display_name, entry->etag);
entry_str = txc_rlist_entry_serialize(entry);
printf("serialized entry: \n%s\n", entry_str);
TSK_SAFE_FREE2(entry_str);
}
TSK_LIST_SAFE_FREE(list);
}
// free the context
txc_omadir_free(&omadir);
}
* @endcode
*/
#define OMADIR_RETURN_IF_INVALID(omadir) if(!omadir || !(omadir->docPtr)) return 0;
@ -36,13 +104,22 @@
TSK_XML_NODE_SELECT_END())
/* init folder */
/**@ingroup txc_oma_directory_group
* Internal function to initialize an OMA XCAP directory folder.
* You must never call this method. You shall use @ref TXC_OMADIR_FOLDER_CREATE to create a folder.
* @param folder The folder to initialize
*/
void txc_omadir_folder_init(txc_omadir_folder_t *folder)
{
memset(folder, 0, sizeof(txc_omadir_folder_t));
}
/* free folder */
/**@ingroup txc_oma_directory_group
* Internal function to free an OMA XCAP directory folder.
* You must never call this method. You shall use @ref TXC_OMADIR_FOLDER_SAFE_FREE to safely free a folder.
* @param _folder The folder to free
* @sa @ref TXC_OMADIR_FOLDER_SAFE_FREE
*/
void txc_omadir_folder_free(void **_folder)
{
txc_omadir_folder_t **folder = ((txc_omadir_folder_t**)_folder);
@ -53,8 +130,11 @@ void txc_omadir_folder_free(void **_folder)
(*_folder) = 0;
}
/* xml<->folder binding*/
/* ATTENTION: use 'TXC_OMADIR_FOLDER_SAFE_FREE' function to free the returned object */
/**@ingroup txc_oma_directory_group
* Deserialize an OMA XCAP folder directory from an XML node pointer.
* @param node The pointer to the XML node to deserialize
* @retval An OMA XCAP folder object. You MUST call @ref TXC_OMADIR_FOLDER_SAFE_FREE to free the returned object.
*/
txc_omadir_folder_t* txc_omadir_folder_from_xml(xmlNodePtr node)
{
xmlNodePtr node2 = 0;
@ -74,7 +154,13 @@ txc_omadir_folder_t* txc_omadir_folder_from_xml(xmlNodePtr node)
return folder;
}
/* create oma xcap-directory context */
/**@ingroup txc_oma_directory_group
* Used to create an OMA XCAP directory context
* @param buffer The XML buffer from which to create the context
* @param size The size of the XML buffer
* @retval An OMA XCAP directory context. You MUST use @ref txc_omadir_free to free the returned object.
* @sa @ref txc_omadir_free
*/
txc_omadir_t* txc_omadir_create(const char* buffer, size_t size)
{
if(buffer && size)
@ -89,8 +175,12 @@ txc_omadir_t* txc_omadir_create(const char* buffer, size_t size)
return 0;
}
/* get all folders in the oma xcap-directory document */
/* ATTENTION: use 'TSK_LIST_SAFE_FREE' function to free the returned object */
/**@ingroup txc_oma_directory_group
* Returns all folders from an OMA XCAP directory context.
* @param omadir The context from which to extract all folders
* @retval The list of all available folders. You MUST use @a TSK_LIST_SAFE_FREE to free the returned list.
* @sa @ref txc_omadir_get_entries_by_folder
*/
txc_omadir_folder_L_t* txc_omadir_get_all_folders(const txc_omadir_t* omadir)
{
txc_omadir_folder_t* folder = 0;
@ -120,8 +210,12 @@ txc_omadir_folder_L_t* txc_omadir_get_all_folders(const txc_omadir_t* omadir)
return list;
}
/* get all entries in the folder */
/* ATTENTION: use 'TSK_LIST_SAFE_FREE' function to free the returned object */
/**@ingroup txc_oma_directory_group
* Returns all entries from an OMA XCAP folder.
* @param omadir The OMA XCAP directory context created using @ref txc_omadir_create.
* @param fo_auid The auid of the folder holding the entries
* @retval The list of all available entries. You MUST use @a TSK_LIST_SAFE_FREE to free the returned list.
*/
txc_rlist_entry_L_t* txc_omadir_get_entries_by_folder(const txc_omadir_t* omadir, const char* fo_auid)
{
txc_rlist_entry_t *rlist_entry = 0;
@ -149,7 +243,11 @@ txc_rlist_entry_L_t* txc_omadir_get_entries_by_folder(const txc_omadir_t* omadir
return list;
}
/* free oma dir context */
/**@ingroup txc_oma_directory_group
* Free an OMA XCAP directory context previously created using @ref txc_omadir_create.
* @param omadir The context to free.
* @sa @ref txc_omadir_create
*/
void txc_omadir_free(txc_omadir_t **omadir)
{
if(*omadir)

View File

@ -20,6 +20,14 @@
*
*/
/**@file txc_oma-directory.h
* @brief <a href="http://www.openmobilealliance.org/Technical/release_program/docs/XDM/V1_1-20080627-A/OMA-TS-XDM_Core-V1_1-20080627-A.pdf">[OMA-TS-XDM_Core-V1_1-20080627-A] - OMA XCAP directory subclause 6.7.2</a>
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#ifndef _TINYXCAP_TXC_OMA_DIRECTORY_H_
#define _TINYXCAP_TXC_OMA_DIRECTORY_H_
@ -27,23 +35,31 @@
#include "txc.h"
#include "txc_rlist.h"
/* urn:oma:xml:xdm:xcap-directory */
/**@def TXC_OMADIR_FOLDER_CREATE
* Create an OMA XCAP directory folder
* You MUST @ref TXC_OMADIR_FOLDER_SAFE_FREE to free the objet.
* @sa @ref TXC_OMADIR_FOLDER_SAFE_FREE
*/
/**@def TXC_OMADIR_FOLDER_SAFE_FREE
* Safely free an OMA XCAP directory previously created using @ref TXC_OMADIR_FOLDER_CREATE.
* @sa @ref TXC_OMADIR_FOLDER_CREATE
*/
#define TXC_OMADIR_FOLDER_CREATE(folder) TXC_XXX_CREATE2(folder, omadir_folder)
#define TXC_OMADIR_FOLDER_SAFE_FREE(folder) TXC_XXX_SAFE_FREE2(folder, omadir_folder)
/* folder */
/** OMA XCAP directory folder .
*/
typedef struct txc_omadir_folder_s
{
char* auid;
char* auid; /**< The auid of the folder */
}
txc_omadir_folder_t;
typedef tsk_list_t txc_omadir_folder_L_t; /* contains txc_omadir_folder_t elements */
typedef tsk_list_t txc_omadir_folder_L_t; /* List of @ref txc_omadir_folder_t elements */
/* oma xcap-directory */
/**OMA XCAP directory context. */
typedef struct txc_omadir_s
{
xmlDocPtr docPtr;
xmlDocPtr docPtr; /**< Pointer to the XML document*/
}
txc_omadir_t;

View File

@ -19,14 +19,63 @@
* along with DOUBANGO.
*
*/
/* implements [OMA-TS-Presence-SIMPLE_Content_XDM-V1_0-20081223-C] */
/**@file txc_oma-prescont.c
* @brief <a href="http://www.openmobilealliance.org/technical/release_program/docs/PresenceSIMPLE/V2_0-20081223-C/OMA-TS-Presence_SIMPLE_Content_XDM-V1_0-20081223-C.pdf">[OMA-TS-Presence-SIMPLE_Content_XDM-V1_0-20081223-C] - OMA Presence Content (Avatar)</a>
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "txc_oma-prescont.h"
/**@defgroup txc_oma_prescont_group OMA Presence Content (Avatars)
*/
//static const char* txc_oma_prescont_ns = "urn:oma:xml:prs:pres-content";
/**@page txc_oma_prescont_page OMA Presence Content Tutorial (org.openmobilealliance.pres-content)
* @par Application Unique ID (AUID)
* - '<span style="text-decoration:underline;">org.openmobilealliance.pres-content</span>' as per [OMA-TS-Presence-SIMPLE_Content_XDM-V1_0-20081223-C] subclause 5.1.2
* @par Default Document Namespace
* - '<span style="text-decoration:underline;">urn:oma:xml:prs:pres-content</span>' as per [OMA-TS-Presence-SIMPLE_Content_XDM-V1_0-20081223-C] subclause 5.1.4
* @par MIME Type
* - '<span style="text-decoration:underline;">application/vnd.oma.pres-content+xml</span>' as per [OMA-TS-Presence-SIMPLE_Content_XDM-V1_0-20081223-C] subclause 5.1.5
* @par Default document name
* - '<span style="text-decoration:underline;">oma_status-icon/rcs_status_icon</span>' as per [R1_090831_RCS_Release_1_Technical_Realisation_v1_1] subclause 4.8.1
*
* <H2>=== Create/deserialize an OMA Presence Content (avatar) document received from the XDMS ===</H2>
*
* @code
#include "txc_api.h"
/* create oma pres-content object */
/* ATTENTION: use 'txc_oma_pres_cont_free' function to free the returned object*/
// OMA pres-cont context
txc_oma_prescont_t* omaprescont = 0;
printf("\n---\nTEST OMA PRES-CONTENT\n---\n");
{
// create oma-pres-content context
omaprescont = txc_oma_prescont_create(buffer, size);
// dump
printf("\ndump pres-content\n");
if(omaprescont)
{
printf("mime-type: \"%s\" encoding: \"%s\" description: \"%s\" data: \"%s\"\n",
omaprescont->mime_type, omaprescont->encoding, omaprescont->description, omaprescont->data);
}
// free omapres-content context
txc_oma_prescont_free(&omaprescont);
}
* @endcode
*
*/
/**@ingroup txc_oma_prescont_group
* Create an OMA presence content object from an XML string.
* @param buffer The XML string from which to create the pres-cont object
* @param size The size of the XML string
* @retval The OMA pres-cont object. You MUST call @ref txc_oma_prescont_free to free the returned object.
* @sa @ref txc_oma_prescont_free
*/
txc_oma_prescont_t* txc_oma_prescont_create(const char* buffer, size_t size)
{
xmlNodePtr node = 0;
@ -74,7 +123,11 @@ txc_oma_prescont_t* txc_oma_prescont_create(const char* buffer, size_t size)
return pres_cont;
}
/* init oma pres-content object */
/**@ingroup txc_oma_prescont_group
* Free an OMA presence content object previously created using @ref txc_oma_prescont_create.
* @param pres_cont The object to free.
* @sa @ref txc_oma_prescont_create
*/
void txc_oma_prescont_free(txc_oma_prescont_t **pres_cont)
{
TSK_SAFE_FREE2((*pres_cont)->mime_type);

View File

@ -19,6 +19,14 @@
* along with DOUBANGO.
*
*/
/**@file txc_oma-prescont.h
* @brief <a href="http://www.openmobilealliance.org/technical/release_program/docs/PresenceSIMPLE/V2_0-20081223-C/OMA-TS-Presence_SIMPLE_Content_XDM-V1_0-20081223-C.pdf">[OMA-TS-Presence-SIMPLE_Content_XDM-V1_0-20081223-C] - OMA Presence Content (Avatar)</a>
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#ifndef _TINYXCAP_TXC_OMA_PRESCONT_H_
#define _TINYXCAP_TXC_OMA_PRESCONT_H_
@ -26,15 +34,13 @@
#include "txc.h"
#include "tsk_xml.h"
/* urn:oma:xml:prs:pres-content */
/* oma pres-content */
/** OMA Presence-Content structure */
typedef struct txc_oma_prescont_s
{
char* mime_type;
char* encoding;
char* description;
char* data;
char* mime_type; /**< The Mime-Type*/
char* encoding; /**< The type of encoding (e.g. base64)*/
char* description; /**< The description*/
char* data; /**< The content */
}
txc_oma_prescont_t;

View File

@ -20,11 +20,33 @@
*
*/
/**@file txc_oma-presrules.c
* @brief <a href="http://www.openmobilealliance.org/Technical/release_program/docs/PresenceSIMPLE/V1_1-20080627-A/OMA-TS-Presence_SIMPLE_XDM-V1_1-20080627-A.pdf">[OMA-TS-Presence_SIMPLE_XDM-V1_1-20080627-A] - OMA Presence Authorization Rules</a>
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
/* as per RCS1: http://www.gsmworld.com/documents/rcs/rcs1_updates/R1_090831_RCS_Release_1_Technical_Realisation_v1_1.pdf subclause 4.4*/
#include "txc_oma-presrules.h"
#include "txc_document.h"
#include "txc_oma.h"
/**@defgroup txc_oma_pres_rules_group OMA Presence Authorization Rules
*/
/**@page txc_oma_pres_rules_page OMA Presence Authorization Rules Tutorial (org.openmobilealliance.pres-rules)
* @par Application Unique ID (AUID)
* - '<span style="text-decoration:underline;">org.openmobilealliance.pres-rules</span>' as per [OMA-TS-Presence_SIMPLE_XDM-V1_1-20080627-A] subclause 5.1.1.2
* @par Default Document Namespace
* - '<span style="text-decoration:underline;">urn:ietf:params:xml:ns:common-policy</span>' as per [OMA-TS-Presence_SIMPLE_XDM-V1_1-20080627-A] subclause 5.1.1.3
* @par MIME Type
* - '<span style="text-decoration:underline;">application/auth-policy+xml</span>' as per [OMA-TS-Presence_SIMPLE_XDM-V1_1-20080627-A] subclause 5.1.1.5
* @par Default document name
* - '<span style="text-decoration:underline;">pres-rules</span>' as per [OMA-TS-Presence_SIMPLE_XDM-V1_1-20080627-A] subclause 5.1.1.8
*/
/* 1= owner uri ; 2=oma_grantedcontacts uri; 3=oma_blockedcontacts*/
#define TXC_OMA_PRESRULES_TEMPLATE "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" \
"<cr:ruleset " \
@ -119,8 +141,11 @@
"</cr:ruleset>"
/* will serialize a complete pres-rules whith xml header*/
/* ATTENTION: use 'TSK_SAFE_FREE2' macro to free the returned string */
/**@ingroup txc_oma_pres_rules_group
* Used to create an initial OMA pres-rules document.
* @param context The xcap context for which to create the OMA pres-rules document.
* @retval The XML document to PUT to the XDMS. You MUST call @a TSK_SAFE_FREE2 to free the returned string.
*/
char* txc_oma_presrules_serialize(const txc_context_t *context)
{
char *oma_presrules_str = 0, *oma_grantedcontacts = 0, *oma_blockedcontacts = 0, *doc_sel = 0;

View File

@ -20,6 +20,14 @@
*
*/
/**@file txc_oma-presrules.h
* @brief <a href="http://www.openmobilealliance.org/Technical/release_program/docs/PresenceSIMPLE/V1_1-20080627-A/OMA-TS-Presence_SIMPLE_XDM-V1_1-20080627-A.pdf">[OMA-TS-Presence_SIMPLE_XDM-V1_1-20080627-A] - OMA Presence Authorization Rules</a>
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
/* as per RCS1: http://www.gsmworld.com/documents/rcs/rcs1_updates/R1_090831_RCS_Release_1_Technical_Realisation_v1_1.pdf subclause 4.4*/
#ifndef _TINYXCAP_TXC_OMA_PRESRULES_H_
#define _TINYXCAP_TXC_OMA_PRESRULES_H_
@ -27,8 +35,6 @@
#include "tinyxcap_config.h"
#include "txc.h"
/* urn:ietf:params:xml:ns:pres-rules */
TINYXCAP_API char* txc_oma_presrules_serialize(const txc_context_t *context);
#endif /* _TINYXCAP_TXC_OMA_PRESRULES_H_ */

View File

@ -122,8 +122,8 @@ typedef struct txc_rlist_list2_s
txc_rlist_external_L_t* externals; /**< All extenals */
}
txc_rlist_list2_t;
typedef tsk_list_t txc_rlist_list2_L_t; /* List of @ref txc_rlist_list2_t elements */
typedef tsk_list_t txc_rlist_list2_LL_t; /* List of @ref txc_rlist_list2_t elements */
typedef tsk_list_t txc_rlist_list2_L_t; /**< List of @ref txc_rlist_list2_t elements */
typedef tsk_list_t txc_rlist_list2_LL_t; /**< List of @ref txc_rlist_list2_L_t elements */
/** Resource-lists document context
*/

View File

@ -21,13 +21,25 @@
*/
#include "stdafx.h"
#define LOOP 0
#define TEST_XXXX_CONTEXT_INIT(context) \
context->user_agent = tsk_strdup2("XDM-client/OMA1.1"); \
context->txc_root = tsk_strdup2("http://example.com:8080/services"); \
context->password = tsk_strdup2("doubango"); \
context->xui = tsk_strdup2("sip:doubango@example.com"); \
context->pragma = tsk_strdup2("keep-alive");
#define RUN_TEST_ALL 0
#define RUN_TEST_SELECTOR 0
#define RUN_TEST_XCAP_CAPS 0
#define RUN_TEST_RLIST 0
#define RUN_TEST_RLS 1
#define LOOP 0
#define RUN_TEST_ALL 1
#define RUN_TEST_SELECTOR 0
#define RUN_TEST_XCAP_CAPS 0
#define RUN_TEST_RLIST 0
#define RUN_TEST_RLS 0
#define RUN_TEST_IETF_PRESRULES 0
#define RUN_TEST_OMA_PRESRULES 0
#define RUN_TEST_OMA_DIRECTORY 0
#define RUN_TEST_GSMA_RCS 0
#define RUN_TEST_OMA_PRESCONT 1
#if RUN_TEST_SELECTOR || RUN_TEST_ALL
#include "test_selector.h"
@ -45,6 +57,26 @@
#include "test_rls.h"
#endif
#if RUN_TEST_IETF_PRESRULES || RUN_TEST_ALL
#include "test_ietf-pres-rules.h"
#endif
#if RUN_TEST_OMA_PRESRULES || RUN_TEST_ALL
#include "test_oma-pres-rules.h"
#endif
#if RUN_TEST_OMA_DIRECTORY || RUN_TEST_ALL
#include "test_oma-directory.h"
#endif
#if RUN_TEST_GSMA_RCS || RUN_TEST_ALL
#include "test_gsma_rcs.h"
#endif
#if RUN_TEST_OMA_PRESCONT || RUN_TEST_ALL
#include "test_oma-pres-cont.h"
#endif
int _tmain(int argc, _TCHAR* argv[])
{
#if LOOP
@ -75,7 +107,33 @@ int _tmain(int argc, _TCHAR* argv[])
test_rls_services(rls_str0, strlen(rls_str0));
#endif
/*ietf pres-rules*/
#if RUN_TEST_IETF_PRESRULES || RUN_TEST_ALL
test_ietf_presrules();
#endif
/*oma pres-rules*/
#if RUN_TEST_OMA_PRESRULES || RUN_TEST_ALL
test_oma_presrules();
#endif
/* oma directory */
#if RUN_TEST_OMA_DIRECTORY || RUN_TEST_ALL
test_oma_directory(omadir_str0, strlen(omadir_str0));
#endif
/* gsma rcs */
#if RUN_TEST_GSMA_RCS || RUN_TEST_ALL
test_gsma_rcs();
#endif
/* oma pres-cont (avatars) */
#if RUN_TEST_OMA_PRESCONT || RUN_TEST_ALL
test_oma_pres_cont(omaprescont_str0, strlen(omaprescont_str0));
#endif
}
getchar();
return 0;

View File

@ -200,6 +200,26 @@
<Filter
Name="tests"
>
<File
RelativePath=".\test_gsma_rcs.h"
>
</File>
<File
RelativePath=".\test_ietf-pres-rules.h"
>
</File>
<File
RelativePath=".\test_oma-directory.h"
>
</File>
<File
RelativePath=".\test_oma-pres-cont.h"
>
</File>
<File
RelativePath=".\test_oma-pres-rules.h"
>
</File>
<File
RelativePath=".\test_rlist.h"
>

View File

@ -1,71 +1,69 @@
/****************************************************************************
_ _
| | | |
_ | | ___ _ _| | _ ____ ____ ____ ___
/ || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \
( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| |
\____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/
(_____|
Copyright (C) 2009 xxxyyyzzz <imsframework(at)gmail.com>
This file is part of Open Source Doubango IMS Client Framework project.
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 Lesser General Public License for more details.
You should have received a copy of the GNU General Public License
along with DOUBANGO.
****************************************************************************/
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
*
* 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef _TEST_GSMA_RCS_H_
#define _TEST_GSMA_RCS_H_
#include "xdm_api.h"
#include "txc_api.h"
/* test gsma rcs */
void test_gsma_rcs()
{
xdm_context_t* context = 0;
xdm_list_t *rlist2 = 0, *services;
txc_context_t* context = 0;
txc_rlist_list2_L_t *rlist2 = 0, *services;
char *rlist2_str = 0, *rls_str = 0, *oma_presrules_str = 0;
/* create our xdm context */
XDM_CONTEXT_CREATE(context);
TXC_CONTEXT_CREATE(context);
context->user_agent = xdm_strdup("XDM-client/OMA1.1");
/*context->user_agent = xdm_strdup("XDM-client/OMA1.1");
context->xdm_root = xdm_strdup("http://xcap.example.com/services");
context->password = xdm_strdup("mysecret");
context->xui = xdm_strdup("sip:doubango@example.com");
context->xui = xdm_strdup("sip:doubango@example.com");*/
/* get rcs lists */
rlist2 = xdm_gsmarcs_create_rlist2(context);
rlist2_str = xdm_rlist_rlist2_serialize(rlist2);
/* Initialize the context */
TEST_XXXX_CONTEXT_INIT(context);
/* Create an GSMA RCS2 resource-lists document object and serialize the document for test */
rlist2 = txc_gsmarcs_create_rlist2(context);
rlist2_str = txc_rlist_list22_serialize(rlist2);
printf("rcs resource-lists: %s\n", rlist2_str);
XDM_SAFE_FREE(rlist2_str);
XDM_LIST_SAFE_FREE(rlist2);
TSK_SAFE_FREE2(rlist2_str);
TSK_LIST_SAFE_FREE(rlist2);
/* get rls services */
services = xdm_gsmarcs_create_rls(context);
rls_str = xdm_rls_rls_serialize(services);
/* Create an GSMA RCS2 rls-services document object and serialize the document for test*/
services = txc_gsmarcs_create_rls(context);
rls_str = txc_rls_services_serialize(services);
printf("rcs rls-services: %s\n", rls_str);
XDM_SAFE_FREE(rls_str);
XDM_LIST_SAFE_FREE(services);
TSK_SAFE_FREE2(rls_str);
TSK_LIST_SAFE_FREE(services);
/* get oma pres-rules */
oma_presrules_str = xdm_gsmarcs_create_oma_presrules(context);
/* Create an GSMA RCS2 pres-rules document as XML string */
oma_presrules_str = txc_gsmarcs_create_oma_presrules(context);
printf("rcs oma pres-rules: %s\n", oma_presrules_str);
XDM_SAFE_FREE(oma_presrules_str);
TSK_SAFE_FREE2(oma_presrules_str);
/* free context */
XDM_CONTEXT_SAFE_FREE(context);
TXC_CONTEXT_SAFE_FREE(context);
}

View File

@ -0,0 +1,49 @@
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
*
* 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#include "txc_api.h"
#ifndef TEST_IETF_PRESRULES
#define TEST_IETF_PRESRULES
/* testing ietf-presrules */
void test_ietf_presrules()
{
txc_context_t* context;
char *presrules = 0;
/* create our XCAP context */
TXC_CONTEXT_CREATE(context);
printf("---\nTEST IETF-PRESRULES\n---\n");
/* Initialize the context */
TEST_XXXX_CONTEXT_INIT(context);
presrules = txc_ietf_presrules_serialize(context);
printf("IETF pres-rules: \n%s\n***\n", presrules);
TSK_SAFE_FREE2(presrules);
/* free the context*/
TXC_CONTEXT_SAFE_FREE(context);
}
#endif

View File

@ -1,85 +1,86 @@
/****************************************************************************
_ _
| | | |
_ | | ___ _ _| | _ ____ ____ ____ ___
/ || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \
( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| |
\____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/
(_____|
Copyright (C) 2009 xxxyyyzzz <imsframework(at)gmail.com>
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
*
* 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#include "txc_api.h"
This file is part of Open Source Doubango IMS Client Framework project.
#ifndef TEST_OMA_DIRECTORY
#define TEST_OMA_DIRECTORY
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 Lesser General Public License for more details.
You should have received a copy of the GNU General Public License
along with DOUBANGO.
****************************************************************************/
#include "xdm_api.h"
// http://www.openmobilealliance.com/technical/release_program/docs/XDM/V2_0-20070724-C/OMA-TS-XDM_Core-V2_0-20070724-C.pdf subclause C.3
const char* omadir_str0 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<xcap-directory xmlns=\"urn:oma:xml:xdm:xcap-directory\" >"
"<folder auid=\"resource-lists\">"
"<entry uri=\"http://xcap.example.com/resource-lists/users/sip:joebloggs@example.com/index\" etag=\"pqr999\"/>"
"</folder>"
"<folder auid=\"groups\">"
"<entry "
"uri=\"http://xcap.example.com/org.openmobilealliance.groups/users/sip:joebloggs@example.com/skiing\" etag=\"abc123\"/>"
"<entry "
"uri=\"http://xcap.example.com/org.openmobilealliance.groups/users/sip:joebloggs@example.com/shopping\" etag=\"def456\"/>"
"</folder>"
"</xcap-directory>";
/* test OMA directory (urn:oma:xml:xdm:xcap-directory) */
void test_oma_directory()
void test_oma_directory(const char* buffer, size_t size)
{
char* entry_str = 0;
xdm_omadir_t* omadir = 0;
xdm_list_t* list = 0;
xdm_list_item_t* item = 0;
// http://www.openmobilealliance.com/technical/release_program/docs/XDM/V2_0-20070724-C/OMA-TS-XDM_Core-V2_0-20070724-C.pdf subclause C.3
const char* omadir_str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<xcap-directory xmlns=\"urn:oma:xml:xdm:xcap-directory\" >"
"<folder auid=\"resource-lists\">"
"<entry uri=\"http://xcap.example.com/resource-lists/users/sip:joebloggs@example.com/index\" etag=\"pqr999\"/>"
"</folder>"
"<folder auid=\"groups\">"
"<entry "
"uri=\"http://xcap.example.com/org.openmobilealliance.groups/users/sip:joebloggs@example.com/skiing\" etag=\"abc123\"/>"
"<entry "
"uri=\"http://xcap.example.com/org.openmobilealliance.groups/users/sip:joebloggs@example.com/shopping\" etag=\"def456\"/>"
"</folder>"
"</xcap-directory>";
txc_omadir_t* omadir = 0;
txc_omadir_folder_L_t* list = 0;
tsk_list_item_t* item = 0;
printf("\n---\nTEST OMA XCAP-DIRECTORY\n---\n");
{
/* create rlist context */
omadir = xdm_omadir_create(omadir_str, strlen(omadir_str));
/* create oma xcap directory context */
omadir = txc_omadir_create(buffer, size);
/* get all folders */
printf("\nget all folders\n");
if(list = xdm_omadir_get_all_folders(omadir))
if(list = txc_omadir_get_all_folders(omadir))
{
xdm_list_foreach(item, list)
tsk_list_foreach(item, list)
{
xdm_omadir_folder_t *folder = ((xdm_omadir_folder_t*)item->data);
txc_omadir_folder_t *folder = ((txc_omadir_folder_t*)item->data);
printf("auid: \"%s\"\n", folder->auid);
}
XDM_LIST_SAFE_FREE(list);
TSK_LIST_SAFE_FREE(list);
}
/* get all entries in the folder with auid 'groups' */
printf("\nget all entries in the folder with auid 'groups'\n");
if(list = xdm_omadir_get_entries_by_folder(omadir, "groups"))
if(list = txc_omadir_get_entries_by_folder(omadir, "groups"))
{
xdm_list_foreach(item, list)
tsk_list_foreach(item, list)
{
xdm_rlist_entry_t *entry = ((xdm_rlist_entry_t*)item->data);
txc_rlist_entry_t *entry = ((txc_rlist_entry_t*)item->data);
printf("folder's auid:\"%s\" uri:\"%s\" display-name=\"%s\" etag\"%s\"\n", entry->list, entry->uri, entry->display_name, entry->etag);
entry_str = xdm_rlist_entry_serialize(entry);
entry_str = txc_rlist_entry_serialize(entry);
printf("serialized entry: \n%s\n", entry_str);
XDM_SAFE_FREE(entry_str);
TSK_SAFE_FREE2(entry_str);
}
XDM_LIST_SAFE_FREE(list);
TSK_LIST_SAFE_FREE(list);
}
/* free omadir */
xdm_omadir_free(&omadir);
/* free the context */
txc_omadir_free(&omadir);
}
}
}
#endif /* TEST_OMA_DIRECTORY */

View File

@ -1,41 +1,30 @@
/****************************************************************************
_ _
| | | |
_ | | ___ _ _| | _ ____ ____ ____ ___
/ || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \
( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| |
\____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/
(_____|
Copyright (C) 2009 xxxyyyzzz <imsframework(at)gmail.com>
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
*
* 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
This file is part of Open Source Doubango IMS Client Framework project.
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 Lesser General Public License for more details.
You should have received a copy of the GNU General Public License
along with DOUBANGO.
****************************************************************************/
#include "xdm_api.h"
/* test OMA directory (urn:oma:xml:xdm:xcap-directory) */
void test_oma_pres_cont()
{
char* entry_str = 0;
xdm_oma_prescont_t* omaprescont = 0;
xdm_list_t* list = 0;
xdm_list_item_t* item = 0;
// http://www.openmobilealliance.org/technical/release_program/docs/PresenceSIMPLE/V2_0-20081223-C/OMA-TS-Presence_SIMPLE_Content_XDM-V1_0-20081223-C.pdf subclause C.1.1
const char* omaprescont_str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
#include "txc_api.h"
#ifndef _TEST_OMA_PRESCONTENT_H_
#define _TEST_OMA_PRESCONTENT_H_
// http://www.openmobilealliance.org/technical/release_program/docs/PresenceSIMPLE/V2_0-20081223-C/OMA-TS-Presence_SIMPLE_Content_XDM-V1_0-20081223-C.pdf subclause C.1.1
const char* omaprescont_str0 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<content xmlns=\"urn:oma:xml:prs:pres-content\">"
"<mime-type>image/png</mime-type>"
"<encoding>base64</encoding>"
@ -75,10 +64,15 @@ void test_oma_pres_cont()
"+9sf/9/+e/BBgA4y6iYV7kockAAAAASUVORK5CYII=</data>"
"</content>";
/* test OMA directory (urn:oma:xml:xdm:xcap-directory) */
void test_oma_pres_cont(const char* buffer, size_t size)
{
txc_oma_prescont_t* omaprescont = 0;
printf("\n---\nTEST OMA PRES-CONTENT\n---\n");
{
/* create oma-prescontent */
omaprescont = xdm_oma_prescont_create(omaprescont_str, strlen(omaprescont_str));
omaprescont = txc_oma_prescont_create(buffer, size);
/* dump */
printf("\ndump pres-content\n");
@ -88,6 +82,7 @@ void test_oma_pres_cont()
omaprescont->mime_type, omaprescont->encoding, omaprescont->description, omaprescont->data);
}
/* free omaprescontent */
xdm_oma_prescont_free(&omaprescont);
txc_oma_prescont_free(&omaprescont);
}
}
}
#endif /* _TEST_OMA_PRESCONTENT_H_ */

View File

@ -0,0 +1,49 @@
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
*
* 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#include "txc_api.h"
#ifndef TEST_OMA_PRESRULES
#define TEST_OMA_PRESRULES
/* testing oma-presrules */
void test_oma_presrules()
{
txc_context_t* context;
char *presrules = 0;
/* create our XCAP context */
TXC_CONTEXT_CREATE(context);
printf("---\nTEST IETF-PRESRULES\n---\n");
/* Initialize the context */
TEST_XXXX_CONTEXT_INIT(context);
presrules = txc_oma_presrules_serialize(context);
printf("OMA pres-rules: \n%s\n***\n", presrules);
TSK_SAFE_FREE2(presrules);
/* free the context*/
TXC_CONTEXT_SAFE_FREE(context);
}
#endif

View File

@ -35,10 +35,8 @@ void test_selector()
printf("---\nTEST XCAP SELECTOR\n---\n");
context->user_agent = tsk_strdup2("XDM-client/OMA1.1");
context->txc_root = tsk_strdup2("http://xcap.example.com:8080/services");
context->password = tsk_strdup2("mysecret");
context->xui = tsk_strdup2("sip:doubango@example.com");
/* Initialize the context */
TEST_XXXX_CONTEXT_INIT(context);
//txc_auid_update(context, ietf_resource_lists, "rlist.xml");