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"
24 #include <MacHeaders.c>
25 #define OTUNIXERRORS 1
26 #include <OpenTransport.h>
27 #include <OpenTransportProviders.h>
28 #include <OpenTptInternet.h>
30 /* Definition of GSocket */
36 bool IsOk() { return m_ok
; }
39 GSocketError
SetLocal(GAddress
*address
);
40 GSocketError
SetPeer(GAddress
*address
);
43 GSocketError
SetServer();
44 GSocket
*WaitConnection();
45 bool SetReusable() { return false; }
46 GSocketError
SetNonOriented();
47 GSocketError
Connect(GSocketStream stream
);
48 int Read(char *buffer
, int size
);
49 int Write(const char *buffer
, int size
);
50 GSocketEventFlags
Select(GSocketEventFlags flags
);
51 void SetNonBlocking(bool non_block
);
52 void SetTimeout(unsigned long millisec
);
53 GSocketError WXDLLIMPEXP_NET
GetError();
54 void SetCallback(GSocketEventFlags flags
,
55 GSocketCallback callback
, char *cdata
);
56 void UnsetCallback(GSocketEventFlags flags
);
57 GSocketError
GetSockOpt(int level
, int optname
, void *optval
, int *optlen
)
58 { return GSOCK_INVOP
; }
59 GSocketError
SetSockOpt(int level
, int optname
,
60 const void *optval
, int optlen
)
61 { return GSOCK_INVOP
; }
67 GSocketError
Input_Timeout();
68 GSocketError
Output_Timeout();
69 int Recv_Stream(char *buffer
, int size
);
70 int Recv_Dgram(char *buffer
, int size
);
71 int Send_Stream(const char *buffer
, int size
);
72 int Send_Dgram(const char *buffer
, int size
);
76 void Disable_Events();
78 // TODO: Make these protected
80 wxMacNotifierTableRef m_mac_events
;
81 EndpointRef m_endpoint
;
90 unsigned long m_timeout
;
93 GSocketEventFlags m_detected
;
94 GSocketCallback m_cbacks
[GSOCK_MAX_EVENT
];
95 char *m_data
[GSOCK_MAX_EVENT
];
102 #endif /* __cplusplus */
104 /* Definition of GAddress */
110 GAddressType m_family
;
111 GSocketError m_error
;
116 void _GSocket_Internal_Proc(unsigned long e
, void* data
) ;
120 GSocketError
_GAddress_translate_from(GAddress
*address
,
122 GSocketError
_GAddress_translate_to(GAddress
*address
,
125 GSocketError
_GAddress_Init_INET(GAddress
*address
);
129 #endif /* __cplusplus */
131 #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
133 #endif /* __GSOCK_UNX_H */