1 /* -------------------------------------------------------------------------
2 * Project: GSocket (Generic Socket) for WX
4 * Copyright: (c) Guilhem Lavaux
5 * Licence: wxWindows Licence
6 * Purpose: GSocket Macintosh header
8 * -------------------------------------------------------------------------
14 #ifndef __GSOCKET_STANDALONE__
18 #if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__)
20 #ifndef __GSOCKET_STANDALONE__
21 #include "wx/gsocket.h"
28 #include <MacHeaders.c>
29 #define OTUNIXERRORS 1
30 // we get a conflict in OT headers otherwise :
32 #include <OpenTransport.h>
33 #include <OpenTransportProviders.h>
34 #include <OpenTptInternet.h>
38 /* Definition of GSocket */
44 bool IsOk() { return m_ok
; }
47 GSocketError
SetLocal(GAddress
*address
);
48 GSocketError
SetPeer(GAddress
*address
);
51 GSocketError
SetServer();
52 GSocket
*WaitConnection();
54 void Notify(bool WXUNUSED(enable
)) { }
55 bool SetReusable() { return false; }
56 GSocketError
SetNonOriented();
57 GSocketError
Connect(GSocketStream stream
);
58 int Read(char *buffer
, int size
);
59 int Write(const char *buffer
, int size
);
60 GSocketEventFlags
Select(GSocketEventFlags flags
);
61 void SetNonBlocking(bool non_block
);
62 void SetTimeout(unsigned long millisec
);
63 GSocketError WXDLLIMPEXP_NET
GetError();
64 void SetCallback(GSocketEventFlags flags
,
65 GSocketCallback callback
, char *cdata
);
66 void UnsetCallback(GSocketEventFlags flags
);
67 GSocketError
GetSockOpt(int level
, int optname
, void *optval
, int *optlen
)
68 { return GSOCK_INVOP
; }
69 GSocketError
SetSockOpt(int level
, int optname
,
70 const void *optval
, int optlen
)
71 { return GSOCK_INVOP
; }
77 GSocketError
Input_Timeout();
78 GSocketError
Output_Timeout();
79 int Recv_Stream(char *buffer
, int size
);
80 int Recv_Dgram(char *buffer
, int size
);
81 int Send_Stream(const char *buffer
, int size
);
82 int Send_Dgram(const char *buffer
, int size
);
86 void Disable_Events();
88 // TODO: Make these protected
90 wxMacNotifierTableRef m_mac_events
;
91 EndpointRef m_endpoint
;
100 unsigned long m_timeout
;
103 GSocketEventFlags m_detected
;
104 GSocketCallback m_cbacks
[GSOCK_MAX_EVENT
];
105 char *m_data
[GSOCK_MAX_EVENT
];
112 #endif /* __cplusplus */
114 /* Definition of GAddress */
120 GAddressType m_family
;
121 GSocketError m_error
;
126 void _GSocket_Internal_Proc(unsigned long e
, void* data
) ;
130 GSocketError
_GAddress_translate_from(GAddress
*address
,
132 GSocketError
_GAddress_translate_to(GAddress
*address
,
135 GSocketError
_GAddress_Init_INET(GAddress
*address
);
139 #endif /* __cplusplus */
141 #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
143 #endif /* __GSOCK_UNX_H */