Changeset 122

Show
Ignore:
Timestamp:
04/12/06 22:01:45 (3 years ago)
Author:
abauer
Message:

Fixed setting of maxObjSize

Added command line switch

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/development-branch/libsyncml/parser/sml_xml_assm.c

    r120 r122  
    219219         
    220220        //Meta 
    221         if (complete_size) { 
     221        /*if (complete_size) { 
    222222                if (!_smlXmlAssemblerStartNode(assm, SML_ELEMENT_META, error)) 
    223223                        goto error; 
     
    229229                if (!_smlXmlAssemblerEndNode(assm, error)) 
    230230                        goto error; 
    231         } 
     231        }*/ 
    232232         
    233233        if (smlItemHasData(item)) { 
     
    385385                goto error; 
    386386         
    387         /*if (change->size) { 
     387        if (change->size) { 
    388388                if (!_smlXmlAssemblerAddID(assm, SML_ELEMENT_SIZE, change->size, error)) 
    389389                        goto error; 
    390         }*/ 
     390        } 
    391391 
    392392        //META 
     
    422422        } 
    423423         
    424          
    425         if (!_smlXmlAssemblerStartNode(assm, SML_ELEMENT_META, error)) 
    426                 goto error; 
    427          
    428         if (!_smlXmlAssemblerAddIDNS(assm, NULL, SML_ELEMENT_MAXOBJSIZE, SML_NAMESPACE_METINF, 786432, error)) 
    429                 goto error; 
    430          
    431         //META 
    432         if (!_smlXmlAssemblerEndNode(assm, error)) 
    433                 goto error; 
     424        printf("max obj %i, version %i %i\n", assm->session->incomingMaxObjSize, assm->session->version, SML_VERSION_10); 
     425        if (assm->session->incomingMaxObjSize && assm->session->version != SML_VERSION_10) { 
     426                if (!_smlXmlAssemblerStartNode(assm, SML_ELEMENT_META, error)) 
     427                        goto error; 
     428                 
     429                if (!_smlXmlAssemblerAddIDNS(assm, NULL, SML_ELEMENT_MAXOBJSIZE, SML_NAMESPACE_METINF, assm->session->incomingMaxObjSize, error)) 
     430                        goto error; 
     431                 
     432                //META 
     433                if (!_smlXmlAssemblerEndNode(assm, error)) 
     434                        goto error; 
     435        } 
    434436         
    435437        if (!smlLocationAssemble(cmd->target, assm, SML_ELEMENT_TARGET, error)) 
     
    19421944         
    19431945        //UTC 
     1946        /* Note: We dont check for devinf version 1.1 here, since there are some 
     1947         * (buggy) phones which _reqqire_ the utc tag even if it is devinf 1.0. */ 
    19441948        if (devinf->supportsUTC) { 
    19451949                if (!_smlXmlAssemblerAddString(assm, SML_ELEMENT_UTC, "", error)) 
  • branches/development-branch/libsyncml/parser/sml_xml_parse.c

    r120 r122  
    508508                        if (!_smlXmlParserGetID(parser, maxobjsize, SML_ELEMENT_MAXOBJSIZE, error)) 
    509509                                goto error; 
     510                } else if (!strcmp((char *)xmlTextReaderConstName(parser->reader), SML_ELEMENT_MEM)) { 
     511                        /* Ignored for now */ 
     512                        if (xmlTextReaderNext(parser->reader) != 1) { 
     513                                smlErrorSet(error, SML_ERROR_GENERIC, "Unable to skip mem node"); 
     514                                goto error; 
     515                        } 
    510516                } else { 
    511517                        smlErrorSet(error, SML_ERROR_GENERIC, "wrong initial node: %s", xmlTextReaderConstName(parser->reader)); 
  • branches/development-branch/libsyncml/sml_defines.h

    r120 r122  
    6767#define SML_ELEMENT_MAXOBJSIZE "MaxObjSize" 
    6868#define SML_ELEMENT_MOREDATA "MoreData" 
     69#define SML_ELEMENT_MEM "Mem" 
     70#define SML_ELEMENT_FREEID "FreeID" 
    6971 
    7072/* For devinf */ 
  • branches/development-branch/libsyncml/sml_elements.h

    r120 r122  
    4444SmlBool smlItemHasData(SmlItem *item); 
    4545SmlBool smlItemGetData(SmlItem *item, char **data, unsigned int *size, SmlError **error); 
     46SmlBool smlItemStealData(SmlItem *item, char **data, unsigned int *size, SmlError **error); 
    4647 
    4748void smlItemSetSource(SmlItem *item, SmlLocation *source); 
  • branches/development-branch/tools/syncml-http-server.c

    r121 r122  
    6262        fprintf (stderr, "[--recvLimit <limit>]\t\t\tLimit the size of the receiving buffer to this size (Needed for some phones)\n\n"); 
    6363        fprintf (stderr, "[--allowLateStatus]\t\t\tAllows that a phone can send commands before statuses (Needed for some phones)\n\n"); 
     64        fprintf (stderr, "[--maxObjSize <limit>]\t\t\tThe maximum size of a object that we can receive (Needed for some phones)\n\n"); 
     65        fprintf (stderr, "[--addUTC]\t\t\tAdd the UTC tag to the device information (Needed for some phones)\n\n"); 
    6466        fprintf (stderr, "[--noPendingReplies]\t\t\tRequire that no pending replies are allowed (Needed for some phones)\n"); 
    6567        fprintf (stderr, "Example: %s --port 9999 --sync vcal /events --sync vcard /addressbook --multi --san\n", name); 
     
    220222 
    221223unsigned int recvLimit = 0; 
     224unsigned int maxObjSize = 0; 
    222225SmlBool lateStatus = FALSE; 
    223226SmlBool noPending = FALSE; 
     
    243246                        if (recvLimit) 
    244247                                smlSessionSetReceivingLimit(session, recvLimit); 
     248                                 
     249                        if (maxObjSize) 
     250                                smlSessionSetReceivingMaxObjSize(session, maxObjSize); 
    245251                         
    246252                        if (lateStatus) 
     
    331337         
    332338        SmlError *error = NULL; 
    333  
     339        SmlBool addUTC = TRUE; 
     340         
    334341        if (!g_thread_supported ()) g_thread_init (NULL); 
    335342         
     
    352359                                usage (argv[0], 1); 
    353360                        recvLimit = atoi(argv[i]); 
     361                } else if (!strcmp (arg, "--maxObjSize")) { 
     362                        i++; 
     363                        if (!argv[i]) 
     364                                usage (argv[0], 1); 
     365                        maxObjSize = atoi(argv[i]); 
    354366                } else if (!strcmp (arg, "--multi")) { 
    355367                        once = FALSE; 
     
    359371                } else if (!strcmp (arg, "--allowLateStatus")) { 
    360372                        lateStatus = TRUE; 
     373                } else if (!strcmp (arg, "--addUTC")) { 
     374                        addUTC = TRUE; 
    361375                } else if (!strcmp (arg, "--noPendingReplies")) { 
    362376                        noPending = TRUE; 
     
    398412                goto error_free_manager; 
    399413         
     414        smlDevInfSetSupportsUTC(devinf, addUTC); 
     415                         
    400416        agent = smlDevInfAgentNew(devinf, &error); 
    401417        if (!agent) 
     
    462478                        if (!datastore) 
    463479                                goto error; 
    464                          
     480                                
    465481                        switch (type) { 
    466482                                case SML_CONTENT_TYPE_VCAL: 
  • branches/development-branch/tools/syncml-obex-client.c

    r120 r122  
    7171        fprintf (stderr, "[--wbxml]\t\t\tUse wbxml (WAP Binary XML) instead of plain xml\n\n"); 
    7272        fprintf (stderr, "[--recvLimit <limit>]\t\t\tLimit the size of the receiving buffer to this size (Needed for some phones)\n\n"); 
     73        fprintf (stderr, "[--maxObjSize <limit>]\t\t\tThe maximum size of a object that we can receive (Needed for some phones)\n\n"); 
     74        fprintf (stderr, "[--addUTC]\t\t\tAdd the UTC tag to the device information (Needed for some phones)\n\n"); 
    7375        fprintf (stderr, "[--allowLateStatus]\t\t\tAllows that a phone can send commands before statuses (Needed for some phones)\n\n"); 
    7476        fprintf (stderr, "[--noPendingReplies]\t\t\tRequire that no pending replies are allowed (Needed for some phones)\n"); 
     
    237239 
    238240unsigned int recvLimit = 0; 
     241unsigned int maxObjSize = 0; 
    239242SmlBool lateStatus = FALSE; 
    240243SmlBool noPending = FALSE; 
     
    262265                        if (recvLimit) 
    263266                                smlSessionSetReceivingLimit(session, recvLimit); 
     267                                 
     268                        if (maxObjSize) 
     269                                smlSessionSetReceivingMaxObjSize(session, maxObjSize); 
    264270                         
    265271                        if (lateStatus) 
     
    392398         
    393399        SmlMimeType type = SML_MIMETYPE_XML; 
     400        SmlBool addUTC = FALSE; 
    394401         
    395402        SmlError *error = NULL; 
     
    455462                                usage (argv[0], 1); 
    456463                        recvLimit = atoi(argv[i]); 
     464                } else if (!strcmp (arg, "--maxObjSize")) { 
     465                        i++; 
     466                        if (!argv[i]) 
     467                                usage (argv[0], 1); 
     468                        maxObjSize = atoi(argv[i]); 
    457469                } else if (!strcmp (arg, "--allowLateStatus")) { 
    458470                        lateStatus = TRUE; 
    459471                } else if (!strcmp (arg, "--noPendingReplies")) { 
    460472                        noPending = TRUE; 
     473                } else if (!strcmp (arg, "--addUTC")) { 
     474                        addUTC = TRUE; 
    461475                } else if (!strcmp (arg, "--version")) { 
    462476                        i++; 
     
    510524        if (!devinf) 
    511525                goto error_free_manager; 
     526         
     527        smlDevInfSetSupportsUTC(devinf, addUTC); 
    512528         
    513529        agent = smlDevInfAgentNew(devinf, &error);