Changeset 10578 for branches/1.9x/third-party/miniupnp/igd_desc_parse.c
- Timestamp:
- May 1, 2010, 4:21:41 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.9x/third-party/miniupnp/igd_desc_parse.c
r10285 r10578 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
Note: See TracChangeset
for help on using the changeset viewer.