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 #include <OpenTransport.h>
29 #include <OpenTransportProviders.h>
30 #include <OpenTptInternet.h>
34 /* Definition of GSocket */
40 bool IsOk() { return m_ok
; }
43 GSocketError
SetLocal(GAddress
*address
);
44 GSocketError
SetPeer(GAddress
*address
);
47 GSocketError
SetServer();
48 GSocket
*WaitConnection();
49 bool SetReusable() { return false; }
50 GSocketError
SetNonOriented();
51 GSocketError
Connect(GSocketStream stream
);
52 int Read(char *buffer
, int size
);
53 int Write(const char *buffer
, int size
);
54 GSocketEventFlags
Select(GSocketEventFlags flags
);
55 void SetNonBlocking(bool non_block
);
56 void SetTimeout(unsigned long millisec
);
57 GSocketError WXDLLIMPEXP_NET
GetError();
58 void SetCallback(GSocketEventFlags flags
,
59 GSocketCallback callback
, char *cdata
);
60 void UnsetCallback(GSocketEventFlags flags
);
61 GSocketError
GetSockOpt(int level
, int optname
, void *optval
, int *optlen
)
62 { return GSOCK_INVOP
; }
63 GSocketError
SetSockOpt(int level
, int optname
,
64 const void *optval
, int optlen
)
65 { return GSOCK_INVOP
; }
71 GSocketError
Input_Timeout();
72 GSocketError
Output_Timeout();
73 int Recv_Stream(char *buffer
, int size
);
74 int Recv_Dgram(char *buffer
, int size
);
75 int Send_Stream(const char *buffer
, int size
);
76 int Send_Dgram(const char *buffer
, int size
);
80 void Disable_Events();
82 // TODO: Make these protected
84 wxMacNotifierTableRef m_mac_events
;
85 EndpointRef m_endpoint
;
94 unsigned long m_timeout
;
97 GSocketEventFlags m_detected
;
98 GSocketCallback m_cbacks
[GSOCK_MAX_EVENT
];
99 char *m_data
[GSOCK_MAX_EVENT
];
106 #endif /* __cplusplus */
108 /* Definition of GAddress */
114 GAddressType m_family
;
115 GSocketError m_error
;
120 void _GSocket_Internal_Proc(unsigned long e
, void* data
) ;
124 GSocketError
_GAddress_translate_from(GAddress
*address
,
126 GSocketError
_GAddress_translate_to(GAddress
*address
,
129 GSocketError
_GAddress_Init_INET(GAddress
*address
);
133 #endif /* __cplusplus */
135 #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
137 #endif /* __GSOCK_UNX_H */