]> git.saurik.com Git - wxWidgets.git/blame - include/wx/unix/gsockunx.h
compatibility changes: WXWIN_COMPATIBILITY_EVENT_TYPES and DECLARE_EVENT_TABLE_ENTRY...
[wxWidgets.git] / include / wx / unix / gsockunx.h
CommitLineData
dbd300df
GL
1/* -------------------------------------------------------------------------
2 * Project: GSocket (Generic Socket) for WX
3 * Name: gsockunx.h
4 * Purpose: GSocket Unix header
5 * CVSID: $Id$
6 * -------------------------------------------------------------------------
7 */
483249fc 8
a324a7bc
GL
9#ifndef __GSOCK_UNX_H
10#define __GSOCK_UNX_H
11
483249fc 12#ifndef __GSOCKET_STANDALONE__
d422d01e 13#include "wx/setup.h"
483249fc 14#endif
d422d01e 15
483249fc 16#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__)
d422d01e 17
483249fc 18#ifndef __GSOCKET_STANDALONE__
d422d01e 19#include "wx/gsocket.h"
483249fc
GRG
20#else
21#include "gsocket.h"
22#endif
23
d422d01e
RR
24
25#ifdef __cplusplus
26extern "C" {
27#endif /* __cplusplus */
28
5c9eff30
GRG
29#if !defined(__cplusplus)
30typedef 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
a324a7bc
GL
41
42/* Definition of GSocket */
483249fc
GRG
43struct _GSocket
44{
a324a7bc 45 int m_fd;
483249fc
GRG
46 GAddress *m_local;
47 GAddress *m_peer;
a324a7bc
GL
48 GSocketError m_error;
49
483249fc
GRG
50 bool m_non_blocking;
51 bool m_server;
52 bool m_stream;
53 bool m_oriented;
aa6d9706 54 bool m_establishing;
39b91eca 55 unsigned long m_timeout;
a324a7bc 56
39b91eca 57 /* Callbacks */
483249fc 58 GSocketEventFlags m_detected;
98781fa3 59 GSocketCallback m_cbacks[GSOCK_MAX_EVENT];
a324a7bc
GL
60 char *m_data[GSOCK_MAX_EVENT];
61
a324a7bc
GL
62 char *m_gui_dependent;
63};
64
65/* Definition of GAddress */
483249fc
GRG
66struct _GAddress
67{
a324a7bc
GL
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
483249fc
GRG
77/* Input / Output */
78
79GSocketError _GSocket_Input_Timeout(GSocket *socket);
80GSocketError _GSocket_Output_Timeout(GSocket *socket);
a324a7bc
GL
81int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size);
82int _GSocket_Recv_Dgram(GSocket *socket, char *buffer, int size);
83int _GSocket_Send_Stream(GSocket *socket, const char *buffer, int size);
84int _GSocket_Send_Dgram(GSocket *socket, const char *buffer, int size);
483249fc
GRG
85
86/* Callbacks */
87
5ff86996 88bool _GSocket_GUI_Init(GSocket *socket);
a324a7bc 89void _GSocket_GUI_Destroy(GSocket *socket);
5ff86996 90
483249fc
GRG
91void _GSocket_Enable_Events(GSocket *socket);
92void _GSocket_Disable_Events(GSocket *socket);
93void _GSocket_Install_Callback(GSocket *socket, GSocketEvent event);
94void _GSocket_Uninstall_Callback(GSocket *socket, GSocketEvent event);
95
5ff86996
GRG
96void _GSocket_Enable(GSocket *socket, GSocketEvent event);
97void _GSocket_Disable(GSocket *socket, GSocketEvent event);
98void _GSocket_Detected_Read(GSocket *socket);
99void _GSocket_Detected_Write(GSocket *socket);
100
483249fc 101/* GAddress */
e00f35bb 102
54e575f9
GL
103GSocketError _GAddress_translate_from(GAddress *address,
104 struct sockaddr *addr, int len);
9bf10d6b
GRG
105GSocketError _GAddress_translate_to (GAddress *address,
106 struct sockaddr **addr, int *len);
54e575f9 107GSocketError _GAddress_Init_INET(GAddress *address);
54e575f9 108GSocketError _GAddress_Init_UNIX(GAddress *address);
a324a7bc 109
9bf10d6b 110
d422d01e
RR
111#ifdef __cplusplus
112}
483249fc 113#endif /* __cplusplus */
d422d01e 114
483249fc 115#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
d422d01e 116
483249fc 117#endif /* __GSOCK_UNX_H */