You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
(56) |
Apr
(109) |
May
(15) |
Jun
(3) |
Jul
(37) |
Aug
(96) |
Sep
(40) |
Oct
(4) |
Nov
(54) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(47) |
Feb
(30) |
Mar
(102) |
Apr
(120) |
May
(68) |
Jun
(54) |
Jul
(53) |
Aug
(122) |
Sep
(190) |
Oct
(71) |
Nov
(85) |
Dec
(108) |
2007 |
Jan
(72) |
Feb
(190) |
Mar
(53) |
Apr
(101) |
May
(145) |
Jun
(148) |
Jul
(167) |
Aug
(143) |
Sep
(23) |
Oct
(198) |
Nov
(223) |
Dec
(195) |
2008 |
Jan
(100) |
Feb
(129) |
Mar
(79) |
Apr
(77) |
May
(34) |
Jun
(95) |
Jul
(112) |
Aug
(160) |
Sep
(82) |
Oct
(124) |
Nov
(199) |
Dec
(355) |
2009 |
Jan
(436) |
Feb
(89) |
Mar
(298) |
Apr
(189) |
May
(33) |
Jun
(88) |
Jul
(105) |
Aug
(44) |
Sep
(181) |
Oct
(87) |
Nov
(75) |
Dec
(1) |
2010 |
Jan
(63) |
Feb
(21) |
Mar
(3) |
Apr
(1) |
May
(1) |
Jun
(3) |
Jul
(26) |
Aug
(37) |
Sep
(26) |
Oct
(15) |
Nov
(13) |
Dec
|
From: <svn...@op...> - 2009-07-27 20:38:41
|
Author: scriptor Date: Mon Jul 27 22:38:30 2009 New Revision: 5706 URL: http://www.opensync.org/changeset/5706 Log: Shortened the "valgrind_" prefix to "vg_". Modified: plugins/ldap-sync/tests/CMakeLists.txt Modified: plugins/ldap-sync/tests/CMakeLists.txt ============================================================================== --- plugins/ldap-sync/tests/CMakeLists.txt Mon Jul 27 19:27:54 2009 (r5705) +++ plugins/ldap-sync/tests/CMakeLists.txt Mon Jul 27 22:38:30 2009 (r5706) @@ -534,18 +534,18 @@ IF (LDAPDELETE_EXECUTABLE) IF (VALGRIND_EXECUTABLE) - ADD_TEST( valgrind_add_mod_del_contact1_and_fastsync ${TESTDIR}/check_add_modify_delete_and_valgrind_and_sync "valgrind_add_mod_del_contact1_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact1.ldif ${TESTDIR}/contact1_entrymods "--fastsync" ${TESTDIR}/opensync.suppr ) + ADD_TEST( vg_add_mod_del_contact1_and_fastsync ${TESTDIR}/check_add_modify_delete_and_valgrind_and_sync "valgrind_add_mod_del_contact1_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact1.ldif ${TESTDIR}/contact1_entrymods "--fastsync" ${TESTDIR}/opensync.suppr ) - ADD_TEST( valgrind_add_mod_del_contact2_and_fastsync ${TESTDIR}/check_add_modify_delete_and_valgrind_and_sync "valgrind_add_mod_del_contact2_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact2.ldif ${TESTDIR}/contact2_entrymods "--fastsync" ${TESTDIR}/opensync.suppr ) + ADD_TEST( vg_add_mod_del_contact2_and_fastsync ${TESTDIR}/check_add_modify_delete_and_valgrind_and_sync "valgrind_add_mod_del_contact2_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact2.ldif ${TESTDIR}/contact2_entrymods "--fastsync" ${TESTDIR}/opensync.suppr ) - ADD_TEST( valgrind_add_mod_del_event_and_fastsync ${TESTDIR}/check_add_modify_delete_and_valgrind_and_sync "valgrind_add_mod_del_event_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/event1.ldif ${TESTDIR}/event1_entrymods "--fastsync" ${TESTDIR}/opensync.suppr ) + ADD_TEST( vg_add_mod_del_event_and_fastsync ${TESTDIR}/check_add_modify_delete_and_valgrind_and_sync "valgrind_add_mod_del_event_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/event1.ldif ${TESTDIR}/event1_entrymods "--fastsync" ${TESTDIR}/opensync.suppr ) - ADD_TEST( valgrind_add_mod_del_todo_and_fastsync ${TESTDIR}/check_add_modify_delete_and_valgrind_and_sync "valgrind_add_mod_del_todo_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/todo1.ldif ${TESTDIR}/todo1_entrymods "--fastsync" ${TESTDIR}/opensync.suppr ) + ADD_TEST( vg_add_mod_del_todo_and_fastsync ${TESTDIR}/check_add_modify_delete_and_valgrind_and_sync "valgrind_add_mod_del_todo_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/todo1.ldif ${TESTDIR}/todo1_entrymods "--fastsync" ${TESTDIR}/opensync.suppr ) - ADD_TEST( valgrind_add_mod_del_note_and_fastsync ${TESTDIR}/check_add_modify_delete_and_valgrind_and_sync "valgrind_add_mod_del_note_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/note1.ldif ${TESTDIR}/note1_entrymods "--fastsync" ${TESTDIR}/opensync.suppr ) + ADD_TEST( vg_add_mod_del_note_and_fastsync ${TESTDIR}/check_add_modify_delete_and_valgrind_and_sync "valgrind_add_mod_del_note_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/note1.ldif ${TESTDIR}/note1_entrymods "--fastsync" ${TESTDIR}/opensync.suppr ) - ADD_TEST( valgrind_add_mod_del_all_four_objtypes_and_fastsync ${TESTDIR}/check_add_modify_delete_four_ldifs_and_valgrind_and_sync "valgrind_add_mod_del_all_four_objtypes_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact1.ldif ${TESTDIR}/event1.ldif ${TESTDIR}/todo1.ldif ${TESTDIR}/note1.ldif ${TESTDIR}/contact1_entrymods ${TESTDIR}/event1_entrymods ${TESTDIR}/todo1_entrymods ${TESTDIR}/note1_entrymods "--fastsync") + ADD_TEST( vg_add_mod_del_all_four_objtypes_and_fastsync ${TESTDIR}/check_add_modify_delete_four_ldifs_and_valgrind_and_sync "valgrind_add_mod_del_all_four_objtypes_and_fastsync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact1.ldif ${TESTDIR}/event1.ldif ${TESTDIR}/todo1.ldif ${TESTDIR}/note1.ldif ${TESTDIR}/contact1_entrymods ${TESTDIR}/event1_entrymods ${TESTDIR}/todo1_entrymods ${TESTDIR}/note1_entrymods "--fastsync") ENDIF (VALGRIND_EXECUTABLE) ENDIF (LDAPDELETE_EXECUTABLE) @@ -639,67 +639,67 @@ ADD_TEST( clean_up5 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) - + - ADD_TEST( valgrind_osynctool_add_contact1_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_contact1_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact1.ldif" ) + ADD_TEST( vg_osynctool_add_contact1_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_contact1_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact1.ldif" ) - #ADD_TEST( valgrind_osynctool_add_contact2_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_contact2_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact2.ldif" ) + #ADD_TEST( vg_osynctool_add_contact2_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_contact2_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact2.ldif" ) - ADD_TEST( valgrind_osynctool_add_event_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_event_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/event1.ldif" ) + ADD_TEST( vg_osynctool_add_event_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_event_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/event1.ldif" ) - ADD_TEST( valgrind_osynctool_add_todo_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_todo_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/todo1.ldif" ) + ADD_TEST( vg_osynctool_add_todo_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_todo_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/todo1.ldif" ) - ADD_TEST( valgrind_osynctool_add_note_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_note_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note1.ldif" ) + ADD_TEST( vg_osynctool_add_note_ldif ${TESTDIR}/check_osynctool_add_ldif_and_valgrind_and_slowsync "valgrind_osynctool_add_note_ldif" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note1.ldif" ) ADD_TEST( clean_up6 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) - ADD_TEST( valgrind_osynctool_add_contact1_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_contact1_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact1.xml" ) + ADD_TEST( vg_osynctool_add_contact1_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_contact1_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact1.xml" ) - ADD_TEST( valgrind_osynctool_add_contact2_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_contact2_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact2.xml" ) + ADD_TEST( vg_osynctool_add_contact2_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_contact2_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact2.xml" ) - ADD_TEST( valgrind_osynctool_add_event_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_event_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/event1.xml" ) + ADD_TEST( vg_osynctool_add_event_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_event_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/event1.xml" ) - ADD_TEST( valgrind_osynctool_add_todo_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_todo_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/todo1.xml" ) + ADD_TEST( vg_osynctool_add_todo_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_todo_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/todo1.xml" ) - ADD_TEST( valgrind_osynctool_add_note1_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_note1_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note1.xml" ) + ADD_TEST( vg_osynctool_add_note1_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_note1_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note1.xml" ) - ADD_TEST( valgrind_osynctool_add_note2_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_note2_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note2.xml" ) + ADD_TEST( vg_osynctool_add_note2_xmlfile ${TESTDIR}/check_osynctool_add_file_and_valgrind_and_slowsync "valgrind_osynctool_add_note2_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note2.xml" ) ADD_TEST( clean_up7 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) - ADD_TEST( valgrind_osynctool_add_mod_del_contact1_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_contact1_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact1.xml" "${TESTDIR}/contact1.xml_modified" ) + ADD_TEST( vg_osynctool_add_mod_del_contact1_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_contact1_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact1.xml" "${TESTDIR}/contact1.xml_modified" ) - ADD_TEST( valgrind_osynctool_add_mod_del_contact2_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_contact2_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact2.xml" "${TESTDIR}/contact2.xml_modified" ) + ADD_TEST( vg_osynctool_add_mod_del_contact2_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_contact2_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" "${TESTDIR}/contact2.xml" "${TESTDIR}/contact2.xml_modified" ) - ADD_TEST( valgrind_osynctool_add_mod_del_event_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_event_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/event1.xml" "${TESTDIR}/event1.xml_modified" ) + ADD_TEST( vg_osynctool_add_mod_del_event_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_event_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" "${TESTDIR}/event1.xml" "${TESTDIR}/event1.xml_modified" ) - ADD_TEST( valgrind_osynctool_add_mod_del_todo_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_todo_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/todo1.xml" "${TESTDIR}/todo1.xml_modified" ) + ADD_TEST( vg_osynctool_add_mod_del_todo_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_todo_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" "${TESTDIR}/todo1.xml" "${TESTDIR}/todo1.xml_modified" ) - ADD_TEST( valgrind_osynctool_add_mod_del_note1_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_note1_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note1.xml" "${TESTDIR}/note1.xml_modified" ) + ADD_TEST( vg_osynctool_add_mod_del_note1_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_note1_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note1.xml" "${TESTDIR}/note1.xml_modified" ) - ADD_TEST( valgrind_osynctool_add_mod_del_note2_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_note2_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note2.xml" "${TESTDIR}/note2.xml_modified" ) + ADD_TEST( vg_osynctool_add_mod_del_note2_xmlfile ${TESTDIR}/check_osynctool_add_modify_delete_file_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_note2_xmlfile" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" "${TESTDIR}/note2.xml" "${TESTDIR}/note2.xml_modified" ) - ADD_TEST( valgrind_osynctool_add_mod_del_all_four_xmlfiles ${TESTDIR}/check_osynctool_add_modify_delete_four_files_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_all_four_xmlfiles" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${TESTDIR}/contact1.xml" "${TESTDIR}/event1.xml" "${TESTDIR}/todo1.xml" "${TESTDIR}/note1.xml" "${TESTDIR}/contact1.xml_modified" "${TESTDIR}/event1.xml_modified" "${TESTDIR}/todo1.xml_modified" "${TESTDIR}/note1.xml_modified" ) + ADD_TEST( vg_osynctool_add_mod_del_all_four_xmlfiles ${TESTDIR}/check_osynctool_add_modify_delete_four_files_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_all_four_xmlfiles" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${TESTDIR}/contact1.xml" "${TESTDIR}/event1.xml" "${TESTDIR}/todo1.xml" "${TESTDIR}/note1.xml" "${TESTDIR}/contact1.xml_modified" "${TESTDIR}/event1.xml_modified" "${TESTDIR}/todo1.xml_modified" "${TESTDIR}/note1.xml_modified" ) ADD_TEST( clean_up8 ${TESTDIR}/clean_up ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) - ADD_TEST( valgrind_osynctool_add_mod_del_contact1_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_contact1_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" ${TESTDIR}/contact1.ldif ${TESTDIR}/contact1_entrymods ) + ADD_TEST( vg_osynctool_add_mod_del_contact1_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_contact1_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" ${TESTDIR}/contact1.ldif ${TESTDIR}/contact1_entrymods ) - ADD_TEST( valgrind_osynctool_add_mod_del_contact2_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_contact2_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" ${TESTDIR}/contact2.ldif ${TESTDIR}/contact2_entrymods ) + ADD_TEST( vg_osynctool_add_mod_del_contact2_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_contact2_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "contact" ${TESTDIR}/contact2.ldif ${TESTDIR}/contact2_entrymods ) - ADD_TEST( valgrind_osynctool_add_mod_del_event_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_event_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" ${TESTDIR}/event1.ldif ${TESTDIR}/event1_entrymods ) + ADD_TEST( vg_osynctool_add_mod_del_event_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_event_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "event" ${TESTDIR}/event1.ldif ${TESTDIR}/event1_entrymods ) - ADD_TEST( valgrind_osynctool_add_mod_del_todo_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_todo_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" ${TESTDIR}/todo1.ldif ${TESTDIR}/todo1_entrymods ) + ADD_TEST( vg_osynctool_add_mod_del_todo_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_todo_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "todo" ${TESTDIR}/todo1.ldif ${TESTDIR}/todo1_entrymods ) - ADD_TEST( valgrind_osynctool_add_mod_del_note_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_note_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" ${TESTDIR}/note1.ldif ${TESTDIR}/note1_entrymods ) + ADD_TEST( vg_osynctool_add_mod_del_note_ldif_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_note_ldif_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "note" ${TESTDIR}/note1.ldif ${TESTDIR}/note1_entrymods ) - ADD_TEST( valgrind_osynctool_add_mod_del_all_four_ldifs_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_four_ldifs_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_all_four_ldifs_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact1.ldif ${TESTDIR}/event1.ldif ${TESTDIR}/todo1.ldif ${TESTDIR}/note1.ldif ${TESTDIR}/contact1_entrymods ${TESTDIR}/event1_entrymods ${TESTDIR}/todo1_entrymods ${TESTDIR}/note1_entrymods ) + ADD_TEST( vg_osynctool_add_mod_del_all_four_ldifs_and_sync ${TESTDIR}/check_osynctool_add_modify_delete_four_ldifs_and_valgrind_and_sync "valgrind_osynctool_add_mod_del_all_four_ldifs_and_sync" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${TESTDIR}/contact1.ldif ${TESTDIR}/event1.ldif ${TESTDIR}/todo1.ldif ${TESTDIR}/note1.ldif ${TESTDIR}/contact1_entrymods ${TESTDIR}/event1_entrymods ${TESTDIR}/todo1_entrymods ${TESTDIR}/note1_entrymods ) ENDIF (VALGRIND_EXECUTABLE) |
From: <svn...@op...> - 2009-07-27 17:28:09
|
Author: scriptor Date: Mon Jul 27 19:27:54 2009 New Revision: 5705 URL: http://www.opensync.org/changeset/5705 Log: I have fixed the wrong exit values in check_ldap_base_entries_objtype and check_ldap_read_entryCSN. Modified: plugins/ldap-sync/tests/check_ldap_base_entries_objtype plugins/ldap-sync/tests/check_ldap_read_entryCSN Modified: plugins/ldap-sync/tests/check_ldap_base_entries_objtype ============================================================================== --- plugins/ldap-sync/tests/check_ldap_base_entries_objtype Mon Jul 27 19:22:31 2009 (r5704) +++ plugins/ldap-sync/tests/check_ldap_base_entries_objtype Mon Jul 27 19:27:54 2009 (r5705) @@ -51,7 +51,7 @@ echo -e "$FILE:$LINENO: ERROR: ldapsearch could not find \"$BASE_CONTACT\". Exiting." echo "Command was:" echo "$LDAPSEARCH $AUTH -LLL -s base -b $BASE_CONTACT" - exit + exit 1 fi @@ -59,7 +59,7 @@ rv=$? if test $rv -ne 0; then echo -e "$FILE:$LINENO: ERROR: ldapsearch could not find \"$BASE_EVENT\". Exiting." - exit + exit 1 fi @@ -67,7 +67,7 @@ rv=$? if test $rv -ne 0; then echo -e "$FILE:$LINENO: ERROR: ldapsearch could not find \"$BASE_TODO\". Exiting." - exit + exit 1 fi @@ -75,7 +75,7 @@ rv=$? if test $rv -ne 0; then echo -e "$FILE:$LINENO: ERROR: ldapsearch could not find \"$BASE_NOTE\". Exiting." - exit + exit 1 fi Modified: plugins/ldap-sync/tests/check_ldap_read_entryCSN ============================================================================== --- plugins/ldap-sync/tests/check_ldap_read_entryCSN Mon Jul 27 19:22:31 2009 (r5704) +++ plugins/ldap-sync/tests/check_ldap_read_entryCSN Mon Jul 27 19:27:54 2009 (r5705) @@ -48,40 +48,73 @@ echo "AUTH = \"$AUTH\"" + + + + +############### contact ################### output=`$LDAPSEARCH $AUTH -LLL -s base -b $BASE_CONTACT entryCSN` rv=$? if test $rv -ne 0; then echo -e "$FILE:$LINENO: ERROR: ldapsearch could not search \"$BASE_CONTACT\" for entryCSN. Exiting." echo "Command was:" echo "$LDAPSEARCH $AUTH -LLL -s base -b $BASE_CONTACT entryCSN" - exit + exit 1; fi echo $output | grep -q "entryCSN" rv=$? if test $rv -ne 0; then - echo -e "$FILE:$LINENO: ERROR: ldapsearch could not find entryCSN with \"$BASE_CONTACT\". Exiting." - exit -fi + echo -e "$FILE:$LINENO: INFO: ldapsearch could not find entryCSN with \"$BASE_CONTACT\". Falling back to modifyTimestamp." + output=`$LDAPSEARCH $AUTH -LLL -s base -b $BASE_CONTACT modifyTimestamp` + rv=$? + if test $rv -ne 0; then + echo -e "$FILE:$LINENO: ERROR: ldapsearch could not search \"$BASE_CONTACT\" for modifyTimestamp. Exiting." + echo "Command was:" + echo "$LDAPSEARCH $AUTH -LLL -s base -b $BASE_CONTACT modifyTimestamp" + exit 1; + fi + echo $output | grep -q "modifyTimestamp" + rv=$? + if test $rv -ne 0; then + echo -e "$FILE:$LINENO: ERROR: ldapsearch could not even find modifyTimestamp with \"$BASE_CONTACT\". Exiting." + exit 1; + fi +fi +############### event ################### output=$($LDAPSEARCH $AUTH -LLL -s base -b $BASE_EVENT entryCSN) rv=$? if test $rv -ne 0; then echo -e "$FILE:$LINENO: ERROR: ldapsearch could not search \"$BASE_EVENT\" for entryCSN. Exiting." - exit + exit 1; fi echo $output | grep -q "entryCSN" rv=$? if test $rv -ne 0; then - echo -e "$FILE:$LINENO: ERROR: ldapsearch could not find entryCSN with \"$BASE_EVENT\". Exiting." - exit -fi + echo -e "$FILE:$LINENO: INFO: ldapsearch could not find entryCSN with \"$BASE_EVENT\". Falling back to modifyTimestamp." + output=`$LDAPSEARCH $AUTH -LLL -s base -b $BASE_EVENT modifyTimestamp` + rv=$? + if test $rv -ne 0; then + echo -e "$FILE:$LINENO: ERROR: ldapsearch could not search \"$BASE_EVENT\" for modifyTimestamp. Exiting." + echo "Command was:" + echo "$LDAPSEARCH $AUTH -LLL -s base -b $BASE_EVENT modifyTimestamp" + exit 1; + fi + echo $output | grep -q "modifyTimestamp" + rv=$? + if test $rv -ne 0; then + echo -e "$FILE:$LINENO: ERROR: ldapsearch could not even find modifyTimestamp with \"$BASE_EVENT\". Exiting." + exit 1; + fi + +fi @@ -90,40 +123,66 @@ +############### todo ################### output=$($LDAPSEARCH $AUTH -LLL -s base -b $BASE_TODO entryCSN) rv=$? if test $rv -ne 0; then echo -e "$FILE:$LINENO: ERROR: ldapsearch could not search \"$BASE_TODO\" for entryCSN. Exiting." - exit + exit 1 fi echo $output | grep -q "entryCSN" rv=$? if test $rv -ne 0; then - echo -e "$FILE:$LINENO: ERROR: ldapsearch could not find entryCSN with \"$BASE_TODO\". Exiting." - exit -fi - - - - + echo -e "$FILE:$LINENO: INFO: ldapsearch could not find entryCSN with \"$BASE_TODO\". Falling back to modifyTimestamp." + output=`$LDAPSEARCH $AUTH -LLL -s base -b $BASE_TODO modifyTimestamp` + rv=$? + if test $rv -ne 0; then + echo -e "$FILE:$LINENO: ERROR: ldapsearch could not search \"$BASE_TODO\" for modifyTimestamp. Exiting." + echo "Command was:" + echo "$LDAPSEARCH $AUTH -LLL -s base -b $BASE_TODO modifyTimestamp" + exit 1; + fi + echo $output | grep -q "modifyTimestamp" + rv=$? + if test $rv -ne 0; then + echo -e "$FILE:$LINENO: ERROR: ldapsearch could not even find modifyTimestamp with \"$BASE_TODO\". Exiting." + exit 1; + fi +fi +############### note ################### output=$($LDAPSEARCH $AUTH -LLL -s base -b $BASE_NOTE entryCSN) rv=$? if test $rv -ne 0; then echo -e "$FILE:$LINENO: ERROR: ldapsearch could not search \"$BASE_NOTE\" for entryCSN. Exiting." - exit + exit 1 fi echo $output | grep -q "entryCSN" rv=$? if test $rv -ne 0; then - echo -e "$FILE:$LINENO: ERROR: ldapsearch could not find entryCSN with \"$BASE_NOTE\". Exiting." - exit + echo -e "$FILE:$LINENO: INFO: ldapsearch could not find entryCSN with \"$BASE_NOTE\". Falling back to modifyTimestamp." + output=`$LDAPSEARCH $AUTH -LLL -s base -b $BASE_NOTE modifyTimestamp` + rv=$? + if test $rv -ne 0; then + echo -e "$FILE:$LINENO: ERROR: ldapsearch could not search \"$BASE_NOTE\" for modifyTimestamp. Exiting." + echo "Command was:" + echo "$LDAPSEARCH $AUTH -LLL -s base -b $BASE_NOTE modifyTimestamp" + exit 1; + fi + + echo $output | grep -q "modifyTimestamp" + rv=$? + if test $rv -ne 0; then + echo -e "$FILE:$LINENO: ERROR: ldapsearch could not even find modifyTimestamp with \"$BASE_NOTE\". Exiting." + exit 1; + fi + fi |
From: <svn...@op...> - 2009-07-27 17:22:44
|
Author: scriptor Date: Mon Jul 27 19:22:31 2009 New Revision: 5704 URL: http://www.opensync.org/changeset/5704 Log: The test scripts include now the plugin specific configuration file tests/ldap-sync.conf rather than src/ldap-sync. This seems to be more appropriate with respect to the character of a test file which is often modified just for trying. I have added a check for the modifyTimestamp attribute in check_ldap_read_entryCSN for those cases when the LDAP server does not offer an entryCSN attribute. Both of these attributes are operational attributes. I have fixed the wrong exit values in check_ldap_base_entries_objtype and check_ldap_read_entryCSN. I have disabled the convert_vtodos1 test, because the corresponding XML schema file is buggy and currently not likely to be fixed soon. Modified: plugins/ldap-sync/tests/CMakeLists.txt plugins/ldap-sync/tests/check_add_modify_delete_and_sync plugins/ldap-sync/tests/check_add_modify_delete_and_valgrind_and_sync plugins/ldap-sync/tests/check_add_modify_delete_four_ldifs_and_sync plugins/ldap-sync/tests/check_add_modify_delete_four_ldifs_and_valgrind_and_sync plugins/ldap-sync/tests/check_connect plugins/ldap-sync/tests/check_fastsync plugins/ldap-sync/tests/check_init plugins/ldap-sync/tests/check_modify_and_fastsync plugins/ldap-sync/tests/check_osynctool_add_file_and_slowsync plugins/ldap-sync/tests/check_osynctool_add_file_and_valgrind_and_slowsync plugins/ldap-sync/tests/check_osynctool_add_ldif_and_slowsync plugins/ldap-sync/tests/check_osynctool_add_ldif_and_valgrind_and_slowsync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_sync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_valgrind_and_sync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_files_and_sync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_files_and_valgrind_and_sync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_ldifs_and_sync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_ldifs_and_valgrind_and_sync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_sync plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync plugins/ldap-sync/tests/check_osynctool_file1 plugins/ldap-sync/tests/check_slowsync plugins/ldap-sync/tests/check_sync plugins/ldap-sync/tests/clean_up Modified: plugins/ldap-sync/tests/CMakeLists.txt ============================================================================== --- plugins/ldap-sync/tests/CMakeLists.txt Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/CMakeLists.txt Mon Jul 27 19:22:31 2009 (r5704) @@ -326,7 +326,7 @@ ADD_TEST( convert_vevents1 ${TESTDIR}/check_convert_from_to ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/vevents/*.?c?" "--to-ldap-event" ) -ADD_TEST( convert_vtodos1 ${TESTDIR}/check_convert_from_to ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/vtodos/*.vc?" "--to-ldap-todo" ) +# ADD_TEST( convert_vtodos1 ${TESTDIR}/check_convert_from_to ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/vtodos/*.vc?" "--to-ldap-todo" ) ADD_TEST( convert_vnotes1 ${TESTDIR}/check_convert_from_to ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/vnotes/*.vnt" "--to-ldap-note" ) Modified: plugins/ldap-sync/tests/check_add_modify_delete_and_sync ============================================================================== --- plugins/ldap-sync/tests/check_add_modify_delete_and_sync Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/check_add_modify_delete_and_sync Mon Jul 27 19:22:31 2009 (r5704) @@ -11,7 +11,7 @@ test_name="$1" PLUGINNAME="ldap-sync" PLUGINPATH="$2/src" -CFG="$3/src/$PLUGINNAME" +CFG="$3/tests/${PLUGINNAME}.conf" LDIF=$4 ENTRYMODS=$5 SYNCMETHOD=$6 Modified: plugins/ldap-sync/tests/check_add_modify_delete_and_valgrind_and_sync ============================================================================== --- plugins/ldap-sync/tests/check_add_modify_delete_and_valgrind_and_sync Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/check_add_modify_delete_and_valgrind_and_sync Mon Jul 27 19:22:31 2009 (r5704) @@ -11,7 +11,7 @@ test_name="$1" PLUGINNAME="ldap-sync" PLUGINPATH="$2/src" -CFG="$3/src/$PLUGINNAME" +CFG="$3/tests/${PLUGINNAME}.conf" LDIF=$4 ENTRYMODS=$5 SYNCMETHOD=$6 Modified: plugins/ldap-sync/tests/check_add_modify_delete_four_ldifs_and_sync ============================================================================== --- plugins/ldap-sync/tests/check_add_modify_delete_four_ldifs_and_sync Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/check_add_modify_delete_four_ldifs_and_sync Mon Jul 27 19:22:31 2009 (r5704) @@ -8,7 +8,7 @@ test_name="$1" PLUGINNAME="ldap-sync" PLUGINPATH="$2/src" -CFG="$3/src/$PLUGINNAME" +CFG="$3/tests/${PLUGINNAME}.conf" LDIF1=$4 LDIF2=$5 LDIF3=$6 Modified: plugins/ldap-sync/tests/check_add_modify_delete_four_ldifs_and_valgrind_and_sync ============================================================================== --- plugins/ldap-sync/tests/check_add_modify_delete_four_ldifs_and_valgrind_and_sync Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/check_add_modify_delete_four_ldifs_and_valgrind_and_sync Mon Jul 27 19:22:31 2009 (r5704) @@ -10,7 +10,7 @@ test_name="$1" PLUGINNAME="ldap-sync" PLUGINPATH="$2/src" -CFG="$3/src/$PLUGINNAME" +CFG="$3/tests/${PLUGINNAME}.conf" LDIF1=$4 LDIF2=$5 LDIF3=$6 Modified: plugins/ldap-sync/tests/check_connect ============================================================================== --- plugins/ldap-sync/tests/check_connect Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/check_connect Mon Jul 27 19:22:31 2009 (r5704) @@ -11,7 +11,7 @@ test_name="$1" PLUGINNAME="ldap-sync" PLUGINPATH="$2/src" -CFG="$3/src/$PLUGINNAME" +CFG="$3/tests/${PLUGINNAME}.conf" Modified: plugins/ldap-sync/tests/check_fastsync ============================================================================== --- plugins/ldap-sync/tests/check_fastsync Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/check_fastsync Mon Jul 27 19:22:31 2009 (r5704) @@ -11,7 +11,7 @@ test_name="$1" PLUGINNAME="ldap-sync" PLUGINPATH="$2/src" -CFG="$3/src/$PLUGINNAME" +CFG="$3/tests/${PLUGINNAME}.conf" OSYNCPLUGIN=$(which osyncplugin 2>/dev/null) Modified: plugins/ldap-sync/tests/check_init ============================================================================== --- plugins/ldap-sync/tests/check_init Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/check_init Mon Jul 27 19:22:31 2009 (r5704) @@ -11,7 +11,7 @@ test_name="$1" PLUGINNAME="ldap-sync" PLUGINPATH="$2/src" -CFG="$3/src/$PLUGINNAME" +CFG="$3/tests/${PLUGINNAME}.conf" OSYNCPLUGIN=$(which osyncplugin 2>/dev/null) Modified: plugins/ldap-sync/tests/check_modify_and_fastsync ============================================================================== --- plugins/ldap-sync/tests/check_modify_and_fastsync Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/check_modify_and_fastsync Mon Jul 27 19:22:31 2009 (r5704) @@ -10,7 +10,7 @@ test_name="$1" PLUGINNAME="ldap-sync" PLUGINPATH="$2/src" -CFG="$3/src/$PLUGINNAME" +CFG="$3/tests/${PLUGINNAME}.conf" LDIF=$4 Modified: plugins/ldap-sync/tests/check_osynctool_add_file_and_slowsync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_file_and_slowsync Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/check_osynctool_add_file_and_slowsync Mon Jul 27 19:22:31 2009 (r5704) @@ -6,7 +6,7 @@ test_name="$1" PLUGINNAME="ldap-sync" PLUGINPATH="$2/src" -CFG="$3/src/$PLUGINNAME" +CFG="$3/tests/${PLUGINNAME}.conf" OBJECTTYPE="$4" XMLFILE="$5" Modified: plugins/ldap-sync/tests/check_osynctool_add_file_and_valgrind_and_slowsync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_file_and_valgrind_and_slowsync Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/check_osynctool_add_file_and_valgrind_and_slowsync Mon Jul 27 19:22:31 2009 (r5704) @@ -6,7 +6,7 @@ test_name="$1" PLUGINNAME="ldap-sync" PLUGINPATH="$2/src" -CFG="$3/src/$PLUGINNAME" +CFG="$3/tests/${PLUGINNAME}.conf" OBJECTTYPE="$4" XMLFILE="$5" Modified: plugins/ldap-sync/tests/check_osynctool_add_ldif_and_slowsync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_ldif_and_slowsync Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/check_osynctool_add_ldif_and_slowsync Mon Jul 27 19:22:31 2009 (r5704) @@ -6,7 +6,7 @@ test_name="$1" PLUGINNAME="ldap-sync" PLUGINPATH="$2/src" -CFG="$3/src/$PLUGINNAME" +CFG="$3/tests/${PLUGINNAME}.conf" OBJECTTYPE="$4" LDIF="$5" Modified: plugins/ldap-sync/tests/check_osynctool_add_ldif_and_valgrind_and_slowsync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_ldif_and_valgrind_and_slowsync Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/check_osynctool_add_ldif_and_valgrind_and_slowsync Mon Jul 27 19:22:31 2009 (r5704) @@ -6,7 +6,7 @@ test_name="$1" PLUGINNAME="ldap-sync" PLUGINPATH="$2/src" -CFG="$3/src/$PLUGINNAME" +CFG="$3/tests/${PLUGINNAME}.conf" OBJECTTYPE="$4" LDIF="$5" Modified: plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_sync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_sync Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_sync Mon Jul 27 19:22:31 2009 (r5704) @@ -6,7 +6,7 @@ test_name="$1" PLUGINNAME="ldap-sync" PLUGINPATH="$2/src" -CFG="$3/src/$PLUGINNAME" +CFG="$3/tests/${PLUGINNAME}.conf" OBJECTTYPE="$4" XMLFILE="$5" MODIFIED_FILE="$6" Modified: plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_valgrind_and_sync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_valgrind_and_sync Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/check_osynctool_add_modify_delete_file_and_valgrind_and_sync Mon Jul 27 19:22:31 2009 (r5704) @@ -6,7 +6,7 @@ test_name="$1" PLUGINNAME="ldap-sync" PLUGINPATH="$2/src" -CFG="$3/src/$PLUGINNAME" +CFG="$3/tests/${PLUGINNAME}.conf" OBJECTTYPE="$4" XMLFILE="$5" MODIFIED_FILE="$6" Modified: plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_files_and_sync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_files_and_sync Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_files_and_sync Mon Jul 27 19:22:31 2009 (r5704) @@ -6,7 +6,7 @@ test_name="$1" PLUGINNAME="ldap-sync" PLUGINPATH="$2/src" -CFG="$3/src/$PLUGINNAME" +CFG="$3/tests/${PLUGINNAME}.conf" XMLFILE_CONTACT="$4" XMLFILE_EVENT="$5" XMLFILE_TODO="$6" Modified: plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_files_and_valgrind_and_sync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_files_and_valgrind_and_sync Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_files_and_valgrind_and_sync Mon Jul 27 19:22:31 2009 (r5704) @@ -6,7 +6,7 @@ test_name="$1" PLUGINNAME="ldap-sync" PLUGINPATH="$2/src" -CFG="$3/src/$PLUGINNAME" +CFG="$3/tests/${PLUGINNAME}.conf" XMLFILE_CONTACT="$4" XMLFILE_EVENT="$5" XMLFILE_TODO="$6" Modified: plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_ldifs_and_sync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_ldifs_and_sync Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_ldifs_and_sync Mon Jul 27 19:22:31 2009 (r5704) @@ -6,7 +6,7 @@ test_name="$1" PLUGINNAME="ldap-sync" PLUGINPATH="$2/src" -CFG="$3/src/$PLUGINNAME" +CFG="$3/tests/${PLUGINNAME}.conf" LDIF_CONTACT="$4" LDIF_EVENT="$5" LDIF_TODO="$6" Modified: plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_ldifs_and_valgrind_and_sync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_ldifs_and_valgrind_and_sync Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/check_osynctool_add_modify_delete_four_ldifs_and_valgrind_and_sync Mon Jul 27 19:22:31 2009 (r5704) @@ -6,7 +6,7 @@ test_name="$1" PLUGINNAME="ldap-sync" PLUGINPATH="$2/src" -CFG="$3/src/$PLUGINNAME" +CFG="$3/tests/${PLUGINNAME}.conf" LDIF_CONTACT="$4" LDIF_EVENT="$5" LDIF_TODO="$6" Modified: plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_sync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_sync Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_sync Mon Jul 27 19:22:31 2009 (r5704) @@ -6,7 +6,7 @@ test_name="$1" PLUGINNAME="ldap-sync" PLUGINPATH="$2/src" -CFG="$3/src/$PLUGINNAME" +CFG="$3/tests/${PLUGINNAME}.conf" OBJECTTYPE="$4" LDIF="$5" ENTRYMODS="$6" Modified: plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/check_osynctool_add_modify_delete_ldif_and_valgrind_and_sync Mon Jul 27 19:22:31 2009 (r5704) @@ -6,7 +6,7 @@ test_name="$1" PLUGINNAME="ldap-sync" PLUGINPATH="$2/src" -CFG="$3/src/$PLUGINNAME" +CFG="$3/tests/${PLUGINNAME}.conf" OBJECTTYPE="$4" LDIF="$5" ENTRYMODS="$6" Modified: plugins/ldap-sync/tests/check_osynctool_file1 ============================================================================== --- plugins/ldap-sync/tests/check_osynctool_file1 Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/check_osynctool_file1 Mon Jul 27 19:22:31 2009 (r5704) @@ -18,7 +18,7 @@ PLUGINNAME="ldap-sync" PLUGINPATH="$2/src" -CFG="$3/src/$PLUGINNAME" +CFG="$3/tests/${PLUGINNAME}.conf" Modified: plugins/ldap-sync/tests/check_slowsync ============================================================================== --- plugins/ldap-sync/tests/check_slowsync Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/check_slowsync Mon Jul 27 19:22:31 2009 (r5704) @@ -10,7 +10,7 @@ test_name="$1" PLUGINNAME="ldap-sync" PLUGINPATH="$2/src" -CFG="$3/src/$PLUGINNAME" +CFG="$3/tests/${PLUGINNAME}.conf" OSYNCPLUGIN=$(which osyncplugin 2>/dev/null) Modified: plugins/ldap-sync/tests/check_sync ============================================================================== --- plugins/ldap-sync/tests/check_sync Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/check_sync Mon Jul 27 19:22:31 2009 (r5704) @@ -10,7 +10,7 @@ test_name="$1" PLUGINNAME="ldap-sync" PLUGINPATH="$2/src" -CFG="$3/src/$PLUGINNAME" +CFG="$3/tests/${PLUGINNAME}.conf" OSYNCPLUGIN=$(which osyncplugin 2>/dev/null) Modified: plugins/ldap-sync/tests/clean_up ============================================================================== --- plugins/ldap-sync/tests/clean_up Mon Jul 27 19:21:56 2009 (r5703) +++ plugins/ldap-sync/tests/clean_up Mon Jul 27 19:22:31 2009 (r5704) @@ -5,7 +5,7 @@ FILE=$0 PLUGINNAME="ldap-sync" PLUGINPATH="$1/src" -CFG="$2/src/$PLUGINNAME" +CFG="$2/tests/${PLUGINNAME}.conf" SOURCE_DIR=`dirname $FILE` if test ! -d "$SOURCE_DIR"; then echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR\" is not a directory. Exiting." |
From: <svn...@op...> - 2009-07-27 17:22:08
|
Author: scriptor Date: Mon Jul 27 19:21:56 2009 New Revision: 5703 URL: http://www.opensync.org/changeset/5703 Log: One further suppression. Taken from the following memory error: ==18677== Warning: invalid file descriptor -1 in syscall close() ==18677== Thread 5: ==18677== Invalid read of size 4 ==18677== at 0x3217A14B32: g_atomic_int_exchange_and_add (in /lib64/libglib-2.0.so.0.2000.1) ==18677== by 0x4C8C69C: osync_objtype_sink_unref (opensync_objtype_sink.c:77) ==18677== by 0x4C8A903: osync_plugin_info_unref (opensync_plugin_info.c:67) ==18677== by 0x4C44BBE: _osync_client_handle_finalize (opensync_client.c:793) ==18677== by 0x4C466DE: _osync_client_message_handler (opensync_client.c:1437) ==18677== by 0x4C78C2C: _incoming_dispatch (opensync_queue.c:399) ==18677== by 0x3217A3818D: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.2000.1) ==18677== by 0x3217A3B8E7: (within /lib64/libglib-2.0.so.0.2000.1) ==18677== by 0x3217A3BD84: g_main_loop_run (in /lib64/libglib-2.0.so.0.2000.1) ==18677== by 0x3217A616E3: (within /lib64/libglib-2.0.so.0.2000.1) ==18677== by 0x3216E06869: start_thread (in /lib64/libpthread-2.10.1.so) ==18677== by 0x32162DE25C: clone (in /lib64/libc-2.10.1.so) ==18677== Address 0xd3894a4 is 188 bytes inside a block of size 200 free'd ==18677== at 0x4A0633D: free (vg_replace_malloc.c:323) ==18677== by 0x4C4E4A6: osync_free (opensync_memory.c:50) ==18677== by 0x4C8C771: osync_objtype_sink_unref (opensync_objtype_sink.c:95) ==18677== by 0x8BBB002: ldap_plugin_free_env (ldap_plugin.c:137) ==18677== by 0x8BC3F51: ldap_plugin_finalize (ldap_plugin.c:4247) ==18677== by 0x4C83AF6: osync_plugin_finalize (opensync_plugin.c:193) ==18677== by 0x4C44B5C: _osync_client_handle_finalize (opensync_client.c:781) ==18677== by 0x4C466DE: _osync_client_message_handler (opensync_client.c:1437) ==18677== by 0x4C78C2C: _incoming_dispatch (opensync_queue.c:399) ==18677== by 0x3217A3818D: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.2000.1) ==18677== by 0x3217A3B8E7: (within /lib64/libglib-2.0.so.0.2000.1) ==18677== by 0x3217A3BD84: g_main_loop_run (in /lib64/libglib-2.0.so.0.2000.1) ==18677== by 0x3217A616E3: (within /lib64/libglib-2.0.so.0.2000.1) ==18677== by 0x3216E06869: start_thread (in /lib64/libpthread-2.10.1.so) ==18677== by 0x32162DE25C: clone (in /lib64/libc-2.10.1.so) Modified: plugins/ldap-sync/tests/opensync.suppr Modified: plugins/ldap-sync/tests/opensync.suppr ============================================================================== --- plugins/ldap-sync/tests/opensync.suppr Wed Jul 15 21:49:32 2009 (r5702) +++ plugins/ldap-sync/tests/opensync.suppr Mon Jul 27 19:21:56 2009 (r5703) @@ -4374,4 +4374,20 @@ +{ + <Invalid read of size 4 - because of ldap_plugin_free_env() in ldap_plugin_finalize() > + Memcheck:Addr4 + fun:g_atomic_int_exchange_and_add + fun:osync_objtype_sink_unref + fun:osync_plugin_info_unref + fun:_osync_client_handle_finalize + fun:_osync_client_message_handler + fun:_incoming_dispatch + fun:g_main_context_dispatch + obj:/lib64/libglib-2.0.so.0.2000.1 + fun:g_main_loop_run + obj:/lib64/libglib-2.0.so.0.2000.1 + fun:start_thread + fun:clone +} |
From: <svn...@op...> - 2009-07-20 11:11:02
|
Author: bellmich Date: Mon Jul 20 13:10:53 2009 New Revision: 1222 URL: http://libsyncml.opensync.org/changeset/1222 Log: cleaned up header file usage in objects/sml_ds_server.c Modified: trunk/libsyncml/objects/sml_ds_server.c trunk/libsyncml/sml_command.c trunk/libsyncml/sml_command.h trunk/libsyncml/sml_elements.c trunk/libsyncml/sml_elements.h trunk/libsyncml/sml_session.c trunk/libsyncml/sml_session.h Modified: trunk/libsyncml/objects/sml_ds_server.c ============================================================================== --- trunk/libsyncml/objects/sml_ds_server.c Mon Jul 20 11:45:20 2009 (r1221) +++ trunk/libsyncml/objects/sml_ds_server.c Mon Jul 20 13:10:53 2009 (r1222) @@ -20,12 +20,14 @@ */ #include "sml_ds_server_internals.h" + #include <libsyncml/sml_support.h> #include <libsyncml/sml_error_internals.h> -#include <libsyncml/sml_manager_internals.h> -#include <libsyncml/sml_session_internals.h> -#include <libsyncml/sml_command_internals.h> -#include <libsyncml/sml_elements_internals.h> + +#include <libsyncml/sml_manager.h> +#include <libsyncml/sml_session.h> +#include <libsyncml/sml_command.h> +#include <libsyncml/sml_elements.h> static SmlWriteContext *_write_context_find(SmlDsSession *dsession, const gchar *uid, SmlChangeType type) { @@ -161,19 +163,19 @@ * peer. We only check the required behaviour and not * the optional one. */ - if (status->type == SML_COMMAND_TYPE_ADD || - session->sessionType == SML_SESSION_TYPE_CLIENT) { + if (smlStatusGetType(status) == SML_COMMAND_TYPE_ADD || + smlSessionGetType(session) == SML_SESSION_TYPE_CLIENT) { /* FIXME: How do we handle remote peers which are clients * FIXME: and only support replace? The assembler will * FIXME: send a replace command with a target instead of * FIXME: an add command with a source. */ - if (!status->sourceRef) { + if (!smlStatusGetSourceRef(status)) { smlTrace(TRACE_EXIT_ERROR, "%s: Received add status or change reply from an OMA DS server without sourceRef", __func__); return; } } else { - if (!status->targetRef) { + if (!smlStatusGetTargetRef(status)) { smlTrace(TRACE_EXIT_ERROR, "%s: Received delete or modify status or change reply from an OMA DS client without targetRef", __func__); return; } @@ -535,7 +537,11 @@ smlTrace(TRACE_INTERNAL, "%s: Dispatching alert", __func__); SmlErrorType type = SML_NO_ERROR; - if (!dsession->recvAlertCallback(dsession, dsession->alertCommand->private.alert.type, dsession->alertCommand->private.alert.anchor->last, dsession->alertCommand->private.alert.anchor->next, dsession->recvAlertCallbackUserdata)) + if (!dsession->recvAlertCallback(dsession, + smlCommandGetAlertType(dsession->alertCommand), + smlAnchorGetLast(smlCommandGetAnchor(dsession->alertCommand)), + smlAnchorGetNext(smlCommandGetAnchor(dsession->alertCommand)), + dsession->recvAlertCallbackUserdata)) type = SML_ERROR_REQUIRE_REFRESH; dsession->recvAlertCallback = NULL; @@ -566,13 +572,16 @@ } else if (dsession->recvSync && dsession->recvSyncCallback) { smlTrace(TRACE_INTERNAL, "%s: Dispatching sync", __func__); - dsession->recvSyncCallback(dsession, ((SmlCommand *)(dsession->recvSync->data))->private.sync.numChanged, dsession->recvSyncCallbackUserdata); + dsession->recvSyncCallback(dsession, smlCommandGetNumberOfChanges(((SmlCommand *)(dsession->recvSync->data))), dsession->recvSyncCallbackUserdata); dsession->recvSyncCallback = NULL; while (dsession->recvSync) { SmlCommand *cmd = dsession->recvSync->data; - smlTrace(TRACE_INTERNAL, "%s: answering sync command with cmdRef %i and msgRef %i", __func__, cmd->cmdID, cmd->msgID); + smlTrace(TRACE_INTERNAL, "%s: answering sync command with cmdRef %i and msgRef %i", + __func__, + smlCommandGetID(cmd), + smlCommandGetMessageID(cmd)); reply = smlCommandNewReply(cmd, SML_NO_ERROR, &error); if (!reply) goto error; @@ -616,8 +625,7 @@ SmlCommand *cmd = dsession->recvChanges->data; if (cmd) { - if (!cmd->private.change.items || - !g_list_length(cmd->private.change.items)) + if (!smlCommandGetNumChanges(cmd)) { g_set_error(&error, SML_ERROR, SML_ERROR_GENERIC, "No items found in command."); @@ -630,10 +638,10 @@ * command is aborted. */ - guint i; - for (i=0; i < g_list_length(cmd->private.change.items); i++) + gsize i; + for (i=0; i < smlCommandGetNumChanges(cmd); i++) { - SmlItem *item = g_list_nth_data(cmd->private.change.items, i); + SmlItem *item = smlCommandGetNthChange(cmd, i); if (!item) { g_set_error(&error, SML_ERROR, SML_ERROR_GENERIC, @@ -643,7 +651,7 @@ /* We'd rather use the target of the change since it already the mapped * uid (if we are a client for example). If it is not given we use the * source uri. This has then to be translated by the sync engine of course */ - if ((!item->source && !item->target)) { + if ((!smlItemGetSource(item) && !smlItemGetTarget(item))) { g_set_error(&error, SML_ERROR, SML_ERROR_GENERIC, "Cannot determine UID because source an target are missing on item %i.", i); goto error; @@ -655,15 +663,15 @@ goto error; if (!dsession->changesCallback(dsession, - cmd->private.change.type, - item->target ? sml_location_get_uri(item->target) : sml_location_get_uri(item->source), + smlCommandGetChangeType(cmd), + smlItemGetTarget(item) ? sml_location_get_uri(smlItemGetTarget(item)) : sml_location_get_uri(smlItemGetSource(item)), data, size, - item->contenttype, + smlItemGetContentType(item), dsession->changesCallbackUserdata, &error)) goto error; } - if (cmd->private.change.type == SML_CHANGE_ADD) + if (smlCommandGetChangeType(cmd) == SML_CHANGE_ADD) reply = smlCommandNewReply(cmd, SML_ITEM_ADDED, &error); else reply = smlCommandNewReply(cmd, SML_NO_ERROR, &error); @@ -735,7 +743,7 @@ g_mutex_lock(dsession->lock); - if (!cmd->target || !cmd->source) { + if (!smlCommandGetTarget(cmd) || !smlCommandGetSource(cmd)) { SmlStatus *reply = smlCommandNewReply(cmd, SML_ERROR_BAD_REQUEST, &error); if (!reply) goto error; @@ -751,7 +759,7 @@ return; } - if (!sml_location_is_equal(dsession->location, cmd->target)) { + if (!sml_location_is_equal(dsession->location, smlCommandGetTarget(cmd))) { SmlStatus *reply = smlCommandNewReply(cmd, SML_ERROR_NOT_FOUND, &error); if (!reply) goto error; @@ -770,8 +778,8 @@ smlCommandRef(cmd); if (!dsession->target) { - dsession->target = cmd->source; - g_object_ref(cmd->source); + dsession->target = smlCommandGetSource(cmd); + g_object_ref(dsession->target); } dsession->alertCommand = cmd; @@ -844,11 +852,17 @@ } if (dsession->syncReply == SML_ERROR_UNKNOWN) { - smlTrace(TRACE_INTERNAL, "%s: Storing sync command with cmdRef %i and msgRef %i", __func__, cmd->cmdID, cmd->msgID); + smlTrace(TRACE_INTERNAL, "%s: Storing sync command with cmdRef %i and msgRef %i", + __func__, + smlCommandGetID(cmd), + smlCommandGetMessageID(cmd)); smlCommandRef(cmd); dsession->recvSync = g_list_append(dsession->recvSync, cmd); } else { - smlTrace(TRACE_INTERNAL, "%s: Using stored sync reply on cmd with cmdRef %i and msgRef %i", __func__, cmd->cmdID, cmd->msgID); + smlTrace(TRACE_INTERNAL, "%s: Using stored sync reply on cmd with cmdRef %i and msgRef %i", + __func__, + smlCommandGetID(cmd), + smlCommandGetMessageID(cmd)); SmlStatus *reply = smlCommandNewReply(cmd, dsession->syncReply, &error); if (!reply) goto error; @@ -904,26 +918,26 @@ smlStatusUnref(reply); - GList *m = NULL; - for (m = cmd->private.map.items; m; m = m->next) { - SmlMapItem *item = m->data; + gsize i; + for (i = 0; i < smlCommandGetNumMappings(cmd); i++) { + SmlMapItem *item = smlCommandGetNthMapping(cmd, i); if (dsession->recvMappingCallback) { dsession->recvMappingCallback( dsession, - item->target, - item->source, + smlMapItemGetTarget(item), + smlMapItemGetSource(item), dsession->recvMappingCallbackUserdata); } else { - SmlWriteContext *ctx = _write_context_find(dsession, sml_location_get_uri(item->target), SML_CHANGE_ADD); + SmlWriteContext *ctx = _write_context_find(dsession, sml_location_get_uri(smlMapItemGetTarget(item)), SML_CHANGE_ADD); if (ctx) { - ctx->newuid = g_strdup(sml_location_get_uri(item->source)); + ctx->newuid = g_strdup(sml_location_get_uri(smlMapItemGetSource(item))); _write_context_dispatch(dsession, ctx); } else { smlTrace(TRACE_ERROR, "%s: Unknown map ... %s => %s", __func__, - VA_STRING(sml_location_get_uri(item->target)), - VA_STRING(sml_location_get_uri(item->source))); + VA_STRING(sml_location_get_uri(smlMapItemGetTarget(item))), + VA_STRING(sml_location_get_uri(smlMapItemGetSource(item)))); } } } @@ -1347,11 +1361,11 @@ GError *error = NULL; /* ensure that the session is in client mode */ - session->sessionType = SML_SESSION_TYPE_CLIENT; + smlSessionSetType(session, SML_SESSION_TYPE_CLIENT); /* fix target */ g_object_unref(server->target); - server->target = cmd->source; + server->target = smlCommandGetSource(cmd); g_object_ref(server->target); /* handle the SAN */ @@ -1359,7 +1373,7 @@ SmlErrorType type = server->sanSessionCallback( server, session, - cmd->private.alert.type, + smlCommandGetAlertType(cmd), server->sanSessionCallbackUserdata); SmlStatus *reply = smlCommandNewReply(cmd, type, &error); Modified: trunk/libsyncml/sml_command.c ============================================================================== --- trunk/libsyncml/sml_command.c Mon Jul 20 11:45:20 2009 (r1221) +++ trunk/libsyncml/sml_command.c Mon Jul 20 13:10:53 2009 (r1222) @@ -250,6 +250,18 @@ return status->data; } +SmlLocation* +smlStatusGetSourceRef (SmlStatus *status) +{ + return status->sourceRef; +} + +SmlLocation* +smlStatusGetTargetRef (SmlStatus *status) +{ + return status->targetRef; +} + SmlCommand* smlCommandNew (SmlCommandType type, GError **error) @@ -1011,12 +1023,6 @@ } } -SmlAlertType -smlCommandGetAlertType (SmlCommand *cmd) -{ - return cmd->private.alert.type; -} - gsize smlCommandGetSize (SmlCommand *cmd) { @@ -1071,6 +1077,18 @@ return cmd->type; } +SmlAlertType +smlCommandGetAlertType (SmlCommand *cmd) +{ + return cmd->private.alert.type; +} + +SmlChangeType +smlCommandGetChangeType (SmlCommand *cmd) +{ + return cmd->private.change.type; +} + SmlLocation* smlCommandGetSource (SmlCommand *cmd) { @@ -1089,6 +1107,12 @@ return cmd->private.alert.contentType; } +SmlAnchor* +smlCommandGetAnchor (SmlCommand *cmd) +{ + return cmd->private.alert.anchor; +} + void smlCommandDisableChanges (SmlCommand *cmd) { @@ -1121,6 +1145,13 @@ } } +/* NumberOfChanges in sync command */ +gsize +smlCommandGetNumberOfChanges (SmlCommand *cmd) +{ + return cmd->private.sync.numChanged; +} + gsize smlCommandGetNumChanges (SmlCommand *cmd) { @@ -1129,6 +1160,30 @@ return g_list_length(cmd->private.change.items); } +SmlItem* +smlCommandGetNthChange (SmlCommand *cmd, + gsize n) +{ + smlAssert(cmd); + return g_list_nth_data(cmd->private.change.items, n); +} + +/* number of items in change command */ +gsize +smlCommandGetNumMappings (SmlCommand *cmd) +{ + smlAssert(cmd); + return g_list_length(cmd->private.map.items); +} + +SmlMapItem* +smlCommandGetNthMapping (SmlCommand *cmd, + gsize n) +{ + smlAssert(cmd); + return g_list_nth_data(cmd->private.map.items, n); +} + gsize smlCommandGetNthItemSize (SmlCommand *orig_cmd, gsize n, @@ -1224,25 +1279,11 @@ } } -SmlItem* -smlCommandGetFirstChange (SmlCommand *cmd) -{ - smlAssert(cmd); - return g_list_nth_data(cmd->private.change.items, 0); -} - -SmlItem* -smlCommandGetLastChange (SmlCommand *cmd) -{ - smlAssert(cmd); - return g_list_nth_data(cmd->private.change.items, g_list_length(cmd->private.change.items) - 1); -} - void smlCommandFreeFirstChange (SmlCommand *cmd) { smlAssert(cmd); - SmlItem *first = smlCommandGetFirstChange(cmd); + SmlItem *first = smlCommandGetNthChange(cmd, 0); cmd->private.change.items = g_list_remove(cmd->private.change.items, first); smlItemUnref(first); } Modified: trunk/libsyncml/sml_command.h ============================================================================== --- trunk/libsyncml/sml_command.h Mon Jul 20 11:45:20 2009 (r1221) +++ trunk/libsyncml/sml_command.h Mon Jul 20 13:10:53 2009 (r1222) @@ -51,6 +51,8 @@ gsize smlStatusGetCommandRef (SmlStatus *status); gsize smlStatusGetMessageRef (SmlStatus *status); const gchar* smlStatusGetData (SmlStatus *status); +SmlLocation* smlStatusGetSourceRef (SmlStatus *status); +SmlLocation* smlStatusGetTargetRef (SmlStatus *status); SmlCommand* smlCommandNew (SmlCommandType type, GError **error); SmlStatus* smlCommandNewReply (const SmlCommand *cmd, SmlErrorType code, GError **error); @@ -77,7 +79,6 @@ void smlCommandSetMessageID (SmlCommand *cmd, gsize id); gsize smlCommandGetMessageID (SmlCommand *cmd); gsize smlCommandGetMaxObjSize (SmlCommand *cmd); -SmlAlertType smlCommandGetAlertType (SmlCommand *cmd); gsize smlCommandGetSize (SmlCommand *cmd); void smlCommandSetSize (SmlCommand *cmd, gsize size); void smlCommandSetNoResp (SmlCommand *cmd, gboolean noResp); @@ -86,21 +87,25 @@ SmlItem* smlCommandGetItem(SmlCommand *cmd); SmlCommandType smlCommandGetType (SmlCommand *cmd); +SmlAlertType smlCommandGetAlertType (SmlCommand *cmd); +SmlChangeType smlCommandGetChangeType (SmlCommand *cmd); SmlLocation* smlCommandGetSource (SmlCommand *cmd); SmlLocation* smlCommandGetTarget (SmlCommand *cmd); const gchar* smlCommandGetContentType (SmlCommand *cmd); - +SmlAnchor* smlCommandGetAnchor (SmlCommand *cmd); G_CONST_RETURN gchar *smlCommandTypeToString(SmlCommandType type, GError **error); -void smlCommandDisableChanges (SmlCommand *cmd); -void smlCommandEnableChanges (SmlCommand *cmd); -gsize smlCommandGetNumChanges (SmlCommand *cmd); +void smlCommandDisableChanges (SmlCommand *cmd); +void smlCommandEnableChanges (SmlCommand *cmd); +gsize smlCommandGetNumberOfChanges (SmlCommand *cmd); /* NumberOfChanges in sync command */ +gsize smlCommandGetNumChanges (SmlCommand *cmd); /* number of items in change command */ +SmlItem* smlCommandGetNthChange (SmlCommand *cmd, gsize n); +gsize smlCommandGetNumMappings (SmlCommand *cmd); /* number of items in change command */ +SmlMapItem* smlCommandGetNthMapping (SmlCommand *cmd, gsize n); SmlStatus* smlCommandResultsGetStatus (SmlCommand *cmd); void smlCommandTransferItems (SmlCommand *source, SmlCommand *target, gsize start); -SmlItem* smlCommandGetLastChange (SmlCommand *cmd); -SmlItem* smlCommandGetFirstChange (SmlCommand *cmd); void smlCommandFreeFirstChange (SmlCommand *cmd); gsize smlCommandGetNthItemSize (SmlCommand *orig_cmd, gsize n, GError **error); Modified: trunk/libsyncml/sml_elements.c ============================================================================== --- trunk/libsyncml/sml_elements.c Mon Jul 20 11:45:20 2009 (r1221) +++ trunk/libsyncml/sml_elements.c Mon Jul 20 13:10:53 2009 (r1222) @@ -926,3 +926,14 @@ smlTrace(TRACE_EXIT, "%s", __func__); } +SmlLocation* +smlMapItemGetSource (SmlMapItem *item) +{ + return item->source; +} + +SmlLocation* +smlMapItemGetTarget (SmlMapItem *item) +{ + return item->target; +} Modified: trunk/libsyncml/sml_elements.h ============================================================================== --- trunk/libsyncml/sml_elements.h Mon Jul 20 11:45:20 2009 (r1221) +++ trunk/libsyncml/sml_elements.h Mon Jul 20 13:10:53 2009 (r1222) @@ -101,9 +101,11 @@ const gchar* smlChalGetNonce (SmlChal *chal); /* Base 64 only */ SmlAuthType smlChalGetType (SmlChal *chal); -SmlMapItem* smlMapItemNew (const gchar *uid, const gchar *newuid, GError **error); -SmlMapItem* smlMapItemRef (SmlMapItem *item); -void smlMapItemUnref (SmlMapItem *item); +SmlMapItem* smlMapItemNew (const gchar *uid, const gchar *newuid, GError **error); +SmlMapItem* smlMapItemRef (SmlMapItem *item); +void smlMapItemUnref (SmlMapItem *item); +SmlLocation* smlMapItemGetSource (SmlMapItem *item); +SmlLocation* smlMapItemGetTarget (SmlMapItem *item); #endif //_SML_ELEMENTS_H_ Modified: trunk/libsyncml/sml_session.c ============================================================================== --- trunk/libsyncml/sml_session.c Mon Jul 20 11:45:20 2009 (r1221) +++ trunk/libsyncml/sml_session.c Mon Jul 20 13:10:53 2009 (r1222) @@ -330,7 +330,7 @@ char *data = NULL; gsize size = 0; - SmlItem *item = smlCommandGetFirstChange(cmd); + SmlItem *item = smlCommandGetNthChange(cmd, 0); if (!smlItemGetData(item, &data, &size, error)) goto error; @@ -384,7 +384,7 @@ * happen that the item is replaced. Therefore the item * reference must be determined again. */ - item = smlCommandGetFirstChange(cmd); + item = smlCommandGetNthChange(cmd, 0); if (smlItemGetMoreData(item) == FALSE) { smlTrace(TRACE_INTERNAL, "%s: This is the last chunk", __func__); @@ -1223,7 +1223,7 @@ /* Here we catch changes with moreData set */ if (smlCommandGetType(cmd) == SML_COMMAND_TYPE_ADD || smlCommandGetType(cmd) == SML_COMMAND_TYPE_REPLACE) { - SmlItem *lastItem = smlCommandGetLastChange(cmd); + SmlItem *lastItem = smlCommandGetNthChange(cmd, smlCommandGetNumChanges(cmd)-1); if (session->incomingBuffer) { /* There is a command in the incoming buffer. @@ -1252,12 +1252,12 @@ */ char *data = NULL; gsize size = 0; - SmlItem *item = smlCommandGetFirstChange(cmd); + SmlItem *item = smlCommandGetNthChange(cmd, 0); if (!item) goto error; if (!smlItemGetData(item, &data, &size, error)) goto error; - lastItem = smlCommandGetLastChange(session->incomingBuffer); + lastItem = smlCommandGetNthChange(session->incomingBuffer, smlCommandGetNumChanges(session->incomingBuffer) -1); if (!smlItemAddData(lastItem, data, size, error)) goto error; smlItemSetMoreData(lastItem, smlItemGetMoreData(item)); @@ -1274,7 +1274,7 @@ /* If the last item of the command is complete * then the command must be prepared for dispatching. */ - lastItem = smlCommandGetLastChange(session->incomingBuffer); + lastItem = smlCommandGetNthChange(session->incomingBuffer, smlCommandGetNumChanges(session->incomingBuffer) -1); if (!smlItemGetMoreData(lastItem)) { smlTrace(TRACE_INTERNAL, "%s: Command buffer complete. Dispatching.", @@ -1787,6 +1787,13 @@ return session->sessionType; } +void +smlSessionSetType (SmlSession *session, + SmlSessionType type) +{ + session->sessionType = type; +} + SmlLocation* smlSessionGetSource (SmlSession *session) { Modified: trunk/libsyncml/sml_session.h ============================================================================== --- trunk/libsyncml/sml_session.h Mon Jul 20 11:45:20 2009 (r1221) +++ trunk/libsyncml/sml_session.h Mon Jul 20 13:10:53 2009 (r1222) @@ -78,6 +78,7 @@ void smlSessionSetSessionID (SmlSession *session, gsize sessionID); SmlProtocolVersion smlSessionGetVersion (SmlSession *session); SmlSessionType smlSessionGetType (SmlSession *session); +void smlSessionSetType (SmlSession *session, SmlSessionType type); void smlSessionDispatchEvent (SmlSession *session, SmlSessionEventType type, SmlCommand *cmd, SmlCommand *parent, SmlStatus *headerreply, const GError *error); SmlLocation* smlSessionGetSource (SmlSession *session); SmlLocation* smlSessionGetTarget (SmlSession *session); |
From: <svn...@op...> - 2009-07-20 09:45:29
|
Author: bellmich Date: Mon Jul 20 11:45:20 2009 New Revision: 1221 URL: http://libsyncml.opensync.org/changeset/1221 Log: cleaned up header file usage in objects/sml_devinf_obj.c Modified: trunk/libsyncml/objects/sml_devinf_obj.c trunk/libsyncml/sml_command.c trunk/libsyncml/sml_command.h trunk/libsyncml/sml_command_internals.h Modified: trunk/libsyncml/objects/sml_devinf_obj.c ============================================================================== --- trunk/libsyncml/objects/sml_devinf_obj.c Fri Jul 17 21:01:06 2009 (r1220) +++ trunk/libsyncml/objects/sml_devinf_obj.c Mon Jul 20 11:45:20 2009 (r1221) @@ -22,16 +22,16 @@ #include <config.h> #include "sml_devinf_obj_internals.h" + #include <libsyncml/sml_support.h> -#include <libsyncml/sml_session_internals.h> -#include <libsyncml/sml_elements_internals.h> -#include <libsyncml/sml_command_internals.h> #include "libsyncml/sml_error_internals.h" + +#include <libsyncml/sml_session.h> +#include <libsyncml/sml_elements.h> +#include <libsyncml/sml_command.h> #include "libsyncml/parser/sml_xml_parse.h" #include "libsyncml/data_sync_api/sml_location_internals.h" -#include "../syncml.h" - #ifdef WIN32 #include <windef.h> #else @@ -130,13 +130,13 @@ /* verify that it is a real result with data */ - if (result->type != SML_COMMAND_TYPE_RESULTS) { + if (smlCommandGetType(result) != SML_COMMAND_TYPE_RESULTS) { g_set_error(&error, SML_ERROR, SML_ERROR_GENERIC, "devinf command was not a result"); goto error; } - SmlItem *item = result->private.results.status->item; + SmlItem *item = smlCommandGetItem(result); if (!item) { g_set_error(&error, SML_ERROR, SML_ERROR_GENERIC, "devinf result did not have a item"); @@ -205,7 +205,7 @@ * required for OMA DS servers. */ if (smlSessionGetVersion(session) >= SML_VERSION_11 && - session->sessionType == SML_SESSION_TYPE_SERVER && + smlSessionGetType(session) == SML_SESSION_TYPE_SERVER && !sml_dev_inf_get_support_large_objs(agent->devinf)) { g_set_error(error, SML_ERROR, SML_ERROR_INTERNAL_MISCONFIGURATION, @@ -340,7 +340,7 @@ char *data = NULL; gsize size = 0; - if (!smlItemGetData(cmd->private.access.item, &data, &size, &error)) + if (!smlItemGetData(smlCommandGetItem(cmd), &data, &size, &error)) goto error; SmlDevInfAgentSession *as = _get_session(agent, session); Modified: trunk/libsyncml/sml_command.c ============================================================================== --- trunk/libsyncml/sml_command.c Fri Jul 17 21:01:06 2009 (r1220) +++ trunk/libsyncml/sml_command.c Mon Jul 20 11:45:20 2009 (r1221) @@ -1050,6 +1050,21 @@ cmd->pushedBack = pushedBack; } +SmlItem* +smlCommandGetItem(SmlCommand *cmd) +{ + switch(cmd->type) + { + case SML_COMMAND_TYPE_PUT: + case SML_COMMAND_TYPE_GET: + return cmd->private.access.item; + case SML_COMMAND_TYPE_RESULTS: + return cmd->private.results.status->item; + default: + return NULL; + } +} + SmlCommandType smlCommandGetType (SmlCommand *cmd) { Modified: trunk/libsyncml/sml_command.h ============================================================================== --- trunk/libsyncml/sml_command.h Fri Jul 17 21:01:06 2009 (r1220) +++ trunk/libsyncml/sml_command.h Mon Jul 20 11:45:20 2009 (r1221) @@ -83,12 +83,14 @@ void smlCommandSetNoResp (SmlCommand *cmd, gboolean noResp); gboolean smlCommandGetPushedBack (SmlCommand *cmd); void smlCommandSetPushedBack (SmlCommand *cmd, gboolean pushedBack); +SmlItem* smlCommandGetItem(SmlCommand *cmd); SmlCommandType smlCommandGetType (SmlCommand *cmd); SmlLocation* smlCommandGetSource (SmlCommand *cmd); SmlLocation* smlCommandGetTarget (SmlCommand *cmd); const gchar* smlCommandGetContentType (SmlCommand *cmd); + G_CONST_RETURN gchar *smlCommandTypeToString(SmlCommandType type, GError **error); void smlCommandDisableChanges (SmlCommand *cmd); Modified: trunk/libsyncml/sml_command_internals.h ============================================================================== --- trunk/libsyncml/sml_command_internals.h Fri Jul 17 21:01:06 2009 (r1220) +++ trunk/libsyncml/sml_command_internals.h Mon Jul 20 11:45:20 2009 (r1221) @@ -47,6 +47,9 @@ gboolean hasNumChanged; } SmlCommandSyncPrivate; +/* used by Put and Get + * The name means direct access to data items on a device. + */ typedef struct SmlCommandAccessPrivate { gchar *type; SmlItem *item; |
From: <svn...@op...> - 2009-07-17 19:01:15
|
Author: bellmich Date: Fri Jul 17 21:01:06 2009 New Revision: 1220 URL: http://libsyncml.opensync.org/changeset/1220 Log: cleaned up header file usage in objects/sml_auth.c Modified: trunk/libsyncml/objects/sml_auth.c trunk/libsyncml/sml_command.c trunk/libsyncml/sml_command.h trunk/libsyncml/sml_session.c trunk/libsyncml/sml_session.h Modified: trunk/libsyncml/objects/sml_auth.c ============================================================================== --- trunk/libsyncml/objects/sml_auth.c Fri Jul 17 18:34:20 2009 (r1219) +++ trunk/libsyncml/objects/sml_auth.c Fri Jul 17 21:01:06 2009 (r1220) @@ -20,11 +20,14 @@ */ #include "sml_auth_internals.h" + #include <libsyncml/sml_support.h> -#include <libsyncml/sml_session_internals.h> -#include <libsyncml/sml_elements_internals.h> -#include <libsyncml/sml_command_internals.h> #include "libsyncml/sml_error_internals.h" + +#include <libsyncml/sml_session.h> +#include <libsyncml/sml_elements.h> +#include <libsyncml/sml_command.h> + #include <string.h> static SmlStatus* _smlAuthHeaderReply(SmlSession *session, SmlErrorType code, SmlAuthType auth, GError **error); @@ -45,7 +48,7 @@ SmlAuthenticator *auth = userdata; GError *error = NULL; - if (session->sessionType == SML_SESSION_TYPE_CLIENT) { + if (smlSessionGetType(session) == SML_SESSION_TYPE_CLIENT) { /* If this is an OMA DS client then there will be no * authentication. Only OMA DS servers can request an * authentication from the remote peer. @@ -75,7 +78,7 @@ */ smlTrace(TRACE_INTERNAL, "%s: Auth is required", __func__); auth->state = SML_ERROR_AUTH_REQUIRED; - session->authenticate = TRUE; + smlSessionSetAuthenticate(session, TRUE); } else { @@ -86,7 +89,7 @@ } } else { /* cred available */ - smlTrace(TRACE_INTERNAL, "%s: Cred is \"%s\"", __func__, VA_STRING(cred->data)); + smlTrace(TRACE_INTERNAL, "%s: Cred is \"%s\"", __func__, VA_STRING(smlCredGetData(cred))); if (!auth->enabled) { smlTrace(TRACE_INTERNAL, "%s: Cred received but unwanted", __func__); @@ -100,15 +103,15 @@ * Cred * LocName(username) */ - if (auth->verifyCallback(session->chal, cred, - sml_location_get_name(session->source), + if (auth->verifyCallback(smlSessionGetChal(session), cred, + sml_location_get_name(smlSessionGetSource(session)), auth->verifyCallbackUserdata, &error)) { auth->state = SML_AUTH_ACCEPTED; } else { g_set_error(&error, SML_ERROR, SML_ERROR_AUTH_REJECTED, "Auth rejected for username %s", - sml_location_get_name(session->source)); + sml_location_get_name(smlSessionGetSource(session))); smlSessionDispatchEvent(session, SML_SESSION_EVENT_ERROR, NULL, NULL, NULL, error); g_error_free(error); error = NULL; @@ -123,7 +126,7 @@ if (auth->state == SML_ERROR_AUTH_REJECTED) { smlTrace(TRACE_INTERNAL, "%s: Ending session due to wrong / missing creds", __func__); - session->end = TRUE; + smlSessionSetEnd(session, TRUE); } reply = _smlAuthHeaderReply(session, auth->state, auth->type, &error); @@ -137,11 +140,12 @@ smlStatusUnref(reply); - if (!session->established && !session->end && - !session->authenticate && - session->sessionType == SML_SESSION_TYPE_SERVER) + if (!smlSessionGetEstablished(session) && + !smlSessionGetEnd(session) && + !smlSessionGetAuthenticate(session) && + smlSessionGetType(session) == SML_SESSION_TYPE_SERVER) { - session->established = TRUE; + smlSessionSetEstablished(session, TRUE); smlSessionDispatchEvent( session, SML_SESSION_EVENT_ESTABLISHED, NULL, NULL, NULL, NULL); @@ -262,10 +266,10 @@ * SECURITY NOTE: against replay attacks. * */ - if (chal && chal->type != cred->type) + if (chal && smlChalGetType(chal) != smlCredGetType(cred)) { - if (chal->type == SML_AUTH_TYPE_BASIC && - cred->type == SML_AUTH_TYPE_MD5) + if (smlChalGetType(chal) == SML_AUTH_TYPE_BASIC && + smlCredGetType(cred) == SML_AUTH_TYPE_MD5) { /* This is an upgrade to more security. * So it is acceptable. @@ -281,7 +285,7 @@ smlTrace(TRACE_INTERNAL, "%s - authentication security policy ok", __func__); char *wanted = NULL; - switch (cred->type) { + switch (smlCredGetType(cred)) { case SML_AUTH_TYPE_BASIC: smlTrace(TRACE_INTERNAL, "%s - SML_AUTH_TYPE_BASIC", __func__); wanted = smlAuthGetCredString(SML_AUTH_TYPE_BASIC, username, password, NULL, error); @@ -292,7 +296,7 @@ wanted = smlAuthGetCredString( SML_AUTH_TYPE_MD5, username, password, - chal->nonce_b64, error); + smlChalGetNonce(chal), error); else wanted = smlAuthGetCredString( SML_AUTH_TYPE_MD5, @@ -307,7 +311,7 @@ smlTrace(TRACE_INTERNAL, "%s - credential string calculated", __func__); /* compare the authentication string */ - if (strcmp(wanted, cred->data)) + if (strcmp(wanted, smlCredGetData(cred))) { smlTrace(TRACE_INTERNAL, "%s - credentials mismatch", __func__); smlSafeCFree(&wanted); @@ -399,18 +403,22 @@ // of the remote peer // we have to revert source and target smlTrace(TRACE_INTERNAL, "%s: SourceRef: %s --> TargetRef: %s", - __func__, VA_STRING(sml_location_get_uri(session->target)), VA_STRING(sml_location_get_uri(session->source))); - SmlStatus *reply = smlStatusNew(code, 0, session->lastReceivedMessageID, session->target, session->source, SML_COMMAND_TYPE_HEADER, error); + __func__, + VA_STRING(sml_location_get_uri(smlSessionGetTarget(session))), + VA_STRING(sml_location_get_uri(smlSessionGetSource(session)))); + SmlStatus *reply = smlStatusNew(code, 0, smlSessionGetLastRecvMsgID(session), smlSessionGetTarget(session), smlSessionGetSource(session), SML_COMMAND_TYPE_HEADER, error); if (!reply) goto error; if (code == SML_ERROR_AUTH_REJECTED || code == SML_ERROR_AUTH_REQUIRED) { - reply->chal = smlChalNew(auth, error); - if (!reply->chal) + SmlChal *chal = smlChalNew(auth, error); + if (!chal) goto error; - session->chal = reply->chal; - smlChalRef(session->chal); + smlStatusSetChal(reply, chal); + smlSessionSetChal(session, chal); + smlChalUnref(chal); + chal = NULL; } smlTrace(TRACE_EXIT, "%s: %p", __func__, reply); Modified: trunk/libsyncml/sml_command.c ============================================================================== --- trunk/libsyncml/sml_command.c Fri Jul 17 18:34:20 2009 (r1219) +++ trunk/libsyncml/sml_command.c Fri Jul 17 21:01:06 2009 (r1220) @@ -222,6 +222,16 @@ return status->chal; } +void +smlStatusSetChal (SmlStatus *status, + SmlChal *chal) +{ + if (status->chal) + smlChalUnref(status->chal); + status->chal = chal; + smlChalRef(chal); +} + gsize smlStatusGetCommandRef (SmlStatus *status) { Modified: trunk/libsyncml/sml_command.h ============================================================================== --- trunk/libsyncml/sml_command.h Fri Jul 17 18:34:20 2009 (r1219) +++ trunk/libsyncml/sml_command.h Fri Jul 17 21:01:06 2009 (r1220) @@ -47,6 +47,7 @@ SmlCommandType smlStatusGetType (SmlStatus *status); SmlAnchor* smlStatusGetAnchor (SmlStatus *status); SmlChal* smlStatusGetChal (SmlStatus *status); +void smlStatusSetChal (SmlStatus *status, SmlChal *chal); gsize smlStatusGetCommandRef (SmlStatus *status); gsize smlStatusGetMessageRef (SmlStatus *status); const gchar* smlStatusGetData (SmlStatus *status); @@ -90,9 +91,9 @@ G_CONST_RETURN gchar *smlCommandTypeToString(SmlCommandType type, GError **error); -void smlCommandDisableChanges (SmlCommand *cmd); -void smlCommandEnableChanges (SmlCommand *cmd); -gsize smlCommandGetNumChanges (SmlCommand *cmd); +void smlCommandDisableChanges (SmlCommand *cmd); +void smlCommandEnableChanges (SmlCommand *cmd); +gsize smlCommandGetNumChanges (SmlCommand *cmd); SmlStatus* smlCommandResultsGetStatus (SmlCommand *cmd); void smlCommandTransferItems (SmlCommand *source, SmlCommand *target, gsize start); Modified: trunk/libsyncml/sml_session.c ============================================================================== --- trunk/libsyncml/sml_session.c Fri Jul 17 18:34:20 2009 (r1219) +++ trunk/libsyncml/sml_session.c Fri Jul 17 21:01:06 2009 (r1220) @@ -1820,6 +1820,48 @@ smlCredRef(session->cred); } +SmlChal* +smlSessionGetChal (SmlSession *session) +{ + return session->chal; +} + +void +smlSessionSetChal (SmlSession *session, + SmlChal *chal) +{ + if (session->chal) + smlChalUnref(session->chal); + session->chal = chal; + smlChalRef(chal); +} + +gboolean +smlSessionGetEnd (SmlSession *session) +{ + return session->end; +} + +void +smlSessionSetEnd (SmlSession *session, + gboolean end) +{ + session->end = end; +} + +gboolean +smlSessionGetAuthenticate (SmlSession *session) +{ + return session->authenticate; +} + +void +smlSessionSetAuthenticate (SmlSession *session, + gboolean authenticate) +{ + session->authenticate = authenticate; +} + /*@}*/ /** @@ -2577,6 +2619,12 @@ return FALSE; } +gsize +smlSessionGetLastRecvMsgID (SmlSession *session) +{ + return session->lastReceivedMessageID; +} + /*@}*/ /*@}*/ Modified: trunk/libsyncml/sml_session.h ============================================================================== --- trunk/libsyncml/sml_session.h Fri Jul 17 18:34:20 2009 (r1219) +++ trunk/libsyncml/sml_session.h Fri Jul 17 21:01:06 2009 (r1220) @@ -84,7 +84,13 @@ /* This function MUST NOT be used for servers. * This function is only used to set the credentials for a client. */ -void smlSessionRegisterCred (SmlSession *session, SmlCred *cred); +void smlSessionRegisterCred (SmlSession *session, SmlCred *cred); +SmlChal* smlSessionGetChal (SmlSession *session); +void smlSessionSetChal (SmlSession *session, SmlChal *chal); +gboolean smlSessionGetEnd (SmlSession *session); +void smlSessionSetEnd (SmlSession *session, gboolean end); +gboolean smlSessionGetAuthenticate (SmlSession *session); +void smlSessionSetAuthenticate (SmlSession *session, gboolean authenticate); /* Session Data input */ gboolean smlSessionReceiveHeader (SmlSession *session, SmlHeader *header, GError **error); @@ -106,4 +112,6 @@ void smlSessionRestoreTargetURI (SmlSession *session); gboolean smlSessionSetResponseURI (SmlSession *session, const gchar *responseURI, GError **error); +gsize smlSessionGetLastRecvMsgID (SmlSession *session); + #endif //_SML_SESSION_H_ |
From: <svn...@op...> - 2009-07-17 16:34:29
|
Author: bellmich Date: Fri Jul 17 18:34:20 2009 New Revision: 1219 URL: http://libsyncml.opensync.org/changeset/1219 Log: cleaned up header file usage in data sync API Modified: trunk/libsyncml/data_sync_api/data_sync.c trunk/libsyncml/data_sync_api/data_sync_callbacks.c trunk/libsyncml/data_sync_api/data_sync_client.c trunk/libsyncml/data_sync_api/data_sync_loop.c trunk/libsyncml/data_sync_api/data_sync_server.c trunk/libsyncml/sml_manager.h trunk/libsyncml/sml_manager_internals.h Modified: trunk/libsyncml/data_sync_api/data_sync.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync.c Fri Jul 17 15:02:17 2009 (r1218) +++ trunk/libsyncml/data_sync_api/data_sync.c Fri Jul 17 18:34:20 2009 (r1219) @@ -30,18 +30,15 @@ /* required because of function index */ #include <string.h> -#include <stdio.h> -#include <stdlib.h> #include "data_sync.h" #include "data_sync_client.h" #include "data_sync_server.h" #include "data_sync_callbacks.h" -#include "data_sync_callbacks.h" #include "data_sync_devinf.h" #include "data_sync_loop.h" #include "transport.h" -#include "libsyncml/objects/sml_ds_server_internals.h" +#include "libsyncml/objects/sml_ds_server.h" /* ********************************* */ /* object creation and configuration */ Modified: trunk/libsyncml/data_sync_api/data_sync_callbacks.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_callbacks.c Fri Jul 17 15:02:17 2009 (r1218) +++ trunk/libsyncml/data_sync_api/data_sync_callbacks.c Fri Jul 17 18:34:20 2009 (r1219) @@ -19,23 +19,17 @@ */ #include "data_sync_callbacks.h" + #include "libsyncml/sml_support.h" #include "libsyncml/sml_error_internals.h" + #include <string.h> #include <strings.h> -#include <stdio.h> -#include <stdlib.h> + #include "defines.h" #include "data_sync_devinf.h" -#include "libsyncml/objects/sml_ds_server_internals.h" -#include "libsyncml/sml_manager_internals.h" - -//#include "syncml_common.h" -//#include "syncml_callbacks.h" -//#include "syncml_vformat.h" -//#include "syncml_devinf.h" -//#include "syncml_ds_client.h" -//#include "syncml_ds_server.h" +#include "libsyncml/objects/sml_ds_server.h" +#include "libsyncml/sml_manager.h" /* **************************************** */ /* ***** Management Callbacks ***** */ Modified: trunk/libsyncml/data_sync_api/data_sync_client.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_client.c Fri Jul 17 15:02:17 2009 (r1218) +++ trunk/libsyncml/data_sync_api/data_sync_client.c Fri Jul 17 18:34:20 2009 (r1219) @@ -18,13 +18,15 @@ * */ -#include "data_sync_server.h" -#include "data_sync_common.h" +#include "data_sync_client.h" + +#include "libsyncml/sml_support.h" #include "libsyncml/sml_error_internals.h" + +#include "data_sync_common.h" #include "data_sync_callbacks.h" -#include "libsyncml/objects/sml_ds_server.h" #include "data_sync_devinf.h" -#include "libsyncml/sml_support.h" +#include "libsyncml/objects/sml_ds_server.h" static gboolean smlDataSyncClientAlertCallback (SmlDsSession *dsession, Modified: trunk/libsyncml/data_sync_api/data_sync_loop.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_loop.c Fri Jul 17 15:02:17 2009 (r1218) +++ trunk/libsyncml/data_sync_api/data_sync_loop.c Fri Jul 17 18:34:20 2009 (r1219) @@ -18,8 +18,9 @@ * */ +#include "data_sync_loop.h" + #include "../sml_support.h" -#include "data_sync_devinf.h" #include "libsyncml/sml_error_internals.h" static gboolean _prepare(GSource *source, gint *timeout_) Modified: trunk/libsyncml/data_sync_api/data_sync_server.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_server.c Fri Jul 17 15:02:17 2009 (r1218) +++ trunk/libsyncml/data_sync_api/data_sync_server.c Fri Jul 17 18:34:20 2009 (r1219) @@ -19,12 +19,14 @@ */ #include "data_sync_server.h" -#include "data_sync_common.h" + #include "libsyncml/sml_error_internals.h" +#include "libsyncml/sml_support.h" + #include "data_sync_callbacks.h" -#include "libsyncml/objects/sml_ds_server.h" +#include "data_sync_common.h" #include "data_sync_devinf.h" -#include "libsyncml/sml_support.h" +#include "libsyncml/objects/sml_ds_server.h" #include <string.h> static gboolean Modified: trunk/libsyncml/sml_manager.h ============================================================================== --- trunk/libsyncml/sml_manager.h Fri Jul 17 15:02:17 2009 (r1218) +++ trunk/libsyncml/sml_manager.h Fri Jul 17 18:34:20 2009 (r1219) @@ -89,6 +89,8 @@ SmlTransport* smlManagerGetTransport (SmlManager *manager); +SmlLink* smlManagerSessionGetLink (SmlManager *manager, SmlSession *session, GError **error); + #endif //_SML_MANAGER_H /*@}*/ Modified: trunk/libsyncml/sml_manager_internals.h ============================================================================== --- trunk/libsyncml/sml_manager_internals.h Fri Jul 17 15:02:17 2009 (r1218) +++ trunk/libsyncml/sml_manager_internals.h Fri Jul 17 18:34:20 2009 (r1219) @@ -83,8 +83,6 @@ void smlManagerSessionFinalLockRef (SmlManager *manager, SmlSession *session); void smlManagerSessionFinalLockUnref (SmlManager *manager, SmlSession *session); -SmlLink* smlManagerSessionGetLink (SmlManager *manager, SmlSession *session, GError **error); - #endif //_SML_MANAGER_INTERNALS_H /*@}*/ |
From: <svn...@op...> - 2009-07-17 13:02:26
|
Author: bellmich Date: Fri Jul 17 15:02:17 2009 New Revision: 1218 URL: http://libsyncml.opensync.org/changeset/1218 Log: fixed warnings from build host clio (Debian old-stable) strlen must be included via string.h Modified: trunk/tests/check_data_sync_api.c trunk/tests/check_dev_inf_property.c trunk/tests/check_devinf.c trunk/tests/check_libsoup.c trunk/tests/check_md5.c Modified: trunk/tests/check_data_sync_api.c ============================================================================== --- trunk/tests/check_data_sync_api.c Fri Jul 17 14:58:37 2009 (r1217) +++ trunk/tests/check_data_sync_api.c Fri Jul 17 15:02:17 2009 (r1218) @@ -26,11 +26,8 @@ #include <libsyncml/data_sync_api/standard.h> #include <libsyncml/data_sync_api/callbacks.h> #include <glib.h> -// #include <glib/gstdio.h> -//#include <stdio.h> -//#include <stdlib.h> -//#include <string.h> +#include <string.h> GMutex *runMutex = NULL; int locks; Modified: trunk/tests/check_dev_inf_property.c ============================================================================== --- trunk/tests/check_dev_inf_property.c Fri Jul 17 14:58:37 2009 (r1217) +++ trunk/tests/check_dev_inf_property.c Fri Jul 17 15:02:17 2009 (r1218) @@ -22,6 +22,8 @@ #include <libsyncml/dev_inf_api/sml_dev_inf_property.h> +#include <string.h> + START_TEST (dev_inf_property_create) { g_type_init(); Modified: trunk/tests/check_devinf.c ============================================================================== --- trunk/tests/check_devinf.c Fri Jul 17 14:58:37 2009 (r1217) +++ trunk/tests/check_devinf.c Fri Jul 17 15:02:17 2009 (r1218) @@ -26,6 +26,8 @@ #include <libsyncml/data_sync_api/sml_location_internals.h> #include "libsyncml/parser/sml_xml_parse.h" +#include <string.h> + #define NUM_SESSIONS 30 typedef struct managerTracker { Modified: trunk/tests/check_libsoup.c ============================================================================== --- trunk/tests/check_libsoup.c Fri Jul 17 14:58:37 2009 (r1217) +++ trunk/tests/check_libsoup.c Fri Jul 17 15:02:17 2009 (r1218) @@ -30,6 +30,8 @@ #include <libsoup/soup-message.h> #include <libsoup/soup-session-sync.h> +#include <string.h> + #ifdef HAVE_LIBSOUP22 #define soup_message_headers_get soup_message_get_header #define soup_message_headers_append soup_message_add_header Modified: trunk/tests/check_md5.c ============================================================================== --- trunk/tests/check_md5.c Fri Jul 17 14:58:37 2009 (r1217) +++ trunk/tests/check_md5.c Fri Jul 17 15:02:17 2009 (r1218) @@ -22,6 +22,8 @@ #include "tests/support.h" #include <libsyncml/sml_md5.h> +#include <string.h> + START_TEST (md5_1) { const char *data = ""; |
From: <svn...@op...> - 2009-07-17 12:58:46
|
Author: bellmich Date: Fri Jul 17 14:58:37 2009 New Revision: 1217 URL: http://libsyncml.opensync.org/changeset/1217 Log: try to fix build errors from FreeBSD (undefined type pid_t) Modified: trunk/libsyncml/sml_support.c Modified: trunk/libsyncml/sml_support.c ============================================================================== --- trunk/libsyncml/sml_support.c Fri Jul 17 14:48:41 2009 (r1216) +++ trunk/libsyncml/sml_support.c Fri Jul 17 14:58:37 2009 (r1217) @@ -24,6 +24,9 @@ #include "config.h" +#include <sys/types.h> +#include <unistd.h> + GPrivate* current_tabs = NULL; #define G_ERRORCHECK_MUTEXES |
From: <svn...@op...> - 2009-07-17 12:48:45
|
Author: bellmich Date: Fri Jul 17 14:48:41 2009 New Revision: 1216 URL: http://libsyncml.opensync.org/changeset/1216 Log: cleaned up header file usage in sml_transport.c Modified: trunk/libsyncml/sml_transport.c Modified: trunk/libsyncml/sml_transport.c ============================================================================== --- trunk/libsyncml/sml_transport.c Fri Jul 17 14:46:02 2009 (r1215) +++ trunk/libsyncml/sml_transport.c Fri Jul 17 14:48:41 2009 (r1216) @@ -20,12 +20,10 @@ */ #include "sml_transport_internals.h" + #include "sml_error_internals.h" #include "sml_support.h" -#include <stdio.h> -#include <stdlib.h> - #include <config.h> #ifdef ENABLE_HTTP |
From: <svn...@op...> - 2009-07-17 12:46:08
|
Author: bellmich Date: Fri Jul 17 14:46:02 2009 New Revision: 1215 URL: http://libsyncml.opensync.org/changeset/1215 Log: cleaned up header file usage in sml_thread.c Modified: trunk/libsyncml/sml_thread.c Modified: trunk/libsyncml/sml_thread.c ============================================================================== --- trunk/libsyncml/sml_thread.c Fri Jul 17 14:44:59 2009 (r1214) +++ trunk/libsyncml/sml_thread.c Fri Jul 17 14:46:02 2009 (r1215) @@ -20,11 +20,10 @@ */ #include "sml_thread_internals.h" + #include "sml_support.h" #include "sml_error_internals.h" -#include <stdio.h> -#include <stdlib.h> - + GPrivate* thread_id = NULL; #define G_ERRORCHECK_MUTEXES |
From: <svn...@op...> - 2009-07-17 12:45:05
|
Author: bellmich Date: Fri Jul 17 14:44:59 2009 New Revision: 1214 URL: http://libsyncml.opensync.org/changeset/1214 Log: cleaned up header file usage in sml_support.c Modified: trunk/libsyncml/sml_support.c Modified: trunk/libsyncml/sml_support.c ============================================================================== --- trunk/libsyncml/sml_support.c Fri Jul 17 14:37:06 2009 (r1213) +++ trunk/libsyncml/sml_support.c Fri Jul 17 14:44:59 2009 (r1214) @@ -24,14 +24,6 @@ #include "config.h" -#include <glib.h> -#include <pthread.h> -#include <stdlib.h> -#include <string.h> -#include <stdio.h> - -#include <libxml/parser.h> - GPrivate* current_tabs = NULL; #define G_ERRORCHECK_MUTEXES |
From: <svn...@op...> - 2009-07-17 12:37:14
|
Author: bellmich Date: Fri Jul 17 14:37:06 2009 New Revision: 1213 URL: http://libsyncml.opensync.org/changeset/1213 Log: cleaned up header file usage in sml_session.c Modified: trunk/libsyncml/objects/sml_auth.h trunk/libsyncml/objects/sml_auth_internals.h trunk/libsyncml/sml_command.c trunk/libsyncml/sml_command.h trunk/libsyncml/sml_elements.c trunk/libsyncml/sml_elements.h trunk/libsyncml/sml_session.c Modified: trunk/libsyncml/objects/sml_auth.h ============================================================================== --- trunk/libsyncml/objects/sml_auth.h Thu Jul 16 13:46:35 2009 (r1212) +++ trunk/libsyncml/objects/sml_auth.h Fri Jul 17 14:37:06 2009 (r1213) @@ -52,5 +52,7 @@ /* set required authentication type if this is a server */ void smlAuthSetType(SmlAuthenticator *auth, SmlAuthType code); +gchar *smlAuthGetCredString (SmlAuthType type, const gchar *username, const gchar *password, const gchar *b64_nonce, GError **error); + #endif //_SML_AUTH_H_ /*@}*/ Modified: trunk/libsyncml/objects/sml_auth_internals.h ============================================================================== --- trunk/libsyncml/objects/sml_auth_internals.h Thu Jul 16 13:46:35 2009 (r1212) +++ trunk/libsyncml/objects/sml_auth_internals.h Fri Jul 17 14:37:06 2009 (r1213) @@ -40,12 +40,5 @@ SmlAuthType type; }; -gchar *smlAuthGetCredString( - SmlAuthType type, - const gchar *username, - const gchar *password, - const gchar *b64_nonce, - GError **error); - #endif //_SML_AUTH_INTERNALS_H_ /*@}*/ Modified: trunk/libsyncml/sml_command.c ============================================================================== --- trunk/libsyncml/sml_command.c Thu Jul 16 13:46:35 2009 (r1212) +++ trunk/libsyncml/sml_command.c Fri Jul 17 14:37:06 2009 (r1213) @@ -204,6 +204,42 @@ return status->type == SML_COMMAND_TYPE_RESULTS ? TRUE : FALSE; } +SmlCommandType +smlStatusGetType (SmlStatus *status) +{ + return status->type; +} + +SmlAnchor* +smlStatusGetAnchor (SmlStatus *status) +{ + return status->anchor; +} + +SmlChal* +smlStatusGetChal (SmlStatus *status) +{ + return status->chal; +} + +gsize +smlStatusGetCommandRef (SmlStatus *status) +{ + return status->cmdRef; +} + +gsize +smlStatusGetMessageRef (SmlStatus *status) +{ + return status->msgRef; +} + +const gchar* +smlStatusGetData (SmlStatus *status) +{ + return status->data; +} + SmlCommand* smlCommandNew (SmlCommandType type, GError **error) @@ -938,6 +974,72 @@ cmd->cmdID = id; } +gsize +smlCommandGetMessageID (SmlCommand *cmd) +{ + return cmd->msgID; +} + +void +smlCommandSetMessageID (SmlCommand *cmd, + gsize id) +{ + cmd->msgID = id; +} + +gsize +smlCommandGetMaxObjSize (SmlCommand *cmd) +{ + switch (cmd->type) + { + case SML_COMMAND_TYPE_ALERT: + return cmd->private.alert.maxObjSize; + case SML_COMMAND_TYPE_SYNC: + return cmd->private.sync.maxObjSize; + default: + return 0; + } +} + +SmlAlertType +smlCommandGetAlertType (SmlCommand *cmd) +{ + return cmd->private.alert.type; +} + +gsize +smlCommandGetSize (SmlCommand *cmd) +{ + return cmd->size; +} + +void +smlCommandSetSize (SmlCommand *cmd, + gsize size) +{ + cmd->size = size; +} + +void +smlCommandSetNoResp (SmlCommand *cmd, + gboolean noResp) +{ + cmd->noResp = noResp; +} + +gboolean +smlCommandGetPushedBack (SmlCommand *cmd) +{ + return cmd->pushedBack; +} + +void +smlCommandSetPushedBack (SmlCommand *cmd, + gboolean pushedBack) +{ + cmd->pushedBack = pushedBack; +} + SmlCommandType smlCommandGetType (SmlCommand *cmd) { @@ -993,3 +1095,129 @@ } } } + +gsize +smlCommandGetNumChanges (SmlCommand *cmd) +{ + smlAssert(cmd); + + return g_list_length(cmd->private.change.items); +} + +gsize +smlCommandGetNthItemSize (SmlCommand *orig_cmd, + gsize n, + GError **error) +{ + smlAssert(orig_cmd); + + char *data = NULL; + gsize size = 0; + + SmlItem *orig_item = g_list_nth_data(orig_cmd->private.change.items, n); + if (!smlItemGetData(orig_item, &data, &size, error)) + goto error; + return size; +error: + return 0; +} + +SmlCommand* +smlCommandGetFragment (SmlCommand *orig_cmd, + gsize start, + gsize space, + gsize complete_size, + GError **error) +{ + smlAssert(orig_cmd); + + gchar *data = NULL; + gsize size = 0; + SmlItem *frag_item = NULL; + SmlCommand *frag_cmd = NULL; + + SmlItem *orig_item = g_list_nth_data(orig_cmd->private.change.items, 0); + if (!smlItemGetData(orig_item, &data, &size, error)) + goto error; + + /* create item fragment */ + + frag_item = smlItemGetFragment(orig_item, start, space, error); + if (!frag_item) + goto error; + + /* create command fragment */ + + frag_cmd = smlCommandNew(orig_cmd->type, error); + if (!frag_cmd) + goto error; + + frag_cmd->private.change.items = g_list_append (NULL, frag_item); + if (!frag_cmd->private.change.items) + { + goto error; + } + frag_item = NULL; + + /* If this is the first sent part of the fragmented command + * then this command must include the size of the complete + * command. + */ + if (start == 0) + frag_cmd->size = complete_size; + + return frag_cmd; +error: + if (frag_cmd) + smlCommandUnref(frag_cmd); + if (frag_item) + smlItemUnref(frag_item); + return NULL; +} + +SmlStatus* +smlCommandResultsGetStatus (SmlCommand *cmd) +{ + smlAssert(cmd); + return cmd->private.results.status; +} + +void +smlCommandTransferItems (SmlCommand *source, + SmlCommand *target, + gsize start) +{ + smlAssert(source); + smlAssert(target); + + while(1) { + SmlItem *item = g_list_nth_data(source->private.change.items, start); + if (!item) + return; + target->private.change.items = g_list_append(target->private.change.items, item); + source->private.change.items = g_list_remove(source->private.change.items, item); + } +} + +SmlItem* +smlCommandGetFirstChange (SmlCommand *cmd) +{ + smlAssert(cmd); + return g_list_nth_data(cmd->private.change.items, 0); +} + +SmlItem* +smlCommandGetLastChange (SmlCommand *cmd) +{ + smlAssert(cmd); + return g_list_nth_data(cmd->private.change.items, g_list_length(cmd->private.change.items) - 1); +} + +void +smlCommandFreeFirstChange (SmlCommand *cmd) +{ + smlAssert(cmd); + SmlItem *first = smlCommandGetFirstChange(cmd); + cmd->private.change.items = g_list_remove(cmd->private.change.items, first); + smlItemUnref(first); +} Modified: trunk/libsyncml/sml_command.h ============================================================================== --- trunk/libsyncml/sml_command.h Thu Jul 16 13:46:35 2009 (r1212) +++ trunk/libsyncml/sml_command.h Fri Jul 17 14:37:06 2009 (r1213) @@ -37,13 +37,19 @@ typedef struct SmlCommand SmlCommand; typedef struct SmlStatus SmlStatus; -SmlStatus* smlStatusNew (SmlErrorType data, gsize cmdref, gsize msgref, SmlLocation *sourceref, SmlLocation *targeref, SmlCommandType type, GError **error); -SmlStatus* smlStatusRef (SmlStatus *status); -void smlStatusUnref (SmlStatus *status); -SmlErrorType smlStatusGetCode (SmlStatus *status); -SmlErrorClass smlStatusGetClass (SmlStatus *status); -SmlCommand* smlStatusGetResult (SmlStatus *status); -gboolean smlStatusIsResult (SmlStatus *status); +SmlStatus* smlStatusNew (SmlErrorType data, gsize cmdref, gsize msgref, SmlLocation *sourceref, SmlLocation *targeref, SmlCommandType type, GError **error); +SmlStatus* smlStatusRef (SmlStatus *status); +void smlStatusUnref (SmlStatus *status); +SmlErrorType smlStatusGetCode (SmlStatus *status); +SmlErrorClass smlStatusGetClass (SmlStatus *status); +SmlCommand* smlStatusGetResult (SmlStatus *status); +gboolean smlStatusIsResult (SmlStatus *status); +SmlCommandType smlStatusGetType (SmlStatus *status); +SmlAnchor* smlStatusGetAnchor (SmlStatus *status); +SmlChal* smlStatusGetChal (SmlStatus *status); +gsize smlStatusGetCommandRef (SmlStatus *status); +gsize smlStatusGetMessageRef (SmlStatus *status); +const gchar* smlStatusGetData (SmlStatus *status); SmlCommand* smlCommandNew (SmlCommandType type, GError **error); SmlStatus* smlCommandNewReply (const SmlCommand *cmd, SmlErrorType code, GError **error); @@ -65,8 +71,17 @@ SmlCommand* smlCommandNewMap (SmlLocation *target, SmlLocation *source, GError **error); gboolean smlCommandAddMapItem (SmlCommand *map, SmlMapItem *item, GError **error); -void smlCommandSetID (SmlCommand *cmd, gsize id); -gsize smlCommandGetID (SmlCommand *cmd); +void smlCommandSetID (SmlCommand *cmd, gsize id); +gsize smlCommandGetID (SmlCommand *cmd); +void smlCommandSetMessageID (SmlCommand *cmd, gsize id); +gsize smlCommandGetMessageID (SmlCommand *cmd); +gsize smlCommandGetMaxObjSize (SmlCommand *cmd); +SmlAlertType smlCommandGetAlertType (SmlCommand *cmd); +gsize smlCommandGetSize (SmlCommand *cmd); +void smlCommandSetSize (SmlCommand *cmd, gsize size); +void smlCommandSetNoResp (SmlCommand *cmd, gboolean noResp); +gboolean smlCommandGetPushedBack (SmlCommand *cmd); +void smlCommandSetPushedBack (SmlCommand *cmd, gboolean pushedBack); SmlCommandType smlCommandGetType (SmlCommand *cmd); SmlLocation* smlCommandGetSource (SmlCommand *cmd); @@ -77,6 +92,16 @@ void smlCommandDisableChanges (SmlCommand *cmd); void smlCommandEnableChanges (SmlCommand *cmd); +gsize smlCommandGetNumChanges (SmlCommand *cmd); + +SmlStatus* smlCommandResultsGetStatus (SmlCommand *cmd); +void smlCommandTransferItems (SmlCommand *source, SmlCommand *target, gsize start); +SmlItem* smlCommandGetLastChange (SmlCommand *cmd); +SmlItem* smlCommandGetFirstChange (SmlCommand *cmd); +void smlCommandFreeFirstChange (SmlCommand *cmd); + +gsize smlCommandGetNthItemSize (SmlCommand *orig_cmd, gsize n, GError **error); +SmlCommand* smlCommandGetFragment (SmlCommand *orig_cmd, gsize start, gsize space, gsize complete_size, GError **error); #endif //_SML_COMMAND_H_ Modified: trunk/libsyncml/sml_elements.c ============================================================================== --- trunk/libsyncml/sml_elements.c Thu Jul 16 13:46:35 2009 (r1212) +++ trunk/libsyncml/sml_elements.c Fri Jul 17 14:37:06 2009 (r1213) @@ -114,6 +114,18 @@ return header->target; } +gsize +smlHeaderGetMaxMsgSize (SmlHeader *header) +{ + return header->maxmsgsize; +} + +const gchar* +smlHeaderGetResponseURI (SmlHeader *header) +{ + return header->responseURI; +} + void smlHeaderFree (SmlHeader *header) { @@ -343,6 +355,20 @@ return FALSE; } +gsize +smlItemGetSize (SmlItem *item) +{ + smlAssert(item); + return xmlBufferLength(item->buffer); +} + +const gchar* +smlItemGetContent (SmlItem *item) +{ + smlAssert(item); + return (gchar *)xmlBufferContent(item->buffer); +} + void smlItemSetDisable (SmlItem *item, gboolean disable) @@ -426,6 +452,43 @@ return item->contenttype; } +SmlItem * +smlItemGetFragment (SmlItem *orig_item, + gsize start, + gsize space, + GError **error) +{ + smlAssert(orig_item); + + const char *data = (char *)xmlBufferContent(orig_item->buffer); + gsize size = xmlBufferLength(orig_item->buffer); + + SmlItem *frag_item = smlItemNewForData(data + start, space, error); + if (!frag_item) + goto error; + + if (start + space < size) + frag_item->moreData = TRUE; + else + frag_item->moreData = FALSE; + + frag_item->target = orig_item->target; + if (frag_item->target) + g_object_ref(frag_item->target); + + frag_item->source = orig_item->source; + if (frag_item->source) + g_object_ref(frag_item->source); + + frag_item->contenttype = g_strdup(orig_item->contenttype); + + return frag_item; +error: + if (frag_item) + smlItemUnref(frag_item); + return NULL; +} + SmlCred* smlCredNewFromString (const gchar *type, const gchar *format, @@ -579,15 +642,39 @@ const gchar* smlCredGetUsername (SmlCred *cred) { + smlAssert(cred); return cred->username; } const gchar* smlCredGetPassword (SmlCred *cred) { + smlAssert(cred); return cred->password; } +const gchar* +smlCredGetData (SmlCred *cred) +{ + smlAssert(cred); + return cred->data; +} + +void +smlCredSetData (SmlCred *cred, + gchar *data) +{ + smlAssert(cred); + cred->data = data; +} + +SmlAuthType +smlCredGetType (SmlCred *cred) +{ + smlAssert(cred); + return cred->type; +} + SmlChal* smlChalNew (SmlAuthType type, GError **error) @@ -749,6 +836,21 @@ smlTrace(TRACE_EXIT, "%s", __func__); } +/* Base 64 only */ +const gchar* +smlChalGetNonce (SmlChal *chal) +{ + smlAssert(chal); + return chal->nonce_b64; +} + +SmlAuthType +smlChalGetType (SmlChal *chal) +{ + smlAssert(chal); + return chal->type; +} + SmlMapItem* smlMapItemNew (const gchar *uid, const gchar *newuid, Modified: trunk/libsyncml/sml_elements.h ============================================================================== --- trunk/libsyncml/sml_elements.h Thu Jul 16 13:46:35 2009 (r1212) +++ trunk/libsyncml/sml_elements.h Fri Jul 17 14:37:06 2009 (r1213) @@ -41,29 +41,34 @@ typedef struct SmlChal SmlChal; typedef struct SmlMapItem SmlMapItem; -SmlCred* smlCredNewFromString (const gchar *type, const gchar *format, const gchar *data, GError **error); -SmlCred* smlCredNewAuth (SmlAuthType type, const gchar *username, const gchar *password, GError **error); -SmlCred* smlCredNew (SmlAuthType type, SmlFormatType format, const gchar *data, const gchar *username, GError **error); -void smlCredRef (SmlCred *cred); -void smlCredUnref (SmlCred *cred); -const gchar* smlCredGetUsername (SmlCred *cred); -const gchar* smlCredGetPassword (SmlCred *cred); +SmlCred* smlCredNewFromString (const gchar *type, const gchar *format, const gchar *data, GError **error); +SmlCred* smlCredNewAuth (SmlAuthType type, const gchar *username, const gchar *password, GError **error); +SmlCred* smlCredNew (SmlAuthType type, SmlFormatType format, const gchar *data, const gchar *username, GError **error); +void smlCredRef (SmlCred *cred); +void smlCredUnref (SmlCred *cred); +const gchar* smlCredGetUsername (SmlCred *cred); +const gchar* smlCredGetPassword (SmlCred *cred); +const gchar* smlCredGetData (SmlCred *cred); +void smlCredSetData (SmlCred *cred, gchar *data); +SmlAuthType smlCredGetType (SmlCred *cred); SmlAnchor* smlAnchorNew (const gchar *last, const gchar *next, GError **error); const char* smlAnchorGetLast (SmlAnchor *anchor); const char* smlAnchorGetNext (SmlAnchor *anchor); void smlAnchorFree (SmlAnchor *anchor); -SmlItem* smlItemNew (gsize size, GError **error); -SmlItem* smlItemNewForData (const gchar *data, gsize size, GError **error); -SmlItem* smlItemRef (SmlItem *item); -void smlItemUnref (SmlItem *item); -gboolean smlItemAddData (SmlItem *item, const gchar *data, gsize size, GError **error); -gboolean smlItemCheck (SmlItem *item); -gboolean smlItemHasData (SmlItem *item); -gboolean smlItemGetData (SmlItem *item, gchar **data, gsize *size, GError **error); -gboolean smlItemStealData (SmlItem *item, gchar **data, gsize *size, GError **error); -void smlItemSetDisable (SmlItem *item, gboolean disable); +SmlItem* smlItemNew (gsize size, GError **error); +SmlItem* smlItemNewForData (const gchar *data, gsize size, GError **error); +SmlItem* smlItemRef (SmlItem *item); +void smlItemUnref (SmlItem *item); +gboolean smlItemAddData (SmlItem *item, const gchar *data, gsize size, GError **error); +gboolean smlItemCheck (SmlItem *item); +gboolean smlItemHasData (SmlItem *item); +gboolean smlItemGetData (SmlItem *item, gchar **data, gsize *size, GError **error); +gsize smlItemGetSize (SmlItem *item); +const char* smlItemGetContent (SmlItem *item); +gboolean smlItemStealData (SmlItem *item, gchar **data, gsize *size, GError **error); +void smlItemSetDisable (SmlItem *item, gboolean disable); void smlItemSetMoreData (SmlItem *item, gboolean enable); gboolean smlItemGetMoreData (SmlItem *item); @@ -76,19 +81,25 @@ SmlLocation* smlItemGetTarget (SmlItem *item); void smlItemSetRaw (SmlItem *item, gboolean raw); +SmlItem * smlItemGetFragment (SmlItem *orig_item, gsize start, gsize space, GError **error); + gsize smlHeaderGetSessionID (SmlHeader *header); gsize smlHeaderGetMessageID (SmlHeader *header); SmlProtocolVersion smlHeaderGetProtocolVersion (SmlHeader *header); SmlProtocolType smlHeaderGetProtocolType (SmlHeader *header); SmlLocation* smlHeaderGetSource (SmlHeader *header); SmlLocation* smlHeaderGetTarget (SmlHeader *header); +gsize smlHeaderGetMaxMsgSize (SmlHeader *header); +const gchar* smlHeaderGetResponseURI (SmlHeader *header); void smlHeaderFree (SmlHeader *header); -SmlChal* smlChalNew (SmlAuthType type, GError **error); -SmlChal* smlChalNewFromBinary (SmlAuthType type, const gchar *nonce, gsize length, GError **error); -SmlChal* smlChalNewFromBase64 (SmlAuthType type, const gchar *nonce, GError **error); -void smlChalRef (SmlChal *chal); -void smlChalUnref (SmlChal *chal); +SmlChal* smlChalNew (SmlAuthType type, GError **error); +SmlChal* smlChalNewFromBinary (SmlAuthType type, const gchar *nonce, gsize length, GError **error); +SmlChal* smlChalNewFromBase64 (SmlAuthType type, const gchar *nonce, GError **error); +void smlChalRef (SmlChal *chal); +void smlChalUnref (SmlChal *chal); +const gchar* smlChalGetNonce (SmlChal *chal); /* Base 64 only */ +SmlAuthType smlChalGetType (SmlChal *chal); SmlMapItem* smlMapItemNew (const gchar *uid, const gchar *newuid, GError **error); SmlMapItem* smlMapItemRef (SmlMapItem *item); Modified: trunk/libsyncml/sml_session.c ============================================================================== --- trunk/libsyncml/sml_session.c Thu Jul 16 13:46:35 2009 (r1212) +++ trunk/libsyncml/sml_session.c Fri Jul 17 14:37:06 2009 (r1213) @@ -19,15 +19,18 @@ * */ +#include "sml_session_internals.h" + #include "sml_support.h" #include "sml_error_internals.h" + #include "sml_queue_internals.h" -#include "sml_session_internals.h" -#include "sml_command_internals.h" -#include "sml_elements_internals.h" -#include "sml_parse_internals.h" +#include "sml_command.h" +#include "sml_elements.h" +#include "sml_parse.h" #include "sml_transport.h" -#include "objects/sml_auth_internals.h" +#include "objects/sml_auth.h" + #include "data_sync_api/sml_location_internals.h" /** @@ -199,7 +202,7 @@ smlTrace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, session, status, userdata); //SmlError *error = NULL; - smlTrace(TRACE_INTERNAL, "%s: Got a status reply %i", __func__, status->type); + smlTrace(TRACE_INTERNAL, "%s: Got a status reply %i", __func__, smlStatusGetType(status)); if (smlStatusGetCode(status) != SML_CHUNK_ACCEPTED) { /* We need to send a error reply for the original command */ @@ -229,17 +232,15 @@ { smlTrace(TRACE_ENTRY, "%s(%p, %p, %p, %i, %i, %i, %p)", __func__, session, orig_cmd, parent, space, start, complete_size, error); CHECK_ERROR_REF - /* This library must not send more that one item per change + /* This library must not send more than one item per change * command. This is compliant with all specification and only a * self limitation. */ - smlAssert(g_list_length(orig_cmd->private.change.items) == 1); + smlAssert(smlCommandGetNumChanges(orig_cmd) == 1); SmlCommand *frag_cmd = NULL; - char *data = NULL; - gsize size = 0; - SmlItem *orig_item = g_list_nth_data(orig_cmd->private.change.items, 0); - if (!smlItemGetData(orig_item, &data, &size, error)) + gsize size = smlCommandGetNthItemSize(orig_cmd, 0, error); + if (!size) goto error; // FIXME: should we add an assertion here to guarantee @@ -248,39 +249,10 @@ if (space < size - start) { /* We need to create a new command. But we only send as much data as space * is available */ - frag_cmd = smlCommandNew(orig_cmd->type, error); + frag_cmd = smlCommandGetFragment(orig_cmd, start, space, complete_size, error); if (!frag_cmd) goto error; - SmlItem *frag_item = smlItemNewForData(data + start, space, error); - if (!frag_item) - goto error; - frag_cmd->private.change.items = g_list_append (NULL, frag_item); - if (!frag_cmd->private.change.items) - { - smlItemUnref(frag_item); - goto error; - } - - frag_item->moreData = TRUE; - - frag_item->target = orig_item->target; - if (frag_item->target) - g_object_ref(frag_item->target); - - frag_item->source = orig_item->source; - if (frag_item->source) - g_object_ref(frag_item->source); - - frag_item->contenttype = g_strdup(orig_item->contenttype); - - /* If this is the first sent part of the fragmented command - * then this command must include the size of the complete - * command. - */ - if (start == 0) - frag_cmd->size = complete_size; - session->frag_size += space; } else { /* We have enough room to send the original command. @@ -289,43 +261,15 @@ * The original item must be freed. */ - /* get original item and cleanup item list */ - smlAssert(g_list_length(orig_cmd->private.change.items) == 1); - smlAssert(g_list_remove(orig_cmd->private.change.items, orig_item) == NULL); - orig_cmd->private.change.items = NULL; - - /* setup new item */ - SmlItem *frag_item = smlItemNewForData(data + start, size - start, error); - if (!frag_item) { - smlItemUnref(orig_item); - goto error; - } - orig_cmd->private.change.items = g_list_append(NULL, frag_item); - if (!orig_cmd->private.change.items) - { - smlItemUnref(orig_item); - smlItemUnref(frag_item); + /* create fragmentation command */ + frag_cmd = smlCommandGetFragment(orig_cmd, start, size - start, complete_size, error); + if (!frag_cmd) goto error; - } - /* configure new item */ - frag_item->contenttype = g_strdup(orig_item->contenttype); - frag_item->target = orig_item->target; - if (frag_item->target) - g_object_ref(frag_item->target); - frag_item->source = orig_item->source; - if (frag_item->source) - g_object_ref(frag_item->source); - - /* cleanup original item */ - smlItemUnref(orig_item); - /* setup fragmentation command */ - frag_cmd = orig_cmd; session->frag_size += size - start; } - smlTrace(TRACE_EXIT, "%s: %p", __func__, frag_cmd); return frag_cmd; error: @@ -368,7 +312,13 @@ /* Large object handling. Only possible of the session has a limit and * we dont have a 1.0 session */ - if ((cmd->type == SML_COMMAND_TYPE_ADD || cmd->type == SML_COMMAND_TYPE_REPLACE) && + smlTrace(TRACE_INTERNAL, "%s: type: %d, MaxMsgSize: %llu, version: %d", + __func__, + smlCommandGetType(cmd), + smlAssemblerGetRemoteMaxMsgSize(session->assembler), + session->version); + if ((smlCommandGetType(cmd) == SML_COMMAND_TYPE_ADD || + smlCommandGetType(cmd) == SML_COMMAND_TYPE_REPLACE) && smlAssemblerGetRemoteMaxMsgSize(session->assembler) > 0 && session->version != SML_VERSION_10) { smlTrace(TRACE_INTERNAL, "%s: Checking if command needs to be fragmented", __func__); @@ -376,19 +326,19 @@ * command. This is compliant with all specification and only a * self limitation. */ - smlAssert(g_list_length(cmd->private.change.items) == 1); + //smlAssert(g_list_length(cmd->private.change.items) == 1); char *data = NULL; gsize size = 0; - SmlItem *item = g_list_nth_data(cmd->private.change.items, 0); + SmlItem *item = smlCommandGetFirstChange(cmd); if (!smlItemGetData(item, &data, &size, error)) goto error; /* If max obj size is not unlimited (0), and the size of the item is larger * than the max obj size, we have to return an error */ - int sendingmaxobjsize = smlSessionGetRemoteMaxObjSize(session); + gsize sendingmaxobjsize = smlSessionGetRemoteMaxObjSize(session); if ((sendingmaxobjsize > 0) && - (size > (unsigned int)sendingmaxobjsize)) + (size > sendingmaxobjsize)) { g_set_error(error, SML_ERROR, SML_ERROR_SIZE_MISMATCH, "Item (%ub) is larger than the limit (%db)", size, smlSessionGetRemoteMaxObjSize(session)); @@ -396,13 +346,13 @@ } if (!session->frag_command) - cmd->size = size; - item->moreData = TRUE; + smlCommandSetSize(cmd, size); + smlItemSetMoreData(item, TRUE); gssize space = 0; if (!smlAssemblerGetSpace(session->assembler, &space, parent, cmd, error)) goto error; - cmd->size = 0; - item->moreData = FALSE; + smlCommandSetSize(cmd, 0); + smlItemSetMoreData(item, FALSE); /* Check if item data fits into the current message */ if (session->frag_command || @@ -434,8 +384,8 @@ * happen that the item is replaced. Therefore the item * reference must be determined again. */ - item = g_list_nth_data(cmd->private.change.items, 0); - if (item->moreData == FALSE) { + item = smlCommandGetFirstChange(cmd); + if (smlItemGetMoreData(item) == FALSE) { smlTrace(TRACE_INTERNAL, "%s: This is the last chunk", __func__); callback = session->frag_callback; @@ -454,21 +404,21 @@ /* We now increment the session ID */ session->lastCommandID++; - cmd->cmdID = session->lastCommandID; + smlCommandSetID(cmd, session->lastCommandID); smlTrace(TRACE_INTERNAL, "%s: last command id is %i", __func__, session->lastCommandID); /* Now we can try to add the command to the assembler */ switch (smlAssemblerStartCommand(session->assembler, parent, cmd, error)) { case SML_ASSEMBLER_RESULT_OK: /* We successfully added the command */ - cmd->pushedBack = FALSE; + smlCommandSetPushedBack(cmd, FALSE); break; case SML_ASSEMBLER_RESULT_MISMATCH: - if (cmd->pushedBack) { + if (smlCommandGetPushedBack(cmd)) { g_set_error(error, SML_ERROR, SML_ERROR_GENERIC, "Command is too large"); goto error; } - cmd->pushedBack = TRUE; + smlCommandSetPushedBack(cmd, TRUE); /* We werent able to add the command. So we have to flush the already * added statuses/commands and then add it again later */ @@ -496,17 +446,17 @@ pending->callback = callback; pending->userdata = userdata; - pending->cmdID = cmd->cmdID; + pending->cmdID = smlCommandGetID(cmd); pending->msgID = session->lastMessageID; smlTrace(TRACE_INTERNAL, "%s: Appending pending status with cmdID %i and msgID %i", __func__, pending->cmdID, pending->msgID); session->pendingReplies = g_list_append(session->pendingReplies, pending); } else - cmd->noResp = TRUE; + smlCommandSetNoResp(cmd, TRUE); /* We will get a status and a result to a get command * so we register a second callback for the result */ - if (cmd->type == SML_COMMAND_TYPE_GET) { + if (smlCommandGetType(cmd) == SML_COMMAND_TYPE_GET) { pending = smlTryMalloc0(sizeof(SmlPendingStatus), error); if (!pending) { session->lastCommandID--; @@ -515,7 +465,7 @@ pending->callback = callback; pending->userdata = userdata; - pending->cmdID = cmd->cmdID; + pending->cmdID = smlCommandGetID(cmd); pending->msgID = session->lastMessageID; smlTrace(TRACE_INTERNAL, "%s: Appending pending status for a result with cmdID %i and msgID %i", __func__, pending->cmdID, pending->msgID); @@ -640,12 +590,15 @@ goto error; } - if (status->cmdRef != cmdRef || status->msgRef != msgRef) { + if (smlStatusGetCommandRef(status) != cmdRef || + smlStatusGetMessageRef(status) != msgRef) { //Put it on the end of the queue smlQueueSendPrio(session->command_queue, message); smlTrace(TRACE_EXIT, "%s - next needed command status %d for message %d is not this one (cmd %d, msg %d)", - __func__, cmdRef, msgRef, status->cmdRef, status->msgRef); + __func__, cmdRef, msgRef, + smlStatusGetCommandRef(status), + smlStatusGetMessageRef(status)); return; } @@ -703,40 +656,41 @@ CHECK_ERROR_REF /* check and set the counters */ - if (header->messageID <= session->lastReceivedMessageID) { + if (smlHeaderGetMessageID(header) <= session->lastReceivedMessageID) { g_set_error(error, SML_ERROR, SML_ERROR_GENERIC, "Message ID not incremented"); goto error; } - session->lastReceivedMessageID = header->messageID; + session->lastReceivedMessageID = smlHeaderGetMessageID(header); session->lastCommandID++; /* check and set the MaxMsgSize */ - if (0 < header->maxmsgsize) { + if (0 < smlHeaderGetMaxMsgSize(header)) { /* If MaxMsgSize is 0 then it is not set. Therefore * a MaxMsgSize of 0 is ignored to not override an * already configured MaxMsgSize from an earlier * message. */ - smlAssemblerSetRemoteMaxMsgSize(session->assembler, header->maxmsgsize); + smlAssemblerSetRemoteMaxMsgSize(session->assembler, smlHeaderGetMaxMsgSize(header)); } - if (0 < header->maxmsgsize && header->maxmsgsize < session->localMaxMsgSize) + if (0 < smlHeaderGetMaxMsgSize(header) && + smlHeaderGetMaxMsgSize(header) < session->localMaxMsgSize) { /* The localMaxMsgSize is only set if it is already * configured. If there is no local limit then it is not * necessary to configure it only because the remote * peer has a limit. */ - smlSessionSetLocalMaxMsgSize(session, header->maxmsgsize); + smlSessionSetLocalMaxMsgSize(session, smlHeaderGetMaxMsgSize(header)); } /* Reserve the status for header reply. It will always be cmdRef 0 * and it will always be the first command in the message */ - if (!smlAssemblerReserveStatus(session->assembler, 0, header->messageID, 1, error)) + if (!smlAssemblerReserveStatus(session->assembler, 0, smlHeaderGetMessageID(header), 1, error)) goto error; /* If RespURI is send in the header * then the URI in the transport layer must be adjusted. */ - if (header->responseURI) { + if (smlHeaderGetResponseURI(header)) { if (!session->orgTarget) { /* If the original target is already set * then it MUST NOT be set again @@ -759,7 +713,7 @@ /* build the new target and publish it*/ session->target = sml_location_new_with_options( - header->responseURI, + smlHeaderGetResponseURI(header), sml_location_get_name(session->orgTarget), error); if (!session->target) @@ -777,7 +731,7 @@ * then we have to change the TargetRef/LocURI * of the session. */ - const char *header_source = sml_location_get_uri(header->source); + const char *header_source = sml_location_get_uri(smlHeaderGetSource(header)); const char *session_target = sml_location_get_uri(session->target); if (header_source && session_target && @@ -807,10 +761,10 @@ smlAssert(status); CHECK_ERROR_REF - if (status->cmdRef == 0) { - smlAssert(status->type == SML_COMMAND_TYPE_HEADER); - smlAssert(status->data); - SmlErrorType errorCode = atoi(status->data); + if (smlStatusGetCommandRef(status) == 0) { + smlAssert(smlStatusGetType(status) == SML_COMMAND_TYPE_HEADER); + smlAssert(smlStatusGetData(status)); + SmlErrorType errorCode = atoi(smlStatusGetData(status)); if (session->sessionType == SML_SESSION_TYPE_SERVER) { /* If this is an OMA DS server then the session @@ -859,10 +813,10 @@ session->established = FALSE; smlAssemblerRestoreCommands(session->assembler); smlTrace(TRACE_INTERNAL, "%s - restored commands from previous message", __func__); - smlAssert(status->chal); + smlAssert(smlStatusGetChal(status)); smlAssert(session->cred); - if (session->cred->type == SML_AUTH_TYPE_MD5 && - status->chal->type != SML_AUTH_TYPE_MD5) + if (smlCredGetType(session->cred) == SML_AUTH_TYPE_MD5 && + smlChalGetType(smlStatusGetChal(status)) != SML_AUTH_TYPE_MD5) { g_set_error(error, SML_ERROR, SML_ERROR_AUTH_REJECTED, "The remote peer tries to enforce an authentication method which violates the local security policy (syncml:auth-md5 is required)."); @@ -871,13 +825,15 @@ smlTrace(TRACE_INTERNAL, "%s - authentication type conforms to security policy", __func__); /* build the authentication string */ - session->cred->data = smlAuthGetCredString( - status->chal->type, - session->cred->username, - session->cred->password, - status->chal->nonce_b64, + char *cred_data = smlAuthGetCredString( + smlChalGetType(smlStatusGetChal(status)), + smlCredGetUsername(session->cred), + smlCredGetPassword(session->cred), + smlChalGetNonce(smlStatusGetChal(status)), error); - if (!session->cred->data) + smlCredSetData(session->cred, cred_data); + cred_data = NULL; + if (!smlCredGetData(session->cred)) goto error; smlTrace(TRACE_INTERNAL, "%s - credential string set", __func__); } else { @@ -906,9 +862,11 @@ for (o = session->pendingReplies; o; o = o ? o->next : NULL ) { SmlPendingStatus *pending = o->data; smlTrace(TRACE_INTERNAL, "%s: check cmd %i of msg %i", __func__, pending->cmdID, pending->msgID); - if (pending->cmdID == status->cmdRef && pending->msgID == status->msgRef) { + if (pending->cmdID == smlStatusGetCommandRef(status) && + pending->msgID == smlStatusGetMessageRef(status)) { smlTrace(TRACE_INTERNAL, "%s - Found pending status %s of command %d in message %d", - __func__, VA_STRING(status->data), status->cmdRef, status->msgRef); + __func__, VA_STRING(smlStatusGetData(status)), + smlStatusGetCommandRef(status), smlStatusGetMessageRef(status)); if (session->authenticate) { /* modify the pending reply @@ -950,9 +908,9 @@ /* We have to catch at this point if the status reply is the reply * to our server alerted sync. Since this initial alert is not sent * over a session, the status can of course not be wanted */ - if (status->type == SML_COMMAND_TYPE_ALERT && !status->anchor) { + if (smlStatusGetType(status) == SML_COMMAND_TYPE_ALERT && !smlStatusGetAnchor(status)) { smlTrace(TRACE_INTERNAL, "%s: Handling status for server alerted sync", __func__); - SmlErrorType errorCode = atoi(status->data); + SmlErrorType errorCode = atoi(smlStatusGetData(status)); if ((199 < errorCode && errorCode < 300) || errorCode == 508) { @@ -970,7 +928,9 @@ g_set_error(error, SML_ERROR, SML_ERROR_GENERIC, "Received unwanted status %s of command %d in message %d", - status->data, status->cmdRef, status->msgRef); + smlStatusGetData(status), + smlStatusGetCommandRef(status), + smlStatusGetMessageRef(status)); goto error; out: smlTrace(TRACE_EXIT, "%s", __func__); @@ -1145,7 +1105,7 @@ } if (cmd) - cmd->msgID = session->lastReceivedMessageID; + smlCommandSetMessageID(cmd, session->lastReceivedMessageID); /* If the handler of the header signals that an authentication * is still required then we must send status 407 to all @@ -1157,7 +1117,7 @@ session->lastCommandID++; /* Reserve the place for the status in the assembler */ - if (!smlAssemblerReserveStatus(session->assembler, cmd->cmdID, session->lastReceivedMessageID, session->lastCommandID, error)) + if (!smlAssemblerReserveStatus(session->assembler, smlCommandGetID(cmd), session->lastReceivedMessageID, session->lastCommandID, error)) goto error; /* send status 407 */ @@ -1177,7 +1137,7 @@ smlTrace(TRACE_INTERNAL, "%s: RESULT_OPEN", __func__); session->lastCommandID++; /* Reserve the place for the status in the assembler */ - if (!smlAssemblerReserveStatus(session->assembler, cmd->cmdID, session->lastReceivedMessageID, session->lastCommandID, error)) + if (!smlAssemblerReserveStatus(session->assembler, smlCommandGetID(cmd), session->lastReceivedMessageID, session->lastCommandID, error)) goto error; /* Store the parent */ @@ -1189,16 +1149,14 @@ /* If we are a server, we just mimick the behaviour of the client regarding * large object handling and support of number of changes. This way we dont * need to parse the devinf */ - if (cmd->type == SML_COMMAND_TYPE_SYNC) { - smlTrace(TRACE_INTERNAL, "%s: SYNC => maxObjSize: %i, numbOfChanges: %i, %i", + if (smlCommandGetType(cmd) == SML_COMMAND_TYPE_SYNC) { + smlTrace(TRACE_INTERNAL, "%s: SYNC => maxObjSize: %i", __func__, - cmd->private.sync.maxObjSize, - cmd->private.sync.hasNumChanged, - cmd->private.sync.numChanged); - /* If the sync has the maxObjSize set (>= 0), we set the requested max obj size. + smlCommandGetMaxObjSize(cmd)); + /* If the sync has the maxObjSize set (> 0), we set the requested max obj size. * If the max obj size was set before (with the alert, we overwrite it */ - if (cmd->private.sync.maxObjSize >= 0) - smlSessionSetRemoteMaxObjSize(session, cmd->private.sync.maxObjSize); + if (smlCommandGetMaxObjSize(cmd) > 0) + smlSessionSetRemoteMaxObjSize(session, smlCommandGetMaxObjSize(cmd)); /* If the DevInf of the client includes SupportNumberOfChanges * but the client does not send NumberOfChanges * then the server still MUST send NumberOfChanges. @@ -1215,7 +1173,7 @@ } session->parentCommand = cmd; - cmd->msgID = session->lastReceivedMessageID; + smlCommandSetMessageID(cmd, session->lastReceivedMessageID); if (!session->end) { smlSessionDispatchEvent(session, SML_SESSION_EVENT_COMMAND_START, cmd, NULL, NULL, NULL); @@ -1236,13 +1194,13 @@ smlTrace(TRACE_INTERNAL, "%s: RESULT_NORMAL", __func__); session->lastCommandID++; /* Reserve the place for the status in the assembler */ - if (!smlAssemblerReserveStatus(session->assembler, cmd->cmdID, session->lastReceivedMessageID, session->lastCommandID, error)) + if (!smlAssemblerReserveStatus(session->assembler, smlCommandGetID(cmd), session->lastReceivedMessageID, session->lastCommandID, error)) goto error; /* Here we catch Alerts for the next message */ - if (cmd->type == SML_COMMAND_TYPE_ALERT) { + if (smlCommandGetType(cmd) == SML_COMMAND_TYPE_ALERT) { smlTrace(TRACE_INTERNAL, "%s: ALERT with RESULT_NORMAL", __func__); - if (cmd->private.alert.type == SML_ALERT_NEXT_MESSAGE) { + if (smlCommandGetAlertType(cmd) == SML_ALERT_NEXT_MESSAGE) { SmlStatus *reply = smlCommandNewReply(cmd, SML_NO_ERROR, error); if (!reply) goto error; @@ -1256,17 +1214,16 @@ break; } else { smlTrace(TRACE_INTERNAL, "%s: Alert maxObjSize: %i", - __func__, cmd->private.alert.maxObjSize); - if (cmd->private.alert.maxObjSize >= 0) - smlAssemblerSetRemoteMaxObjSize(session->assembler, cmd->private.alert.maxObjSize); + __func__, smlCommandGetMaxObjSize(cmd)); + if (smlCommandGetMaxObjSize(cmd) >= 0) + smlAssemblerSetRemoteMaxObjSize(session->assembler, smlCommandGetMaxObjSize(cmd)); } } /* Here we catch changes with moreData set */ - if (cmd->type == SML_COMMAND_TYPE_ADD || cmd->type == SML_COMMAND_TYPE_REPLACE) { + if (smlCommandGetType(cmd) == SML_COMMAND_TYPE_ADD || smlCommandGetType(cmd) == SML_COMMAND_TYPE_REPLACE) { - SmlItem *lastItem = g_list_nth_data(cmd->private.change.items, - g_list_length(cmd->private.change.items) - 1); + SmlItem *lastItem = smlCommandGetLastChange(cmd); if (session->incomingBuffer) { /* There is a command in the incoming buffer. @@ -1283,7 +1240,7 @@ /* The size of an item must not be set in the * different chunks except the first one. */ - if (cmd->size) { + if (smlCommandGetSize(cmd)) { g_set_error(error, SML_ERROR, SML_ERROR_GENERIC, "Only the first chunk can have the size set"); goto error; @@ -1295,40 +1252,30 @@ */ char *data = NULL; gsize size = 0; - SmlItem *item = g_list_nth_data(cmd->private.change.items, 0); + SmlItem *item = smlCommandGetFirstChange(cmd); if (!item) goto error; if (!smlItemGetData(item, &data, &size, error)) goto error; - lastItem = g_list_nth_data(session->incomingBuffer->private.change.items, g_list_length(session->incomingBuffer->private.change.items) - 1); + lastItem = smlCommandGetLastChange(session->incomingBuffer); if (!smlItemAddData(lastItem, data, size, error)) goto error; - lastItem->moreData = item->moreData; - smlTrace(TRACE_INTERNAL, - "%s: Appended %i to buffer. Buffer size: %i. Required: %i", - __func__, size, - xmlBufferLength(lastItem->buffer), - lastItem->size); + smlItemSetMoreData(lastItem, smlItemGetMoreData(item)); + //smlTrace(TRACE_INTERNAL, + // "%s: Appended %i to buffer. Buffer size: %i. Required: %i", + // __func__, size, + // xmlBufferLength(lastItem->buffer), + // lastItem->size); /* move all other items from the new to the buffered command */ - guint i; - for (i=1; i < g_list_length(cmd->private.change.items); i++) - { - item = g_list_nth_data(cmd->private.change.items, i); - session->incomingBuffer->private.change.items = - g_list_append( - session->incomingBuffer->private.change.items, - item); - } - smlItemUnref(g_list_nth_data(cmd->private.change.items, 0)); - g_list_free(cmd->private.change.items); - cmd->private.change.items = NULL; + smlCommandTransferItems(cmd, session->incomingBuffer, 1); + smlCommandFreeFirstChange(cmd); /* If the last item of the command is complete * then the command must be prepared for dispatching. */ - lastItem = g_list_nth_data(session->incomingBuffer->private.change.items, g_list_length(session->incomingBuffer->private.change.items) - 1); - if (!lastItem->moreData) { + lastItem = smlCommandGetLastChange(session->incomingBuffer); + if (!smlItemGetMoreData(lastItem)) { smlTrace(TRACE_INTERNAL, "%s: Command buffer complete. Dispatching.", __func__); @@ -1353,20 +1300,18 @@ * the message ID are required for correct * status replies. */ - cmd->private.change.items = - session->incomingBuffer->private.change.items; - session->incomingBuffer->private.change.items = NULL; + smlCommandTransferItems(session->incomingBuffer, cmd, 0); smlCommandUnref(session->incomingBuffer); session->incomingBuffer = NULL; } - } else if (lastItem->moreData) { + } else if (smlItemGetMoreData(lastItem)) { /* There is no buffered command yet. * The new command is copied to the buffer. * This is done by reference copy and * an incrementation of the reference counter. */ - if (!cmd->size) { + if (!smlCommandGetSize(cmd)) { g_set_error(error, SML_ERROR, SML_ERROR_GENERIC, "First MoreData item didn't have size set"); goto error; @@ -1374,20 +1319,20 @@ session->incomingBuffer = cmd; smlCommandRef(cmd); - smlTrace(TRACE_INTERNAL, "%s: New Buffer started. Buffered item size: %i. Required: %i", - __func__, - xmlBufferLength(lastItem->buffer), - lastItem->size); + //smlTrace(TRACE_INTERNAL, "%s: New Buffer started. Buffered item size: %i. Required: %i", + // __func__, + // xmlBufferLength(lastItem->buffer), + // lastItem->size); - char *bin = smlPrintBinary((char *) xmlBufferContent(lastItem->buffer), xmlBufferLength(lastItem->buffer)); + char *bin = smlPrintBinary(smlItemGetContent(lastItem), smlItemGetSize(lastItem)); smlTrace(TRACE_INTERNAL, "%s: Content so far: %s\n", __func__, VA_STRING(bin)); smlSafeCFree(&bin); } - if (lastItem->moreData == TRUE) { + if (smlItemGetMoreData(lastItem) == TRUE) { smlTrace(TRACE_INTERNAL, "%s: Got item with moreData %i", - __func__, cmd->msgID); + __func__, smlCommandGetMessageID(cmd)); SmlStatus *reply = smlCommandNewReply(cmd, SML_CHUNK_ACCEPTED, error); if (!reply) @@ -1404,13 +1349,13 @@ } /* if the command is a result, we treat it as a status */ - if (cmd->type == SML_COMMAND_TYPE_RESULTS) { + if (smlCommandGetType(cmd) == SML_COMMAND_TYPE_RESULTS) { /* Call the callback*/ - if (!smlSessionDispatchStatus(session, cmd->private.results.status, error)) + if (!smlSessionDispatchStatus(session, smlCommandResultsGetStatus(cmd), error)) goto error; } else { /* Dispatch the command */ - cmd->msgID = session->lastReceivedMessageID; + smlCommandSetMessageID(cmd, session->lastReceivedMessageID); if (!session->end) { if (!session->parentCommand) { smlSessionDispatchEvent(session, SML_SESSION_EVENT_COMMAND_START, cmd, NULL, NULL, NULL); @@ -1441,7 +1386,7 @@ * twice that the callback are ready to be called twice * (usually this requires some kind of statefulness). */ - if (session->parentCommand->type == SML_COMMAND_TYPE_SYNC) { + if (smlCommandGetType(session->parentCommand) == SML_COMMAND_TYPE_SYNC) { smlSessionDispatchEvent( session, SML_SESSION_EVENT_COMMAND_END, @@ -1866,9 +1811,9 @@ if (session->cred) smlCredUnref(session->cred); session->cred = cred; - if (cred->username) { + if (smlCredGetUsername(cred)) { GError *error = NULL; - sml_location_set_name(session->source, cred->username, &error); + sml_location_set_name(session->source, smlCredGetUsername(cred), &error); if (error) g_error_free(error); } @@ -2356,7 +2301,7 @@ session->localMaxMsgSize = smlSessionGetRemoteMaxMsgSize(session); } - smlTrace(TRACE_EXIT, "%s", __func__); + smlTrace(TRACE_EXIT, "%s - %u", __func__, session->localMaxMsgSize); } gsize |
From: <svn...@op...> - 2009-07-16 11:46:40
|
Author: bellmich Date: Thu Jul 16 13:46:35 2009 New Revision: 1212 URL: http://libsyncml.opensync.org/changeset/1212 Log: cleaned up header file usage in sml_queue.c Modified: trunk/libsyncml/sml_queue.c Modified: trunk/libsyncml/sml_queue.c ============================================================================== --- trunk/libsyncml/sml_queue.c Thu Jul 16 13:45:22 2009 (r1211) +++ trunk/libsyncml/sml_queue.c Thu Jul 16 13:46:35 2009 (r1212) @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ + +#include <config.h> +#include "sml_queue_internals.h" #include "sml_support.h" -#include "sml_queue_internals.h" #include "sml_error_internals.h" -#include <stdio.h> -#include <stdlib.h> - #ifndef DOXYGEN_SHOULD_SKIP_THIS static gboolean |
From: <svn...@op...> - 2009-07-16 11:45:30
|
Author: bellmich Date: Thu Jul 16 13:45:22 2009 New Revision: 1211 URL: http://libsyncml.opensync.org/changeset/1211 Log: cleaned up header file usage in sml_parse.c Modified: trunk/libsyncml/sml_command.c trunk/libsyncml/sml_command.h trunk/libsyncml/sml_elements.c trunk/libsyncml/sml_elements.h trunk/libsyncml/sml_notification.c trunk/libsyncml/sml_notification.h trunk/libsyncml/sml_notification_internals.h trunk/libsyncml/sml_parse.c Modified: trunk/libsyncml/sml_command.c ============================================================================== --- trunk/libsyncml/sml_command.c Thu Jul 16 12:33:01 2009 (r1210) +++ trunk/libsyncml/sml_command.c Thu Jul 16 13:45:22 2009 (r1211) @@ -925,6 +925,12 @@ } } +gsize +smlCommandGetID (SmlCommand *cmd) +{ + return cmd->cmdID; +} + void smlCommandSetID (SmlCommand *cmd, gsize id) @@ -955,3 +961,35 @@ { return cmd->private.alert.contentType; } + +void +smlCommandDisableChanges (SmlCommand *cmd) +{ + smlAssert(cmd); + + if (cmd->private.change.items) + { + guint i; + for (i=0; i < g_list_length(cmd->private.change.items); i++) + { + SmlItem *item = g_list_nth_data(cmd->private.change.items, i); + smlItemSetDisable(item, TRUE); + } + } +} + +void +smlCommandEnableChanges (SmlCommand *cmd) +{ + smlAssert(cmd); + + if (cmd->private.change.items) + { + guint i; + for (i=0; i < g_list_length(cmd->private.change.items); i++) + { + SmlItem *item = g_list_nth_data(cmd->private.change.items, i); + smlItemSetDisable(item, FALSE); + } + } +} Modified: trunk/libsyncml/sml_command.h ============================================================================== --- trunk/libsyncml/sml_command.h Thu Jul 16 12:33:01 2009 (r1210) +++ trunk/libsyncml/sml_command.h Thu Jul 16 13:45:22 2009 (r1211) @@ -65,7 +65,8 @@ SmlCommand* smlCommandNewMap (SmlLocation *target, SmlLocation *source, GError **error); gboolean smlCommandAddMapItem (SmlCommand *map, SmlMapItem *item, GError **error); -void smlCommandSetID (SmlCommand *cmd, gsize id); +void smlCommandSetID (SmlCommand *cmd, gsize id); +gsize smlCommandGetID (SmlCommand *cmd); SmlCommandType smlCommandGetType (SmlCommand *cmd); SmlLocation* smlCommandGetSource (SmlCommand *cmd); @@ -74,6 +75,9 @@ G_CONST_RETURN gchar *smlCommandTypeToString(SmlCommandType type, GError **error); +void smlCommandDisableChanges (SmlCommand *cmd); +void smlCommandEnableChanges (SmlCommand *cmd); + #endif //_SML_COMMAND_H_ /*@}*/ Modified: trunk/libsyncml/sml_elements.c ============================================================================== --- trunk/libsyncml/sml_elements.c Thu Jul 16 12:33:01 2009 (r1210) +++ trunk/libsyncml/sml_elements.c Thu Jul 16 13:45:22 2009 (r1211) @@ -344,6 +344,13 @@ } void +smlItemSetDisable (SmlItem *item, + gboolean disable) +{ + item->disabled = disable; +} + +void smlItemSetSource (SmlItem *item, SmlLocation *source) { Modified: trunk/libsyncml/sml_elements.h ============================================================================== --- trunk/libsyncml/sml_elements.h Thu Jul 16 12:33:01 2009 (r1210) +++ trunk/libsyncml/sml_elements.h Thu Jul 16 13:45:22 2009 (r1211) @@ -63,6 +63,7 @@ gboolean smlItemHasData (SmlItem *item); gboolean smlItemGetData (SmlItem *item, gchar **data, gsize *size, GError **error); gboolean smlItemStealData (SmlItem *item, gchar **data, gsize *size, GError **error); +void smlItemSetDisable (SmlItem *item, gboolean disable); void smlItemSetMoreData (SmlItem *item, gboolean enable); gboolean smlItemGetMoreData (SmlItem *item); Modified: trunk/libsyncml/sml_notification.c ============================================================================== --- trunk/libsyncml/sml_notification.c Thu Jul 16 12:33:01 2009 (r1210) +++ trunk/libsyncml/sml_notification.c Thu Jul 16 13:45:22 2009 (r1211) @@ -104,6 +104,28 @@ } void +smlNotificationSetMimeType (SmlNotification *san, + SmlMimeType mimeType) +{ + san->type = mimeType; +} + +void +smlNotificationSetSessionType (SmlNotification *san, + SmlSessionType sessionType) +{ + san->sessionType = sessionType; +} + +void +smlNotificationSetTarget (SmlNotification *san, + SmlLocation *target) +{ + san->target = target; + g_object_ref(san->target); +} + +void smlNotificationFree (SmlNotification *san) { smlTrace(TRACE_ENTRY, "%s(%p)", __func__, san); Modified: trunk/libsyncml/sml_notification.h ============================================================================== --- trunk/libsyncml/sml_notification.h Thu Jul 16 12:33:01 2009 (r1210) +++ trunk/libsyncml/sml_notification.h Thu Jul 16 13:45:22 2009 (r1211) @@ -56,13 +56,16 @@ SML_SAN_INITIATOR_SERVER = 1 } SmlNotificationInitiator; -SmlNotification* smlNotificationNew (SmlNotificationVersion version, SmlNotificationUIMode mode, SmlNotificationInitiator init, guint sessionID, const gchar *identifier, const gchar *target, SmlMimeType type, GError **error); -void smlNotificationSetCred (SmlNotification *san, SmlCred *cred); -void smlNotificationSetManager (SmlNotification *san, SmlManager *manager); -void smlNotificationFree (SmlNotification *san); -SmlNotification* smlNotificationParse (const gchar *data, gsize size, GError **error); -gboolean smlNotificationAssemble (SmlNotification *san, gchar **data, gsize *size, GError **error); -gboolean smlNotificationSend (SmlNotification *san, SmlTransport *tsp, GError **error); +SmlNotification* smlNotificationNew (SmlNotificationVersion version, SmlNotificationUIMode mode, SmlNotificationInitiator init, guint sessionID, const gchar *identifier, const gchar *target, SmlMimeType type, GError **error); +void smlNotificationSetCred (SmlNotification *san, SmlCred *cred); +void smlNotificationSetManager (SmlNotification *san, SmlManager *manager); +void smlNotificationSetMimeType (SmlNotification *san, SmlMimeType mimeType); +void smlNotificationSetSessionType (SmlNotification *san, SmlSessionType sessionType); +void smlNotificationSetTarget (SmlNotification *san, SmlLocation *target); +void smlNotificationFree (SmlNotification *san); +SmlNotification* smlNotificationParse (const gchar *data, gsize size, GError **error); +gboolean smlNotificationAssemble (SmlNotification *san, gchar **data, gsize *size, GError **error); +gboolean smlNotificationSend (SmlNotification *san, SmlTransport *tsp, GError **error); gboolean smlNotificationNewAlert (SmlNotification *san, SmlAlertType type, const gchar *contenttype, const gchar *serverURI, GError **error); void smlNotificationFreeAlert (SmlSanAlert *alert); @@ -79,6 +82,8 @@ const gchar* smlSanAlertGetContentType (SmlSanAlert *alert); const gchar* smlSanAlertGetServerURI (SmlSanAlert *alert); +gboolean smlNotificationAssemble11 (SmlNotification *san, gchar **data, gsize *size, SmlProtocolVersion version, GError **error); + #endif //_SML_NOTIFICATION_H_ /*@{*/ Modified: trunk/libsyncml/sml_notification_internals.h ============================================================================== --- trunk/libsyncml/sml_notification_internals.h Thu Jul 16 12:33:01 2009 (r1210) +++ trunk/libsyncml/sml_notification_internals.h Thu Jul 16 13:45:22 2009 (r1211) @@ -55,13 +55,6 @@ gchar *serverURI; }; -gboolean smlNotificationAssemble11( - SmlNotification *san, - gchar **data, - gsize *size, - SmlProtocolVersion version, - GError **error); - #endif //_SML_NOTIFICATION_INTERNALS_H_ /*@{*/ Modified: trunk/libsyncml/sml_parse.c ============================================================================== --- trunk/libsyncml/sml_parse.c Thu Jul 16 12:33:01 2009 (r1210) +++ trunk/libsyncml/sml_parse.c Thu Jul 16 13:45:22 2009 (r1211) @@ -19,14 +19,17 @@ * */ +#include "sml_parse_internals.h" + #include <config.h> #include "sml_error_internals.h" #include "sml_support.h" -#include "sml_parse_internals.h" -#include "sml_command_internals.h" -#include "sml_elements_internals.h" -#include "sml_notification_internals.h" + +#include "sml_command.h" +#include "sml_elements.h" +#include "sml_notification.h" + #include "data_sync_api/sml_location_internals.h" #include "parser/sml_xml_assm.h" @@ -166,11 +169,14 @@ /* fix 1.2 SAN for use with SyncML 1.1 */ smlNotificationSetManager(san, parser->manager); - san->type = SML_MIMETYPE_XML; - san->sessionType = SML_SESSION_TYPE_CLIENT; - san->target = sml_location_new_with_options("/", NULL, error); - if (!san->target) - goto error; + smlNotificationSetMimeType(san, SML_MIMETYPE_XML); + smlNotificationSetSessionType(san, SML_SESSION_TYPE_CLIENT); + SmlLocation *target = sml_location_new_with_options("/", NULL, error); + if (!target) + goto error; + smlNotificationSetTarget(san, target); + g_object_unref(target); + target = NULL; /* assemble a SyncML 1.1 notification */ char *xmlData = NULL; @@ -589,7 +595,7 @@ smlAssert(cmd); smlAssert(assm->functions.start_cmd); smlAssert(assm->functions.rem_cmd); - smlAssert(cmd->type == SML_COMMAND_TYPE_ADD || cmd->type == SML_COMMAND_TYPE_REPLACE); + smlAssert(smlCommandGetType(cmd) == SML_COMMAND_TYPE_ADD || smlCommandGetType(cmd) == SML_COMMAND_TYPE_REPLACE); unsigned int parentID = 0; gsize limit = smlAssemblerGetRemoteMaxMsgSize(assm); @@ -601,30 +607,25 @@ /* Add the command */ if (parent) { - if (!parent->cmdID) { + if (!smlCommandGetID(parent)) { g_set_error(error, SML_ERROR, SML_ERROR_GENERIC, "Parent has to be added before"); goto error; } - parentID = parent->cmdID; + parentID = smlCommandGetID(parent); } /* disable the items */ - if (cmd->private.change.items) - { - guint i; - for (i=0; i < g_list_length(cmd->private.change.items); i++) - { - SmlItem *item = g_list_nth_data(cmd->private.change.items, i); - item->disabled = TRUE; - } - } + smlCommandDisableChanges(cmd); + gboolean noCmdID = FALSE; - if (!cmd->cmdID) { + if (!smlCommandGetID(cmd)) { noCmdID = TRUE; /* FIXME: This code does not support more - * FIXME: than 99.999 commands in one session. */ - cmd->cmdID = 10000; + * FIXME: than 99.999 commands in one session. + * FIXME: Why don't we use 0? + */ + smlCommandSetID(cmd, 10000); } if (!assm->functions.start_cmd(assm->assm_userdata, parentID, cmd, error)) @@ -645,18 +646,10 @@ goto error_remove; /* enable the items again */ - if (cmd->private.change.items) - { - guint i; - for (i=0; i < g_list_length(cmd->private.change.items); i++) - { - SmlItem *item = g_list_nth_data(cmd->private.change.items, i); - item->disabled = FALSE; - } - } + smlCommandEnableChanges(cmd); if (noCmdID) - cmd->cmdID = 0; + smlCommandSetID(cmd, 0); smlTrace(TRACE_EXIT, "%s: %i", __func__, *space); return TRUE; @@ -664,17 +657,9 @@ error_remove: assm->functions.rem_cmd(assm->assm_userdata, parentID, NULL); error_enable_item: - if (cmd->private.change.items) - { - guint i; - for (i=0; i < g_list_length(cmd->private.change.items); i++) - { - SmlItem *item = g_list_nth_data(cmd->private.change.items, i); - item->disabled = FALSE; - } - } + smlCommandEnableChanges(cmd); if (noCmdID) - cmd->cmdID = 0; + smlCommandSetID(cmd, 0); error: smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, (*error)->message); return FALSE; @@ -710,11 +695,11 @@ /* Add the command */ if (parent) { - if (!parent->cmdID) { + if (!smlCommandGetID(parent)) { g_set_error(error, SML_ERROR, SML_ERROR_GENERIC, "Parent has to be added before"); goto error; } - parentID = parent->cmdID; + parentID = smlCommandGetID(parent); } if (!assm->functions.start_cmd(assm->assm_userdata, parentID, cmd, error)) @@ -739,7 +724,7 @@ smlTrace(TRACE_INTERNAL, "%s: size %i, limit %i", __func__, size, limit); } - if (cmd->cmdID) + if (smlCommandGetID(cmd)) assm->empty = FALSE; smlTrace(TRACE_EXIT, "%s", __func__); @@ -774,11 +759,11 @@ /* Add the command */ if (parent) { - if (!parent->cmdID) { + if (!smlCommandGetID(parent)) { g_set_error(error, SML_ERROR, SML_ERROR_GENERIC, "Parent has to be added before"); goto error; } - parentID = parent->cmdID; + parentID = smlCommandGetID(parent); } /* End the command */ |
From: <svn...@op...> - 2009-07-16 10:33:15
|
Author: bellmich Date: Thu Jul 16 12:33:01 2009 New Revision: 1210 URL: http://libsyncml.opensync.org/changeset/1210 Log: cleaned up header file usage in sml_notification.c Modified: trunk/libsyncml/sml_notification.c Modified: trunk/libsyncml/sml_notification.c ============================================================================== --- trunk/libsyncml/sml_notification.c Thu Jul 16 12:31:16 2009 (r1209) +++ trunk/libsyncml/sml_notification.c Thu Jul 16 12:33:01 2009 (r1210) @@ -22,18 +22,12 @@ #include "sml_notification_internals.h" #include "sml_support.h" +#include "sml_error_internals.h" -#include "string.h" #include "sml_transport.h" -//#include "sml_command_internals.h" -//#include "sml_manager_internals.h" -#include "sml_error_internals.h" -//#include "objects/sml_auth_internals.h" -//#include "sml_elements_internals.h" -#include "data_sync_api/sml_location_internals.h" -#include <stdlib.h> -#include <stdio.h> +#include "sml_md5.h" +#include "data_sync_api/sml_location_internals.h" SmlNotification* smlNotificationNew (SmlNotificationVersion version, |
From: <svn...@op...> - 2009-07-16 10:31:22
|
Author: bellmich Date: Thu Jul 16 12:31:16 2009 New Revision: 1209 URL: http://libsyncml.opensync.org/changeset/1209 Log: cleaned up header file usage in sml_md5.c Modified: trunk/libsyncml/sml_md5.c Modified: trunk/libsyncml/sml_md5.c ============================================================================== --- trunk/libsyncml/sml_md5.c Thu Jul 16 12:30:26 2009 (r1208) +++ trunk/libsyncml/sml_md5.c Thu Jul 16 12:31:16 2009 (r1209) @@ -13,11 +13,7 @@ #include "sml_error_internals.h" #include "sml_support.h" -#include <string.h> #include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <glib.h> typedef struct SmlMD5Context { uint32_t buf[4]; |
From: <svn...@op...> - 2009-07-16 10:30:32
|
Author: bellmich Date: Thu Jul 16 12:30:26 2009 New Revision: 1208 URL: http://libsyncml.opensync.org/changeset/1208 Log: cleaned up header file usage in sml_manager.c Modified: trunk/libsyncml/sml_manager.c trunk/libsyncml/sml_session.h trunk/libsyncml/sml_session_internals.h trunk/libsyncml/sml_transport.h trunk/libsyncml/sml_transport_internals.h Modified: trunk/libsyncml/sml_manager.c ============================================================================== --- trunk/libsyncml/sml_manager.c Thu Jul 16 12:26:42 2009 (r1207) +++ trunk/libsyncml/sml_manager.c Thu Jul 16 12:30:26 2009 (r1208) @@ -19,15 +19,16 @@ * */ -#include "sml_error_internals.h" #include "sml_manager_internals.h" + +#include "sml_error_internals.h" #include "sml_support.h" -#include <stdio.h> -#include <stdlib.h> -//#include "sml_transport_internals.h" + +#include "sml_transport.h" +#include "sml_session.h" + //#include "sml_command_internals.h" //#include "sml_elements_internals.h" -//#include "sml_session_internals.h" typedef struct managerSession { SmlLink *link; Modified: trunk/libsyncml/sml_session.h ============================================================================== --- trunk/libsyncml/sml_session.h Thu Jul 16 12:26:42 2009 (r1207) +++ trunk/libsyncml/sml_session.h Thu Jul 16 12:30:26 2009 (r1208) @@ -99,4 +99,11 @@ gboolean smlSessionCheck (SmlSession *session); void smlSessionDispatch (SmlSession *session); +gboolean smlSessionTryLock (SmlSession *session); +void smlSessionLock (SmlSession *session); +void smlSessionUnlock (SmlSession *session); + +void smlSessionRestoreTargetURI (SmlSession *session); +gboolean smlSessionSetResponseURI (SmlSession *session, const gchar *responseURI, GError **error); + #endif //_SML_SESSION_H_ Modified: trunk/libsyncml/sml_session_internals.h ============================================================================== --- trunk/libsyncml/sml_session_internals.h Thu Jul 16 12:26:42 2009 (r1207) +++ trunk/libsyncml/sml_session_internals.h Thu Jul 16 12:30:26 2009 (r1208) @@ -106,11 +106,4 @@ void *userdata; }; -gboolean smlSessionTryLock (SmlSession *session); -void smlSessionLock (SmlSession *session); -void smlSessionUnlock (SmlSession *session); - -void smlSessionRestoreTargetURI (SmlSession *session); -gboolean smlSessionSetResponseURI (SmlSession *session, const gchar *responseURI, GError **error); - #endif //_SML_SESSION_INTERNALS_H_ Modified: trunk/libsyncml/sml_transport.h ============================================================================== --- trunk/libsyncml/sml_transport.h Thu Jul 16 12:26:42 2009 (r1207) +++ trunk/libsyncml/sml_transport.h Thu Jul 16 12:30:26 2009 (r1208) @@ -66,6 +66,8 @@ gboolean smlTransportSend (SmlTransport *tsp, SmlLink *link, SmlTransportData *data, GError **error); void smlTransportSendError (SmlTransport *tsp, SmlLink *link, const GError *error); SmlTransportType smlTransportGetType (SmlTransport *tsp); +gboolean smlTransportSetResponseURI (SmlTransport *tsp, const gchar *uri, GError **error); + SmlTransportData* smlTransportDataNew (gchar *data, gsize size, SmlMimeType mimetype, gboolean ownsData, GError **error); SmlTransportData* smlTransportDataRef (SmlTransportData *data); Modified: trunk/libsyncml/sml_transport_internals.h ============================================================================== --- trunk/libsyncml/sml_transport_internals.h Thu Jul 16 12:26:42 2009 (r1207) +++ trunk/libsyncml/sml_transport_internals.h Thu Jul 16 12:30:26 2009 (r1208) @@ -138,6 +138,4 @@ void smlTransportWorkerHandler (void *message, void *userdata); gboolean smlTransportReceiveEvent (SmlTransport *tsp, SmlLink *link, SmlTransportEventType type, SmlTransportData *data, const GError *error); -gboolean smlTransportSetResponseURI (SmlTransport *tsp, const gchar *uri, GError **error); - #endif //_SML_TRANSPORT_INTERNALS_H_ |
From: <svn...@op...> - 2009-07-16 10:26:49
|
Author: bellmich Date: Thu Jul 16 12:26:42 2009 New Revision: 1207 URL: http://libsyncml.opensync.org/changeset/1207 Log: cleaned up header file usage in sml_elements.c Modified: trunk/libsyncml/sml_elements.c Modified: trunk/libsyncml/sml_elements.c ============================================================================== --- trunk/libsyncml/sml_elements.c Thu Jul 16 12:24:51 2009 (r1206) +++ trunk/libsyncml/sml_elements.c Thu Jul 16 12:26:42 2009 (r1207) @@ -20,12 +20,13 @@ */ #include "sml_elements_internals.h" + +#include "sml_error_internals.h" #include "sml_support.h" + #include "sml_parse.h" #include "sml_command.h" -#include "sml_error_internals.h" #include "data_sync_api/sml_location_internals.h" -#include <string.h> SmlAnchor* smlAnchorNew (const gchar *last, |
From: <svn...@op...> - 2009-07-16 10:24:59
|
Author: bellmich Date: Thu Jul 16 12:24:51 2009 New Revision: 1206 URL: http://libsyncml.opensync.org/changeset/1206 Log: cleaned up header file usage in sml_command.c Modified: trunk/libsyncml/sml_command.c Modified: trunk/libsyncml/sml_command.c ============================================================================== --- trunk/libsyncml/sml_command.c Thu Jul 16 12:19:18 2009 (r1205) +++ trunk/libsyncml/sml_command.c Thu Jul 16 12:24:51 2009 (r1206) @@ -20,10 +20,11 @@ */ #include "sml_command_internals.h" + #include "sml_error_internals.h" #include "sml_support.h" -#include <stdio.h> -#include <stdlib.h> + +#include "parser/sml_xml_assm.h" SmlCommandType smlCommandTypeFromString (const gchar *name, |
From: <svn...@op...> - 2009-07-16 10:19:40
|
Author: bellmich Date: Thu Jul 16 12:19:18 2009 New Revision: 1205 URL: http://libsyncml.opensync.org/changeset/1205 Log: fixed header files - removed syncml_internals.h - cleaned up syncml.h The header file cleanup requires some new functions. GOAL: A C file should include on normal header files if the header file is not public. GOAL: A C file should only include an internal header file if the normal header file is public. Added: trunk/libsyncml/sml_thread.c trunk/libsyncml/sml_thread.h trunk/libsyncml/sml_thread_internals.h trunk/tools/syncml-ds-tool_internals.c trunk/tools/syncml-ds-tool_internals.h Deleted: trunk/libsyncml/syncml_internals.h Modified: trunk/libsyncml/CMakeLists.txt trunk/libsyncml/data_sync_api/callbacks.h trunk/libsyncml/data_sync_api/data_sync.c trunk/libsyncml/data_sync_api/data_sync.h trunk/libsyncml/data_sync_api/data_sync_abort.c trunk/libsyncml/data_sync_api/data_sync_callbacks.c trunk/libsyncml/data_sync_api/data_sync_common.c trunk/libsyncml/data_sync_api/data_sync_devinf.c trunk/libsyncml/data_sync_api/data_sync_loop.c trunk/libsyncml/data_sync_api/data_sync_server.c trunk/libsyncml/data_sync_api/defines.h trunk/libsyncml/data_sync_api/sml_location.c trunk/libsyncml/data_sync_api/sml_location_internals.h trunk/libsyncml/data_sync_api/standard.h trunk/libsyncml/data_sync_api/transport_obex_client.c trunk/libsyncml/objects/sml_auth.c trunk/libsyncml/objects/sml_auth.h trunk/libsyncml/objects/sml_devinf_obj.c trunk/libsyncml/objects/sml_devinf_obj.h trunk/libsyncml/objects/sml_devinf_obj_internals.h trunk/libsyncml/objects/sml_ds_server.c trunk/libsyncml/objects/sml_ds_server.h trunk/libsyncml/objects/sml_ds_server_internals.h trunk/libsyncml/parser/sml_wbxml.c trunk/libsyncml/parser/sml_wbxml.h trunk/libsyncml/parser/sml_wbxml_internals.h trunk/libsyncml/parser/sml_xml_assm.c trunk/libsyncml/parser/sml_xml_assm_internals.h trunk/libsyncml/parser/sml_xml_parse.c trunk/libsyncml/parser/sml_xml_parse_internals.h trunk/libsyncml/sml_command.c trunk/libsyncml/sml_command.h trunk/libsyncml/sml_command_internals.h trunk/libsyncml/sml_defines.h trunk/libsyncml/sml_elements.c trunk/libsyncml/sml_elements.h trunk/libsyncml/sml_elements_internals.h trunk/libsyncml/sml_error.c trunk/libsyncml/sml_error_internals.h trunk/libsyncml/sml_manager.c trunk/libsyncml/sml_manager.h trunk/libsyncml/sml_manager_internals.h trunk/libsyncml/sml_md5.c trunk/libsyncml/sml_md5.h trunk/libsyncml/sml_notification.c trunk/libsyncml/sml_notification.h trunk/libsyncml/sml_notification_internals.h trunk/libsyncml/sml_parse.c trunk/libsyncml/sml_parse.h trunk/libsyncml/sml_parse_internals.h trunk/libsyncml/sml_queue.c trunk/libsyncml/sml_queue_internals.h trunk/libsyncml/sml_session.c trunk/libsyncml/sml_session.h trunk/libsyncml/sml_session_internals.h trunk/libsyncml/sml_support.c trunk/libsyncml/sml_support.h trunk/libsyncml/sml_transport.c trunk/libsyncml/sml_transport.h trunk/libsyncml/sml_transport_internals.h trunk/libsyncml/syncml.h trunk/libsyncml/transports/http_client.c trunk/libsyncml/transports/http_client_internals.h trunk/libsyncml/transports/http_server.c trunk/libsyncml/transports/http_server_internals.h trunk/libsyncml/transports/obex_client.c trunk/libsyncml/transports/obex_client_samsung.c trunk/libsyncml/transports/obex_server.c trunk/libsyncml/transports/obex_server_internals.h trunk/tests/check_data_sync_api.c trunk/tests/check_libsoup.c trunk/tests/check_manager.c trunk/tests/check_md5.c trunk/tests/check_obex.c trunk/tests/check_san.c trunk/tests/check_session.c trunk/tests/check_sync.c trunk/tests/check_wbxml_assembler.c trunk/tests/check_wbxml_parser.c trunk/tests/check_xml_assembler.c trunk/tests/support.h trunk/tools/CMakeLists.txt trunk/tools/syncml-ds-tool.c Modified: trunk/libsyncml/CMakeLists.txt ============================================================================== --- trunk/libsyncml/CMakeLists.txt Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/CMakeLists.txt Thu Jul 16 12:19:18 2009 (r1205) @@ -13,6 +13,7 @@ sml_queue.c sml_session.c sml_support.c + sml_thread.c sml_transport.c data_sync_api/data_sync.c data_sync_api/data_sync_abort.c @@ -68,7 +69,6 @@ INSTALL( TARGETS syncml DESTINATION ${LIBSYNCML_LIBRARIES_DIR} ) INSTALL( FILES - sml_defines.h sml_error.h syncml.h DESTINATION ${LIBSYNCML_INCLUDE_DIR}/libsyncml Modified: trunk/libsyncml/data_sync_api/callbacks.h ============================================================================== --- trunk/libsyncml/data_sync_api/callbacks.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/data_sync_api/callbacks.h Thu Jul 16 12:19:18 2009 (r1205) @@ -28,7 +28,11 @@ #ifndef _SML_DATA_SYNC_API_CALLBACKS_H_ #define _SML_DATA_SYNC_API_CALLBACKS_H_ +#include <libsyncml/data_sync_api/defines.h> #include <libsyncml/data_sync_api/standard.h> +#include <libsyncml/dev_inf_api/sml_dev_inf.h> + +#include <glib.h> #ifdef __cplusplus extern "C" Modified: trunk/libsyncml/data_sync_api/data_sync.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync.c Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/data_sync_api/data_sync.c Thu Jul 16 12:19:18 2009 (r1205) @@ -18,16 +18,20 @@ * */ -#include "../syncml.h" -#include "../syncml_internals.h" -#include "../sml_error_internals.h" #include <libsyncml/data_sync_api/defines.h> #include <libsyncml/data_sync_api/standard.h> #include <libsyncml/data_sync_api/callbacks.h> +#include "../syncml.h" +#include "../sml_support.h" +#include "../sml_thread.h" +#include "../sml_error_internals.h" + /* required because of function index */ -#include <strings.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> #include "data_sync.h" #include "data_sync_client.h" @@ -51,7 +55,7 @@ smlTrace(TRACE_ENTRY, "%s(%d, %d, %p)", __func__, dsType, tspType, error); CHECK_ERROR_REF - smlTrace(TRACE_INTERNAL, "%s: libsyncml version: %s", __func__, VERSION); + smlTrace(TRACE_INTERNAL, "%s: libsyncml version: %s", __func__, smlGetLibraryVersion()); SmlDataSyncObject *dsObject = smlTryMalloc0(sizeof(SmlDataSyncObject), error); if (!dsObject) Modified: trunk/libsyncml/data_sync_api/data_sync.h ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/data_sync_api/data_sync.h Thu Jul 16 12:19:18 2009 (r1205) @@ -24,8 +24,8 @@ #include <libsyncml/data_sync_api/standard.h> #include <libsyncml/data_sync_api/callbacks.h> -#include <libsyncml/syncml_internals.h> #include <libsyncml/sml_support.h> +#include <libsyncml/sml_thread.h> #include <libsyncml/sml_session.h> #include <libsyncml/sml_transport.h> Modified: trunk/libsyncml/data_sync_api/data_sync_abort.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_abort.c Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/data_sync_api/data_sync_abort.c Thu Jul 16 12:19:18 2009 (r1205) @@ -18,8 +18,7 @@ * */ -#include "../syncml.h" -#include "../syncml_internals.h" +#include "../sml_support.h" #include "../sml_error_internals.h" #include <libsyncml/data_sync_api/defines.h> Modified: trunk/libsyncml/data_sync_api/data_sync_callbacks.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_callbacks.c Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/data_sync_api/data_sync_callbacks.c Thu Jul 16 12:19:18 2009 (r1205) @@ -19,11 +19,12 @@ */ #include "data_sync_callbacks.h" -#include "libsyncml/syncml_internals.h" #include "libsyncml/sml_support.h" #include "libsyncml/sml_error_internals.h" #include <string.h> #include <strings.h> +#include <stdio.h> +#include <stdlib.h> #include "defines.h" #include "data_sync_devinf.h" #include "libsyncml/objects/sml_ds_server_internals.h" Modified: trunk/libsyncml/data_sync_api/data_sync_common.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_common.c Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/data_sync_api/data_sync_common.c Thu Jul 16 12:19:18 2009 (r1205) @@ -19,9 +19,11 @@ */ #include "data_sync_common.h" -#include "libsyncml/syncml_internals.h" +#include "libsyncml/sml_support.h" #include "libsyncml/sml_error_internals.h" +#include <string.h> + #include "data_sync_devinf.h" gboolean Modified: trunk/libsyncml/data_sync_api/data_sync_devinf.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_devinf.c Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/data_sync_api/data_sync_devinf.c Thu Jul 16 12:19:18 2009 (r1205) @@ -19,7 +19,7 @@ */ #include "data_sync_devinf.h" -#include "libsyncml/syncml_internals.h" +#include "libsyncml/sml_support.h" #include "libsyncml/sml_error_internals.h" static SmlDevInfProperty* Modified: trunk/libsyncml/data_sync_api/data_sync_loop.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_loop.c Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/data_sync_api/data_sync_loop.c Thu Jul 16 12:19:18 2009 (r1205) @@ -18,8 +18,7 @@ * */ -#include "../syncml.h" -#include "../syncml_internals.h" +#include "../sml_support.h" #include "data_sync_devinf.h" #include "libsyncml/sml_error_internals.h" Modified: trunk/libsyncml/data_sync_api/data_sync_server.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_server.c Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/data_sync_api/data_sync_server.c Thu Jul 16 12:19:18 2009 (r1205) @@ -25,6 +25,7 @@ #include "libsyncml/objects/sml_ds_server.h" #include "data_sync_devinf.h" #include "libsyncml/sml_support.h" +#include <string.h> static gboolean smlDataSyncServerAlertCallback (SmlDsSession *dsession, Modified: trunk/libsyncml/data_sync_api/defines.h ============================================================================== --- trunk/libsyncml/data_sync_api/defines.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/data_sync_api/defines.h Thu Jul 16 12:19:18 2009 (r1205) @@ -48,7 +48,57 @@ { #endif -#include <libsyncml/sml_defines.h> +/* necessary public types */ + +typedef enum { + SML_ALERT_UNKNOWN = 0, + SML_ALERT_DISPLAY = 100, + SML_ALERT_TWO_WAY = 200, + SML_ALERT_SLOW_SYNC = 201, + SML_ALERT_ONE_WAY_FROM_CLIENT = 202, + SML_ALERT_REFRESH_FROM_CLIENT = 203, + SML_ALERT_ONE_WAY_FROM_SERVER = 204, + SML_ALERT_REFRESH_FROM_SERVER = 205, + SML_ALERT_TWO_WAY_BY_SERVER = 206, + SML_ALERT_ONE_WAY_FROM_CLIENT_BY_SERVER = 207, + SML_ALERT_REFRESH_FROM_CLIENT_BY_SERVER = 208, + SML_ALERT_ONE_WAY_FROM_SERVER_BY_SERVER = 209, + SML_ALERT_REFRESH_FROM_SERVER_BY_SERVER = 210, + SML_ALERT_RESULT = 221, + SML_ALERT_NEXT_MESSAGE = 222, + SML_ALERT_NO_END_OF_DATA = 223 +} SmlAlertType; + +typedef enum { + SML_CHANGE_UNKNOWN = 0, + SML_CHANGE_ADD = 1, + SML_CHANGE_REPLACE = 2, + SML_CHANGE_DELETE = 3 +} SmlChangeType; + +typedef enum { + SML_TRANSPORT_HTTP_SERVER = 1, + SML_TRANSPORT_HTTP_CLIENT = 2, + SML_TRANSPORT_OBEX_CLIENT = 3, + SML_TRANSPORT_OBEX_SERVER = 4 +} SmlTransportType; + +typedef enum SmlSessionType { + SML_SESSION_TYPE_SERVER = 1, + SML_SESSION_TYPE_CLIENT = 2 +} SmlSessionType; + +/*! @brief These are all possible events which the high level API sends. + */ +typedef enum SmlDataSyncEventType { + SML_DATA_SYNC_EVENT_ERROR = 0, + SML_DATA_SYNC_EVENT_CONNECT = 1, + SML_DATA_SYNC_EVENT_GOT_ALL_ALERTS = 2, + SML_DATA_SYNC_EVENT_GOT_ALL_CHANGES = 3, + SML_DATA_SYNC_EVENT_GOT_ALL_MAPPINGS = 4, + SML_DATA_SYNC_EVENT_DISCONNECT = 5, + SML_DATA_SYNC_EVENT_FINISHED = 6 +} SmlDataSyncEventType; /* SyncML default limitations */ Modified: trunk/libsyncml/data_sync_api/sml_location.c ============================================================================== --- trunk/libsyncml/data_sync_api/sml_location.c Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/data_sync_api/sml_location.c Thu Jul 16 12:19:18 2009 (r1205) @@ -18,9 +18,9 @@ * Boston, MA 02110-1301 USA */ -#include "sml_location.h" -#include <libsyncml/syncml.h> +#include "sml_location_internals.h" #include "../sml_error_internals.h" +#include <string.h> G_DEFINE_TYPE (SmlLocation, sml_location, G_TYPE_OBJECT) Modified: trunk/libsyncml/data_sync_api/sml_location_internals.h ============================================================================== --- trunk/libsyncml/data_sync_api/sml_location_internals.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/data_sync_api/sml_location_internals.h Thu Jul 16 12:19:18 2009 (r1205) @@ -22,7 +22,6 @@ #define __SML_LOCATION_INTERNALS_H__ #include "sml_location.h" -#include "../sml_error_internals.h" G_BEGIN_DECLS Modified: trunk/libsyncml/data_sync_api/standard.h ============================================================================== --- trunk/libsyncml/data_sync_api/standard.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/data_sync_api/standard.h Thu Jul 16 12:19:18 2009 (r1205) @@ -33,25 +33,14 @@ #ifndef _SML_DATA_SYNC_API_STANDARD_H_ #define _SML_DATA_SYNC_API_STANDARD_H_ -#include <libsyncml/syncml.h> +#include <libsyncml/data_sync_api/defines.h> +#include <libsyncml/data_sync_api/sml_location.h> #ifdef __cplusplus extern "C" { #endif -/*! @brief These are all possible events which the high level API sends. - */ -typedef enum SmlDataSyncEventType { - SML_DATA_SYNC_EVENT_ERROR = 0, - SML_DATA_SYNC_EVENT_CONNECT = 1, - SML_DATA_SYNC_EVENT_GOT_ALL_ALERTS = 2, - SML_DATA_SYNC_EVENT_GOT_ALL_CHANGES = 3, - SML_DATA_SYNC_EVENT_GOT_ALL_MAPPINGS = 4, - SML_DATA_SYNC_EVENT_DISCONNECT = 5, - SML_DATA_SYNC_EVENT_FINISHED = 6 -} SmlDataSyncEventType; - typedef struct SmlDataSyncObject SmlDataSyncObject; /* object creation and configuration */ Modified: trunk/libsyncml/data_sync_api/transport_obex_client.c ============================================================================== --- trunk/libsyncml/data_sync_api/transport_obex_client.c Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/data_sync_api/transport_obex_client.c Thu Jul 16 12:19:18 2009 (r1205) @@ -21,6 +21,7 @@ #include "transport.h" #include "libsyncml/sml_error_internals.h" #include "libsyncml/sml_support.h" +#include <string.h> gboolean smlDataSyncTransportObexClientInit (SmlDataSyncObject *dsObject, Modified: trunk/libsyncml/objects/sml_auth.c ============================================================================== --- trunk/libsyncml/objects/sml_auth.c Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/objects/sml_auth.c Thu Jul 16 12:19:18 2009 (r1205) @@ -19,15 +19,13 @@ * */ -#include <libsyncml/syncml.h> -#include "sml_auth.h" - -#include <libsyncml/syncml_internals.h> #include "sml_auth_internals.h" +#include <libsyncml/sml_support.h> #include <libsyncml/sml_session_internals.h> #include <libsyncml/sml_elements_internals.h> #include <libsyncml/sml_command_internals.h> #include "libsyncml/sml_error_internals.h" +#include <string.h> static SmlStatus* _smlAuthHeaderReply(SmlSession *session, SmlErrorType code, SmlAuthType auth, GError **error); Modified: trunk/libsyncml/objects/sml_auth.h ============================================================================== --- trunk/libsyncml/objects/sml_auth.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/objects/sml_auth.h Thu Jul 16 12:19:18 2009 (r1205) @@ -30,7 +30,12 @@ #ifndef _SML_AUTH_H_ #define _SML_AUTH_H_ +#include <glib.h> +#include "../sml_elements.h" +#include "../sml_manager.h" + typedef struct SmlAuthenticator SmlAuthenticator; + typedef gboolean (* SmlAuthVerifyCb)(SmlChal *chal, SmlCred *cred, const gchar *username, void *userdata, GError **error); SmlAuthenticator* smlAuthNew (GError **error); Modified: trunk/libsyncml/objects/sml_devinf_obj.c ============================================================================== --- trunk/libsyncml/objects/sml_devinf_obj.c Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/objects/sml_devinf_obj.c Thu Jul 16 12:19:18 2009 (r1205) @@ -19,11 +19,10 @@ * */ -#include <libsyncml/syncml.h> -#include "sml_devinf_obj.h" +#include <config.h> -#include <libsyncml/syncml_internals.h> #include "sml_devinf_obj_internals.h" +#include <libsyncml/sml_support.h> #include <libsyncml/sml_session_internals.h> #include <libsyncml/sml_elements_internals.h> #include <libsyncml/sml_command_internals.h> @@ -31,6 +30,8 @@ #include "libsyncml/parser/sml_xml_parse.h" #include "libsyncml/data_sync_api/sml_location_internals.h" +#include "../syncml.h" + #ifdef WIN32 #include <windef.h> #else @@ -446,7 +447,7 @@ #endif } if (!sml_dev_inf_get_swv(devinf) && - !sml_dev_inf_set_swv(devinf, VERSION, error)) + !sml_dev_inf_set_swv(devinf, smlGetLibraryVersion(), error)) goto error; smlTrace(TRACE_EXIT, "%s: %p", __func__, agent); Modified: trunk/libsyncml/objects/sml_devinf_obj.h ============================================================================== --- trunk/libsyncml/objects/sml_devinf_obj.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/objects/sml_devinf_obj.h Thu Jul 16 12:19:18 2009 (r1205) @@ -30,6 +30,10 @@ #ifndef _SML_DEVINF_OBJ_H_ #define _SML_DEVINF_OBJ_H_ +#include <glib.h> +#include "../sml_manager.h" +#include "../sml_session.h" + typedef struct SmlDevInfAgent SmlDevInfAgent; // only the SmlDevInf pointer of smlDevInfAgentNew is the local DevInf Modified: trunk/libsyncml/objects/sml_devinf_obj_internals.h ============================================================================== --- trunk/libsyncml/objects/sml_devinf_obj_internals.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/objects/sml_devinf_obj_internals.h Thu Jul 16 12:19:18 2009 (r1205) @@ -30,6 +30,8 @@ #ifndef _SML_DEVINF_OBJ_INTERNALS_H_ #define _SML_DEVINF_OBJ_INTERNALS_H_ +#include "sml_devinf_obj.h" + typedef struct SmlDevInfAgentSession { /* states */ gboolean devinfSent; Modified: trunk/libsyncml/objects/sml_ds_server.c ============================================================================== --- trunk/libsyncml/objects/sml_ds_server.c Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/objects/sml_ds_server.c Thu Jul 16 12:19:18 2009 (r1205) @@ -19,11 +19,8 @@ * */ -#include <libsyncml/syncml.h> -#include "sml_ds_server.h" - -#include <libsyncml/syncml_internals.h> #include "sml_ds_server_internals.h" +#include <libsyncml/sml_support.h> #include <libsyncml/sml_error_internals.h> #include <libsyncml/sml_manager_internals.h> #include <libsyncml/sml_session_internals.h> Modified: trunk/libsyncml/objects/sml_ds_server.h ============================================================================== --- trunk/libsyncml/objects/sml_ds_server.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/objects/sml_ds_server.h Thu Jul 16 12:19:18 2009 (r1205) @@ -30,6 +30,8 @@ #ifndef _SML_DS_SERVER_H_ #define _SML_DS_SERVER_H_ +#include "../sml_notification.h" + typedef struct SmlDsServer SmlDsServer; typedef struct SmlDsSession SmlDsSession; Modified: trunk/libsyncml/objects/sml_ds_server_internals.h ============================================================================== --- trunk/libsyncml/objects/sml_ds_server_internals.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/objects/sml_ds_server_internals.h Thu Jul 16 12:19:18 2009 (r1205) @@ -30,6 +30,8 @@ #ifndef _SML_DS_SERVER_INTERNALS_H_ #define _SML_DS_SERVER_INTERNALS_H_ +#include "sml_ds_server.h" + typedef void (* SmlDsSessionMapCb) (SmlDsSession *dsession, SmlLocation *orig, SmlLocation *mapped, void *userdata); typedef struct SmlWriteContext { Modified: trunk/libsyncml/parser/sml_wbxml.c ============================================================================== --- trunk/libsyncml/parser/sml_wbxml.c Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/parser/sml_wbxml.c Thu Jul 16 12:19:18 2009 (r1205) @@ -19,21 +19,20 @@ * */ -#include <libsyncml/syncml.h> - -#include <libsyncml/syncml_internals.h> +#include <libsyncml/sml_support.h> #include <libsyncml/sml_elements_internals.h> #include <libsyncml/sml_command_internals.h> #include <libsyncml/sml_session_internals.h> #include "libsyncml/sml_error_internals.h" +#include <config.h> + #ifdef ENABLE_WBXML #include "sml_xml_assm.h" #include "sml_xml_assm_internals.h" #include "sml_xml_parse.h" #include "sml_xml_parse_internals.h" -#include "sml_wbxml.h" #include "sml_wbxml_internals.h" gboolean Modified: trunk/libsyncml/parser/sml_wbxml.h ============================================================================== --- trunk/libsyncml/parser/sml_wbxml.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/parser/sml_wbxml.h Thu Jul 16 12:19:18 2009 (r1205) @@ -30,6 +30,9 @@ #ifndef _SML_WBXML_H_ #define _SML_WBXML_H_ +#include "sml_xml_parse.h" +#include "sml_xml_assm.h" + SmlXmlParser* smlWbxmlParserNew (SmlParserFunctions *functions, GError **error); SmlXmlAssembler* smlWbxmlAssemblerNew (SmlAssembler *assembler, SmlAssemblerFunctions *functions, GError **error); Modified: trunk/libsyncml/parser/sml_wbxml_internals.h ============================================================================== --- trunk/libsyncml/parser/sml_wbxml_internals.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/parser/sml_wbxml_internals.h Thu Jul 16 12:19:18 2009 (r1205) @@ -31,6 +31,7 @@ #define _SML_WBXML_INTERNALS_H_ #include <wbxml.h> +#include "sml_wbxml.h" gboolean smlWbxmlConvertTo (WBXMLConvXML2WBXMLParams *params, const gchar *input, gchar **output, gsize *outputLen, GError** error); gboolean smlWbxmlConvertFrom (WBXMLConvWBXML2XMLParams *params, const gchar *input, gsize inputLen, gchar **output, gsize *outputLen, GError** error); Modified: trunk/libsyncml/parser/sml_xml_assm.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_assm.c Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/parser/sml_xml_assm.c Thu Jul 16 12:19:18 2009 (r1205) @@ -19,17 +19,16 @@ * */ -#include <libsyncml/syncml.h> - -#include <libsyncml/syncml_internals.h> +#include <libsyncml/sml_support.h> #include <libsyncml/sml_elements_internals.h> #include <libsyncml/sml_command_internals.h> #include <libsyncml/sml_session_internals.h> #include "libsyncml/sml_error_internals.h" -#include "sml_xml_assm.h" #include "sml_xml_assm_internals.h" +#include <string.h> + #define BUFFER_SIZE 500 /** @@ -1044,7 +1043,7 @@ break; default: g_set_error(error, SML_ERROR, SML_ERROR_GENERIC, - "Unknown version"); + "Unknown version %d", session->version); goto error; } break; @@ -1119,7 +1118,7 @@ } /* set MaxMsgSize if available */ - unsigned int localMaxMsgSize = smlSessionGetLocalMaxMsgSize(session); + gsize localMaxMsgSize = smlSessionGetLocalMaxMsgSize(session); if (localMaxMsgSize) { if (!_smlXmlAssemblerStartNode(assm, SML_ELEMENT_META, error)) goto error; Modified: trunk/libsyncml/parser/sml_xml_assm_internals.h ============================================================================== --- trunk/libsyncml/parser/sml_xml_assm_internals.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/parser/sml_xml_assm_internals.h Thu Jul 16 12:19:18 2009 (r1205) @@ -31,6 +31,7 @@ #define _SML_XML_ASSM_INTERNALS_H_ #include <libxml/xmlwriter.h> +#include "sml_xml_assm.h" #define XML_NODE_START 1 #define XML_NODE_TEXT 3 Modified: trunk/libsyncml/parser/sml_xml_parse.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_parse.c Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/parser/sml_xml_parse.c Thu Jul 16 12:19:18 2009 (r1205) @@ -19,17 +19,15 @@ * */ -#include <libsyncml/syncml.h> - -#include <libsyncml/syncml_internals.h> +#include <libsyncml/sml_support.h> #include <libsyncml/sml_elements_internals.h> #include <libsyncml/sml_command_internals.h> #include <libsyncml/sml_session_internals.h> #include "libsyncml/sml_error_internals.h" #include "libsyncml/data_sync_api/sml_location_internals.h" -#include "sml_xml_parse.h" #include "sml_xml_parse_internals.h" +#include <string.h> #define BUFFER_SIZE 500 @@ -1312,7 +1310,7 @@ if (!*cmd) goto error; (*cmd)->refCount = 1; - (*cmd)->private.alert.maxObjSize = -1; + (*cmd)->private.alert.maxObjSize = 0; while (1) { if (!_smlXmlParserStep(parser)) { @@ -1395,7 +1393,7 @@ *cmd = smlCommandNew(SML_COMMAND_TYPE_SYNC, error); if (!*cmd) goto error; - (*cmd)->private.sync.maxObjSize = -1; + (*cmd)->private.sync.maxObjSize = 0; while (1) { if (!_smlXmlParserStep(parser)) { Modified: trunk/libsyncml/parser/sml_xml_parse_internals.h ============================================================================== --- trunk/libsyncml/parser/sml_xml_parse_internals.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/parser/sml_xml_parse_internals.h Thu Jul 16 12:19:18 2009 (r1205) @@ -38,6 +38,7 @@ #include <libxml/xmlreader.h> #include <libxml/xmlwriter.h> +#include "sml_xml_parse.h" #define XML_NODE_START 1 #define XML_NODE_TEXT 3 Modified: trunk/libsyncml/sml_command.c ============================================================================== --- trunk/libsyncml/sml_command.c Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/sml_command.c Thu Jul 16 12:19:18 2009 (r1205) @@ -19,15 +19,11 @@ * */ -#include "syncml.h" - -#include "syncml_internals.h" -#include "sml_parse_internals.h" #include "sml_command_internals.h" -#include "sml_session_internals.h" -#include "sml_elements_internals.h" #include "sml_error_internals.h" -#include "parser/sml_xml_assm.h" +#include "sml_support.h" +#include <stdio.h> +#include <stdlib.h> SmlCommandType smlCommandTypeFromString (const gchar *name, @@ -245,7 +241,7 @@ switch (cmd->type) { case SML_COMMAND_TYPE_ALERT: if (cmd->private.alert.anchor) { - reply->anchor = smlAnchorNew(NULL, cmd->private.alert.anchor->next, error); + reply->anchor = smlAnchorNew(NULL, smlAnchorGetNext(cmd->private.alert.anchor), error); if (!reply->anchor) goto error; } @@ -287,14 +283,11 @@ if (!result->private.results.status->item) goto error; - result->private.results.status->item->contenttype = g_strdup(contenttype); - result->private.results.status->item->source = sml_location_clone(source, error); - if (!result->private.results.status->item->source) - goto error; - - if (!result->private.results.status->item->source) + if (!smlItemSetContentType(result->private.results.status->item, contenttype, error)) goto error; - + /* FIXME: Why did we use sml_location_clone here? */ + smlItemSetSource(result->private.results.status->item, source); + smlTrace(TRACE_EXIT, "%s: %p", __func__, result); return result; error: @@ -444,16 +437,18 @@ * smlDsSessionQueueChange. So the correct usage of target * and source must be ensured by the XML assembler. */ - item->source = loc; + smlItemSetSource(item, loc); if (type != SML_CHANGE_ADD) { /* If this is an Add command then nobody knows * which ID the remote peer will be use for this item. */ g_object_ref(loc); - item->target = loc; + smlItemSetTarget(item, loc); } + g_object_unref(loc); - item->contenttype = g_strdup(contenttype); + if (!smlItemSetContentType(item, contenttype, error)) + goto error; smlTrace(TRACE_EXIT, "%s: %p", __func__, cmd); return cmd; @@ -518,13 +513,16 @@ if (!sml_location_set_uri(loc, uid, error)) goto error; - if (type != SML_CHANGE_ADD) - item->target = loc; - else - item->source = loc; + if (type != SML_CHANGE_ADD) { + smlItemSetTarget(item, loc); + } else { + smlItemSetSource(item, loc); + } + g_object_unref(loc); - item->moreData = TRUE; - item->contenttype = g_strdup(contenttype); + smlItemSetMoreData(item, TRUE); + if (!smlItemSetContentType(item, contenttype, error)) + goto error; smlTrace(TRACE_EXIT, "%s: %p", __func__, cmd); return cmd; @@ -652,7 +650,8 @@ smlItemSetSource(cmd->private.access.item, cmd->source); } - cmd->private.access.item->contenttype = g_strdup(contenttype); + if (!smlItemSetContentType(cmd->private.access.item, contenttype, error)) + goto error; smlTrace(TRACE_EXIT, "%s: %p", __func__, cmd); return cmd; @@ -684,7 +683,8 @@ g_object_ref(target); smlItemSetTarget(cmd->private.access.item, cmd->target); - cmd->private.access.item->contenttype = g_strdup(contenttype); + if (!smlItemSetContentType(cmd->private.access.item, contenttype, error)) + goto error; smlTrace(TRACE_EXIT, "%s: %p", __func__, cmd); return cmd; @@ -733,7 +733,7 @@ goto error; /* Since the devinf is xml, we want to send it "raw" (without cdata) */ - result->private.results.status->item->raw = TRUE; + smlItemSetRaw(result->private.results.status->item, TRUE); g_object_unref(source); @@ -924,3 +924,33 @@ } } +void +smlCommandSetID (SmlCommand *cmd, + gsize id) +{ + cmd->cmdID = id; +} + +SmlCommandType +smlCommandGetType (SmlCommand *cmd) +{ + return cmd->type; +} + +SmlLocation* +smlCommandGetSource (SmlCommand *cmd) +{ + return cmd->source; +} + +SmlLocation* +smlCommandGetTarget (SmlCommand *cmd) +{ + return cmd->target; +} + +const gchar* +smlCommandGetContentType (SmlCommand *cmd) +{ + return cmd->private.alert.contentType; +} Modified: trunk/libsyncml/sml_command.h ============================================================================== --- trunk/libsyncml/sml_command.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/sml_command.h Thu Jul 16 12:19:18 2009 (r1205) @@ -32,6 +32,10 @@ #include <libsyncml/syncml.h> #include <libsyncml/dev_inf_api/sml_dev_inf.h> +#include "sml_elements.h" + +typedef struct SmlCommand SmlCommand; +typedef struct SmlStatus SmlStatus; SmlStatus* smlStatusNew (SmlErrorType data, gsize cmdref, gsize msgref, SmlLocation *sourceref, SmlLocation *targeref, SmlCommandType type, GError **error); SmlStatus* smlStatusRef (SmlStatus *status); @@ -61,6 +65,15 @@ SmlCommand* smlCommandNewMap (SmlLocation *target, SmlLocation *source, GError **error); gboolean smlCommandAddMapItem (SmlCommand *map, SmlMapItem *item, GError **error); +void smlCommandSetID (SmlCommand *cmd, gsize id); + +SmlCommandType smlCommandGetType (SmlCommand *cmd); +SmlLocation* smlCommandGetSource (SmlCommand *cmd); +SmlLocation* smlCommandGetTarget (SmlCommand *cmd); +const gchar* smlCommandGetContentType (SmlCommand *cmd); + +G_CONST_RETURN gchar *smlCommandTypeToString(SmlCommandType type, GError **error); + #endif //_SML_COMMAND_H_ /*@}*/ Modified: trunk/libsyncml/sml_command_internals.h ============================================================================== --- trunk/libsyncml/sml_command_internals.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/sml_command_internals.h Thu Jul 16 12:19:18 2009 (r1205) @@ -30,6 +30,10 @@ #ifndef _SML_COMMAND_INTERNALS_H_ #define _SML_COMMAND_INTERNALS_H_ +#include "sml_command.h" +#include "sml_elements.h" +#include "sml_session.h" + typedef struct SmlCommandAlertPrivate { SmlAlertType type; SmlAnchor *anchor; @@ -108,7 +112,6 @@ }; SmlCommandType smlCommandTypeFromString(const gchar *name, GError **error); -G_CONST_RETURN gchar *smlCommandTypeToString(SmlCommandType type, GError **error); SmlAlertType smlAlertTypeConvert(guint id, GError **error); Modified: trunk/libsyncml/sml_defines.h ============================================================================== --- trunk/libsyncml/sml_defines.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/sml_defines.h Thu Jul 16 12:19:18 2009 (r1205) @@ -237,13 +237,6 @@ } SmlMimeType; typedef enum { - SML_TRANSPORT_HTTP_SERVER, - SML_TRANSPORT_HTTP_CLIENT, - SML_TRANSPORT_OBEX_CLIENT, - SML_TRANSPORT_OBEX_SERVER -} SmlTransportType; - -typedef enum { SML_RESULT_OK, SML_RESULT_RETRY, SML_RESULT_FATAL @@ -277,32 +270,6 @@ } SmlCommandType; typedef enum { - SML_ALERT_UNKNOWN = 0, - SML_ALERT_DISPLAY = 100, - SML_ALERT_TWO_WAY = 200, - SML_ALERT_SLOW_SYNC = 201, - SML_ALERT_ONE_WAY_FROM_CLIENT = 202, - SML_ALERT_REFRESH_FROM_CLIENT = 203, - SML_ALERT_ONE_WAY_FROM_SERVER = 204, - SML_ALERT_REFRESH_FROM_SERVER = 205, - SML_ALERT_TWO_WAY_BY_SERVER = 206, - SML_ALERT_ONE_WAY_FROM_CLIENT_BY_SERVER = 207, - SML_ALERT_REFRESH_FROM_CLIENT_BY_SERVER = 208, - SML_ALERT_ONE_WAY_FROM_SERVER_BY_SERVER = 209, - SML_ALERT_REFRESH_FROM_SERVER_BY_SERVER = 210, - SML_ALERT_RESULT = 221, - SML_ALERT_NEXT_MESSAGE = 222, - SML_ALERT_NO_END_OF_DATA = 223 -} SmlAlertType; - -typedef enum { - SML_CHANGE_UNKNOWN = 0, - SML_CHANGE_ADD = 1, - SML_CHANGE_REPLACE = 2, - SML_CHANGE_DELETE = 3 -} SmlChangeType; - -typedef enum { SML_AUTH_TYPE_UNKNOWN = 0, SML_AUTH_TYPE_BASIC = 1, SML_AUTH_TYPE_MD5 = 2 Modified: trunk/libsyncml/sml_elements.c ============================================================================== --- trunk/libsyncml/sml_elements.c Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/sml_elements.c Thu Jul 16 12:19:18 2009 (r1205) @@ -19,14 +19,13 @@ * */ -#include "syncml.h" - -#include "syncml_internals.h" -#include "sml_parse_internals.h" #include "sml_elements_internals.h" -#include "sml_command_internals.h" +#include "sml_support.h" +#include "sml_parse.h" +#include "sml_command.h" #include "sml_error_internals.h" #include "data_sync_api/sml_location_internals.h" +#include <string.h> SmlAnchor* smlAnchorNew (const gchar *last, @@ -66,6 +65,54 @@ smlTrace(TRACE_EXIT, "%s", __func__); } +const gchar* +smlAnchorGetLast (SmlAnchor *anchor) +{ + return anchor->last; +} + +const gchar* +smlAnchorGetNext (SmlAnchor *anchor) +{ + return anchor->next; +} + +gsize +smlHeaderGetSessionID (SmlHeader *header) +{ + return header->sessionID; +} + +gsize +smlHeaderGetMessageID (SmlHeader *header) +{ + return header->messageID; +} + +SmlProtocolVersion +smlHeaderGetProtocolVersion (SmlHeader *header) +{ + return header->version; +} + +SmlProtocolType +smlHeaderGetProtocolType (SmlHeader *header) +{ + return header->protocol; +} + +SmlLocation* +smlHeaderGetSource (SmlHeader *header) +{ + return header->source; +} + +SmlLocation* +smlHeaderGetTarget (SmlHeader *header) +{ + return header->target; +} + void smlHeaderFree (SmlHeader *header) { @@ -342,6 +389,35 @@ item->raw = raw; } +void +smlItemSetMoreData (SmlItem *item, + gboolean enable) +{ + item->moreData = enable; +} + +gboolean +smlItemGetMoreData (SmlItem *item) +{ + return item->moreData; +} + +gboolean +smlItemSetContentType (SmlItem *item, + const gchar *ct, + GError **error) +{ + CHECK_ERROR_REF + item->contenttype = g_strdup(ct); + return TRUE; +} + +const gchar* +smlItemGetContentType (SmlItem *item) +{ + return item->contenttype; +} + SmlCred* smlCredNewFromString (const gchar *type, const gchar *format, @@ -492,6 +568,18 @@ smlTrace(TRACE_EXIT, "%s", __func__); } +const gchar* +smlCredGetUsername (SmlCred *cred) +{ + return cred->username; +} + +const gchar* +smlCredGetPassword (SmlCred *cred) +{ + return cred->password; +} + SmlChal* smlChalNew (SmlAuthType type, GError **error) Modified: trunk/libsyncml/sml_elements.h ============================================================================== --- trunk/libsyncml/sml_elements.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/sml_elements.h Thu Jul 16 12:19:18 2009 (r1205) @@ -30,14 +30,29 @@ #ifndef _SML_ELEMENTS_H_ #define _SML_ELEMENTS_H_ -SmlCred* smlCredNewFromString (const gchar *type, const gchar *format, const gchar *data, GError **error); -SmlCred* smlCredNewAuth (SmlAuthType type, const gchar *username, const gchar *password, GError **error); -SmlCred* smlCredNew (SmlAuthType type, SmlFormatType format, const gchar *data, const gchar *username, GError **error); -void smlCredRef (SmlCred *cred); -void smlCredUnref (SmlCred *cred); - -SmlAnchor* smlAnchorNew (const gchar *last, const gchar *next, GError **error); -void smlAnchorFree (SmlAnchor *anchor); +#include <glib.h> +#include "sml_defines.h" +#include <libsyncml/data_sync_api/sml_location.h> + +typedef struct SmlCred SmlCred; +typedef struct SmlAnchor SmlAnchor; +typedef struct SmlItem SmlItem; +typedef struct SmlHeader SmlHeader; +typedef struct SmlChal SmlChal; +typedef struct SmlMapItem SmlMapItem; + +SmlCred* smlCredNewFromString (const gchar *type, const gchar *format, const gchar *data, GError **error); +SmlCred* smlCredNewAuth (SmlAuthType type, const gchar *username, const gchar *password, GError **error); +SmlCred* smlCredNew (SmlAuthType type, SmlFormatType format, const gchar *data, const gchar *username, GError **error); +void smlCredRef (SmlCred *cred); +void smlCredUnref (SmlCred *cred); +const gchar* smlCredGetUsername (SmlCred *cred); +const gchar* smlCredGetPassword (SmlCred *cred); + +SmlAnchor* smlAnchorNew (const gchar *last, const gchar *next, GError **error); +const char* smlAnchorGetLast (SmlAnchor *anchor); +const char* smlAnchorGetNext (SmlAnchor *anchor); +void smlAnchorFree (SmlAnchor *anchor); SmlItem* smlItemNew (gsize size, GError **error); SmlItem* smlItemNewForData (const gchar *data, gsize size, GError **error); @@ -49,13 +64,24 @@ gboolean smlItemGetData (SmlItem *item, gchar **data, gsize *size, GError **error); gboolean smlItemStealData (SmlItem *item, gchar **data, gsize *size, GError **error); +void smlItemSetMoreData (SmlItem *item, gboolean enable); +gboolean smlItemGetMoreData (SmlItem *item); +gboolean smlItemSetContentType (SmlItem *item, const gchar *ct, GError **error); +const gchar* smlItemGetContentType (SmlItem *item); + void smlItemSetSource (SmlItem *item, SmlLocation *source); SmlLocation* smlItemGetSource (SmlItem *item); void smlItemSetTarget (SmlItem *item, SmlLocation *target); SmlLocation* smlItemGetTarget (SmlItem *item); void smlItemSetRaw (SmlItem *item, gboolean raw); -void smlHeaderFree(SmlHeader *header); +gsize smlHeaderGetSessionID (SmlHeader *header); +gsize smlHeaderGetMessageID (SmlHeader *header); +SmlProtocolVersion smlHeaderGetProtocolVersion (SmlHeader *header); +SmlProtocolType smlHeaderGetProtocolType (SmlHeader *header); +SmlLocation* smlHeaderGetSource (SmlHeader *header); +SmlLocation* smlHeaderGetTarget (SmlHeader *header); +void smlHeaderFree (SmlHeader *header); SmlChal* smlChalNew (SmlAuthType type, GError **error); SmlChal* smlChalNewFromBinary (SmlAuthType type, const gchar *nonce, gsize length, GError **error); Modified: trunk/libsyncml/sml_elements_internals.h ============================================================================== --- trunk/libsyncml/sml_elements_internals.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/sml_elements_internals.h Thu Jul 16 12:19:18 2009 (r1205) @@ -30,6 +30,7 @@ #ifndef _SML_ELEMENTS_INTERNALS_H_ #define _SML_ELEMENTS_INTERNALS_H_ +#include "sml_elements.h" #include <libxml/xmlreader.h> struct SmlAnchor { Modified: trunk/libsyncml/sml_error.c ============================================================================== --- trunk/libsyncml/sml_error.c Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/sml_error.c Thu Jul 16 12:19:18 2009 (r1205) @@ -19,9 +19,6 @@ * */ -#include "syncml.h" - -#include "syncml_internals.h" #include "sml_error_internals.h" /** Modified: trunk/libsyncml/sml_error_internals.h ============================================================================== --- trunk/libsyncml/sml_error_internals.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/sml_error_internals.h Thu Jul 16 12:19:18 2009 (r1205) @@ -22,7 +22,9 @@ #ifndef _SML_ERROR_INTERNALS_H_ #define _SML_ERROR_INTERNALS_H_ -#include "syncml_internals.h" +#include "sml_error.h" +#include "sml_support.h" +#include <string.h> #define CHECK_ERROR_REF \ smlAssertMsg(error, "The error handling of the function must be used."); \ Modified: trunk/libsyncml/sml_manager.c ============================================================================== --- trunk/libsyncml/sml_manager.c Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/sml_manager.c Thu Jul 16 12:19:18 2009 (r1205) @@ -19,15 +19,15 @@ * */ -#include "syncml.h" - -#include "syncml_internals.h" #include "sml_error_internals.h" #include "sml_manager_internals.h" -#include "sml_transport_internals.h" -#include "sml_command_internals.h" -#include "sml_elements_internals.h" -#include "sml_session_internals.h" +#include "sml_support.h" +#include <stdio.h> +#include <stdlib.h> +//#include "sml_transport_internals.h" +//#include "sml_command_internals.h" +//#include "sml_elements_internals.h" +//#include "sml_session_internals.h" typedef struct managerSession { SmlLink *link; @@ -230,14 +230,14 @@ break; case SML_TRANSPORT_EVENT_DATA: - parser = smlParserNew(data->type, 0, &locerror); + parser = smlParserNew(smlTransportDataGetType(data), 0, &locerror); if (!parser) goto error; /* add manager to parser for OMA DS 1.2 SAN handling */ smlParserSetManager(parser, manager); /* start to parse the data */ - if (!smlParserStart(parser, data->data, data->size, &locerror)) + if (!smlParserStart(parser, smlTransportDataGetData(data), smlTransportDataGetSize(data), &locerror)) goto error; /* Get the header of the message*/ @@ -247,7 +247,7 @@ goto error; /* Find the session if available otherwise register it as new */ - session = smlManagerSessionFind(manager, header->sessionID); + session = smlManagerSessionFind(manager, smlHeaderGetSessionID(header)); if (!session) { /* If we use the target and source from the header of the received message * then we MUST interchange source and target */ @@ -275,14 +275,18 @@ break; } if (!(session = smlSessionNew( - sessionType, data->type, - header->version, header->protocol, - header->source, header->target, - header->sessionID, 1, &locerror))) + sessionType, + smlTransportDataGetType(data), + smlHeaderGetProtocolVersion(header), + smlHeaderGetProtocolType(header), + smlHeaderGetSource(header), + smlHeaderGetTarget(header), + smlHeaderGetSessionID(header), + 1, &locerror))) goto error; if (link_) { - char *responseURI = smlTransportGetResponseURI(link_, session, &locerror); + char *responseURI = smlLinkGetResponseURI(link_, session, &locerror); if (!responseURI && locerror) goto error; if (responseURI) @@ -303,7 +307,7 @@ * SECURITY: this is important to avoid replay attacks */ if (link_) { - char *responseUri = smlTransportGetResponseURI(link_, session, &locerror); + char *responseUri = smlLinkGetResponseURI(link_, session, &locerror); if (!responseUri && locerror) { goto error; } @@ -625,8 +629,8 @@ * 2.2. this is an active server connection */ GError *error = NULL; - if (manager->transport->connected && - (!sess->link || sess->link->link_data) && + if (smlTransportIsConnected(manager->transport) && + (!sess->link || smlLinkIsConnected(sess->link)) && !smlTransportDisconnect(manager->transport, sess->link, &error)) { g_warning("Errors from the transport layer " \ "cannot be handled while freeing the manager. %s", @@ -1132,9 +1136,10 @@ SmlObject *object = smlManagerObjectFindInternal( manager, session, - cmd->type, - cmd->target, cmd->source, - cmd->private.alert.contentType); + smlCommandGetType(cmd), + smlCommandGetTarget(cmd), + smlCommandGetSource(cmd), + smlCommandGetContentType(cmd)); smlTrace(TRACE_EXIT, "%s(%p)", __func__, object); return object; } @@ -1237,13 +1242,15 @@ CHECK_ERROR_REF if (manager->headerCallback && - session->sessionType == SML_SESSION_TYPE_SERVER) { + smlSessionGetType(session) == SML_SESSION_TYPE_SERVER) { /* Authentication is only specified for OMA DS server. */ manager->headerCallback(session, header, cred, manager->headerCallbackUserdata); } else { smlTrace(TRACE_INTERNAL, "%s: Header not handled!", __func__); - if (session->sessionType == SML_SESSION_TYPE_SERVER && - !session->established) { + smlTrace(TRACE_INTERNAL, "%s: type %d", __func__, smlSessionGetType(session)); + smlTrace(TRACE_INTERNAL, "%s: established %d", __func__, smlSessionGetEstablished(session)); + if (smlSessionGetType(session) == SML_SESSION_TYPE_SERVER && + !smlSessionGetEstablished(session)) { /* An OMA DS server must handle the header for security * reasons - especially authentication. * @@ -1253,15 +1260,16 @@ "The header callback is missing. " \ "All requests will be accepted without authentication.", __func__); - session->established = TRUE; + smlSessionSetEstablished(session, TRUE); smlSessionDispatchEvent( session, SML_SESSION_EVENT_ESTABLISHED, NULL, NULL, NULL, NULL); } SmlStatus *status = smlStatusNew( SML_NO_ERROR, 0, - header->messageID, - header->source, header->target, + smlHeaderGetMessageID(header), + smlHeaderGetSource(header), + smlHeaderGetTarget(header), SML_COMMAND_TYPE_HEADER, error); if (!status) goto error; @@ -1351,18 +1359,18 @@ object->commandCallback(session, cmd, object->commandCallbackUserdata); } else { - const char *type = smlCommandTypeToString(cmd->type, error); + const char *type = smlCommandTypeToString(smlCommandGetType(cmd), error); /* If the type is unknown then this can be part of the error. */ if (*error) { g_error_free(*error); *error = NULL; } const char *srcuri = NULL; - if (cmd->source) - srcuri = sml_location_get_uri(cmd->source); + if (smlCommandGetSource(cmd)) + srcuri = sml_location_get_uri(smlCommandGetSource(cmd)); const char *dsturi = NULL; - if (cmd->target) - dsturi = sml_location_get_uri(cmd->target); + if (smlCommandGetTarget(cmd)) + dsturi = sml_location_get_uri(smlCommandGetTarget(cmd)); g_set_error(error, SML_ERROR, SML_ERROR_NOT_FOUND, "Unable to find command handler (%s: %s -> %s)", (type) ? type : "UNKNOWN", VA_STRING(srcuri), VA_STRING(dsturi)); GError *locerror = NULL; Modified: trunk/libsyncml/sml_manager.h ============================================================================== --- trunk/libsyncml/sml_manager.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/sml_manager.h Thu Jul 16 12:19:18 2009 (r1205) @@ -30,6 +30,9 @@ #ifndef _SML_MANAGER_H #define _SML_MANAGER_H +typedef struct SmlManager SmlManager; +typedef struct SmlObject SmlObject; + typedef enum { SML_MANAGER_CONNECT_DONE, SML_MANAGER_DISCONNECT_DONE, @@ -43,10 +46,15 @@ SML_MANAGER_SESSION_ESTABLISHED } SmlManagerEventType; +/* Always include header files after typedefs. */ + +#include "sml_session.h" + +/* Always include callbacks after the inclusion of the header files. */ + typedef void (* SmlManagerEventCb) (SmlManager *manager, SmlManagerEventType type, SmlSession *session, GError *error, void *userdata); typedef void (* SmlCommandCb) (SmlSession *session, SmlCommand *cmd, void *userdata); typedef void (* SmlHeaderCb) (SmlSession *session, SmlHeader *header, SmlCred *cred, void *userdata); -typedef void (* SmlStatusReplyCb) (SmlSession *session, SmlStatus *status, void *userdata); SmlManager* smlManagerNew (SmlTransport *tsp, GError **error); void smlManagerFree (SmlManager *manager); @@ -79,6 +87,8 @@ gsize smlManagerGetNewSessionID (SmlManager *manager); +SmlTransport* smlManagerGetTransport (SmlManager *manager); + #endif //_SML_MANAGER_H /*@}*/ Modified: trunk/libsyncml/sml_manager_internals.h ============================================================================== --- trunk/libsyncml/sml_manager_internals.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/sml_manager_internals.h Thu Jul 16 12:19:18 2009 (r1205) @@ -30,6 +30,8 @@ #ifndef _SML_MANAGER_INTERNALS_H #define _SML_MANAGER_INTERNALS_H +#include "sml_manager.h" +#include "sml_thread.h" #include "sml_queue_internals.h" struct SmlManager { Modified: trunk/libsyncml/sml_md5.c ============================================================================== --- trunk/libsyncml/sml_md5.c Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/sml_md5.c Thu Jul 16 12:19:18 2009 (r1205) @@ -8,13 +8,15 @@ * */ -#include "syncml.h" -#include "syncml_internals.h" +#include "sml_md5.h" + #include "sml_error_internals.h" +#include "sml_support.h" #include <string.h> #include <stdint.h> -#include "sml_md5.h" +#include <stdio.h> +#include <stdlib.h> #include <glib.h> typedef struct SmlMD5Context { Modified: trunk/libsyncml/sml_md5.h ============================================================================== --- trunk/libsyncml/sml_md5.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/sml_md5.h Thu Jul 16 12:19:18 2009 (r1205) @@ -30,6 +30,8 @@ #ifndef _SML_MD5_H_ #define _SML_MD5_H_ +#include <glib.h> + void smlMD5GetDigest (const gchar *buffer, gsize buffer_size, guchar digest[16]); gchar* smlMD5ToString (guchar digest[16], GError **error); Modified: trunk/libsyncml/sml_notification.c ============================================================================== --- trunk/libsyncml/sml_notification.c Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/sml_notification.c Thu Jul 16 12:19:18 2009 (r1205) @@ -19,17 +19,21 @@ * */ -#include "syncml.h" - -#include "syncml_internals.h" #include "sml_notification_internals.h" -#include "sml_transport_internals.h" -#include "sml_command_internals.h" -#include "sml_manager_internals.h" + +#include "sml_support.h" + +#include "string.h" +#include "sml_transport.h" +//#include "sml_command_internals.h" +//#include "sml_manager_internals.h" #include "sml_error_internals.h" -#include "objects/sml_auth_internals.h" -#include "sml_elements_internals.h" +//#include "objects/sml_auth_internals.h" +//#include "sml_elements_internals.h" #include "data_sync_api/sml_location_internals.h" +#include <stdlib.h> +#include <stdio.h> + SmlNotification* smlNotificationNew (SmlNotificationVersion version, @@ -192,7 +196,7 @@ goto error; } - unsigned int idLength = (uint8_t)data[23]; + guint8 idLength = (guint8) data[23]; if (size < (25 + idLength)) { g_set_error(error, SML_ERROR, SML_ERROR_GENERIC, "Size too small2"); goto error; @@ -204,8 +208,8 @@ san->type = SML_MIMETYPE_SAN; /* Version */ - unsigned int version = ((uint8_t)data[16]) << 2; - version = version | ((uint8_t)data[17]) >> 6; + guint8 version = ((guint8)data[16]) << 2; + version = version | ((guint8)data[17]) >> 6; switch (version) { case 12: san->version = SML_SAN_VERSION_12; @@ -216,14 +220,14 @@ } /* ui mode */ - san->mode = (((uint8_t)data[17]) & 0x30) >> 4; + san->mode = (((guint8)data[17]) & 0x30) >> 4; /* initiator */ - san->init = (((uint8_t)data[17]) & 0x08) >> 3; + san->init = (((guint8)data[17]) & 0x08) >> 3; /* session id */ - san->sessionID = ((uint8_t)data[21]) << 8; - san->sessionID = san->sessionID | (uint8_t)data[22]; + san->sessionID = ((guint8)data[21]) << 8; + san->sessionID = san->sessionID | (guint8)data[22]; /* server identifier */ if (idLength) { @@ -235,9 +239,9 @@ memcpy(san->identifier, data + 24, idLength); } - unsigned int numSync = ((uint8_t)data[24 + idLength]) >> 4; + guint8 numSync = ((guint8)data[24 + idLength]) >> 4; data += 25 + idLength; - unsigned int alertLength = 25 + idLength; + guint8 alertLength = 25 + idLength; unsigned int i = 0; for (i = 0; i < numSync; i++) { @@ -246,7 +250,7 @@ goto error; } - idLength = (uint8_t)data[4]; + idLength = (guint8)data[4]; if (size < (alertLength + 5 + idLength)) { g_set_error(error, SML_ERROR, SML_ERROR_GENERIC, "Size too small4"); goto error; @@ -254,15 +258,15 @@ alertLength = alertLength + 5 + idLength; /* Alert type + future */ - SmlAlertType alert_type = (((uint8_t)data[0]) >> 4) + 200; + SmlAlertType alert_type = (((guint8)data[0]) >> 4) + 200; if (alert_type < 206 || alert_type > 210) { g_set_error(error, SML_ERROR, SML_ERROR_GENERIC, "Wrong alert type"); goto error; } - unsigned int contenttype = ((uint8_t)data[1]) << 16; - contenttype = contenttype | ((uint8_t)data[2]) << 8; - contenttype = contenttype | ((uint8_t)data[3]); + guint32 contenttype = ((guint8)data[1]) << 16; + contenttype = contenttype | ((guint8)data[2]) << 8; + contenttype = contenttype | ((guint8)data[3]); /* The contenttype */ const char *alert_ct; @@ -409,7 +413,7 @@ goto error; } - cmd->cmdID = i; + smlCommandSetID(cmd, i); i++; if (!smlAssemblerStartCommand(assm, NULL, cmd, error) == SML_ASSEMBLER_RESULT_OK) @@ -569,8 +573,8 @@ const char *username = ""; const char *password = ""; if (san->cred) { - username = san->cred->username; - password = san->cred->password; + username = smlCredGetUsername(san->cred); + password = smlCredGetPassword(san->cred); } char *auth = g_strdup_printf("%s:%s", username, password); smlMD5GetDigest (auth, strlen(auth), digest); @@ -659,7 +663,7 @@ SyncML message type (xml/wbxml) for GET. To avoid that we response after the PUT with a GET SML_MIMETYPE_SAN request. */ if (san->version == SML_SAN_VERSION_12) - tspdata->type_get = san->type; + smlTransportDataSetRequestedType(tspdata, san->type); if (!smlTransportSend(tsp, NULL, tspdata, error)) goto error; Modified: trunk/libsyncml/sml_notification.h ============================================================================== --- trunk/libsyncml/sml_notification.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/sml_notification.h Thu Jul 16 12:19:18 2009 (r1205) @@ -30,6 +30,13 @@ #ifndef _SML_NOTIFICATION_H_ #define _SML_NOTIFICATION_H_ +#include "sml_elements.h" +#include "sml_manager.h" +#include "sml_transport.h" + +typedef struct SmlNotification SmlNotification; +typedef struct SmlSanAlert SmlSanAlert; + typedef enum { SML_SAN_VERSION_UNKNOWN = 0, SML_SAN_VERSION_10 = 1, Modified: trunk/libsyncml/sml_notification_internals.h ============================================================================== --- trunk/libsyncml/sml_notification_internals.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/sml_notification_internals.h Thu Jul 16 12:19:18 2009 (r1205) @@ -30,6 +30,8 @@ #ifndef _SML_NOTIFICATION_INTERNALS_H_ #define _SML_NOTIFICATION_INTERNALS_H_ +#include "sml_notification.h" + struct SmlNotification { SmlNotificationVersion version; SmlNotificationUIMode mode; Modified: trunk/libsyncml/sml_parse.c ============================================================================== --- trunk/libsyncml/sml_parse.c Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/sml_parse.c Thu Jul 16 12:19:18 2009 (r1205) @@ -19,10 +19,10 @@ * */ -#include "syncml.h" +#include <config.h> -#include "syncml_internals.h" #include "sml_error_internals.h" +#include "sml_support.h" #include "sml_parse_internals.h" #include "sml_command_internals.h" #include "sml_elements_internals.h" @@ -573,11 +573,11 @@ * * This command tries to add the given command to the assembler without the * item data. Then it returns how big the item data could be without violating - * the limits. If there is not limit set, -1 is returned. This command only + * the limits. If there is not limit set, 0 is returned. This command only * makes sense for change commands */ gboolean smlAssemblerGetSpace (SmlAssembler *assm, - gsize *space, + gssize *space, SmlCommand *parent, SmlCommand *cmd, GError **error) @@ -592,7 +592,7 @@ smlAssert(cmd->type == SML_COMMAND_TYPE_ADD || cmd->type == SML_COMMAND_TYPE_REPLACE); unsigned int parentID = 0; - int limit = smlAssemblerGetRemoteMaxMsgSize(assm); + gsize limit = smlAssemblerGetRemoteMaxMsgSize(assm); if (!limit) { *space = -1; smlTrace(TRACE_EXIT, "%s: No limit", __func__); @@ -721,10 +721,10 @@ goto error; /* Lets see if the new buffer is small enough */ - int limit = smlAssemblerGetRemoteMaxMsgSize(assm); + gsize limit = smlAssemblerGetRemoteMaxMsgSize(assm); if (limit) { /* Now check the size */ - int size = 0; + gsize size = 0; if (!(size = smlAssemblerCheckSize(assm, FALSE, error))) goto error; @@ -904,10 +904,10 @@ if (!force) { /* Lets see if the new buffer is small enough */ - int limit = smlAssemblerGetRemoteMaxMsgSize(assm); + gsize limit = smlAssemblerGetRemoteMaxMsgSize(assm); if (limit) { /* Now check the size */ - int size = 0; + gsize size = 0; if (!(size = smlAssemblerCheckSize(assm, FALSE, error))) goto error; Modified: trunk/libsyncml/sml_parse.h ============================================================================== --- trunk/libsyncml/sml_parse.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/sml_parse.h Thu Jul 16 12:19:18 2009 (r1205) @@ -22,6 +22,11 @@ #ifndef _SML_PARSE_H_ #define _SML_PARSE_H_ +typedef struct SmlParser SmlParser; +typedef struct SmlAssembler SmlAssembler; + +#include "sml_manager.h" + typedef enum { SML_PARSER_RESULT_ERROR = 0, SML_PARSER_RESULT_OPEN = 1, @@ -115,7 +120,7 @@ gsize smlAssemblerSetRemoteMaxMsgSize (SmlAssembler *assm, gsize limit); gsize smlAssemblerGetRemoteMaxMsgSize (SmlAssembler *assm); -gboolean smlAssemblerGetSpace (SmlAssembler *assm, gsize *space, SmlCommand *parent, SmlCommand *cmd, GError **error); +gboolean smlAssemblerGetSpace (SmlAssembler *assm, gssize *space, SmlCommand *parent, SmlCommand *cmd, GError **error); gsize smlAssemblerGetRemoteMaxObjSize (SmlAssembler *assm); gsize smlAssemblerSetRemoteMaxObjSize (SmlAssembler *assm, gsize limit); Modified: trunk/libsyncml/sml_parse_internals.h ============================================================================== --- trunk/libsyncml/sml_parse_internals.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/sml_parse_internals.h Thu Jul 16 12:19:18 2009 (r1205) @@ -22,6 +22,8 @@ #ifndef _SML_PARSE_INTERNALS_H_ #define _SML_PARSE_INTERNALS_H_ +#include "sml_parse.h" + struct SmlParser { SmlParserFunctions functions; void *parser_userdata; Modified: trunk/libsyncml/sml_queue.c ============================================================================== --- trunk/libsyncml/sml_queue.c Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/sml_queue.c Thu Jul 16 12:19:18 2009 (r1205) @@ -19,12 +19,14 @@ * */ -#include "syncml.h" -#include "syncml_internals.h" +#include "sml_support.h" #include "sml_queue_internals.h" #include "sml_error_internals.h" +#include <stdio.h> +#include <stdlib.h> + #ifndef DOXYGEN_SHOULD_SKIP_THIS static gboolean Modified: trunk/libsyncml/sml_queue_internals.h ============================================================================== --- trunk/libsyncml/sml_queue_internals.h Mon Jul 13 18:16:09 2009 (r1204) +++ trunk/libsyncml/sml_queue_internals.h Thu Jul 16 12:19:18 2009 (r1205) @@ -30,6 +30,8 @@ #ifndef _SML_QUEUE_INTERNALS_H_ #define _SML_QUEUE_INTERNALS_H_ +#include <glib.h> + typedef void (*SmlQueueHandler)(void *message, void *userdata); /*! @brief Represents a Queue which can be used to receive messages Modified: trunk/libsyncml/sml_session.c... [truncated message content] |
From: <svn...@op...> - 2009-07-15 19:49:52
|
Author: scriptor Date: Wed Jul 15 21:49:32 2009 New Revision: 5702 URL: http://www.opensync.org/changeset/5702 Log: Fixed a type error. Modified: plugins/ldap-sync/src/ldap_plugin.c Modified: plugins/ldap-sync/src/ldap_plugin.c ============================================================================== --- plugins/ldap-sync/src/ldap_plugin.c Wed Jul 15 21:48:39 2009 (r5701) +++ plugins/ldap-sync/src/ldap_plugin.c Wed Jul 15 21:49:32 2009 (r5702) @@ -1280,7 +1280,7 @@ glist_container *to_be_reported = NULL; OSyncHashTable *hashtable = NULL; - osync_trace(TRACE_ENTRY, "%s(%p, %p, %i, %p, %p, %p)", __func__, ctx, sinkenv, slow_sync_requested, changetype_from_caller, list_to_be_reported, error); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %i, %i, %p, %p)", __func__, ctx, sinkenv, slow_sync_requested, changetype_from_caller, list_to_be_reported, error); if (ctx == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ctx = NULL.", __FILE__, __LINE__); |
From: <svn...@op...> - 2009-07-15 19:48:50
|
Author: scriptor Date: Wed Jul 15 21:48:39 2009 New Revision: 5701 URL: http://www.opensync.org/changeset/5701 Log: I have added further search paths specific to 64-bit-systems. Modified: branches/3rd-party-cmake-modules/modules/FindLibGCrypt.cmake branches/3rd-party-cmake-modules/modules/FindLibGSSAPIV2.cmake branches/3rd-party-cmake-modules/modules/FindLibLdap.cmake Modified: branches/3rd-party-cmake-modules/modules/FindLibGCrypt.cmake ============================================================================== --- branches/3rd-party-cmake-modules/modules/FindLibGCrypt.cmake Fri Jul 10 11:08:34 2009 (r5700) +++ branches/3rd-party-cmake-modules/modules/FindLibGCrypt.cmake Wed Jul 15 21:48:39 2009 (r5701) @@ -19,7 +19,7 @@ DOC "Try and find the header file gcrypt.h") FIND_LIBRARY(GCRYPT_LIBRARY NAMES gcrypt - PATHS /usr/lib /lib /usr/local/lib /usr/share/lib /opt/lib /opt/share/lib /var/lib + PATHS /usr/lib /lib /usr/local/lib /usr/share/lib /opt/lib /opt/share/lib /var/lib /usr/lib64 /lib64 /usr/local/lib64 /usr/share/lib64 /opt/lib64 /opt/share/lib64 /var/lib64 DOC "Try and find libgcrypt") IF (GCRYPT_INCLUDE_DIR AND GCRYPT_LIBRARY) Modified: branches/3rd-party-cmake-modules/modules/FindLibGSSAPIV2.cmake ============================================================================== --- branches/3rd-party-cmake-modules/modules/FindLibGSSAPIV2.cmake Fri Jul 10 11:08:34 2009 (r5700) +++ branches/3rd-party-cmake-modules/modules/FindLibGSSAPIV2.cmake Wed Jul 15 21:48:39 2009 (r5701) @@ -17,7 +17,7 @@ # No header files required for the ldap plugin. FIND_LIBRARY(GSSAPIV2_LIBRARY NAMES gssapiv2 - PATHS /usr/lib /lib /usr/local/lib /usr/share/lib /opt/lib /opt/share/lib /var/lib /usr/lib/sasl2 /lib/sasl2 /usr/local/lib/sasl2 /usr/share/lib/sasl2 /opt/lib/sasl2 /opt/share/lib/sasl2 /var/lib/sasl2 + PATHS /usr/lib /lib /usr/local/lib /usr/share/lib /opt/lib /opt/share/lib /var/lib /usr/lib/sasl2 /lib/sasl2 /usr/local/lib/sasl2 /usr/share/lib/sasl2 /opt/lib/sasl2 /opt/share/lib/sasl2 /var/lib/sasl2 /usr/lib64 /lib64 /usr/local/lib64 /usr/share/lib64 /opt/lib64 /opt/share/lib64 /var/lib64 /usr/lib64/sasl2 /lib64/sasl2 /usr/local/lib64/sasl2 /usr/share/lib64/sasl2 /opt/lib64/sasl2 /opt/share/lib64/sasl2 /var/lib64/sasl2 DOC "Try and find libgssapiv2") IF (GSSAPIV2_LIBRARY) Modified: branches/3rd-party-cmake-modules/modules/FindLibLdap.cmake ============================================================================== --- branches/3rd-party-cmake-modules/modules/FindLibLdap.cmake Fri Jul 10 11:08:34 2009 (r5700) +++ branches/3rd-party-cmake-modules/modules/FindLibLdap.cmake Wed Jul 15 21:48:39 2009 (r5701) @@ -21,7 +21,7 @@ DOC "Try and find the header file ldap.h") FIND_LIBRARY(LDAP_LIBRARY NAMES ldap - PATHS /usr/lib /lib /usr/local/lib /usr/share/lib /opt/lib /opt/share/lib /var/lib + PATHS /usr/lib /lib /usr/local/lib /usr/share/lib /opt/lib /opt/share/lib /var/lib /usr/lib64 /lib64 /usr/local/lib64 /usr/share/lib64 /opt/lib64 /opt/share/lib64 /var/lib64 DOC "Try and find libldap") IF (LDAP_INCLUDE_DIR AND LDAP_LIBRARY) |
From: <svn...@op...> - 2009-07-13 16:16:19
|
Author: bellmich Date: Mon Jul 13 18:16:09 2009 New Revision: 1204 URL: http://libsyncml.opensync.org/changeset/1204 Log: more robust error setting Modified: trunk/libsyncml/sml_error_internals.h Modified: trunk/libsyncml/sml_error_internals.h ============================================================================== --- trunk/libsyncml/sml_error_internals.h Mon Jul 13 17:41:49 2009 (r1203) +++ trunk/libsyncml/sml_error_internals.h Mon Jul 13 18:16:09 2009 (r1204) @@ -34,10 +34,13 @@ gchar *__sml_error_string = NULL; \ if (format) \ __sml_error_string = g_strdup_printf(format, ##__VA_ARGS__); \ + const gchar *msg = smlErrorTypeGetMessage(type); \ + if (!msg) \ + msg = "There is no error."; \ if (__sml_error_string && strlen(__sml_error_string)) \ - g_set_error(error, SML_ERROR, type, "%s %s", smlErrorTypeGetMessage(type), __sml_error_string); \ + g_set_error(error, SML_ERROR, type, "%s %s", msg, __sml_error_string); \ else \ - g_set_error(error, SML_ERROR, type, "Error %d: %s", type, smlErrorTypeGetMessage(type)); \ + g_set_error(error, SML_ERROR, type, "Error %d: %s", type, msg); \ g_free(__sml_error_string);\ } |