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();
53 bool SetReusable() { return false; }
54 GSocketError
SetNonOriented();
55 GSocketError
Connect(GSocketStream stream
);
56 int Read(char *buffer
, int size
);
57 int Write(const char *buffer
, int size
);
58 GSocketEventFlags
Select(GSocketEventFlags flags
);
59 void SetNonBlocking(bool non_block
);
60 void SetTimeout(unsigned long millisec
);
61 GSocketError WXDLLIMPEXP_NET
GetError();
62 void SetCallback(GSocketEventFlags flags
,
63 GSocketCallback callback
, char *cdata
);
64 void UnsetCallback(GSocketEventFlags flags
);
65 GSocketError
GetSockOpt(int level
, int optname
, void *optval
, int *optlen
)
66 { return GSOCK_INVOP
; }
67 GSocketError
SetSockOpt(int level
, int optname
,
68 const void *optval
, int optlen
)
69 { return GSOCK_INVOP
; }
75 GSocketError
Input_Timeout();
76 GSocketError
Output_Timeout();
77 int Recv_Stream(char *buffer
, int size
);
78 int Recv_Dgram(char *buffer
, int size
);
79 int Send_Stream(const char *buffer
, int size
);
80 int Send_Dgram(const char *buffer
, int size
);
84 void Disable_Events();
86 // TODO: Make these protected
88 wxMacNotifierTableRef m_mac_events
;
89 EndpointRef m_endpoint
;
98 unsigned long m_timeout
;
101 GSocketEventFlags m_detected
;
102 GSocketCallback m_cbacks
[GSOCK_MAX_EVENT
];
103 char *m_data
[GSOCK_MAX_EVENT
];
110 #endif /* __cplusplus */
112 /* Definition of GAddress */
118 GAddressType m_family
;
119 GSocketError m_error
;
124 void _GSocket_Internal_Proc(unsigned long e
, void* data
) ;
128 GSocketError
_GAddress_translate_from(GAddress
*address
,
130 GSocketError
_GAddress_translate_to(GAddress
*address
,
133 GSocketError
_GAddress_Init_INET(GAddress
*address
);
137 #endif /* __cplusplus */
139 #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
141 #endif /* __GSOCK_UNX_H */