]>
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 | ||
c21b68f7 | 12 | #ifndef __GSOCKET_STANDALONE__ |
904ec517 GRG |
13 | #include "wx/gsocket.h" |
14 | #else | |
15 | #include "gsocket.h" | |
16 | #endif | |
17 | ||
18 | #include <winsock.h> | |
19 | ||
20 | ||
c21b68f7 GRG |
21 | #ifdef __cplusplus |
22 | extern "C" { | |
23 | #endif | |
24 | ||
904ec517 GRG |
25 | /* Definition of GSocket */ |
26 | struct _GSocket | |
27 | { | |
28 | SOCKET m_fd; | |
29 | GAddress *m_local; | |
30 | GAddress *m_peer; | |
31 | GSocketError m_error; | |
32 | ||
33 | bool m_non_blocking; | |
34 | bool m_server; | |
35 | bool m_stream; | |
36 | bool m_oriented; | |
37 | struct timeval m_timeout; | |
38 | ||
39 | /* Callbacks */ | |
40 | GSocketCallback m_cbacks[GSOCK_MAX_EVENT]; | |
41 | char *m_data[GSOCK_MAX_EVENT]; | |
42 | int m_msgnumber; | |
43 | }; | |
44 | ||
45 | /* Definition of GAddress */ | |
46 | struct _GAddress | |
47 | { | |
48 | struct sockaddr *m_addr; | |
49 | size_t m_len; | |
50 | ||
51 | GAddressType m_family; | |
52 | int m_realfamily; | |
53 | ||
54 | GSocketError m_error; | |
55 | }; | |
56 | ||
57 | ||
904ec517 GRG |
58 | /* Input / output */ |
59 | ||
60 | GSocketError _GSocket_Input_Timeout(GSocket *socket); | |
61 | GSocketError _GSocket_Output_Timeout(GSocket *socket); | |
62 | int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size); | |
63 | int _GSocket_Recv_Dgram(GSocket *socket, char *buffer, int size); | |
64 | int _GSocket_Send_Stream(GSocket *socket, const char *buffer, int size); | |
65 | int _GSocket_Send_Dgram(GSocket *socket, const char *buffer, int size); | |
66 | ||
67 | /* Callbacks */ | |
68 | ||
69 | void _GSocket_Configure_Callbacks(GSocket *socket); | |
70 | LRESULT CALLBACK _GSocket_Internal_WinProc(HWND, UINT, WPARAM, LPARAM); | |
71 | ||
72 | /* GAddress */ | |
73 | ||
74 | GSocketError _GAddress_translate_from(GAddress *address, | |
75 | struct sockaddr *addr, int len); | |
76 | ||
77 | GSocketError _GAddress_translate_to(GAddress *address, | |
78 | struct sockaddr **addr, int *len); | |
79 | ||
80 | GSocketError _GAddress_Init_INET(GAddress *address); | |
81 | GSocketError _GAddress_Init_UNIX(GAddress *address); | |
82 | ||
83 | #ifdef __cplusplus | |
84 | } | |
85 | #endif | |
86 | ||
87 | #endif /* __GSOCK_MSW_H */ |