miniupnp.tuxfamily.org Forum Index miniupnp.tuxfamily.org
The forum about miniupnp and libnatpmp
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[patch] Changes for MinGW (using Fedora cross-tools)

 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpc Compilation/Installation
View previous topic :: View next topic  
Author Message
rb07



Joined: 31 May 2009
Posts: 8

PostPosted: Sun May 31, 2009 1:34 am    Post subject: [patch] Changes for MinGW (using Fedora cross-tools) Reply with quote

As part of building Transmission (1.61) for Windows I had to make the following changes (plus others to libnatpmp):

Code:
diff -NaurX diff-excludes.txt transmission-1.61-orig/third-party/miniupnp/minissdpc.c transmission-1.61/third-party/miniupnp/minissdpc.c
--- transmission-1.61-orig/third-party/miniupnp/minissdpc.c   2009-05-12 00:32:38.000000000 +0000
+++ transmission-1.61/third-party/miniupnp/minissdpc.c   2009-05-23 03:17:26.395365582 +0000
@@ -12,8 +12,14 @@
 #include <sys/types.h>
 #ifdef WIN32
 #include <winsock2.h>
-#include <Ws2tcpip.h>
+#include <ws2tcpip.h>
 #include <io.h>
+/* Hack */
+#define UNIX_PATH_LEN   108
+struct sockaddr_un {
+  uint16_t   sun_family;
+  char      sun_path[UNIX_PATH_LEN];
+};
 #else
 #include <sys/socket.h>
 #include <sys/un.h>
diff -NaurX diff-excludes.txt transmission-1.61-orig/third-party/miniupnp/miniupnpc.c transmission-1.61/third-party/miniupnp/miniupnpc.c
--- transmission-1.61-orig/third-party/miniupnp/miniupnpc.c   2009-05-12 00:32:38.000000000 +0000
+++ transmission-1.61/third-party/miniupnp/miniupnpc.c   2009-05-23 08:07:56.859450767 +0000
@@ -10,7 +10,7 @@
 #ifdef WIN32
 /* Win32 Specific includes and defines */
 #include <winsock2.h>
-#include <Ws2tcpip.h>
+#include <ws2tcpip.h>
 #include <io.h>
 #define snprintf _snprintf
 #if defined(_MSC_VER) && (_MSC_VER >= 1400)
@@ -49,7 +49,7 @@
 #define SERVICEPREFIX2 'u'
 
 /* root description parsing */
