]>
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 | ||
24 | #include <winsock.h> | |
25 | ||
c21b68f7 GRG |
26 | #ifdef __cplusplus |
27 | extern "C" { | |
28 | #endif | |
29 | ||
904ec517 GRG |
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 | ||
483249fc | 38 | /* Attributes */ |
904ec517 GRG |
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 */ | |
483249fc | 46 | GSocketEventFlags m_detected; |
904ec517 GRG |
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 | ||
904ec517 GRG |
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 | ||
483249fc GRG |
76 | void _GSocket_Enable_Events(GSocket *socket); |
77 | void _GSocket_Disable_Events(GSocket *socket); | |
904ec517 GRG |
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 | ||
0ce742cf GRG |
95 | #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ |
96 | ||
904ec517 | 97 | #endif /* __GSOCK_MSW_H */ |