]> git.saurik.com Git - wxWidgets.git/blame - include/wx/unix/gsockunx.h
fix memory leak as Dimitri suggested
[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#ifndef TRUE
30#define TRUE 1
31#endif
32
33#ifndef FALSE
34#define FALSE 0
35#endif
36
a324a7bc
GL
37
38/* Definition of GSocket */
483249fc
GRG
39struct _GSocket
40{
a324a7bc 41 int m_fd;
483249fc
GRG
42 GAddress *m_local;
43 GAddress *m_peer;
a324a7bc
GL
44 GSocketError m_error;
45
27a97d02
GRG
46 int m_non_blocking;
47 int m_server;
48 int m_stream;
49 int m_oriented;
50 int m_establishing;
39b91eca 51 unsigned long m_timeout;
a324a7bc 52
39b91eca 53 /* Callbacks */
483249fc 54 GSocketEventFlags m_detected;
98781fa3 55 GSocketCallback m_cbacks[GSOCK_MAX_EVENT];
a324a7bc
GL
56 char *m_data[GSOCK_MAX_EVENT];
57
a324a7bc
GL
58 char *m_gui_dependent;
59};
60
61/* Definition of GAddress */
483249fc
GRG
62struct _GAddress
63{
a324a7bc
GL
64 struct sockaddr *m_addr;
65 size_t m_len;
66
67 GAddressType m_family;
68 int m_realfamily;
69
70 GSocketError m_error;
71};
72
483249fc
GRG
73/* Input / Output */
74
75GSocketError _GSocket_Input_Timeout(GSocket *socket);
76GSocketError _GSocket_Output_Timeout(GSocket *socket);
a324a7bc
GL
77int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size);
78int _GSocket_Recv_Dgram(GSocket *socket, char *buffer, int size);
79int _GSocket_Send_Stream(GSocket *socket, const char *buffer, int size);
80int _GSocket_Send_Dgram(GSocket *socket, const char *buffer, int size);
483249fc
GRG
81
82/* Callbacks */
83
27a97d02 84int _GSocket_GUI_Init(GSocket *socket);
a324a7bc 85void _GSocket_GUI_Destroy(GSocket *socket);
5ff86996 86
483249fc
GRG
87void _GSocket_Enable_Events(GSocket *socket);
88void _GSocket_Disable_Events(GSocket *socket);
89void _GSocket_Install_Callback(GSocket *socket, GSocketEvent event);
90void _GSocket_Uninstall_Callback(GSocket *socket, GSocketEvent event);
91
5ff86996
GRG
92void _GSocket_Enable(GSocket *socket, GSocketEvent event);
93void _GSocket_Disable(GSocket *socket, GSocketEvent event);
94void _GSocket_Detected_Read(GSocket *socket);
95void _GSocket_Detected_Write(GSocket *socket);
96
483249fc 97/* GAddress */
e00f35bb 98
54e575f9
GL
99GSocketError _GAddress_translate_from(GAddress *address,
100 struct sockaddr *addr, int len);
9bf10d6b
GRG
101GSocketError _GAddress_translate_to (GAddress *address,
102 struct sockaddr **addr, int *len);
54e575f9 103GSocketError _GAddress_Init_INET(GAddress *address);
54e575f9 104GSocketError _GAddress_Init_UNIX(GAddress *address);
a324a7bc 105
9bf10d6b 106
d422d01e
RR
107#ifdef __cplusplus
108}
483249fc 109#endif /* __cplusplus */
d422d01e 110
483249fc 111#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
d422d01e 112
483249fc 113#endif /* __GSOCK_UNX_H */