1 /* -------------------------------------------------------------------------
2 * Project: GSocket (Generic Socket) for WX
4 * Purpose: GSocket Macintosh header
6 * -------------------------------------------------------------------------
12 #ifndef __GSOCKET_STANDALONE__
16 #if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__)
18 #ifndef __GSOCKET_STANDALONE__
19 #include "wx/gsocket.h"
26 #include <MacHeaders.c>
27 #define OTUNIXERRORS 1
28 // we get a conflict in OT headers otherwise :
30 #include <OpenTransport.h>
31 #include <OpenTransportProviders.h>
32 #include <OpenTptInternet.h>
36 /* Definition of GSocket */
42 bool IsOk() { return m_ok
; }
45 GSocketError
SetLocal(GAddress
*address
);
46 GSocketError
SetPeer(GAddress
*address
);
49 GSocketError
SetServer();
50 GSocket
*WaitConnection();
51 bool SetReusable() { return false; }
52 GSocketError
SetNonOriented();
53 GSocketError
Connect(GSocketStream stream
);
54 int Read(char *buffer
, int size
);
55 int Write(const char *buffer
, int size
);
56 GSocketEventFlags
Select(GSocketEventFlags flags
);
57 void SetNonBlocking(bool non_block
);
58 void SetTimeout(unsigned long millisec
);
59 GSocketError WXDLLIMPEXP_NET
GetError();
60 void SetCallback(GSocketEventFlags flags
,
61 GSocketCallback callback
, char *cdata
);
62 void UnsetCallback(GSocketEventFlags flags
);
63 GSocketError
GetSockOpt(int level
, int optname
, void *optval
, int *optlen
)
64 { return GSOCK_INVOP
; }
65 GSocketError
SetSockOpt(int level
, int optname
,
66 const void *optval
, int optlen
)
67 { return GSOCK_INVOP
; }
73 GSocketError
Input_Timeout();
74 GSocketError
Output_Timeout();
75 int Recv_Stream(char *buffer
, int size
);
76 int Recv_Dgram(char *buffer
, int size
);
77 int Send_Stream(const char *buffer
, int size
);
78 int Send_Dgram(const char *buffer
, int size
);
82 void Disable_Events();
84 // TODO: Make these protected
86 wxMacNotifierTableRef m_mac_events
;
87 EndpointRef m_endpoint
;
96 unsigned long m_timeout
;
99 GSocketEventFlags m_detected
;
100 GSocketCallback m_cbacks
[GSOCK_MAX_EVENT
];
101 char *m_data
[GSOCK_MAX_EVENT
];
108 #endif /* __cplusplus */
110 /* Definition of GAddress */
116 GAddressType m_family
;
117 GSocketError m_error
;
122 void _GSocket_Internal_Proc(unsigned long e
, void* data
) ;
126 GSocketError
_GAddress_translate_from(GAddress
*address
,
128 GSocketError
_GAddress_translate_to(GAddress
*address
,
131 GSocketError
_GAddress_Init_INET(GAddress
*address
);
135 #endif /* __cplusplus */
137 #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
139 #endif /* __GSOCK_UNX_H */