Changeset 10460
- Timestamp:
- Apr 7, 2010, 10:45:35 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/upnp.c
r9868 r10460 138 138 tr_snprintf( portStr, sizeof( portStr ), "%d", handle->port ); 139 139 i = UPNP_GetSpecificPortMappingEntry( handle->urls.controlURL, 140 handle->data. servicetype, portStr,140 handle->data.first.servicetype, portStr, 141 141 "TCP", intClient, intPort ); 142 142 if( i != UPNPCOMMAND_SUCCESS ) … … 152 152 tr_snprintf( portStr, sizeof( portStr ), "%d", handle->port ); 153 153 UPNP_DeletePortMapping( handle->urls.controlURL, 154 handle->data. servicetype,154 handle->data.first.servicetype, 155 155 portStr, "TCP", NULL ); 156 156 tr_ninf( getKey( ), 157 157 _( 158 158 "Stopping port forwarding through \"%s\", service \"%s\"" ), 159 handle->urls.controlURL, handle->data. servicetype );159 handle->urls.controlURL, handle->data.first.servicetype ); 160 160 handle->isMapped = 0; 161 161 handle->state = TR_UPNP_IDLE; … … 174 174 errno = 0; 175 175 176 if( !handle->urls.controlURL || !handle->data. servicetype )176 if( !handle->urls.controlURL || !handle->data.first.servicetype ) 177 177 handle->isMapped = 0; 178 178 else … … 183 183 tr_snprintf( desc, sizeof( desc ), "%s at %d", TR_NAME, port ); 184 184 err = UPNP_AddPortMapping( handle->urls.controlURL, 185 handle->data. servicetype,185 handle->data.first.servicetype, 186 186 portStr, portStr, handle->lanaddr, 187 187 desc, "TCP", NULL ); … … 191 191 _( 192 192 "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, 194 194 handle->lanaddr, port ); 195 195 if( handle->isMapped ) -
trunk/third-party/miniupnp/Changelog.txt
r10447 r10460 1 $Id: Changelog.txt,v 1.11 0 2010/04/05 12:09:51nanard Exp $1 $Id: Changelog.txt,v 1.111 2010/04/05 20:36:59 nanard Exp $ 2 2 miniUPnP client Changelog. 3 3 … … 8 8 Work to make miniupnpc IPV6 compatible... 9 9 Add java test code. 10 Big changes in order to support device having both WANIPConnection 11 and WANPPPConnection. 10 12 11 13 2010/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:06nanard Exp $ */1 /* $Id: igd_desc_parse.c,v 1.10 2010/04/05 20:36:59 nanard Exp $ */ 2 2 /* Project : miniupnp 3 3 * http://miniupnp.free.fr/ 4 4 * Author : Thomas Bernard 5 * Copyright (c) 2005-20 08Thomas Bernard5 * Copyright (c) 2005-2010 Thomas Bernard 6 6 * 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 9 9 #include "igd_desc_parse.h" 10 10 #include <stdio.h> 11 11 #include <string.h> 12 13 /* TODO : rewrite this code so it correctly handle descriptions with14 * both WANIPConnection and/or WANPPPConnection */15 12 16 13 /* Start element handler : … … 23 20 datas->level++; 24 21 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'; 29 26 } 30 27 } … … 47 44 datas->state ++; 48 45 */ 49 if(0==strcmp(datas-> servicetype_tmp,46 if(0==strcmp(datas->tmp.servicetype, 50 47 "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, 56 50 "urn:schemas-upnp-org:service:WANIPConnection:1") 57 || 0==strcmp(datas-> servicetype_tmp,51 || 0==strcmp(datas->tmp.servicetype, 58 52 "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 } 63 58 } 64 59 } … … 76 71 dstmember = datas->urlbase; 77 72 else if( !strcmp(datas->cureltname, "serviceType") ) 78 dstmember = datas-> servicetype_tmp;73 dstmember = datas->tmp.servicetype; 79 74 else if( !strcmp(datas->cureltname, "controlURL") ) 80 dstmember = datas-> controlurl_tmp;75 dstmember = datas->tmp.controlurl; 81 76 else if( !strcmp(datas->cureltname, "eventSubURL") ) 82 dstmember = datas-> eventsuburl_tmp;77 dstmember = datas->tmp.eventsuburl; 83 78 else if( !strcmp(datas->cureltname, "SCPDURL") ) 84 dstmember = datas-> scpdurl_tmp;79 dstmember = datas->tmp.scpdurl; 85 80 /* else if( !strcmp(datas->cureltname, "deviceType") ) 86 81 dstmember = datas->devicetype_tmp;*/ … … 98 93 printf("urlbase = '%s'\n", d->urlbase); 99 94 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); 105 100 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); 111 112 } 112 113 -
trunk/third-party/miniupnp/igd_desc_parse.h
r5743 r10460 1 /* $Id: igd_desc_parse.h,v 1. 6 2008/04/23 11:51:07nanard Exp $ */1 /* $Id: igd_desc_parse.h,v 1.7 2010/04/05 20:36:59 nanard Exp $ */ 2 2 /* Project : miniupnp 3 3 * http://miniupnp.free.fr/ 4 4 * Author : Thomas Bernard 5 * Copyright (c) 2005-20 08Thomas Bernard5 * Copyright (c) 2005-2010 Thomas Bernard 6 6 * This software is subject to the conditions detailed in the 7 7 * LICENCE file provided in this distribution. … … 13 13 * descriptions of Internet Gateway Devices */ 14 14 #define MINIUPNPC_URL_MAXSIZE (128) 15 struct 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 15 23 struct IGDdatas { 16 24 char cureltname[MINIUPNPC_URL_MAXSIZE]; … … 19 27 /*int state;*/ 20 28 /* "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; 26 30 /* "urn:schemas-upnp-org:service:WANIPConnection:1" 27 31 * "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; 33 35 /* 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; 39 37 }; 40 38 -
trunk/third-party/miniupnp/miniupnpc.c
r10447 r10460 1 /* $Id: miniupnpc.c,v 1.7 7 2010/04/05 12:34:05nanard Exp $ */1 /* $Id: miniupnpc.c,v 1.78 2010/04/05 20:36:59 nanard Exp $ */ 2 2 /* Project : miniupnp 3 3 * Author : Thomas BERNARD … … 654 654 n1 += 2; /* 1 byte more for Null terminator, 1 byte for '/' if needed */ 655 655 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); 659 659 660 660 urls->ipcondescURL = (char *)malloc(n1); … … 671 671 strncpy(urls->controlURL_CIF, urls->ipcondescURL, n3); 672 672 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); 678 678 679 679 #ifdef DEBUG 680 printf("urls->ipcondescURL='%s' % dn1=%d\n", urls->ipcondescURL,681 strlen(urls->ipcondescURL), n1);682 printf("urls->controlURL='%s' % dn2=%d\n", urls->controlURL,683 strlen(urls->controlURL), n2);684 printf("urls->controlURL_CIF='%s' % dn3=%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); 686 686 #endif 687 687 } … … 756 756 unsigned int uptime; 757 757 status[0] = '\0'; 758 UPNP_GetStatusInfo(urls->controlURL, data-> servicetype,758 UPNP_GetStatusInfo(urls->controlURL, data->first.servicetype, 759 759 status, &uptime, NULL); 760 760 if(0 == strcmp("Connected", status)) … … 813 813 free(descXML); 814 814 descXML = NULL; 815 if(0==strcmp(data-> servicetype_CIF,815 if(0==strcmp(data->CIF.servicetype, 816 816 "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1") 817 817 || state >= 3 ) … … 827 827 return state; 828 828 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 } 829 848 } 830 849 memset(data, 0, sizeof(struct IGDdatas));
Note: See TracChangeset
for help on using the changeset viewer.