]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/gsockmsw.h
627af329b339ab9713f9383855c5fc64eb8b9d03
[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 <winsock.h>
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 /* Definition of GSocket */
31 struct _GSocket
32 {
33 SOCKET m_fd;
34 GAddress *m_local;
35 GAddress *m_peer;
36 GSocketError m_error;
37
38 /* Attributes */
39 bool m_non_blocking;
40 bool m_server;
41 bool m_stream;
42 bool m_oriented;
43 struct timeval m_timeout;
44
45 /* Callbacks */
46 GSocketEventFlags m_detected;
47 GSocketCallback m_cbacks[GSOCK_MAX_EVENT];
48 char *m_data[GSOCK_MAX_EVENT];
49 int m_msgnumber;
50 };
51
52 /* Definition of GAddress */
53 struct _GAddress
54 {
55 struct sockaddr *m_addr;
56 size_t m_len;
57
58 GAddressType m_family;
59 int m_realfamily;
60
61 GSocketError m_error;
62 };
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 LRESULT CALLBACK _GSocket_Internal_WinProc(HWND, UINT, WPARAM, LPARAM);
79
80 /* GAddress */
81
82 GSocketError _GAddress_translate_from(GAddress *address,
83 struct sockaddr *addr, int len);
84
85 GSocketError _GAddress_translate_to(GAddress *address,
86 struct sockaddr **addr, int *len);
87
88 GSocketError _GAddress_Init_INET(GAddress *address);
89 GSocketError _GAddress_Init_UNIX(GAddress *address);
90
91 #ifdef __cplusplus
92 }
93 #endif
94
95 #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
96
97 #endif /* __GSOCK_MSW_H */