]> git.saurik.com Git - wxWidgets.git/blob - include/wx/unix/gsockunx.h
FloodFill correction, wxQuantize correction
[wxWidgets.git] / include / wx / unix / gsockunx.h
1 /* -------------------------------------------------------------------------
2 * Project: GSocket (Generic Socket) for WX
3 * Name: gsockunx.h
4 * Purpose: GSocket Unix 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
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28
29 #if !defined(__cplusplus)
30 typedef int bool;
31 #endif
32
33 #ifndef TRUE
34 #define TRUE 1
35 #endif
36
37 #ifndef FALSE
38 #define FALSE 0
39 #endif
40
41
42 /* Definition of GSocket */
43 struct _GSocket
44 {
45 int m_fd;
46 GAddress *m_local;
47 GAddress *m_peer;
48 GSocketError m_error;
49
50 bool m_non_blocking;
51 bool m_server;
52 bool m_stream;
53 bool m_oriented;
54 bool m_establishing;
55 unsigned long m_timeout;
56
57 /* Callbacks */
58 GSocketEventFlags m_detected;
59 GSocketCallback m_cbacks[GSOCK_MAX_EVENT];
60 char *m_data[GSOCK_MAX_EVENT];
61
62 char *m_gui_dependent;
63 };
64
65 /* Definition of GAddress */
66 struct _GAddress
67 {
68 struct sockaddr *m_addr;
69 size_t m_len;
70
71 GAddressType m_family;
72 int m_realfamily;
73
74 GSocketError m_error;
75 };
76
77 /* Input / Output */
78
79 GSocketError _GSocket_Input_Timeout(GSocket *socket);
80 GSocketError _GSocket_Output_Timeout(GSocket *socket);
81 int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size);
82 int _GSocket_Recv_Dgram(GSocket *socket, char *buffer, int size);
83 int _GSocket_Send_Stream(GSocket *socket, const char *buffer, int size);
84 int _GSocket_Send_Dgram(GSocket *socket, const char *buffer, int size);
85
86 /* Callbacks */
87
88 bool _GSocket_GUI_Init(GSocket *socket);
89 void _GSocket_GUI_Destroy(GSocket *socket);
90
91 void _GSocket_Enable_Events(GSocket *socket);
92 void _GSocket_Disable_Events(GSocket *socket);
93 void _GSocket_Install_Callback(GSocket *socket, GSocketEvent event);
94 void _GSocket_Uninstall_Callback(GSocket *socket, GSocketEvent event);
95
96 void _GSocket_Enable(GSocket *socket, GSocketEvent event);
97 void _GSocket_Disable(GSocket *socket, GSocketEvent event);
98 void _GSocket_Detected_Read(GSocket *socket);
99 void _GSocket_Detected_Write(GSocket *socket);
100
101 /* GAddress */
102
103 GSocketError _GAddress_translate_from(GAddress *address,
104 struct sockaddr *addr, int len);
105 GSocketError _GAddress_translate_to (GAddress *address,
106 struct sockaddr **addr, int *len);
107 GSocketError _GAddress_Init_INET(GAddress *address);
108 GSocketError _GAddress_Init_UNIX(GAddress *address);
109
110
111 #ifdef __cplusplus
112 }
113 #endif /* __cplusplus */
114
115 #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
116
117 #endif /* __GSOCK_UNX_H */