Hello,

The patch adds support for sending binary syncsettings documents as
described on the Nokia/SonyEriccsson OTA Specification 7. This allows
the remote configuration of syncml settings. OTA syncsettings are
primarily supported by SonyEriccsson phones.

A new ota type, 'syncsettings', is enabled. Changes to ota_prov.c send
fixed udh and wsp headers as required by the OTA Spec. 

In ota_compiler.c the function 'parse_ota_syncsettings' is called only
when parsing a syncsettings xml and skips the other parsing functions
in 'parse_element'. 

Included also in the patch is a small addition to the user guide
explaining 'oma-settings' and 'syncsettings' support on the cgi interface.

Regards,
saude
Index: gw/ota_compiler.c
===================================================================
RCS file: /home/cvs/gateway/gw/ota_compiler.c,v
retrieving revision 1.8
diff -u -r1.8 ota_compiler.c
--- gw/ota_compiler.c	4 Feb 2006 14:36:22 -0000	1.8
+++ gw/ota_compiler.c	11 Sep 2006 15:26:30 -0000
@@ -122,6 +122,7 @@
  */
 
 static ota_2table_t ota_elements[] = {
+    { "SYNCSETTINGS", 0x15 },
     { "WAP-PROVISIONINGDOC", 0x05 },
     { "CHARACTERISTIC-LIST", 0x05 },
     { "CHARACTERISTIC", 0x06 },
@@ -131,6 +132,34 @@
 #define NUMBER_OF_ELEMENTS sizeof(ota_elements)/sizeof(ota_elements[0])
 
 /*
+ * SYNCSETTINGS tags are defined in OTA specs 7.0, chapter 11.1
+ */
+
+static ota_2table_t ota_syncsettings_elements[] = {
+    { "Version", 0x58 },
+    { "HostAddr", 0x50 },
+    { "Port", 0x52 },
+    { "RemoteDB", 0x54 },
+    { "CTType", 0x4E },
+    { "CTVer", 0x4F },
+    { "URI", 0x56 },
+    { "Name", 0x51 },
+    { "Auth", 0x47 },
+    { "AuthLevel", 0x48 },
+    { "AuthScheme", 0x49 },
+    { "Username", 0x57 },
+    { "Cred", 0x4D },
+    { "ConRef", 0x4B },
+    { "ConType", 0x4E },
+    { "Bearer", 0x4A },
+    { "AddrType", 0x46 },
+    { "Addr", 0x45 },
+    { "RefID", 0x53 }
+};
+
+#define NUMBER_OF_SYNCSETTINGS_ELEMENTS sizeof(ota_syncsettings_elements)/sizeof(ota_syncsettings_elements[0])
+
+/*
  * Attribute names and values from code page zero. These are defined in ota,
  * chapter 8.2. Some values are presented as inline strings; in this case 
  * value "INLINE" is used. (Note a quirk: there is an attribute with name 
@@ -523,6 +552,70 @@
 }
 
 /*
+ * Parse only valid syncsettings tags. Output element tags as binary
+ *  tokens. If the element has CDATA content, output it.
+ * Returns:      1, add an end tag (element node has no children)
+ *               0, do not add an end tag (it has children)
+ *              -1, an error occurred
+ */
+static int parse_ota_syncsettings(xmlNodePtr node, simple_binary_t **otabxml)
+{
+    xmlNodePtr childNode;
+    Octstr *name, *content;
+    unsigned char status_bits, ota_hex;
+    int add_end_tag;
+    size_t i;
+
+    name = NULL;
+    content = NULL;
+    name = octstr_create(node->name);
+    if (octstr_len(name) == 0) {
+        goto error;
+    }
+
+    i = 0;
+    while (i < NUMBER_OF_SYNCSETTINGS_ELEMENTS) {
+        if (octstr_case_compare(name, octstr_imm(ota_syncsettings_elements[i].name)) == 0)
+            break;
+        ++i;
+    }
+
+    if (i == NUMBER_OF_SYNCSETTINGS_ELEMENTS) {
+        goto error;
+    }
+
+    ota_hex = ota_syncsettings_elements[i].token;
+    output_char(ota_syncsettings_elements[i].token, otabxml);
+
+    /* if the node has CDATA content output it. 
+     * Else expect child tags */
+    if (!only_blanks(node->children->content)) {
+        content = octstr_create(node->children->content);
+        parse_inline_string(content, otabxml);
+    }
+
+    add_end_tag = 0;
+    if ((status_bits = element_check_content(node)) > 0) {
+        ota_hex = ota_hex | status_bits;
+        /* If this node has children, the end tag must be added after them. */
+        if ((status_bits & WBXML_CONTENT_BIT) == WBXML_CONTENT_BIT) {
+            add_end_tag = 1;
+        }
+    }
+
+    octstr_destroy(content);
+    octstr_destroy(name);
+    return add_end_tag;
+
+    error:
+        warning(0, "OTA compiler: Unknown tag '%s' in OTA SyncSettings source",
+                octstr_get_cstr(name));
+        octstr_destroy(content);
+        octstr_destroy(name);
+        return -1;
+}
+
+/*
  * Parse an element node. Check if there is a token for an element tag; if not
  * output the element as a string, else output the token. After that, call 
  * attribute parsing functions
@@ -535,9 +628,19 @@
     Octstr *name;
     size_t i;
     unsigned char status_bits, ota_hex;
-    int add_end_tag;
+    int add_end_tag, syncstat;
     xmlAttrPtr attribute;
 
+    /* if compiling a syncsettings document there's no need to
+       continue with the parsing of ota or oma tags. */
+    syncstat = -1;
+    if (octstr_search_char((**otabxml).binary, 0x55, 0) == 0) {
+        syncstat = parse_ota_syncsettings(node, otabxml);
+        if (syncstat >= 0) {
+            return syncstat;
+        }
+    }
+
     name = octstr_create(node->name);
     if (octstr_len(name) == 0) {
         octstr_destroy(name);
Index: gw/ota_prov.c
===================================================================
RCS file: /home/cvs/gateway/gw/ota_prov.c,v
retrieving revision 1.12
diff -u -r1.12 ota_prov.c
--- gw/ota_prov.c	7 Apr 2006 12:33:37 -0000	1.12
+++ gw/ota_prov.c	11 Sep 2006 15:26:31 -0000
@@ -101,7 +101,9 @@
     (*msg)->sms.udhdata = octstr_create("");
     if (octstr_case_compare(doc_type, octstr_imm("oma-settings")) == 0) 
         octstr_append_from_hex((*msg)->sms.udhdata, "0605040B840B84");    
-    else 
+    else if (octstr_case_compare(doc_type, octstr_imm("syncsettings")) == 0) {
+        octstr_append_from_hex((*msg)->sms.udhdata, "060504C34CC002");
+    } else 
         octstr_append_from_hex((*msg)->sms.udhdata, "060504C34FC002");    
  }
 
@@ -135,6 +137,10 @@
         /* charset UTF-8 */
         octstr_append_from_hex((*msg)->sms.msgdata, "81EA");
 
+    } else if (octstr_case_compare(mime_type, octstr_imm("syncsettings")) == 0) {
+
+        octstr_append_from_hex((*msg)->sms.msgdata, "3406060502020b81EA"); 
+
     } else if (octstr_case_compare(mime_type, octstr_imm("oma-settings")) == 0) {
         Octstr *hdr = octstr_create(""), *mac; 
         unsigned char *p;
Index: doc/userguide/userguide.xml
===================================================================
RCS file: /home/cvs/gateway/doc/userguide/userguide.xml,v
retrieving revision 1.319
diff -u -r1.319 userguide.xml
--- doc/userguide/userguide.xml	28 Aug 2006 12:06:14 -0000	1.319
+++ doc/userguide/userguide.xml	11 Sep 2006 15:27:31 -0000
@@ -7200,29 +7200,7 @@
 		 be compiled to as OTA message.</para>
 
 <sect3>
-<title>GET method for the OTA HTTP interface</title>
-														  
-		 <para>An example URL (OTA configuration defined in the Kannel 
-		 configuration file):
-	
-	<screen><userinput>
-	http://smsbox.host.name:13013/cgi-bin/sendota?
-	    otaid=myconfig&amp;username=foo&amp;password=bar&amp;to=0123456
-	</userinput></screen>
-
-       URL containing XML document looks like this (you must URL encode it before sending
-       it over HTTP): 
-
-	<screen><userinput>
-	http://smsbox.host.name:13013/cgi-bin/sendota?
-	    username=foo&amp;password=bar&amp;to=0123456&amp;
-	    text=MyURLEncodedXMLdocument&amp;type=settings
-	</userinput></screen>
-       
-       You can send either settings or bookmark, set CGI variable type accordingly. 
-       Default for this variable is settings. 
-       </para>
-
+<title>OTA settings and bookmark documents</title>
 
        <para>
        Here is an example XML document (this one contains CSD settings for logging
@@ -7268,10 +7246,88 @@
 &#60;/CHARACTERISTIC-LIST&#62;
 </programlisting>
 
-       Document type definition (DTD) for these documents is not available ,
-       from Internet, you must supply it as a file. Kannel gw directory contains 
-       an example, <literal>settings.dtd</literal>.
+       Document type definition (DTD) for these documents is not
+       available from Internet, you must supply it as a file. Kannel
+       gw directory contains an
+       example, <literal>settings.dtd</literal>.
+
+       </para>
+</sect3>
+
+<sect3>
+<title>OTA syncsettings documents</title>
+
+	<para>Used for the provisioning of sync configuration to
+	  SyncMl enabled handsets. Best supported by sonyericcsson
+	  terminals.
+	</para>
+
+	<para>Sample syncsettings documents to set contacts, connection data
+	  and authentication:
+
+<programlisting>
+&#60;SyncSettings&#62;
+&#60;Version&#62;1.0&#60;/Version&#62;
+&#60;HostAddr&#62;http://syncml.server.com&#60;/HostAddr&#62;
+&#60;RemoteDB&#62;
+  &#60;CTType&#62;text/x-vcard&#60;/CTType&#62;
+  &#60;CTVer&#62;2.1&#60;/CTVer&#62;
+  &#60;URI&#62;contact&#60;/URI&#62;
+  &#60;Name&#62;Address Book&#60;/Name&#62;
+&#60;/RemoteDB&#62;
+&#60;Name&#62;Synchonization&#60;/Name&#62;
+&#60;Auth&#62;
+  &#60;AuthLevel&#62;1&#60;/AuthLevel&#62;
+  &#60;AuthScheme&#62;1&#60;/AuthScheme&#62;
+  &#60;Username&#62;yourusername&#60;/Username&#62;
+  &#60;Cred&#62;passwordbase64encoded&#60;/Cred&#62;
+&#60;/Auth&#62;
+&#60;/SyncSettings&#62;
+</programlisting>
+
+</para>
+
+</sect3>
+
+<sect3>
+<title>OMA provisioning content</title>
+
+	<para>OMA provisioning allows the configuration of a wider
+	  range of settings than previously available in OTA
+	  terminals. Refer to OMA-WAP-ProvCont-v1_1-20021112-C (at
+	  http://www.openmobilealliance.org/tech/docs/) for details.
+	</para>
+
+	<para>A shared secret (i.e. a pin or the phone IMSI) can be
+	  used to authenticate the settings. Defaults are 'userpin'
+	  and '1234' a. See the cgi variables 'sec' and 'pin' for
+	  available authentication options.
+	</para>
+
+</sect3>
+<sect3>
+<title>GET method for the OTA HTTP interface</title>
+														  
+		 <para>An example URL (OTA configuration defined in the Kannel 
+		 configuration file):
+	
+	<screen><userinput>
+	http://smsbox.host.name:13013/cgi-bin/sendota?
+	    otaid=myconfig&amp;username=foo&amp;password=bar&amp;to=0123456
+	</userinput></screen>
 
+       URL containing XML document looks like this (you must URL encode it before sending
+       it over HTTP): 
+
+	<screen><userinput>
+	http://smsbox.host.name:13013/cgi-bin/sendota?
+	    username=foo&amp;password=bar&amp;to=0123456&amp;
+	    text=MyURLEncodedXMLdocument&amp;type=settings
+	</userinput></screen>
+       
+       You can send either settings, bookmark, syncsettings, or
+       oma-settings, set CGI variable type accordingly.  Default for
+       this variable is settings.
        </para>
 
  <table frame="none">
@@ -7338,8 +7394,21 @@
    <row><entry><literal>type</literal></entry>
    <entry><literal>string</literal></entry>
    <entry valign="bottom">
-       Type of the XML document, either "settings" or "bookmarks". Default is 
-       "settings".
+       Type of the XML document, supported values are "settings",
+       "bookmarks", "syncsettings", and "oma-settings". Default is "settings".
+   </entry></row>
+
+   <row><entry><literal>sec</literal></entry>
+   <entry><literal>string</literal></entry>
+   <entry valign="bottom">
+       Security model used to authenticate oma-settings. One of:
+       "userpin", "netwpin", "usernetwpin", or "userpinmac".
+   </entry></row>
+
+   <row><entry><literal>pin</literal></entry>
+   <entry><literal>number</literal></entry>
+   <entry valign="bottom">
+     Authentication token.
    </entry></row>
 
   </tbody>
-- 
Adrian Silva Franco
Visualtis - Desarrollo de sistemas.
Cl Saavedra Fajardo, 5 -entlo.5
30001 Murcia - Spain
Tlf +34 968 900 248
Fax +34 968 900 490
mailto:[EMAIL PROTECTED]
http://www.visualtis.com

Reply via email to