]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/gsockmsw.h
Fixed bug #1022383: 'several ComboBoxes appear selected'
[wxWidgets.git] / include / wx / msw / gsockmsw.h
CommitLineData
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
4b4d23c7 24#include "wx/msw/wrapwin.h"
c21b68f7 25
7acf6a92 26#if defined(__WXWINCE__)
dbfb61b3
JS
27#include <winsock.h>
28#endif
29
4b4d23c7
DE
30class GSocketGUIFunctionsTableConcrete: public GSocketGUIFunctionsTable
31{
32public:
33 virtual bool OnInit();
34 virtual void OnExit();
35 virtual bool CanUseEventLoop();
36 virtual bool Init_Socket(GSocket *socket);
37 virtual void Destroy_Socket(GSocket *socket);
38 virtual void Enable_Events(GSocket *socket);
39 virtual void Disable_Events(GSocket *socket);
40};
4b4d23c7 41
904ec517 42/* Definition of GSocket */
4b4d23c7 43class GSocket
904ec517 44{
4b4d23c7
DE
45public:
46 GSocket();
47 ~GSocket();
48 bool IsOk() { return m_ok; }
49 void Close();
50 void Shutdown();
51 GSocketError SetLocal(GAddress *address);
52 GSocketError SetPeer(GAddress *address);
53 GAddress *GetLocal();
54 GAddress *GetPeer();
55 GSocketError SetServer();
56 GSocket *WaitConnection();
948c96ef 57 bool SetReusable();
4b4d23c7
DE
58 GSocketError Connect(GSocketStream stream);
59 GSocketError SetNonOriented();
60 int Read(char *buffer, int size);
61 int Write(const char *buffer, int size);
62 GSocketEventFlags Select(GSocketEventFlags flags);
63 void SetNonBlocking(bool non_block);
64 void SetTimeout(unsigned long millis);
a4506848 65 GSocketError WXDLLIMPEXP_NET GetError();
4b4d23c7
DE
66 void SetCallback(GSocketEventFlags flags,
67 GSocketCallback callback, char *cdata);
68 void UnsetCallback(GSocketEventFlags flags);
69 GSocketError GetSockOpt(int level, int optname,
70 void *optval, int *optlen);
71 GSocketError SetSockOpt(int level, int optname,
72 const void *optval, int optlen);
73protected:
74 GSocketError Input_Timeout();
75 GSocketError Output_Timeout();
76 GSocketError Connect_Timeout();
77 int Recv_Stream(char *buffer, int size);
78 int Recv_Dgram(char *buffer, int size);
79 int Send_Stream(const char *buffer, int size);
80 int Send_Dgram(const char *buffer, int size);
81 bool m_ok;
82
83/* TODO: Make these protected */
84public:
904ec517
GRG
85 SOCKET m_fd;
86 GAddress *m_local;
87 GAddress *m_peer;
88 GSocketError m_error;
89
483249fc 90 /* Attributes */
948c96ef
DE
91 bool m_non_blocking;
92 bool m_server;
93 bool m_stream;
94 bool m_establishing;
95 bool m_reusable;
904ec517
GRG
96 struct timeval m_timeout;
97
98 /* Callbacks */
483249fc 99 GSocketEventFlags m_detected;
904ec517
GRG
100 GSocketCallback m_cbacks[GSOCK_MAX_EVENT];
101 char *m_data[GSOCK_MAX_EVENT];
102 int m_msgnumber;
103};
104
4b4d23c7
DE
105#ifdef __cplusplus
106extern "C" {
107#endif
108
904ec517
GRG
109/* Definition of GAddress */
110struct _GAddress
111{
112 struct sockaddr *m_addr;
113 size_t m_len;
114
115 GAddressType m_family;
116 int m_realfamily;
117
118 GSocketError m_error;
119};
120
904ec517
GRG
121
122/* GAddress */
123
124GSocketError _GAddress_translate_from(GAddress *address,
125 struct sockaddr *addr, int len);
d3ea6527
GRG
126GSocketError _GAddress_translate_to (GAddress *address,
127 struct sockaddr **addr, int *len);
904ec517
GRG
128GSocketError _GAddress_Init_INET(GAddress *address);
129GSocketError _GAddress_Init_UNIX(GAddress *address);
130
131#ifdef __cplusplus
132}
133#endif
134
0ce742cf
GRG
135#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
136
904ec517 137#endif /* __GSOCK_MSW_H */