#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__)
+#ifdef __DARWIN__
+ #include <CoreServices/CoreServices.h>
+
+ #ifndef FALSE
+ #define FALSE 0
+ #endif
+ #ifndef TRUE
+ #define TRUE 1
+ #endif
+#else
+ #define OTUNIXERRORS 1
+ #include <OpenTransport.h>
+ #include <OpenTransportProviders.h>
+ #include <OpenTptInternet.h>
+#endif
+#if TARGET_CARBON
+ #define OTAssert( str , cond ) /* does not exists in Carbon */
+#endif
+
#include <assert.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <stddef.h>
#include <ctype.h>
-#define OTUNIXERRORS 1
-#include <OpenTransport.h>
-#include <OpenTransportProviders.h>
-#include <OpenTptInternet.h>
-#if TARGET_CARBON
- #define OTAssert( str , cond ) /* does not exists in Carbon */
-#endif
#include <utime.h>
/*
#define qDebug2 1
extern pascal void OTDebugStr(const char* str);
#endif
-#include <OTDebug.h>
+#ifndef __DARWIN__
+ #include <OTDebug.h>
+#endif
InetSvcRef gInetSvcRef = 0 ;
ret.opt.maxlen = kOTFourByteOptionSize;
opt->level = INET_IP; // dealing with an IP Level function
+#ifdef __DARWIN__
+ opt->name = kIP_REUSEADDR;
+#else
opt->name = IP_REUSEADDR;
+#endif
opt->len = kOTFourByteOptionSize;
opt->status = 0;
*(UInt32*)opt->value = enableReuseIPMode; // set the desired option level, true or false
int GSocket_Init()
{
- OSStatus err ;
+ OSStatus err ;
#if TARGET_CARBON
- InitOpenTransportInContext( kInitOTForApplicationMask , NULL ) ;
+ // Marc Newsam: added the clientcontext variable
+ // however, documentation is unclear how this works
+ OTClientContextPtr clientcontext;
+
+ InitOpenTransportInContext(kInitOTForApplicationMask, &clientcontext);
+ gInetSvcRef = OTOpenInternetServicesInContext(kDefaultInternetServicesPath,
+ NULL, &err, clientcontext);
#else
- InitOpenTransport() ;
+ InitOpenTransport() ;
+ gInetSvcRef = OTOpenInternetServices(kDefaultInternetServicesPath, NULL, &err);
#endif
- gInetSvcRef = OTOpenInternetServices(kDefaultInternetServicesPath, NULL, &err);
- if ( gInetSvcRef == NULL || err != kOTNoError )
- {
- OTAssert("Could not open Inet Services", err == noErr);
- return FALSE ;
- }
- return TRUE;
+ if ( gInetSvcRef == NULL || err != kOTNoError )
+ {
+ OTAssert("Could not open Inet Services", err == noErr);
+ return FALSE ;
+ }
+ return TRUE;
}
void GSocket_Cleanup()
GAddress *GSocket_GetLocal(GSocket *socket)
{
GAddress *address = NULL ;
- InetAddress addr;
GSocketError err;
InetAddress loc ;
{
OTFlags flags ;
OTResult res ;
+ OTByteCount sz = 0 ;
- size_t sz = 0 ;
OTCountDataBytes( socket->m_endpoint , &sz ) ;
res = OTRcv( socket->m_endpoint , buffer , size , &flags ) ;
if ( res < 0 )
// we simulate another read event if there are still bytes
if ( socket->m_takesEvents )
{
- size_t sz = 0 ;
+ OTByteCount sz = 0 ;
OTCountDataBytes( socket->m_endpoint , &sz ) ;
if ( sz > 0 )
{
assert(address != NULL);
CHECK_ADDRESS(address, INET, GSOCK_INVADDR);
- OTInetAddressToName( gInetSvcRef , address->m_host , &name ) ;
+ OTInetAddressToName( gInetSvcRef , address->m_host , name ) ;
strncpy( hostname , name , sbuf ) ;
return GSOCK_NOERROR;
}
state = OTGetEndpointState(socket->m_endpoint);
{
- size_t sz = 0 ;
+ OTByteCount sz = 0 ;
OTCountDataBytes( socket->m_endpoint , &sz ) ;
if ( state == T_INCON || sz > 0 )
{
while( (now.hi * 4294967296.0 + now.lo) - (start.hi * 4294967296.0 + start.lo) < socket->m_timeout * 1000.0 )
{
OTResult state ;
- size_t sz = 0 ;
+ OTByteCount sz = 0 ;
state = OTGetEndpointState(socket->m_endpoint);
OTCountDataBytes( socket->m_endpoint , &sz ) ;
}
+/* Hack added for Mac OS X */
+GSocketError GAddress_UNIX_GetPath(GAddress *addr, char *path, size_t buf)
+{
+}
+
+GSocketError GAddress_UNIX_SetPath(GAddress *addr, const char *path)
+{
+}
+
#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */