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"
32 class GSocketGUIFunctionsTableConcrete
: public GSocketGUIFunctionsTable
35 virtual bool OnInit();
36 virtual void OnExit();
37 virtual bool CanUseEventLoop();
38 virtual bool Init_Socket(GSocket
*socket
);
39 virtual void Destroy_Socket(GSocket
*socket
);
40 virtual void Install_Callback(GSocket
*socket
, GSocketEvent event
);
41 virtual void Uninstall_Callback(GSocket
*socket
, GSocketEvent event
);
42 virtual void Enable_Events(GSocket
*socket
);
43 virtual void Disable_Events(GSocket
*socket
);
51 bool IsOk() { return m_ok
; }
54 GSocketError
SetLocal(GAddress
*address
);
55 GSocketError
SetPeer(GAddress
*address
);
58 GSocketError
SetServer();
59 GSocket
*WaitConnection();
61 GSocketError
Connect(GSocketStream stream
);
62 GSocketError
SetNonOriented();
63 int Read(char *buffer
, int size
);
64 int Write(const char *buffer
, int size
);
65 GSocketEventFlags
Select(GSocketEventFlags flags
);
66 void SetNonBlocking(int non_block
);
67 void SetTimeout(unsigned long millisec
);
68 GSocketError WXDLLIMPEXP_NET
GetError();
69 void SetCallback(GSocketEventFlags flags
,
70 GSocketCallback callback
, char *cdata
);
71 void UnsetCallback(GSocketEventFlags flags
);
72 GSocketError
GetSockOpt(int level
, int optname
, void *optval
, int *optlen
);
73 GSocketError
SetSockOpt(int level
, int optname
,
74 const void *optval
, int optlen
);
75 /* API compatibility functions */
76 static void _GSocket_Detected_Read(GSocket
*socket
);
77 static void _GSocket_Detected_Write(GSocket
*socket
);
78 virtual void Detected_Read();
79 virtual void Detected_Write();
81 void Enable(GSocketEvent event
);
82 void Disable(GSocketEvent event
);
83 GSocketError
Input_Timeout();
84 GSocketError
Output_Timeout();
85 int Recv_Stream(char *buffer
, int size
);
86 int Recv_Dgram(char *buffer
, int size
);
87 int Send_Stream(const char *buffer
, int size
);
88 int Send_Dgram(const char *buffer
, int size
);
91 /* DFE: We can't protect these data member until the GUI code is updated */
103 unsigned long m_timeout
;
106 GSocketEventFlags m_detected
;
107 GSocketCallback m_cbacks
[GSOCK_MAX_EVENT
];
108 char *m_data
[GSOCK_MAX_EVENT
];
110 char *m_gui_dependent
;
116 #endif /* __cplusplus */
117 /* Definition of GAddress */
120 struct sockaddr
*m_addr
;
123 GAddressType m_family
;
126 GSocketError m_error
;
130 #endif /* __cplusplus */
135 #endif /* __cplusplus */
140 GSocketError
_GAddress_translate_from(GAddress
*address
,
141 struct sockaddr
*addr
, int len
);
142 GSocketError
_GAddress_translate_to (GAddress
*address
,
143 struct sockaddr
**addr
, int *len
);
144 GSocketError
_GAddress_Init_INET(GAddress
*address
);
145 GSocketError
_GAddress_Init_UNIX(GAddress
*address
);
150 #endif /* __cplusplus */
152 #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
154 #endif /* __GSOCK_UNX_H */