]>
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 | 30 | /* Definition of GSocket */ |
519cb848 | 31 | typedef |
904ec517 GRG |
32 | struct _GSocket |
33 | { | |
34 | SOCKET m_fd; | |
35 | GAddress *m_local; | |
36 | GAddress *m_peer; | |
37 | GSocketError m_error; | |
38 | ||
483249fc | 39 | /* Attributes */ |
904ec517 GRG |
40 | bool m_non_blocking; |
41 | bool m_server; | |
42 | bool m_stream; | |
43 | bool m_oriented; | |
44 | struct timeval m_timeout; | |
45 | ||
46 | /* Callbacks */ | |
483249fc | 47 | GSocketEventFlags m_detected; |
904ec517 GRG |
48 | GSocketCallback m_cbacks[GSOCK_MAX_EVENT]; |
49 | char *m_data[GSOCK_MAX_EVENT]; | |
50 | int m_msgnumber; | |
51 | }; | |
52 | ||
53 | /* Definition of GAddress */ | |
54 | struct _GAddress | |
55 | { | |
56 | struct sockaddr *m_addr; | |
57 | size_t m_len; | |
58 | ||
59 | GAddressType m_family; | |
60 | int m_realfamily; | |
61 | ||
62 | GSocketError m_error; | |
63 | }; | |
64 | ||
65 | ||
904ec517 GRG |
66 | /* Input / output */ |
67 | ||
68 | GSocketError _GSocket_Input_Timeout(GSocket *socket); | |
69 | GSocketError _GSocket_Output_Timeout(GSocket *socket); | |
70 | int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size); | |
71 | int _GSocket_Recv_Dgram(GSocket *socket, char *buffer, int size); | |
72 | int _GSocket_Send_Stream(GSocket *socket, const char *buffer, int size); | |
73 | int _GSocket_Send_Dgram(GSocket *socket, const char *buffer, int size); | |
74 | ||
75 | /* Callbacks */ | |
76 | ||
483249fc GRG |
77 | void _GSocket_Enable_Events(GSocket *socket); |
78 | void _GSocket_Disable_Events(GSocket *socket); | |
904ec517 GRG |
79 | LRESULT CALLBACK _GSocket_Internal_WinProc(HWND, UINT, WPARAM, LPARAM); |
80 | ||
81 | /* GAddress */ | |
82 | ||
83 | GSocketError _GAddress_translate_from(GAddress *address, | |
84 | struct sockaddr *addr, int len); | |
85 | ||
86 | GSocketError _GAddress_translate_to(GAddress *address, | |
87 | struct sockaddr **addr, int *len); | |
88 | ||
89 | GSocketError _GAddress_Init_INET(GAddress *address); | |
90 | GSocketError _GAddress_Init_UNIX(GAddress *address); | |
91 | ||
92 | #ifdef __cplusplus | |
93 | } | |
94 | #endif | |
95 | ||
0ce742cf GRG |
96 | #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ |
97 | ||
904ec517 | 98 | #endif /* __GSOCK_MSW_H */ |