Changeset 8798


Ignore:
Timestamp:
Jul 13, 2009, 4:00:21 PM (14 years ago)
Author:
charles
Message:

(trunk third-party) #2273: update to latest libnatpmp and miniupnpc libraries

Location:
trunk/third-party
Files:
1 added
11 edited

Legend:

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

    r8735 r8798  
    11libnatpmp is written by Thomas Bernard.
    22Its homepage is http://miniupnp.tuxfamily.org/libnatpmp.html
    3 This code is from the libnatpmp-20090605 snapshot
     3This code is from the libnatpmp-20090713 snapshot
    44
  • trunk/third-party/libnatpmp/getgateway.c

    r8735 r8798  
    1 /* $Id: getgateway.c,v 1.14 2009/06/04 22:27:53 nanard Exp $ */
     1/* $Id: getgateway.c,v 1.15 2009/07/13 08:36:02 nanard Exp $ */
    22/* libnatpmp
    33 * Copyright (c) 2007-2008, Thomas BERNARD <miniupnp@free.fr>
     
    6666#include <w32api/winbase.h>
    6767#include <w32api/winreg.h>
     68#endif
     69
     70#ifdef __HAIKU__
     71#include <stdlib.h>
     72#include <unistd.h>
     73#include <net/if.h>
     74#include <sys/sockio.h>
     75#define USE_HAIKU_CODE
    6876#endif
    6977
     
    433441#endif /* #ifdef USE_WIN32_CODE */
    434442
     443#ifdef USE_HAIKU_CODE
     444int getdefaultgateway(in_addr_t *addr)
     445{
     446    int fd, ret = -1;
     447    struct ifconf config;
     448    void *buffer = NULL;
     449    struct ifreq *interface;
     450
     451    if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
     452        return -1;
     453    }
     454    if (ioctl(fd, SIOCGRTSIZE, &config, sizeof(config)) != 0) {
     455        goto fail;
     456    }
     457    if (config.ifc_value < 1) {
     458        goto fail; /* No routes */
     459    }
     460    if ((buffer = malloc(config.ifc_value)) == NULL) {
     461        goto fail;
     462    }
     463    config.ifc_len = config.ifc_value;
     464    config.ifc_buf = buffer;
     465    if (ioctl(fd, SIOCGRTTABLE, &config, sizeof(config)) != 0) {
     466        goto fail;
     467    }
     468    for (interface = buffer;
     469      (uint8_t *)interface < (uint8_t *)buffer + config.ifc_len; ) {
     470        struct route_entry route = interface->ifr_route;
     471        int intfSize;
     472        if (route.flags & (RTF_GATEWAY | RTF_DEFAULT)) {
     473            *addr = ((struct sockaddr_in *)route.gateway)->sin_addr.s_addr;
     474            ret = 0;
     475            break;
     476        }
     477        intfSize = sizeof(route) + IF_NAMESIZE;
     478        if (route.destination != NULL) {
     479            intfSize += route.destination->sa_len;
     480        }
     481        if (route.mask != NULL) {
     482            intfSize += route.mask->sa_len;
     483        }
     484        if (route.gateway != NULL) {
     485            intfSize += route.gateway->sa_len;
     486        }
     487        interface = (struct ifreq *)((uint8_t *)interface + intfSize);
     488    }
     489fail:
     490    free(buffer);
     491    close(fd);
     492    return ret;
     493}
     494#endif /* #ifdef USE_HAIKU_CODE */
     495
     496
  • trunk/third-party/libnatpmp/natpmp.c

    r8735 r8798  
    8181}
    8282
    83 int sendpendingrequest(natpmp_t * p)
     83static int sendpendingrequest(natpmp_t * p)
    8484{
    8585        int r;
     
    9797}
    9898
    99 int sendnatpmprequest(natpmp_t * p)
     99static int sendnatpmprequest(natpmp_t * p)
    100100{
    101101        int n;
  • trunk/third-party/miniupnp/Changelog.txt

    r7837 r8798  
    1 $Id: Changelog.txt,v 1.77 2008/12/18 17:47:32 nanard Exp $
     1$Id: Changelog.txt,v 1.82 2009/07/09 16:14:06 nanard Exp $
    22miniUPnP client Changelog.
     3
     42009/07/09:
     5  Compile under Haiku
     6  generate miniupnpcstrings.h.in from miniupnpcstrings.h
     7
     82009/06/04:
     9  patching to compile under CygWin and cross compile for minGW
     10
     112009/04/17:
     12  updating python module
     13  Use strtoull() when using C99
     14
     152009/02/28:
     16  Fixed miniwget.c for compiling under sun
    317
    4182008/12/18:
  • trunk/third-party/miniupnp/README

    r8735 r8798  
    11MiniUPnP is written by Thomas Bernard.
    22Its homepage is http://miniupnp.free.fr/
    3 This is from miniupnpc-20090605.tar.gz
     3This is from miniupnpc-20090713.tar.gz
  • trunk/third-party/miniupnp/miniupnpc.c

    r7837 r8798  
    1 /* $Id: miniupnpc.c,v 1.57 2008/12/18 17:46:36 nanard Exp $ */
     1/* $Id: miniupnpc.c,v 1.58 2009/07/09 15:59:46 nanard Exp $ */
    22/* Project : miniupnp
    33 * Author : Thomas BERNARD
     
    1111/* Win32 Specific includes and defines */
    1212#include <winsock2.h>
    13 #include <Ws2tcpip.h>
     13#include <ws2tcpip.h>
    1414#include <io.h>
    1515#define snprintf _snprintf
     
    5050
    5151/* root description parsing */
    52 void parserootdesc(const char * buffer, int bufsize, struct IGDdatas * data)
     52LIBSPEC void parserootdesc(const char * buffer, int bufsize, struct IGDdatas * data)
    5353{
    5454        struct xmlparser parser;
     
    341341 * It is up to the caller to free the chained list
    342342 * delay is in millisecond (poll) */
    343 struct UPNPDev * upnpDiscover(int delay, const char * multicastif,
     343LIBSPEC struct UPNPDev * upnpDiscover(int delay, const char * multicastif,
    344344                              const char * minissdpdsock, int sameport)
    345345{
     
    490490/* freeUPNPDevlist() should be used to
    491491 * free the chained list returned by upnpDiscover() */
    492 void freeUPNPDevlist(struct UPNPDev * devlist)
     492LIBSPEC void freeUPNPDevlist(struct UPNPDev * devlist)
    493493{
    494494        struct UPNPDev * next;
     
    526526/* Prepare the Urls for usage...
    527527 */
    528 void GetUPNPUrls(struct UPNPUrls * urls, struct IGDdatas * data,
     528LIBSPEC void GetUPNPUrls(struct UPNPUrls * urls, struct IGDdatas * data,
    529529                 const char * descURL)
    530530{
     
    569569}
    570570
    571 void
     571LIBSPEC void
    572572FreeUPNPUrls(struct UPNPUrls * urls)
    573573{
     
    627627}
    628628
    629 int
     629static int
    630630UPNPIGD_IsConnected(struct UPNPUrls * urls, struct IGDdatas * data)
    631631{
     
    656656 * free allocated memory.
    657657 */
    658 int
     658LIBSPEC int
    659659UPNP_GetValidIGD(struct UPNPDev * devlist,
    660660                 struct UPNPUrls * urls,
  • trunk/third-party/miniupnp/miniupnpcstrings.h

    r8735 r8798  
    1 /* $Id: miniupnpcstrings.h,v 1.3 2009/06/04 09:05:56 nanard Exp $ */
     1/* $Id: miniupnpcstrings.h.in,v 1.1 2009/07/09 16:13:31 nanard Exp $ */
    22/* Project: miniupnp
    33 * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
     
    99#define __MINIUPNPCSTRINGS_H__
    1010
    11 #define OS_STRING "OpenBSD/4.3"
     11#define OS_STRING "RedHatEnterpriseClient/5.3"
    1212#define MINIUPNPC_VERSION_STRING "1.3"
    1313
  • trunk/third-party/miniupnp/miniwget.c

    r8263 r8798  
    3232
    3333#include "miniupnpcstrings.h"
     34#include "miniwget.h"
    3435
    3536/* miniwget2() :
  • trunk/third-party/miniupnp/minixml.c

    r3731 r8798  
    3636 * return 0 (false) in case of success and -1 (true) if the end
    3737 * of the xmlbuffer is reached. */
    38 int parseatt(struct xmlparser * p)
     38static int parseatt(struct xmlparser * p)
    3939{
    4040        const char * attname;
     
    107107/* parseelt parse the xml stream and
    108108 * call the callback functions when needed... */
    109 void parseelt(struct xmlparser * p)
     109static void parseelt(struct xmlparser * p)
    110110{
    111111        int i;
  • trunk/third-party/miniupnp/upnpcommands.c

    r8263 r8798  
    1 /* $Id: upnpcommands.c,v 1.24 2009/04/17 21:21:19 nanard Exp $ */
     1/* $Id: upnpcommands.c,v 1.25 2009/07/09 16:00:42 nanard Exp $ */
    22/* Project : miniupnp
    33 * Author : Thomas Bernard
     
    2020/*
    2121 * */
    22 UNSIGNED_INTEGER
     22LIBSPEC UNSIGNED_INTEGER
    2323UPNP_GetTotalBytesSent(const char * controlURL,
    2424                                        const char * servicetype)
     
    4040/*
    4141 * */
    42 UNSIGNED_INTEGER
     42LIBSPEC UNSIGNED_INTEGER
    4343UPNP_GetTotalBytesReceived(const char * controlURL,
    4444                                                const char * servicetype)
     
    6060/*
    6161 * */
    62 UNSIGNED_INTEGER
     62LIBSPEC UNSIGNED_INTEGER
    6363UPNP_GetTotalPacketsSent(const char * controlURL,
    6464                                                const char * servicetype)
     
    8080/*
    8181 * */
    82 UNSIGNED_INTEGER
     82LIBSPEC UNSIGNED_INTEGER
    8383UPNP_GetTotalPacketsReceived(const char * controlURL,
    8484                                                const char * servicetype)
     
    100100/* UPNP_GetStatusInfo() call the corresponding UPNP method
    101101 * returns the current status and uptime */
    102 int UPNP_GetStatusInfo(const char * controlURL,
    103                                         const char * servicetype,
    104                                         char * status,
    105                                         unsigned int * uptime,
    106                                         char * lastconnerror)
     102LIBSPEC int
     103UPNP_GetStatusInfo(const char * controlURL,
     104                                const char * servicetype,
     105                                char * status,
     106                                unsigned int * uptime,
     107                                char * lastconnerror)
    107108{
    108109        struct NameValueParserData pdata;
     
    160161/* UPNP_GetConnectionTypeInfo() call the corresponding UPNP method
    161162 * returns the connection type */
    162 int UPNP_GetConnectionTypeInfo(const char * controlURL,
    163                                const char * servicetype,
    164                                char * connectionType)
     163LIBSPEC int
     164UPNP_GetConnectionTypeInfo(const char * controlURL,
     165                           const char * servicetype,
     166                           char * connectionType)
    165167{
    166168        struct NameValueParserData pdata;
     
    199201 * Note : GetLinkLayerMaxBitRates belongs to WANPPPConnection:1 only
    200202 * We can use the GetCommonLinkProperties from WANCommonInterfaceConfig:1 */
    201 int UPNP_GetLinkLayerMaxBitRates(const char * controlURL, const char * servicetype, unsigned int * bitrateDown, unsigned int* bitrateUp)
     203LIBSPEC int
     204UPNP_GetLinkLayerMaxBitRates(const char * controlURL,
     205                             const char * servicetype,
     206                             unsigned int * bitrateDown,
     207                             unsigned int* bitrateUp)
    202208{
    203209        struct NameValueParserData pdata;
     
    227233                ret = UPNPCOMMAND_SUCCESS;
    228234
    229         if(bitrateDown)
    230         {
     235        if(bitrateDown) {
    231236                if(down)
    232237                        sscanf(down,"%u",bitrateDown);
     
    235240        }
    236241
    237         if(bitrateUp)
    238         {
     242        if(bitrateUp) {
    239243                if(up)
    240244                        sscanf(up,"%u",bitrateUp);
     
    263267 * 501 Action Failed - See UPnP Device Architecture section on Control.
    264268 */
    265 int UPNP_GetExternalIPAddress(const char * controlURL,
    266                               const char * servicetype,
    267                                                           char * extIpAdd)
     269LIBSPEC int
     270UPNP_GetExternalIPAddress(const char * controlURL,
     271                          const char * servicetype,
     272                          char * extIpAdd)
    268273{
    269274        struct NameValueParserData pdata;
     
    298303}
    299304
    300 int
     305LIBSPEC int
    301306UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
    302307                    const char * extPort,
     
    352357}
    353358
    354 int
     359LIBSPEC int
    355360UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
    356361                       const char * extPort, const char * proto,
     
    392397}
    393398
    394 int UPNP_GetGenericPortMappingEntry(const char * controlURL,
    395                                      const char * servicetype,
    396                                                                          const char * index,
    397                                                                          char * extPort,
    398                                                                          char * intClient,
    399                                                                          char * intPort,
    400                                                                          char * protocol,
    401                                                                          char * desc,
    402                                                                          char * enabled,
    403                                                                          char * rHost,
    404                                                                          char * duration)
     399LIBSPEC int
     400UPNP_GetGenericPortMappingEntry(const char * controlURL,
     401                                const char * servicetype,
     402                                                         const char * index,
     403                                                         char * extPort,
     404                                                         char * intClient,
     405                                                         char * intPort,
     406                                                         char * protocol,
     407                                                         char * desc,
     408                                                         char * enabled,
     409                                                         char * rHost,
     410                                                         char * duration)
    405411{
    406412        struct NameValueParserData pdata;
     
    481487}
    482488
    483 int UPNP_GetPortMappingNumberOfEntries(const char * controlURL, const char * servicetype, unsigned int * numEntries)
     489LIBSPEC int
     490UPNP_GetPortMappingNumberOfEntries(const char * controlURL,
     491                                   const char * servicetype,
     492                                   unsigned int * numEntries)
    484493{
    485494        struct NameValueParserData pdata;
     
    514523 * the result is returned in the intClient and intPort strings
    515524 * please provide 16 and 6 bytes of data */
    516 int
     525LIBSPEC int
    517526UPNP_GetSpecificPortMappingEntry(const char * controlURL,
    518527                                 const char * servicetype,
  • trunk/third-party/miniupnp/upnpreplyparse.h

    r5094 r8798  
    1 /* $Id: upnpreplyparse.h,v 1.8 2008/02/21 13:05:27 nanard Exp $ */
     1/* $Id: upnpreplyparse.h,v 1.10 2009/07/09 16:01:50 nanard Exp $ */
    22/* MiniUPnP project
    33 * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
    4  * (c) 2006 Thomas Bernard
     4 * (c) 2006-2009 Thomas Bernard
    55 * This software is subject to the conditions detailed
    66 * in the LICENCE file provided within the distribution */
     
    99#define __UPNPREPLYPARSE_H__
    1010
    11 #if defined(NO_SYS_QUEUE_H) || defined(WIN32)
     11#if defined(NO_SYS_QUEUE_H) || defined(WIN32) || defined(__HAIKU__)
    1212#include "bsdqueue.h"
    1313#else
Note: See TracChangeset for help on using the changeset viewer.