]>
Commit | Line | Data |
---|---|---|
904ec517 GRG |
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 | ||
0ce742cf GRG |
12 | #ifndef __GSOCKET_STANDALONE__ |
13 | #include "wx/setup.h" | |
14 | #endif | |
15 | ||
16 | #if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) | |
17 | ||
c21b68f7 | 18 | #ifndef __GSOCKET_STANDALONE__ |
904ec517 GRG |
19 | #include "wx/gsocket.h" |
20 | #else | |
21 | #include "gsocket.h" | |
22 | #endif | |
23 | ||
c09f2879 | 24 | #include <windows.h> |
904ec517 GRG |
25 | #include <winsock.h> |
26 | ||
c21b68f7 GRG |
27 | #ifdef __cplusplus |
28 | extern "C" { | |
29 | #endif | |
30 | ||
5c9eff30 GRG |
31 | #ifndef TRUE |
32 | #define TRUE 1 | |
33 | #endif | |
34 | ||
35 | #ifndef FALSE | |
36 | #define FALSE 0 | |
37 | #endif | |
38 | ||
904ec517 GRG |
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 | ||
483249fc | 47 | /* Attributes */ |
27a97d02 GRG |
48 | int m_non_blocking; |
49 | int m_server; | |
50 | int m_stream; | |
51 | int m_oriented; | |
52 | int m_establishing; | |
904ec517 GRG |
53 | struct timeval m_timeout; |
54 | ||
55 | /* Callbacks */ | |
483249fc | 56 | GSocketEventFlags m_detected; |
904ec517 GRG |
57 | GSocketCallback m_cbacks[GSOCK_MAX_EVENT]; |
58 | char *m_data[GSOCK_MAX_EVENT]; | |
59 | int m_msgnumber; | |
60 | }; | |
61 | ||
62 | /* Definition of GAddress */ | |
63 | struct _GAddress | |
64 | { | |
65 | struct sockaddr *m_addr; | |
66 | size_t m_len; | |
67 | ||
68 | GAddressType m_family; | |
69 | int m_realfamily; | |
70 | ||
71 | GSocketError m_error; | |
72 | }; | |
73 | ||
904ec517 GRG |
74 | /* Input / output */ |
75 | ||
76 | GSocketError _GSocket_Input_Timeout(GSocket *socket); | |
77 | GSocketError _GSocket_Output_Timeout(GSocket *socket); | |
d3ea6527 | 78 | GSocketError _GSocket_Connect_Timeout(GSocket *socket); |
904ec517 GRG |
79 | int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size); |
80 | int _GSocket_Recv_Dgram(GSocket *socket, char *buffer, int size); | |
81 | int _GSocket_Send_Stream(GSocket *socket, const char *buffer, int size); | |
82 | int _GSocket_Send_Dgram(GSocket *socket, const char *buffer, int size); | |
83 | ||
84 | /* Callbacks */ | |
85 | ||
27a97d02 | 86 | int _GSocket_GUI_Init(GSocket *socket); |
70988afb GRG |
87 | void _GSocket_GUI_Destroy(GSocket *socket); |
88 | ||
89 | LRESULT CALLBACK _GSocket_Internal_WinProc(HWND, UINT, WPARAM, LPARAM); | |
90 | ||
483249fc GRG |
91 | void _GSocket_Enable_Events(GSocket *socket); |
92 | void _GSocket_Disable_Events(GSocket *socket); | |
904ec517 GRG |
93 | |
94 | /* GAddress */ | |
95 | ||
96 | GSocketError _GAddress_translate_from(GAddress *address, | |
97 | struct sockaddr *addr, int len); | |
d3ea6527 GRG |
98 | GSocketError _GAddress_translate_to (GAddress *address, |
99 | struct sockaddr **addr, int *len); | |
904ec517 GRG |
100 | GSocketError _GAddress_Init_INET(GAddress *address); |
101 | GSocketError _GAddress_Init_UNIX(GAddress *address); | |
102 | ||
103 | #ifdef __cplusplus | |
104 | } | |
105 | #endif | |
106 | ||
0ce742cf GRG |
107 | #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ |
108 | ||
904ec517 | 109 | #endif /* __GSOCK_MSW_H */ |