]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/gsockmsw.h
replaced my recent GSocket_SetReuseAddr() addition with GSocket_SetReusable() from...
[wxWidgets.git] / include / wx / msw / gsockmsw.h
1 /* -------------------------------------------------------------------------
2 * Project: GSocket (Generic Socket) for WX
3 * Name: gsockmsw.h
4 * Purpose: GSocket MSW header
5 * CVSID: $Id$
6 * -------------------------------------------------------------------------
7 */
8
9 #ifndef __GSOCK_MSW_H
10 #define __GSOCK_MSW_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 #include <windows.h>
25 #include <winsock.h>
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 #ifndef TRUE
32 #define TRUE 1
33 #endif
34
35 #ifndef FALSE
36 #define FALSE 0
37 #endif
38
39 /* Definition of GSocket */
40 struct _GSocket
41 {
42 SOCKET m_fd;
43 GAddress *m_local;
44 GAddress *m_peer;
45 GSocketError m_error;
46
47 /* Attributes */
48 int m_non_blocking;
49 int m_server;
50 int m_stream;
51 int m_oriented;
52 int m_establishing;
53 int m_reusable;
54 struct timeval m_timeout;
55
56 /* Callbacks */
57 GSocketEventFlags m_detected;
58 GSocketCallback m_cbacks[GSOCK_MAX_EVENT];
59 char *m_data[GSOCK_MAX_EVENT];
60 int m_msgnumber;
61 };
62
63 /* Definition of GAddress */
64 struct _GAddress
65 {
66 struct sockaddr *m_addr;
67 size_t m_len;
68
69 GAddressType m_family;
70 int m_realfamily;
71
72 GSocketError m_error;
73 };
74
75 /* Input / output */
76
77 GSocketError _GSocket_Input_Timeout(GSocket *socket);
78 GSocketError _GSocket_Output_Timeout(GSocket *socket);
79 GSocketError _GSocket_Connect_Timeout(GSocket *socket);
80 int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size);
81 int _GSocket_Recv_Dgram(GSocket *socket, char *buffer, int size);
82 int _GSocket_Send_Stream(GSocket *socket, const char *buffer, int size);
83 int _GSocket_Send_Dgram(GSocket *socket, const char *buffer, int size);
84
85 /* Callbacks */
86
87 int _GSocket_GUI_Init(void);
88 void _GSocket_GUI_Cleanup(void);
89 int _GSocket_GUI_Init_Socket(GSocket *socket);
90 void _GSocket_GUI_Destroy_Socket(GSocket *socket);
91
92 LRESULT CALLBACK _GSocket_Internal_WinProc(HWND, UINT, WPARAM, LPARAM);
93
94 void _GSocket_Enable_Events(GSocket *socket);
95 void _GSocket_Disable_Events(GSocket *socket);
96
97 /* GAddress */
98
99 GSocketError _GAddress_translate_from(GAddress *address,
100 struct sockaddr *addr, int len);
101 GSocketError _GAddress_translate_to (GAddress *address,
102 struct sockaddr **addr, int *len);
103 GSocketError _GAddress_Init_INET(GAddress *address);
104 GSocketError _GAddress_Init_UNIX(GAddress *address);
105
106 #ifdef __cplusplus
107 }
108 #endif
109
110 #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
111
112 #endif /* __GSOCK_MSW_H */