]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/gsockmsw.h
patches from Ricky Gonzales <gonzales@pyramid3.net> for BC++ Builder
[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 #if defined(__BORLANDC__)
25 #include <windows.h>
26 #endif
27 #include <winsock.h>
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 /* Definition of GSocket */
34 struct _GSocket
35 {
36 SOCKET m_fd;
37 GAddress *m_local;
38 GAddress *m_peer;
39 GSocketError m_error;
40
41 /* Attributes */
42 bool m_non_blocking;
43 bool m_server;
44 bool m_stream;
45 bool m_oriented;
46 struct timeval m_timeout;
47
48 /* Callbacks */
49 GSocketEventFlags m_detected;
50 GSocketCallback m_cbacks[GSOCK_MAX_EVENT];
51 char *m_data[GSOCK_MAX_EVENT];
52 int m_msgnumber;
53 };
54
55 /* Definition of GAddress */
56 struct _GAddress
57 {
58 struct sockaddr *m_addr;
59 size_t m_len;
60
61 GAddressType m_family;
62 int m_realfamily;
63
64 GSocketError m_error;
65 };
66
67
68 /* Input / output */
69
70 GSocketError _GSocket_Input_Timeout(GSocket *socket);
71 GSocketError _GSocket_Output_Timeout(GSocket *socket);
72 int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size);
73 int _GSocket_Recv_Dgram(GSocket *socket, char *buffer, int size);
74 int _GSocket_Send_Stream(GSocket *socket, const char *buffer, int size);
75 int _GSocket_Send_Dgram(GSocket *socket, const char *buffer, int size);
76
77 /* Callbacks */
78
79 void _GSocket_Enable_Events(GSocket *socket);
80 void _GSocket_Disable_Events(GSocket *socket);
81 LRESULT CALLBACK _GSocket_Internal_WinProc(HWND, UINT, WPARAM, LPARAM);
82
83 /* GAddress */
84
85 GSocketError _GAddress_translate_from(GAddress *address,
86 struct sockaddr *addr, int len);
87
88 GSocketError _GAddress_translate_to(GAddress *address,
89 struct sockaddr **addr, int *len);
90
91 GSocketError _GAddress_Init_INET(GAddress *address);
92 GSocketError _GAddress_Init_UNIX(GAddress *address);
93
94 #ifdef __cplusplus
95 }
96 #endif
97
98 #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
99
100 #endif /* __GSOCK_MSW_H */