Changeset 10460


Ignore:
Timestamp:
Apr 7, 2010, 10:45:35 PM (13 years ago)
Author:
livings124
Message:

update miniupnp to 20100407

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/upnp.c

    r9868 r10460  
    138138        tr_snprintf( portStr, sizeof( portStr ), "%d", handle->port );
    139139        i = UPNP_GetSpecificPortMappingEntry( handle->urls.controlURL,
    140                                               handle->data.servicetype, portStr,
     140                                              handle->data.first.servicetype, portStr,
    141141                                              "TCP", intClient, intPort );
    142142        if( i != UPNPCOMMAND_SUCCESS )
     
    152152        tr_snprintf( portStr, sizeof( portStr ), "%d", handle->port );
    153153        UPNP_DeletePortMapping( handle->urls.controlURL,
    154                                 handle->data.servicetype,
     154                                handle->data.first.servicetype,
    155155                                portStr, "TCP", NULL );
    156156        tr_ninf( getKey( ),
    157157                 _(
    158158                     "Stopping port forwarding through \"%s\", service \"%s\"" ),
    159                  handle->urls.controlURL, handle->data.servicetype );
     159                 handle->urls.controlURL, handle->data.first.servicetype );
    160160        handle->isMapped = 0;
    161161        handle->state = TR_UPNP_IDLE;
     
    174174        errno = 0;
    175175
    176         if( !handle->urls.controlURL || !handle->data.servicetype )
     176        if( !handle->urls.controlURL || !handle->data.first.servicetype )
    177177            handle->isMapped = 0;
    178178        else
     
    183183            tr_snprintf( desc, sizeof( desc ), "%s at %d", TR_NAME, port );
    184184            err = UPNP_AddPortMapping( handle->urls.controlURL,
    185                                        handle->data.servicetype,
     185                                       handle->data.first.servicetype,
    186186                                       portStr, portStr, handle->lanaddr,
    187187                                       desc, "TCP", NULL );
     
    191191                 _(
    192192                     "Port forwarding through \"%s\", service \"%s\".  (local address: %s:%d)" ),
    193                  handle->urls.controlURL, handle->data.servicetype,
     193                 handle->urls.controlURL, handle->data.first.servicetype,
    194194                 handle->lanaddr, port );
    195195        if( handle->isMapped )
  • trunk/third-party/miniupnp/Changelog.txt

    r10447 r10460  
    1 $Id: Changelog.txt,v 1.110 2010/04/05 12:09:51 nanard Exp $
     1$Id: Changelog.txt,v 1.111 2010/04/05 20:36:59 nanard Exp $
    22miniUPnP client Changelog.
    33
     
    88  Work to make miniupnpc IPV6 compatible...
    99  Add java test code.
     10  Big changes in order to support device having both WANIPConnection
     11  and WANPPPConnection.
    1012
    11132010/04/04:
  • trunk/third-party/miniupnp/igd_desc_parse.c

    r10285 r10460  
    1 /* $Id: igd_desc_parse.c,v 1.9 2009/12/03 13:50:06 nanard Exp $ */
     1/* $Id: igd_desc_parse.c,v 1.10 2010/04/05 20:36:59 nanard Exp $ */
    22/* Project : miniupnp
    33 * http://miniupnp.free.fr/
    44 * Author : Thomas Bernard
    5  * Copyright (c) 2005-2008 Thomas Bernard
     5 * Copyright (c) 2005-2010 Thomas Bernard
    66 * This software is subject to the conditions detailed in the
    7  * LICENCE file provided in this distribution.
    8  * */
     7 * LICENCE file provided in this distribution. */
     8
    99#include "igd_desc_parse.h"
    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 */
    1512
    1613/* Start element handler :
     
    2320        datas->level++;
    2421        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';
     22                datas->tmp.controlurl[0] = '\0';
     23                datas->tmp.eventsuburl[0] = '\0';
     24                datas->tmp.scpdurl[0] = '\0';
     25                datas->tmp.servicetype[0] = '\0';
    2926        }
    3027}
     
    4744                        datas->state ++;
    4845                */
    49                 if(0==strcmp(datas->servicetype_tmp,
     46                if(0==strcmp(datas->tmp.servicetype,
    5047                                "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,
     48                        memcpy(&datas->CIF, &datas->tmp, sizeof(struct IGDdatas_service));
     49                } else if(0==strcmp(datas->tmp.servicetype,
    5650                                "urn:schemas-upnp-org:service:WANIPConnection:1")
    57                                  || 0==strcmp(datas->servicetype_tmp,
     51                                 || 0==strcmp(datas->tmp.servicetype,
    5852                                "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);
     53                        if(datas->first.servicetype[0] == '\0') {
     54                                memcpy(&datas->first, &datas->tmp, sizeof(struct IGDdatas_service));
     55                        } else {
     56                                memcpy(&datas->second, &datas->tmp, sizeof(struct IGDdatas_service));
     57                        }
    6358                }
    6459        }
     
    7671                dstmember = datas->urlbase;
    7772        else if( !strcmp(datas->cureltname, "serviceType") )
    78                 dstmember = datas->servicetype_tmp;
     73                dstmember = datas->tmp.servicetype;
    7974        else if( !strcmp(datas->cureltname, "controlURL") )
    80                 dstmember = datas->controlurl_tmp;
     75                dstmember = datas->tmp.controlurl;
    8176        else if( !strcmp(datas->cureltname, "eventSubURL") )
    82                 dstmember = datas->eventsuburl_tmp;
     77                dstmember = datas->tmp.eventsuburl;
    8378        else if( !strcmp(datas->cureltname, "SCPDURL") )
    84                 dstmember = datas->scpdurl_tmp;
     79                dstmember = datas->tmp.scpdurl;
    8580/*      else if( !strcmp(datas->cureltname, "deviceType") )
    8681                dstmember = datas->devicetype_tmp;*/
     
    9893        printf("urlbase = '%s'\n", d->urlbase);
    9994        printf("WAN Device (Common interface config) :\n");
    100         /*printf(" deviceType = '%s'\n", d->devicetype_CIF);*/
    101         printf(" serviceType = '%s'\n", d->servicetype_CIF);
    102         printf(" controlURL = '%s'\n", d->controlurl_CIF);
    103         printf(" eventSubURL = '%s'\n", d->eventsuburl_CIF);
    104         printf(" SCPDURL = '%s'\n", d->scpdurl_CIF);
     95        /*printf(" deviceType = '%s'\n", d->CIF.devicetype);*/
     96        printf(" serviceType = '%s'\n", d->CIF.servicetype);
     97        printf(" controlURL = '%s'\n", d->CIF.controlurl);
     98        printf(" eventSubURL = '%s'\n", d->CIF.eventsuburl);
     99        printf(" SCPDURL = '%s'\n", d->CIF.scpdurl);
    105100        printf("WAN Connection Device (IP or PPP Connection):\n");
    106         /*printf(" deviceType = '%s'\n", d->devicetype);*/
    107         printf(" servicetype = '%s'\n", d->servicetype);
    108         printf(" controlURL = '%s'\n", d->controlurl);
    109         printf(" eventSubURL = '%s'\n", d->eventsuburl);
    110         printf(" SCPDURL = '%s'\n", d->scpdurl);
     101        /*printf(" deviceType = '%s'\n", d->first.devicetype);*/
     102        printf(" servicetype = '%s'\n", d->first.servicetype);
     103        printf(" controlURL = '%s'\n", d->first.controlurl);
     104        printf(" eventSubURL = '%s'\n", d->first.eventsuburl);
     105        printf(" SCPDURL = '%s'\n", d->first.scpdurl);
     106        printf("secondary WAN Connection Device (IP or PPP Connection):\n");
     107        /*printf(" deviceType = '%s'\n", d->second.devicetype);*/
     108        printf(" servicetype = '%s'\n", d->second.servicetype);
     109        printf(" controlURL = '%s'\n", d->second.controlurl);
     110        printf(" eventSubURL = '%s'\n", d->second.eventsuburl);
     111        printf(" SCPDURL = '%s'\n", d->second.scpdurl);
    111112}
    112113
  • trunk/third-party/miniupnp/igd_desc_parse.h

    r5743 r10460  
    1 /* $Id: igd_desc_parse.h,v 1.6 2008/04/23 11:51:07 nanard Exp $ */
     1/* $Id: igd_desc_parse.h,v 1.7 2010/04/05 20:36:59 nanard Exp $ */
    22/* Project : miniupnp
    33 * http://miniupnp.free.fr/
    44 * Author : Thomas Bernard
    5  * Copyright (c) 2005-2008 Thomas Bernard
     5 * Copyright (c) 2005-2010 Thomas Bernard
    66 * This software is subject to the conditions detailed in the
    77 * LICENCE file provided in this distribution.
     
    1313 * descriptions of Internet Gateway Devices */
    1414#define MINIUPNPC_URL_MAXSIZE (128)
     15struct IGDdatas_service {
     16        char controlurl[MINIUPNPC_URL_MAXSIZE];
     17        char eventsuburl[MINIUPNPC_URL_MAXSIZE];
     18        char scpdurl[MINIUPNPC_URL_MAXSIZE];
     19        char servicetype[MINIUPNPC_URL_MAXSIZE];
     20        /*char devicetype[MINIUPNPC_URL_MAXSIZE];*/
     21};
     22
    1523struct IGDdatas {
    1624        char cureltname[MINIUPNPC_URL_MAXSIZE];
     
    1927        /*int state;*/
    2028        /* "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1" */
    21         char controlurl_CIF[MINIUPNPC_URL_MAXSIZE];
    22         char eventsuburl_CIF[MINIUPNPC_URL_MAXSIZE];
    23         char scpdurl_CIF[MINIUPNPC_URL_MAXSIZE];
    24         char servicetype_CIF[MINIUPNPC_URL_MAXSIZE];
    25         /*char devicetype_CIF[MINIUPNPC_URL_MAXSIZE];*/
     29        struct IGDdatas_service CIF;
    2630        /* "urn:schemas-upnp-org:service:WANIPConnection:1"
    2731         * "urn:schemas-upnp-org:service:WANPPPConnection:1" */
    28         char controlurl[MINIUPNPC_URL_MAXSIZE];
    29         char eventsuburl[MINIUPNPC_URL_MAXSIZE];
    30         char scpdurl[MINIUPNPC_URL_MAXSIZE];
    31         char servicetype[MINIUPNPC_URL_MAXSIZE];
    32         /*char devicetype[MINIUPNPC_URL_MAXSIZE];*/
     32        struct IGDdatas_service first;
     33        /* if both WANIPConnection and WANPPPConnection are present */
     34        struct IGDdatas_service second;
    3335        /* tmp */
    34         char controlurl_tmp[MINIUPNPC_URL_MAXSIZE];
    35         char eventsuburl_tmp[MINIUPNPC_URL_MAXSIZE];
    36         char scpdurl_tmp[MINIUPNPC_URL_MAXSIZE];
    37         char servicetype_tmp[MINIUPNPC_URL_MAXSIZE];
    38         /*char devicetype_tmp[MINIUPNPC_URL_MAXSIZE];*/
     36        struct IGDdatas_service tmp;
    3937};
    4038
  • trunk/third-party/miniupnp/miniupnpc.c

    r10447 r10460  
    1 /* $Id: miniupnpc.c,v 1.77 2010/04/05 12:34:05 nanard Exp $ */
     1/* $Id: miniupnpc.c,v 1.78 2010/04/05 20:36:59 nanard Exp $ */
    22/* Project : miniupnp
    33 * Author : Thomas BERNARD
     
    654654        n1 += 2;        /* 1 byte more for Null terminator, 1 byte for '/' if needed */
    655655        n2 = n1; n3 = n1;
    656         n1 += strlen(data->scpdurl);
    657         n2 += strlen(data->controlurl);
    658         n3 += strlen(data->controlurl_CIF);
     656        n1 += strlen(data->first.scpdurl);
     657        n2 += strlen(data->first.controlurl);
     658        n3 += strlen(data->CIF.controlurl);
    659659
    660660        urls->ipcondescURL = (char *)malloc(n1);
     
    671671        strncpy(urls->controlURL_CIF, urls->ipcondescURL, n3);
    672672       
    673         url_cpy_or_cat(urls->ipcondescURL, data->scpdurl, n1);
    674 
    675         url_cpy_or_cat(urls->controlURL, data->controlurl, n2);
    676 
    677         url_cpy_or_cat(urls->controlURL_CIF, data->controlurl_CIF, n3);
     673        url_cpy_or_cat(urls->ipcondescURL, data->first.scpdurl, n1);
     674
     675        url_cpy_or_cat(urls->controlURL, data->first.controlurl, n2);
     676
     677        url_cpy_or_cat(urls->controlURL_CIF, data->CIF.controlurl, n3);
    678678
    679679#ifdef DEBUG
    680         printf("urls->ipcondescURL='%s' %d n1=%d\n", urls->ipcondescURL,
    681                strlen(urls->ipcondescURL), n1);
    682         printf("urls->controlURL='%s' %d n2=%d\n", urls->controlURL,
    683                strlen(urls->controlURL), n2);
    684         printf("urls->controlURL_CIF='%s' %d n3=%d\n", urls->controlURL_CIF,
    685                strlen(urls->controlURL_CIF), n3);
     680        printf("urls->ipcondescURL='%s' %u n1=%d\n", urls->ipcondescURL,
     681               (unsigned)strlen(urls->ipcondescURL), n1);
     682        printf("urls->controlURL='%s' %u n2=%d\n", urls->controlURL,
     683               (unsigned)strlen(urls->controlURL), n2);
     684        printf("urls->controlURL_CIF='%s' %u n3=%d\n", urls->controlURL_CIF,
     685               (unsigned)strlen(urls->controlURL_CIF), n3);
    686686#endif
    687687}
     
    756756        unsigned int uptime;
    757757        status[0] = '\0';
    758         UPNP_GetStatusInfo(urls->controlURL, data->servicetype,
     758        UPNP_GetStatusInfo(urls->controlURL, data->first.servicetype,
    759759                           status, &uptime, NULL);
    760760        if(0 == strcmp("Connected", status))
     
    813813                                free(descXML);
    814814                                descXML = NULL;
    815                                 if(0==strcmp(data->servicetype_CIF,
     815                                if(0==strcmp(data->CIF.servicetype,
    816816                                   "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1")
    817817                                   || state >= 3 )
     
    827827                                        return state;
    828828                                  FreeUPNPUrls(urls);
     829                                  if(data->second.servicetype[0] != '\0') {
     830#ifdef DEBUG
     831                                    printf("We tried %s, now we try %s !\n",
     832                                           data->first.servicetype, data->second.servicetype);
     833#endif
     834                                    /* swaping WANPPPConnection and WANIPConnection ! */
     835                                    memcpy(&data->tmp, &data->first, sizeof(struct IGDdatas_service));
     836                                    memcpy(&data->first, &data->second, sizeof(struct IGDdatas_service));
     837                                    memcpy(&data->second, &data->tmp, sizeof(struct IGDdatas_service));
     838                                    GetUPNPUrls(urls, data, dev->descURL);
     839#ifdef DEBUG
     840                                    printf("UPNPIGD_IsConnected(%s) = %d\n",
     841                                       urls->controlURL,
     842                                   UPNPIGD_IsConnected(urls, data));
     843#endif
     844                                    if((state >= 2) || UPNPIGD_IsConnected(urls, data))
     845                                          return state;
     846                                    FreeUPNPUrls(urls);
     847                                  }
    829848                                }
    830849                                memset(data, 0, sizeof(struct IGDdatas));
Note: See TracChangeset for help on using the changeset viewer.