-void parserootdesc(const char * buffer, int bufsize, struct IGDdatas * data)
+LIBSPEC void parserootdesc(const char * buffer, int bufsize, struct IGDdatas * data)
 {
    struct xmlparser parser;
    /* xmlparser object */
@@ -340,7 +340,7 @@
  * no devices was found.
  * It is up to the caller to free the chained list
  * delay is in millisecond (poll) */
-struct UPNPDev * upnpDiscover(int delay, const char * multicastif,
+LIBSPEC struct UPNPDev * upnpDiscover(int delay, const char * multicastif,
                               const char * minissdpdsock, int sameport)
 {
    struct UPNPDev * tmp;
@@ -489,7 +489,7 @@
 
 /* freeUPNPDevlist() should be used to
  * free the chained list returned by upnpDiscover() */
-void freeUPNPDevlist(struct UPNPDev * devlist)
+LIBSPEC void freeUPNPDevlist(struct UPNPDev * devlist)
 {
    struct UPNPDev * next;
    while(devlist)
@@ -525,7 +525,7 @@
 
 /* Prepare the Urls for usage...
  */
-void GetUPNPUrls(struct UPNPUrls * urls, struct IGDdatas * data,
+LIBSPEC void GetUPNPUrls(struct UPNPUrls * urls, struct IGDdatas * data,
                  const char * descURL)
 {
    char * p;
@@ -568,7 +568,7 @@
 #endif
 }
 
-void
+LIBSPEC void
 FreeUPNPUrls(struct UPNPUrls * urls)
 {
    if(!urls)
@@ -655,7 +655,7 @@
  * passed as parameters are set. Donc forget to call FreeUPNPUrls(urls) to
  * free allocated memory.
  */
-int
+LIBSPEC int
 UPNP_GetValidIGD(struct UPNPDev * devlist,
                  struct UPNPUrls * urls,
              struct IGDdatas * data,
@@ -722,7 +722,7 @@
  * return value :
  *   0 - Not ok
  *   1 - OK */
-int
+LIBSPEC int
 UPNP_GetIGDFromUrl(const char * rootdescurl,
                    struct UPNPUrls * urls,
                    struct IGDdatas * data,
diff -NaurX diff-excludes.txt transmission-1.61-orig/third-party/miniupnp/upnpcommands.c transmission-1.61/third-party/miniupnp/upnpcommands.c
--- transmission-1.61-orig/third-party/miniupnp/upnpcommands.c   2009-05-12 00:32:38.000000000 +0000
+++ transmission-1.61/third-party/miniupnp/upnpcommands.c   2009-05-23 08:12:56.793365936 +0000
@@ -19,7 +19,7 @@
 
 /*
  * */
-UNSIGNED_INTEGER
+LIBSPEC UNSIGNED_INTEGER
 UPNP_GetTotalBytesSent(const char * controlURL,
                const char * servicetype)
 {
@@ -39,7 +39,7 @@
 
 /*
  * */
-UNSIGNED_INTEGER
+LIBSPEC UNSIGNED_INTEGER
 UPNP_GetTotalBytesReceived(const char * controlURL,
                   const char * servicetype)
 {
@@ -59,7 +59,7 @@
 
 /*
  * */
-UNSIGNED_INTEGER
+LIBSPEC UNSIGNED_INTEGER
 UPNP_GetTotalPacketsSent(const char * controlURL,
                   const char * servicetype)
 {
@@ -79,7 +79,7 @@
 
 /*
  * */
-UNSIGNED_INTEGER
+LIBSPEC UNSIGNED_INTEGER
 UPNP_GetTotalPacketsReceived(const char * controlURL,
                   const char * servicetype)
 {
@@ -99,7 +99,7 @@
 
 /* UPNP_GetStatusInfo() call the corresponding UPNP method
  * returns the current status and uptime */
-int UPNP_GetStatusInfo(const char * controlURL,
+LIBSPEC int UPNP_GetStatusInfo(const char * controlURL,
                const char * servicetype,
                char * status,
                unsigned int * uptime,
@@ -159,7 +159,7 @@
 
 /* UPNP_GetConnectionTypeInfo() call the corresponding UPNP method
  * returns the connection type */
-int UPNP_GetConnectionTypeInfo(const char * controlURL,
+LIBSPEC int UPNP_GetConnectionTypeInfo(const char * controlURL,
                                const char * servicetype,
                                char * connectionType)
 {
@@ -198,7 +198,7 @@
  * One of the values can be null
  * Note : GetLinkLayerMaxBitRates belongs to WANPPPConnection:1 only
  * We can use the GetCommonLinkProperties from WANCommonInterfaceConfig:1 */
-int UPNP_GetLinkLayerMaxBitRates(const char * controlURL, const char * servicetype, unsigned int * bitrateDown, unsigned int* bitrateUp)
+LIBSPEC int UPNP_GetLinkLayerMaxBitRates(const char * controlURL, const char * servicetype, unsigned int * bitrateDown, unsigned int* bitrateUp)
 {
    struct NameValueParserData pdata;
    char buffer[4096];
@@ -262,7 +262,7 @@
  * 402 Invalid Args - See UPnP Device Architecture section on Control.
  * 501 Action Failed - See UPnP Device Architecture section on Control.
  */
-int UPNP_GetExternalIPAddress(const char * controlURL,
+LIBSPEC int UPNP_GetExternalIPAddress(const char * controlURL,
                               const char * servicetype,
                        char * extIpAdd)
 {
@@ -297,7 +297,7 @@
    return ret;
 }
 
-int
+LIBSPEC int
 UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
                     const char * extPort,
                const char * inPort,
@@ -351,7 +351,7 @@
    return ret;
 }
 
-int
+LIBSPEC int
 UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
                        const char * extPort, const char * proto,
                        const char * remoteHost)
@@ -391,7 +391,7 @@
    return ret;
 }
 
-int UPNP_GetGenericPortMappingEntry(const char * controlURL,
+LIBSPEC int UPNP_GetGenericPortMappingEntry(const char * controlURL,
                                      const char * servicetype,
                             const char * index,
                             char * extPort,
@@ -480,7 +480,7 @@
    return r;
 }
 
-int UPNP_GetPortMappingNumberOfEntries(const char * controlURL, const char * servicetype, unsigned int * numEntries)
+LIBSPEC int UPNP_GetPortMappingNumberOfEntries(const char * controlURL, const char * servicetype, unsigned int * numEntries)
 {
     struct NameValueParserData pdata;
     char buffer[4096];
@@ -513,7 +513,7 @@
 /* UPNP_GetSpecificPortMappingEntry retrieves an existing port mapping
  * the result is returned in the intClient and intPort strings
  * please provide 16 and 6 bytes of data */
-int
+LIBSPEC int
 UPNP_GetSpecificPortMappingEntry(const char * controlURL,
                                  const char * servicetype,
                                  const char * extPort,



As you may well know, Transmission includes miniupnpc-1.3; the build was made as a cross-build from Fedora (Linux) to MinGW (Windows).

The case sensitive build environment did create problems that a pure MinGW build won't find. On the other hand, making those changes won't affect a pure MinGW build.
_________________
R.B.
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Thu Jun 04, 2009 9:49 pm    Post subject: Reply with quote

thanks. These modifications will be available in next release.
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpc Compilation/Installation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP
© 2007 Thomas Bernard, author of MiniUPNP.