]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/carbon/gsockmac.h
1. added SetSelection() to wxItemContainer and removed its declarations
[wxWidgets.git] / include / wx / mac / carbon / gsockmac.h
1 /* -------------------------------------------------------------------------
2 * Project: GSocket (Generic Socket) for WX
3 * Name: gsockunx.h
4 * Purpose: GSocket Macintosh header
5 * CVSID: $Id$
6 * -------------------------------------------------------------------------
7 */
8
9 #ifndef __GSOCK_UNX_H
10 #define __GSOCK_UNX_H
11
12 #ifndef __GSOCKET_STANDALONE__
13 #include "wx/setup.h"
14 #endif
15
16 #if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__)
17
18 #ifndef __GSOCKET_STANDALONE__
19 #include "wx/gsocket.h"
20 #else
21 #include "gsocket.h"
22 #endif
23
24 #ifndef OTUNIXERRORS
25
26 #include <MacHeaders.c>
27 #define OTUNIXERRORS 1
28 #include <OpenTransport.h>
29 #include <OpenTransportProviders.h>
30 #include <OpenTptInternet.h>
31
32 #endif
33
34 /* Definition of GSocket */
35 class GSocket
36 {
37 public:
38 GSocket();
39 ~GSocket();
40 bool IsOk() { return m_ok; }
41
42 void Shutdown();
43 GSocketError SetLocal(GAddress *address);
44 GSocketError SetPeer(GAddress *address);
45 GAddress *GetLocal();
46 GAddress *GetPeer();
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; }
66
67 protected:
68 bool m_ok;
69
70 /* Input / Output */
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);
77
78 /* Callbacks */
79 void Enable_Events();
80 void Disable_Events();
81
82 // TODO: Make these protected
83 public:
84 wxMacNotifierTableRef m_mac_events ;
85 EndpointRef m_endpoint;
86 GAddress *m_local;
87 GAddress *m_peer;
88 GSocketError m_error;
89
90 bool m_non_blocking;
91 bool m_server;
92 bool m_stream;
93 bool m_oriented;
94 unsigned long m_timeout;
95
96 /* Callbacks */
97 GSocketEventFlags m_detected;
98 GSocketCallback m_cbacks[GSOCK_MAX_EVENT];
99 char *m_data[GSOCK_MAX_EVENT];
100 bool m_takesEvents ;
101 };
102
103
104 #ifdef __cplusplus
105 extern "C" {
106 #endif /* __cplusplus */
107
108 /* Definition of GAddress */
109
110 struct _GAddress
111 {
112 UInt32 m_host ;
113 UInt16 m_port ;
114 GAddressType m_family;
115 GSocketError m_error;
116 };
117
118 /* Callbacks */
119
120 void _GSocket_Internal_Proc(unsigned long e , void* data ) ;
121
122 /* GAddress */
123
124 GSocketError _GAddress_translate_from(GAddress *address,
125 InetAddress *addr );
126 GSocketError _GAddress_translate_to(GAddress *address,
127 InetAddress *addr);
128
129 GSocketError _GAddress_Init_INET(GAddress *address);
130
131 #ifdef __cplusplus
132 }
133 #endif /* __cplusplus */
134
135 #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
136
137 #endif /* __GSOCK_UNX_H */