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 class GSocketGUIFunctionsTableConcrete
: public GSocketGUIFunctionsTable
29 virtual bool OnInit();
30 virtual void OnExit();
31 virtual bool CanUseEventLoop();
32 virtual bool Init_Socket(GSocket
*socket
);
33 virtual void Destroy_Socket(GSocket
*socket
);
34 virtual void Enable_Events(GSocket
*socket
);
35 virtual void Disable_Events(GSocket
*socket
);
38 /* Definition of GSocket */
44 bool IsOk() { return m_ok
; }
47 GSocketError
SetLocal(GAddress
*address
);
48 GSocketError
SetPeer(GAddress
*address
);
51 GSocketError
SetServer();
52 GSocket
*WaitConnection();
54 GSocketError
Connect(GSocketStream stream
);
55 GSocketError
SetNonOriented();
56 int Read(char *buffer
, int size
);
57 int Write(const char *buffer
, int size
);
58 GSocketEventFlags
Select(GSocketEventFlags flags
);
59 void SetNonBlocking(bool non_block
);
60 void SetTimeout(unsigned long millis
);
61 GSocketError WXDLLIMPEXP_NET
GetError();
62 void SetCallback(GSocketEventFlags flags
,
63 GSocketCallback callback
, char *cdata
);
64 void UnsetCallback(GSocketEventFlags flags
);
65 GSocketError
GetSockOpt(int level
, int optname
,
66 void *optval
, int *optlen
);
67 GSocketError
SetSockOpt(int level
, int optname
,
68 const void *optval
, int optlen
);
70 GSocketError
Input_Timeout();
71 GSocketError
Output_Timeout();
72 GSocketError
Connect_Timeout();
73 int Recv_Stream(char *buffer
, int size
);
74 int Recv_Dgram(char *buffer
, int size
);
75 int Send_Stream(const char *buffer
, int size
);
76 int Send_Dgram(const char *buffer
, int size
);
79 /* TODO: Make these protected */
92 struct timeval m_timeout
;
95 GSocketEventFlags m_detected
;
96 GSocketCallback m_cbacks
[GSOCK_MAX_EVENT
];
97 char *m_data
[GSOCK_MAX_EVENT
];
105 /* Definition of GAddress */
108 struct sockaddr
*m_addr
;
111 GAddressType m_family
;
114 GSocketError m_error
;
120 GSocketError
_GAddress_translate_from(GAddress
*address
,
121 struct sockaddr
*addr
, int len
);
122 GSocketError
_GAddress_translate_to (GAddress
*address
,
123 struct sockaddr
**addr
, int *len
);
124 GSocketError
_GAddress_Init_INET(GAddress
*address
);
125 GSocketError
_GAddress_Init_UNIX(GAddress
*address
);
131 #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
133 #endif /* __GSOCK_MSW_H */