I'm less certain that these are unneeded because networking APIs seem to have more variation between platforms, but it's better to remove the cruft and then add back whatever headers $PLATFORM users complain about, than to not remove the cruft at all...
#include <time.h>
#include <inttypes.h>
+#include <event2/util.h> /* evutil_inet_ntop() */
+
#define ENABLE_STRNATPMPERR
#include <libnatpmp/natpmp.h>
#include "transmission.h"
#include "natpmp.h"
-#include "net.h" /* inet_ntoa() */
+#include "net.h" /* tr_netCloseSocket */
#include "port-forwarding.h"
#include "utils.h"
logVal( "readnatpmpresponseorretry", val );
if( val >= 0 )
{
- tr_ninf( getKey( ), _( "Found public address \"%s\"" ),
- inet_ntoa( response.pnu.publicaddress.addr ) );
+ char str[128];
+ evutil_inet_ntop( AF_INET, &response.pnu.publicaddress.addr, str, sizeof( str ) );
+ tr_ninf( getKey( ), _( "Found public address \"%s\"" ), str );
nat->state = TR_NATPMP_IDLE;
}
else if( val != NATPMP_TRYAGAIN )
#ifdef WIN32
#define _WIN32_WINNT 0x0501
#include <ws2tcpip.h>
-#else
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <netinet/tcp.h>
- #include <arpa/inet.h> /* inet_addr */
- #include <netdb.h>
#endif
#include <event2/util.h>
+
#include <libutp/utp.h>
#include "transmission.h"
-#include "fdlimit.h"
-#include "natpmp.h"
+#include "fdlimit.h" /* tr_fdSocketClose() */
#include "net.h"
-#include "peer-io.h"
-#include "platform.h"
-#include "session.h"
-#include "tr-utp.h"
-#include "utils.h"
+#include "peer-io.h" /* tr_peerIoAddrStr() FIXME this should be moved to net.h */
+#include "session.h" /* tr_sessionGetPublicAddress() */
+#include "tr-utp.h" /* tr_utpSendTo() */
+#include "utils.h" /* tr_time(), tr_dbg() */
#ifndef IN_MULTICAST
#define IN_MULTICAST( a ) ( ( ( a ) & 0xf0000000 ) == 0xe0000000 )
#include <inttypes.h>
#include <ws2tcpip.h>
#else
- #include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
- #include <arpa/inet.h>
#endif
#ifdef WIN32
#include <limits.h> /* INT_MAX */
#include <string.h>
-#ifdef WIN32
- #include <winsock2.h>
-#else
- #include <arpa/inet.h> /* inet_ntoa */
-#endif
-
#include <event2/event.h>
#include <event2/buffer.h>
#include <event2/bufferevent.h>
/* we found a suitable peer, add it to the torrent */
tr_peerMgrAddPex( tor, TR_PEER_FROM_LPD, peer, -1 );
tr_tordbg( tor, "Learned %d local peer from LPD (%s:%u)",
- 1, inet_ntoa( peer->addr.addr.addr4 ), peerPort );
+ 1, tr_ntop_non_ts( &peer->addr ), peerPort );
/* periodic reconnectPulse() deals with the rest... */
*/
#include <errno.h>
-#include <stdio.h>
+#include <stdio.h> /* fprintf() */
#include <stdlib.h> /* EXIT_FAILURE */
#include <unistd.h> /* getcwd() */
* $Id$
*/
-#include <stdio.h>
+#include <stdio.h> /* fprintf() */
#include <string.h> /* strlen(), strstr(), strcmp() */
#include <stdlib.h> /* EXIT_FAILURE */
* $Id$
*/
-#include <stdio.h>
+#include <stdio.h> /* fprintf() */
#include <string.h> /* strcmp(), strchr(), memcmp() */
#include <stdlib.h> /* getenv(), qsort() */
#include <time.h>