1 /* -------------------------------------------------------------------------
2 * Project: GSocket (Generic Socket) for WX
4 * Purpose: GSocket MSW header
6 * -------------------------------------------------------------------------
12 #ifndef __GSOCKET_STANDALONE__
16 #if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__)
18 #ifndef __GSOCKET_STANDALONE__
19 #include "wx/gsocket.h"
24 #include "wx/msw/wrapwin.h"
26 #if defined(__WXWINCE__)
30 class GSocketGUIFunctionsTableConcrete
: public GSocketGUIFunctionsTable
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
);
42 /* Definition of GSocket */
48 bool IsOk() { return m_ok
; }
51 GSocketError
SetLocal(GAddress
*address
);
52 GSocketError
SetPeer(GAddress
*address
);
55 GSocketError
SetServer();
56 GSocket
*WaitConnection();
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
);
65 GSocketError WXDLLIMPEXP_NET
GetError();
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
);
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
);
83 /* TODO: Make these protected */
96 struct timeval m_timeout
;
99 GSocketEventFlags m_detected
;
100 GSocketCallback m_cbacks
[GSOCK_MAX_EVENT
];
101 char *m_data
[GSOCK_MAX_EVENT
];
109 /* Definition of GAddress */
112 struct sockaddr
*m_addr
;
115 GAddressType m_family
;
118 GSocketError m_error
;
124 GSocketError
_GAddress_translate_from(GAddress
*address
,
125 struct sockaddr
*addr
, int len
);
126 GSocketError
_GAddress_translate_to (GAddress
*address
,
127 struct sockaddr
**addr
, int *len
);
128 GSocketError
_GAddress_Init_INET(GAddress
*address
);
129 GSocketError
_GAddress_Init_UNIX(GAddress
*address
);
135 #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
137 #endif /* __GSOCK_MSW_H */