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