Changeset 6848


Ignore:
Timestamp:
Oct 4, 2008, 3:10:24 PM (13 years ago)
Author:
charles
Message:

updated to miniupnpc-20081002

Location:
trunk/third-party/miniupnp
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/third-party/miniupnp/README

    r6303 r6848  
    11MiniUPnP is written by Thomas Bernard.
    22Its homepage is http://miniupnp.free.fr/
    3 This is from the miniupnp-20080703 snapshot
     3This is from the miniupnpc-20081002 snapshot
  • trunk/third-party/miniupnp/declspec.h

    r6708 r6848  
    22#define __DECLSPEC_H__
    33
    4 /*
    54#if defined(WIN32) && !defined(STATICLIB)
    65        #ifdef MINIUPNP_EXPORTS
     
    109        #endif
    1110#else
    12 */
    1311        #define LIBSPEC
    14 /*
    1512#endif
    16 */
    1713
    1814#endif
  • trunk/third-party/miniupnp/minissdpc.c

    r6707 r6848  
    55 * This software is subjet to the conditions detailed in the
    66 * provided LICENCE file. */
    7 
    8 #ifndef WIN32
    9 
    107/*#include <syslog.h>*/
    118#include <stdio.h>
     
    109106}
    110107
    111 #endif
    112 
  • trunk/third-party/miniupnp/miniupnpc.c

    r6704 r6848  
    1 /* $Id: miniupnpc.c,v 1.52 2008/02/18 13:28:33 nanard Exp $ */
     1/* $Id: miniupnpc.c,v 1.55 2008/09/25 18:02:50 nanard Exp $ */
    22/* Project : miniupnp
    33 * Author : Thomas BERNARD
     
    1010#ifdef WIN32
    1111#include <winsock2.h>
    12 #include <ws2tcpip.h>
     12#include <Ws2tcpip.h>
    1313#include <io.h>
    1414#define snprintf _snprintf
     
    3333#include "upnpcommands.h"
    3434
    35 /* Uncomment the following to transmit the msearch from the same port
    36  * as the UPnP multicast port. With WinXP this seems to result in the
    37  * responses to the msearch being lost, thus if things dont work then
    38  * comment this out. */
    39 /* #define TX_FROM_UPNP_PORT */
    40 
    4135#ifdef WIN32
    4236#define PRINT_SOCKET_ERROR(x)    printf("Socket error: %s, %d\n", x, WSAGetLastError());
     
    4438#define PRINT_SOCKET_ERROR(x) perror(x)
    4539#endif
     40
     41#define SOAPPREFIX "s"
    4642
    4743/* root description parsing */
     
    149145        if(args==NULL)
    150146        {
    151                 /*snprintf(soapbody, sizeof(soapbody),
     147                /*soapbodylen = */snprintf(soapbody, sizeof(soapbody),
    152148                                                "<?xml version=\"1.0\"?>\r\n"
    153                               "<SOAP-ENV:Envelope "
    154                                                   "xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" "
    155                                                   "SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
    156                                                   "<SOAP-ENV:Body>"
    157                                                   "<m:%s xmlns:m=\"%s\"/>"
    158                                                   "</SOAP-ENV:Body></SOAP-ENV:Envelope>"
    159                                                   "\r\n", action, service);*/
    160                 snprintf(soapbody, sizeof(soapbody),
    161                                                 "<?xml version=\"1.0\"?>\r\n"
    162                               "<s:Envelope "
    163                                                   "xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
    164                                                   "s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
    165                                                   "<s:Body>"
     149                              "<" SOAPPREFIX ":Envelope "
     150                                                  "xmlns:" SOAPPREFIX "=\"http://schemas.xmlsoap.org/soap/envelope/\" "
     151                                                  SOAPPREFIX ":encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
     152                                                  "<" SOAPPREFIX ":Body>"
    166153                                                  "<m:%s xmlns:m=\"%s\">"
    167154                                                  "</m:%s>"
    168                                                   "</s:Body></s:Envelope>"
     155                                                  "</" SOAPPREFIX ":Body></" SOAPPREFIX ":Envelope>"
    169156                                                  "\r\n", action, service, action);
    170157        }
     
    173160                char * p;
    174161                const char * pe, * pv;
    175                 int soapbodylen;
     162                int soapbodylen;
    176163                soapbodylen = snprintf(soapbody, sizeof(soapbody),
    177164                                                "<?xml version=\"1.0\"?>\r\n"
    178                             "<SOAP-ENV:Envelope "
    179                                                 "xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" "
    180                                                 "SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
    181                                                 "<SOAP-ENV:Body>"
     165                            "<" SOAPPREFIX ":Envelope "
     166                                                "xmlns:" SOAPPREFIX "=\"http://schemas.xmlsoap.org/soap/envelope/\" "
     167                                                SOAPPREFIX ":encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
     168                                                "<" SOAPPREFIX ":Body>"
    182169                                                "<m:%s xmlns:m=\"%s\">",
    183170                                                action, service);
     
    217204                while(*pe)
    218205                        *(p++) = *(pe++);
    219                 strncpy(p, "></SOAP-ENV:Body></SOAP-ENV:Envelope>\r\n",
     206                strncpy(p, "></" SOAPPREFIX ":Body></" SOAPPREFIX ":Envelope>\r\n",
    220207                        soapbody + sizeof(soapbody) - p);
    221208        }
     
    336323
    337324/* port upnp discover : SSDP protocol */
    338 #define PORT (1900)
     325#define PORT 1900
     326#define XSTR(s) STR(s)
     327#define STR(s) #s
    339328#define UPNP_MCAST_ADDR "239.255.255.250"
    340329
     
    345334 * delay is in millisecond (poll) */
    346335struct UPNPDev * upnpDiscover(int delay, const char * multicastif,
    347                               const char * minissdpdsock)
     336                              const char * minissdpdsock, int sameport)
    348337{
    349338        struct UPNPDev * tmp;
     
    352341        static const char MSearchMsgFmt[] =
    353342        "M-SEARCH * HTTP/1.1\r\n"
    354         "HOST: " UPNP_MCAST_ADDR ":" "1900" "\r\n"
     343        "HOST: " UPNP_MCAST_ADDR ":" XSTR(PORT) "\r\n"
    355344        "ST: %s\r\n"
    356345        "MAN: \"ssdp:discover\"\r\n"
     
    398387    memset(&sockudp_r, 0, sizeof(struct sockaddr_in));
    399388    sockudp_r.sin_family = AF_INET;
    400 #ifdef TX_FROM_UPNP_PORT
    401     sockudp_r.sin_port = htons(PORT);
    402 #endif
     389        if(sameport)
     390        sockudp_r.sin_port = htons(PORT);
    403391    sockudp_r.sin_addr.s_addr = INADDR_ANY;
    404392    /* emission */
  • trunk/third-party/miniupnp/miniupnpc.h

    r4251 r6848  
    1 /* $Id: miniupnpc.h,v 1.17 2007/12/19 14:58:54 nanard Exp $ */
     1/* $Id: miniupnpc.h,v 1.18 2008/09/25 18:02:50 nanard Exp $ */
    22/* Project: miniupnp
    33 * http://miniupnp.free.fr/
     
    4040 * is NULL.
    4141 * If multicastif is not NULL, it will be used instead of the default
    42  * multicast interface for sending SSDP discover packets. */
     42 * multicast interface for sending SSDP discover packets.
     43 * If sameport is not null, SSDP packets will be sent from the source port
     44 * 1900 (same as destination port) otherwise system assign a source port. */
    4345LIBSPEC struct UPNPDev * upnpDiscover(int delay, const char * multicastif,
    44                                       const char * minissdpdsock);
     46                                      const char * minissdpdsock, int sameport);
    4547/* freeUPNPDevlist()
    4648 * free list returned by upnpDiscover() */
  • trunk/third-party/miniupnp/upnpcommands.h

    r5094 r6848  
    1 /* $Id: upnpcommands.h,v 1.13 2008/02/18 13:27:24 nanard Exp $ */
     1/* $Id: upnpcommands.h,v 1.14 2008/09/25 18:02:50 nanard Exp $ */
    22/* Miniupnp project : http://miniupnp.free.fr/
    33 * Author : Thomas Bernard
    4  * Copyright (c) 2005-2006 Thomas Bernard
     4 * Copyright (c) 2005-2008 Thomas Bernard
    55 * This software is subject to the conditions detailed in the
    66 * LICENCE file provided within this distribution */
Note: See TracChangeset for help on using the changeset viewer.