+public:
+ GSocket(wxSocketBase& wxsocket);
+ virtual ~GSocket();
+
+ virtual void Shutdown();
+ virtual GSocket *WaitConnection(wxSocketBase& wxsocket);
+
+ GSocketError SetServer();
+ bool SetReusable();
+ bool SetBroadcast();
+ bool DontDoBind();
+ GSocketError Connect(GSocketStream stream);
+ GSocketError SetNonOriented();
+ int Read(char *buffer, int size);
+ int Write(const char *buffer, int size);
+ void SetNonBlocking(bool non_block);
+ GSocketError WXDLLIMPEXP_NET GetError();
+ GSocketError GetSockOpt(int level, int optname, void *optval, int *optlen);
+ GSocketError SetSockOpt(int level, int optname,
+ const void *optval, int optlen);
+ //attach or detach from main loop
+ void Notify(bool flag);
+ void Detected_Read();
+ void Detected_Write();
+
+private:
+ // enable or disable notifications for socket input/output events but only
+ // if m_use_events is true; do nothing otherwise
+ void EnableEvents()
+ {
+ if ( m_use_events )
+ DoEnableEvents(true);
+ }
+
+ void DisableEvents()
+ {
+ if ( m_use_events )
+ DoEnableEvents(false);
+ }
+
+ // really enable or disable socket input/output events, regardless of
+ // m_use_events value
+ void DoEnableEvents(bool enable);
+
+
+ // enable or disable events for the given event if m_use_events; do nothing
+ // otherwise
+ //
+ // notice that these functions also update m_detected: EnableEvent() clears
+ // the corresponding bit in it and DisableEvent() sets it
+ void EnableEvent(GSocketEvent event);
+ void DisableEvent(GSocketEvent event);
+
+
+ GSocketError Input_Timeout();
+ GSocketError Output_Timeout();
+ int Recv_Stream(char *buffer, int size);
+ int Recv_Dgram(char *buffer, int size);
+ int Send_Stream(const char *buffer, int size);
+ int Send_Dgram(const char *buffer, int size);
+public:
+ /* DFE: We can't protect these data member until the GUI code is updated */
+ /* protected: */
+ wxGSocketIOHandler *m_handler;
+
+ // true if socket should fire events
+ bool m_use_events;
+
+ // pointer for storing extra (usually GUI-specific) data
+ void *m_gui_dependent;
+
+private:
+ // notify the associated wxSocket about a change in socket state and shut
+ // down the socket if the event is GSOCK_LOST
+ void OnStateChange(GSocketEvent event);