1 /* -------------------------------------------------------------------------
2 * Project: GSocket (Generic Socket) for WX
4 * Purpose: GSocket Unix header
6 * -------------------------------------------------------------------------
12 #ifndef __GSOCKET_STANDALONE__
16 #if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__)
18 #ifndef __GSOCKET_STANDALONE__
19 #include "wx/gsocket.h"
24 class GSocketGUIFunctionsTableConcrete
: public GSocketGUIFunctionsTable
27 virtual bool OnInit();
28 virtual void OnExit();
29 virtual bool CanUseEventLoop();
30 virtual bool Init_Socket(GSocket
*socket
);
31 virtual void Destroy_Socket(GSocket
*socket
);
32 virtual void Install_Callback(GSocket
*socket
, GSocketEvent event
);
33 virtual void Uninstall_Callback(GSocket
*socket
, GSocketEvent event
);
34 virtual void Enable_Events(GSocket
*socket
);
35 virtual void Disable_Events(GSocket
*socket
);
43 bool IsOk() { return m_ok
; }
46 GSocketError
SetLocal(GAddress
*address
);
47 GSocketError
SetPeer(GAddress
*address
);
50 GSocketError
SetServer();
51 GSocket
*WaitConnection();
53 GSocketError
Connect(GSocketStream stream
);
54 GSocketError
SetNonOriented();
55 int Read(char *buffer
, int size
);
56 int Write(const char *buffer
, int size
);
57 GSocketEventFlags
Select(GSocketEventFlags flags
);
58 void SetNonBlocking(bool non_block
);
59 void SetTimeout(unsigned long millisec
);
60 GSocketError WXDLLIMPEXP_NET
GetError();
61 void SetCallback(GSocketEventFlags flags
,
62 GSocketCallback callback
, char *cdata
);
63 void UnsetCallback(GSocketEventFlags flags
);
64 GSocketError
GetSockOpt(int level
, int optname
, void *optval
, int *optlen
);
65 GSocketError
SetSockOpt(int level
, int optname
,
66 const void *optval
, int optlen
);
67 virtual void Detected_Read();
68 virtual void Detected_Write();
70 void Enable(GSocketEvent event
);
71 void Disable(GSocketEvent event
);
72 GSocketError
Input_Timeout();
73 GSocketError
Output_Timeout();
74 int Recv_Stream(char *buffer
, int size
);
75 int Recv_Dgram(char *buffer
, int size
);
76 int Send_Stream(const char *buffer
, int size
);
77 int Send_Dgram(const char *buffer
, int size
);
80 /* DFE: We can't protect these data member until the GUI code is updated */
92 unsigned long m_timeout
;
95 GSocketEventFlags m_detected
;
96 GSocketCallback m_cbacks
[GSOCK_MAX_EVENT
];
97 char *m_data
[GSOCK_MAX_EVENT
];
99 char *m_gui_dependent
;
105 #endif /* __cplusplus */
106 /* Definition of GAddress */
109 struct sockaddr
*m_addr
;
112 GAddressType m_family
;
115 GSocketError m_error
;
119 #endif /* __cplusplus */
124 #endif /* __cplusplus */
129 GSocketError
_GAddress_translate_from(GAddress
*address
,
130 struct sockaddr
*addr
, int len
);
131 GSocketError
_GAddress_translate_to (GAddress
*address
,
132 struct sockaddr
**addr
, int *len
);
133 GSocketError
_GAddress_Init_INET(GAddress
*address
);
134 GSocketError
_GAddress_Init_UNIX(GAddress
*address
);
139 #endif /* __cplusplus */
141 #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
143 #endif /* __GSOCK_UNX_H */