1 /* -------------------------------------------------------------------------
2 * Project: GSocket (Generic Socket) for WX
4 * Copyright: (c) Guilhem Lavaux
5 * Licence: wxWindows Licence
6 * Purpose: GSocket Unix header
8 * -------------------------------------------------------------------------
14 #ifndef __GSOCKET_STANDALONE__
18 #if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__)
20 #ifndef __GSOCKET_STANDALONE__
21 #include "wx/gsocket.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 Install_Callback(GSocket
*socket
, GSocketEvent event
);
35 virtual void Uninstall_Callback(GSocket
*socket
, GSocketEvent event
);
36 virtual void Enable_Events(GSocket
*socket
);
37 virtual void Disable_Events(GSocket
*socket
);
45 bool IsOk() { return m_ok
; }
48 GSocketError
SetLocal(GAddress
*address
);
49 GSocketError
SetPeer(GAddress
*address
);
52 GSocketError
SetServer();
53 GSocket
*WaitConnection();
55 GSocketError
Connect(GSocketStream stream
);
56 GSocketError
SetNonOriented();
57 int Read(char *buffer
, int size
);
58 int Write(const char *buffer
, int size
);
59 GSocketEventFlags
Select(GSocketEventFlags flags
);
60 void SetNonBlocking(bool non_block
);
61 void SetTimeout(unsigned long millisec
);
62 GSocketError WXDLLIMPEXP_NET
GetError();
63 void SetCallback(GSocketEventFlags flags
,
64 GSocketCallback callback
, char *cdata
);
65 void UnsetCallback(GSocketEventFlags flags
);
66 GSocketError
GetSockOpt(int level
, int optname
, void *optval
, int *optlen
);
67 GSocketError
SetSockOpt(int level
, int optname
,
68 const void *optval
, int optlen
);
69 virtual void Detected_Read();
70 virtual void Detected_Write();
72 void Enable(GSocketEvent event
);
73 void Disable(GSocketEvent event
);
74 GSocketError
Input_Timeout();
75 GSocketError
Output_Timeout();
76 int Recv_Stream(char *buffer
, int size
);
77 int Recv_Dgram(char *buffer
, int size
);
78 int Send_Stream(const char *buffer
, int size
);
79 int Send_Dgram(const char *buffer
, int size
);
82 /* DFE: We can't protect these data member until the GUI code is updated */
94 unsigned long m_timeout
;
97 GSocketEventFlags m_detected
;
98 GSocketCallback m_cbacks
[GSOCK_MAX_EVENT
];
99 char *m_data
[GSOCK_MAX_EVENT
];
101 char *m_gui_dependent
;
107 #endif /* __cplusplus */
108 /* Definition of GAddress */
111 struct sockaddr
*m_addr
;
114 GAddressType m_family
;
117 GSocketError m_error
;
121 #endif /* __cplusplus */
126 #endif /* __cplusplus */
131 GSocketError
_GAddress_translate_from(GAddress
*address
,
132 struct sockaddr
*addr
, int len
);
133 GSocketError
_GAddress_translate_to (GAddress
*address
,
134 struct sockaddr
**addr
, int *len
);
135 GSocketError
_GAddress_Init_INET(GAddress
*address
);
136 GSocketError
_GAddress_Init_UNIX(GAddress
*address
);
141 #endif /* __cplusplus */
143 #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
145 #endif /* __GSOCK_UNX_H */