/* -------------------------------------------------------------------------
* Project: GSocket (Generic Socket) for WX
- * Name: gsocket.cpp
+ * Name: src/mac/carbon/gsocket.cpp
* Copyright: (c) Guilhem Lavaux
* Licence: wxWindows Licence
* Authors: Guilhem Lavaux,
*/
#ifndef __GSOCKET_STANDALONE__
-#include "wx/setup.h"
#include "wx/platform.h"
#endif
*/
}
-/* Global initialisers */
-
-void GSocket_SetGUIFunctions(GSocketGUIFunctionsTable *table)
-{
- // do nothing, wxMac doesn't have wxBase-GUI separation yet
-}
-
-int GSocket_Init()
+bool GSocket_Init()
{
- return 1;
+ return true;
}
-bool GSocket_Verify_Inited() ;
bool GSocket_Verify_Inited()
{
OSStatus err ;
if ((bind(m_endpoint, m_local->m_addr, m_local->m_len) != 0) ||
(getsockname(m_endpoint,
m_local->m_addr,
- (SOCKLEN_T *) &m_local->m_len) != 0) ||
+ (WX_SOCKLEN_T *) &m_local->m_len) != 0) ||
(listen(m_endpoint, 5) != 0))
{
close(m_endpoint);
// TODO
#if 0
- connection->m_endpoint = accept(m_endpoint, &from, (SOCKLEN_T *) &fromlen);
+ connection->m_endpoint = accept(m_endpoint, &from, (WX_SOCKLEN_T *) &fromlen);
#endif
if (connection->m_endpoint == kOTInvalidEndpointRef )
if ((bind(m_endpoint, m_local->m_addr, m_local->m_len) != 0) ||
(getsockname(m_endpoint,
m_local->m_addr,
- (SOCKLEN_T *) &m_local->m_len) != 0))
+ (WX_SOCKLEN_T *) &m_local->m_len) != 0))
{
close(m_endpoint);
m_endpoint = -1;
{
/*
int error;
- SOCKLEN_T len = sizeof(error);
+ WX_SOCKLEN_T len = sizeof(error);
getsockopt(m_endpoint, SOL_SOCKET, SO_ERROR, (void*) &error, &len);
int ret = -1;
#if 0
struct sockaddr from;
- SOCKLEN_T fromlen = sizeof(from);
+ WX_SOCKLEN_T fromlen = sizeof(from);
GSocketError err;
fromlen = sizeof(from);
- ret = recvfrom(m_endpoint, buffer, size, 0, &from, (SOCKLEN_T *) &fromlen);
+ ret = recvfrom(m_endpoint, buffer, size, 0, &from, (WX_SOCKLEN_T *) &fromlen);
if (ret == -1)
return -1;
return GSOCK_NOERROR;
}
+GSocketError GAddress_INET_SetBroadcastAddress(GAddress *address)
+{
+ return GAddress_INET_SetHostAddress(address, INADDR_BROADCAST);
+}
+
GSocketError GAddress_INET_SetAnyAddress(GAddress *address)
{
return GAddress_INET_SetHostAddress(address, INADDR_ANY);