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();
57 GSocketError
Connect(GSocketStream stream
);
58 GSocketError
SetNonOriented();
59 int Read(char *buffer
, int size
);
60 int Write(const char *buffer
, int size
);
61 GSocketEventFlags
Select(GSocketEventFlags flags
);
62 void SetNonBlocking(bool non_block
);
63 void SetTimeout(unsigned long millisec
);
64 GSocketError WXDLLIMPEXP_NET
GetError();
65 void SetCallback(GSocketEventFlags flags
,
66 GSocketCallback callback
, char *cdata
);
67 void UnsetCallback(GSocketEventFlags flags
);
68 GSocketError
GetSockOpt(int level
, int optname
, void *optval
, int *optlen
);
69 GSocketError
SetSockOpt(int level
, int optname
,
70 const void *optval
, int optlen
);
71 virtual void Detected_Read();
72 virtual void Detected_Write();
74 void Enable(GSocketEvent event
);
75 void Disable(GSocketEvent event
);
76 GSocketError
Input_Timeout();
77 GSocketError
Output_Timeout();
78 int Recv_Stream(char *buffer
, int size
);
79 int Recv_Dgram(char *buffer
, int size
);
80 int Send_Stream(const char *buffer
, int size
);
81 int Send_Dgram(const char *buffer
, int size
);
84 /* DFE: We can't protect these data member until the GUI code is updated */
98 unsigned long m_timeout
;
101 GSocketEventFlags m_detected
;
102 GSocketCallback m_cbacks
[GSOCK_MAX_EVENT
];
103 char *m_data
[GSOCK_MAX_EVENT
];
105 char *m_gui_dependent
;
111 #endif /* __cplusplus */
112 /* Definition of GAddress */
115 struct sockaddr
*m_addr
;
118 GAddressType m_family
;
121 GSocketError m_error
;
125 #endif /* __cplusplus */
130 #endif /* __cplusplus */
135 GSocketError
_GAddress_translate_from(GAddress
*address
,
136 struct sockaddr
*addr
, int len
);
137 GSocketError
_GAddress_translate_to (GAddress
*address
,
138 struct sockaddr
**addr
, int *len
);
139 GSocketError
_GAddress_Init_INET(GAddress
*address
);
140 GSocketError
_GAddress_Init_UNIX(GAddress
*address
);
145 #endif /* __cplusplus */
147 #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
149 #endif /* __GSOCK_UNX_H */