Ignore:
Timestamp:
May 4, 2008, 10:09:33 PM (14 years ago)
Author:
charles
Message:

update to the miniupnpc-20080427 snapshot
update to the libnatpmp-20080428 snapshot

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/third-party/miniupnp/igd_desc_parse.c

    r3731 r5743  
    1 /* $Id: igd_desc_parse.c,v 1.7 2006/11/19 22:32:33 nanard Exp $ */
     1/* $Id: igd_desc_parse.c,v 1.8 2008/04/23 11:51:06 nanard Exp $ */
    22/* Project : miniupnp
    33 * http://miniupnp.free.fr/
    44 * Author : Thomas Bernard
    5  * Copyright (c) 2005 Thomas Bernard
     5 * Copyright (c) 2005-2008 Thomas Bernard
    66 * This software is subject to the conditions detailed in the
    77 * LICENCE file provided in this distribution.
     
    1010#include <stdio.h>
    1111#include <string.h>
     12
     13/* TODO : rewrite this code so it correctly handle descriptions with
     14 * both WANIPConnection and/or WANPPPConnection */
    1215
    1316/* Start element handler :
     
    1922        datas->cureltname[l] = '\0';
    2023        datas->level++;
     24        if( (l==7) && !memcmp(name, "service", l) ) {
     25                datas->controlurl_tmp[0] = '\0';
     26                datas->eventsuburl_tmp[0] = '\0';
     27                datas->scpdurl_tmp[0] = '\0';
     28                datas->servicetype_tmp[0] = '\0';
     29        }
    2130}
    2231
     
    3140        if( (l==7) && !memcmp(name, "service", l) )
    3241        {
    33                 /*datas->state++; */
    3442                /*
    3543                if( datas->state < 1
     
    3947                        datas->state ++;
    4048                */
    41                 if(0==strcmp(datas->servicetype_CIF,
    42                                 "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1"))
    43                         datas->state = 2;
    44                 if(0==strcmp(datas->servicetype,
    45                                 "urn:schemas-upnp-org:service:WANIPConnection:1") )
    46                         datas->state = 3;
    47 /*              if(0==strcmp(datas->servicetype,
    48                                 "urn:schemas-upnp-org:service:WANPPPConnection:1") )
    49                         datas->state = 4; */
     49                if(0==strcmp(datas->servicetype_tmp,
     50                                "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1")) {
     51                        memcpy(datas->controlurl_CIF, datas->controlurl_tmp, MINIUPNPC_URL_MAXSIZE);
     52                        memcpy(datas->eventsuburl_CIF, datas->eventsuburl_tmp, MINIUPNPC_URL_MAXSIZE);
     53                        memcpy(datas->scpdurl_CIF, datas->scpdurl_tmp, MINIUPNPC_URL_MAXSIZE);
     54                        memcpy(datas->servicetype_CIF, datas->servicetype_tmp, MINIUPNPC_URL_MAXSIZE);
     55                } else if(0==strcmp(datas->servicetype_tmp,
     56                                "urn:schemas-upnp-org:service:WANIPConnection:1")
     57                                 || 0==strcmp(datas->servicetype_tmp,
     58                                "urn:schemas-upnp-org:service:WANPPPConnection:1") ) {
     59                        memcpy(datas->controlurl, datas->controlurl_tmp, MINIUPNPC_URL_MAXSIZE);
     60                        memcpy(datas->eventsuburl, datas->eventsuburl_tmp, MINIUPNPC_URL_MAXSIZE);
     61                        memcpy(datas->scpdurl, datas->scpdurl_tmp, MINIUPNPC_URL_MAXSIZE);
     62                        memcpy(datas->servicetype, datas->servicetype_tmp, MINIUPNPC_URL_MAXSIZE);
     63                }
    5064        }
    5165}
     
    6175        if( !strcmp(datas->cureltname, "URLBase") )
    6276                dstmember = datas->urlbase;
    63         else if(datas->state<=1)
    64         {
    65                 if( !strcmp(datas->cureltname, "serviceType") )
    66                         dstmember = datas->servicetype_CIF;
    67                 else if( !strcmp(datas->cureltname, "controlURL") )
    68                         dstmember = datas->controlurl_CIF;
    69                 else if( !strcmp(datas->cureltname, "eventSubURL") )
    70                         dstmember = datas->eventsuburl_CIF;
    71                 else if( !strcmp(datas->cureltname, "SCPDURL") )
    72                         dstmember = datas->scpdurl_CIF;
    73                 else if( !strcmp(datas->cureltname, "deviceType") )
    74                         dstmember = datas->devicetype_CIF;
    75         }
    76         else if(datas->state==2)
    77         {
    78                 if( !strcmp(datas->cureltname, "serviceType") )
    79                         dstmember = datas->servicetype;
    80                 else if( !strcmp(datas->cureltname, "controlURL") )
    81                         dstmember = datas->controlurl;
    82                 else if( !strcmp(datas->cureltname, "eventSubURL") )
    83                         dstmember = datas->eventsuburl;
    84                 else if( !strcmp(datas->cureltname, "SCPDURL") )
    85                         dstmember = datas->scpdurl;
    86                 else if( !strcmp(datas->cureltname, "deviceType") )
    87                         dstmember = datas->devicetype;
    88         }
     77        else if( !strcmp(datas->cureltname, "serviceType") )
     78                dstmember = datas->servicetype_tmp;
     79        else if( !strcmp(datas->cureltname, "controlURL") )
     80                dstmember = datas->controlurl_tmp;
     81        else if( !strcmp(datas->cureltname, "eventSubURL") )
     82                dstmember = datas->eventsuburl_tmp;
     83        else if( !strcmp(datas->cureltname, "SCPDURL") )
     84                dstmember = datas->scpdurl_tmp;
     85/*      else if( !strcmp(datas->cureltname, "deviceType") )
     86                dstmember = datas->devicetype_tmp;*/
    8987        if(dstmember)
    9088        {
     
    10098        printf("urlbase = %s\n", d->urlbase);
    10199        printf("WAN Device (Common interface config) :\n");
    102         printf(" deviceType = %s\n", d->devicetype_CIF);
     100        /*printf(" deviceType = %s\n", d->devicetype_CIF);*/
    103101        printf(" serviceType = %s\n", d->servicetype_CIF);
    104102        printf(" controlURL = %s\n", d->controlurl_CIF);
    105103        printf(" eventSubURL = %s\n", d->eventsuburl_CIF);
    106104        printf(" SCPDURL = %s\n", d->scpdurl_CIF);
    107         printf("WAN Connection Device :\n");
    108         printf(" deviceType = %s\n", d->devicetype);
     105        printf("WAN Connection Device (IP or PPP Connection):\n");
     106        /*printf(" deviceType = %s\n", d->devicetype);*/
    109107        printf(" servicetype = %s\n", d->servicetype);
    110108        printf(" controlURL = %s\n", d->controlurl);
Note: See TracChangeset for help on using the changeset viewer.