]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/carbon/gsockmac.h
warning for 2.5.3
[wxWidgets.git] / include / wx / mac / carbon / gsockmac.h
CommitLineData
8cf73271
SC
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
5b2693a7
SC
24#ifndef OTUNIXERRORS
25
c5602b4a
DE
26#include <MacHeaders.c>
27#define OTUNIXERRORS 1
28#include <OpenTransport.h>
29#include <OpenTransportProviders.h>
30#include <OpenTptInternet.h>
8cf73271 31
5b2693a7
SC
32#endif
33
8cf73271 34/* Definition of GSocket */
c5602b4a 35class GSocket
8cf73271 36{
c5602b4a
DE
37public:
38 GSocket();
39 ~GSocket();
fe942d6f 40 bool IsOk() { return m_ok; }
c5602b4a
DE
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();
948c96ef 49 bool SetReusable() { return false; }
c5602b4a
DE
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);
948c96ef 55 void SetNonBlocking(bool non_block);
c5602b4a
DE
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
67protected:
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
83public:
8cf73271
SC
84 wxMacNotifierTableRef m_mac_events ;
85 EndpointRef m_endpoint;
86 GAddress *m_local;
87 GAddress *m_peer;
88 GSocketError m_error;
89
948c96ef
DE
90 bool m_non_blocking;
91 bool m_server;
92 bool m_stream;
93 bool m_oriented;
8cf73271
SC
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];
948c96ef 100 bool m_takesEvents ;
8cf73271
SC
101};
102
c5602b4a 103
c5602b4a
DE
104#ifdef __cplusplus
105extern "C" {
106#endif /* __cplusplus */
107
8cf73271
SC
108/* Definition of GAddress */
109
110struct _GAddress
111{
112 UInt32 m_host ;
113 UInt16 m_port ;
114 GAddressType m_family;
115 GSocketError m_error;
116};
117
8cf73271
SC
118/* Callbacks */
119
8cf73271
SC
120void _GSocket_Internal_Proc(unsigned long e , void* data ) ;
121
122/* GAddress */
123
124GSocketError _GAddress_translate_from(GAddress *address,
125 InetAddress *addr );
126GSocketError _GAddress_translate_to(GAddress *address,
127 InetAddress *addr);
128
129GSocketError _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 */