]>
Commit | Line | Data |
---|---|---|
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 | ||
27 | #ifdef __cplusplus | |
28 | extern "C" { | |
29 | #endif | |
30 | ||
31 | /* Definition of GSocket */ | |
32 | struct _GSocket | |
33 | { | |
34 | SOCKET m_fd; | |
35 | GAddress *m_local; | |
36 | GAddress *m_peer; | |
37 | GSocketError m_error; | |
38 | ||
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 | GSocketCallback m_cbacks[GSOCK_MAX_EVENT]; | |
47 | char *m_data[GSOCK_MAX_EVENT]; | |
48 | int m_msgnumber; | |
49 | }; | |
50 | ||
51 | /* Definition of GAddress */ | |
52 | struct _GAddress | |
53 | { | |
54 | struct sockaddr *m_addr; | |
55 | size_t m_len; | |
56 | ||
57 | GAddressType m_family; | |
58 | int m_realfamily; | |
59 | ||
60 | GSocketError m_error; | |
61 | }; | |
62 | ||
63 | ||
64 | /* Input / output */ | |
65 | ||
66 | GSocketError _GSocket_Input_Timeout(GSocket *socket); | |
67 | GSocketError _GSocket_Output_Timeout(GSocket *socket); | |
68 | int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size); | |
69 | int _GSocket_Recv_Dgram(GSocket *socket, char *buffer, int size); | |
70 | int _GSocket_Send_Stream(GSocket *socket, const char *buffer, int size); | |
71 | int _GSocket_Send_Dgram(GSocket *socket, const char *buffer, int size); | |
72 | ||
73 | /* Callbacks */ | |
74 | ||
75 | void _GSocket_Configure_Callbacks(GSocket *socket); | |
76 | LRESULT CALLBACK _GSocket_Internal_WinProc(HWND, UINT, WPARAM, LPARAM); | |
77 | ||
78 | /* GAddress */ | |
79 | ||
80 | GSocketError _GAddress_translate_from(GAddress *address, | |
81 | struct sockaddr *addr, int len); | |
82 | ||
83 | GSocketError _GAddress_translate_to(GAddress *address, | |
84 | struct sockaddr **addr, int *len); | |
85 | ||
86 | GSocketError _GAddress_Init_INET(GAddress *address); | |
87 | GSocketError _GAddress_Init_UNIX(GAddress *address); | |
88 | ||
89 | #ifdef __cplusplus | |
90 | } | |
91 | #endif | |
92 | ||
93 | #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ | |
94 | ||
95 | #endif /* __GSOCK_MSW_H */ |