]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/classic/gsockmac.h
use AllocExclusive
[wxWidgets.git] / include / wx / mac / classic / gsockmac.h
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
27 #ifdef __cplusplus
28 extern "C" {
29 #endif /* __cplusplus */
30
31 typedef GSocket* GSocketPtr ;
32
33 /* Definition of GSocket */
34 struct _GSocket
35 {
36 wxMacNotifierTableRef m_mac_events ;
37 EndpointRef m_endpoint;
38 GAddress *m_local;
39 GAddress *m_peer;
40 GSocketError m_error;
41
42 int m_non_blocking;
43 int m_server;
44 int m_stream;
45 int m_oriented;
46 unsigned long m_timeout;
47
48 /* Callbacks */
49 GSocketEventFlags m_detected;
50 GSocketCallback m_cbacks[GSOCK_MAX_EVENT];
51 char *m_data[GSOCK_MAX_EVENT];
52 int m_takesEvents ;
53 };
54
55 /* Definition of GAddress */
56
57 struct _GAddress
58 {
59 UInt32 m_host ;
60 UInt16 m_port ;
61 GAddressType m_family;
62 GSocketError m_error;
63 };
64
65 /* Input / Output */
66
67 GSocketError _GSocket_Input_Timeout(GSocket *socket);
68 GSocketError _GSocket_Output_Timeout(GSocket *socket);
69 int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size);
70 int _GSocket_Recv_Dgram(GSocket *socket, char *buffer, int size);
71 int _GSocket_Send_Stream(GSocket *socket, const char *buffer, int size);
72 int _GSocket_Send_Dgram(GSocket *socket, const char *buffer, int size);
73
74 /* Callbacks */
75
76 void _GSocket_Enable_Events(GSocket *socket);
77 void _GSocket_Disable_Events(GSocket *socket);
78 void _GSocket_Internal_Proc(unsigned long e , void* data ) ;
79
80 /* GAddress */
81
82 GSocketError _GAddress_translate_from(GAddress *address,
83 InetAddress *addr );
84 GSocketError _GAddress_translate_to(GAddress *address,
85 InetAddress *addr);
86
87 GSocketError _GAddress_Init_INET(GAddress *address);
88
89 #ifdef __cplusplus
90 }
91 #endif /* __cplusplus */
92
93 #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
94
95 #endif /* __GSOCK_UNX_H */