-GSocket *GSocket_WaitConnection(GSocket *socket);
-
-/* Client specific parts */
-
-/* GSocket_Connect:
- * Establishes a client connection to a server using the "Peer"
- * field of GSocket. "Peer" must be set by GSocket_SetPeer() before
- * GSocket_Connect() is called. Possible error codes are GSOCK_INVSOCK,
- * GSOCK_INVADDR, GSOCK_TIMEDOUT, GSOCK_WOULDBLOCK and GSOCK_IOERR.
- * If a socket is nonblocking and Connect() returns GSOCK_WOULDBLOCK,
- * the connection request can be completed later. Use GSocket_Select()
- * to check it, or wait for a GSOCK_CONNECTION event.
- */
-GSocketError GSocket_Connect(GSocket *socket, GSocketStream stream);
+class GSocketManager
+{
+public:
+ // set the manager to use, we don't take ownership of it
+ //
+ // this should be called before GSocket_Init(), i.e. before the first
+ // wxSocket object is created, otherwise the manager returned by
+ // wxAppTraits::GetSocketManager() will be used
+ static void Set(GSocketManager *manager);
+
+ // return the manager to use
+ //
+ // this initializes the manager at first use
+ static GSocketManager *Get()
+ {
+ if ( !ms_manager )
+ Init();
+
+ return ms_manager;
+ }
+
+ // called before the first wxSocket is created and should do the
+ // initializations needed in order to use the network
+ //
+ // return true if initialized successfully
+ virtual bool OnInit() = 0;
+
+ // undo the initializations of OnInit()
+ virtual void OnExit() = 0;
+
+
+ // do manager-specific socket initializations (and undo it): this is called
+ // in the beginning/end of the socket initialization/destruction
+ virtual bool Init_Socket(GSocket *socket) = 0;
+ virtual void Destroy_Socket(GSocket *socket) = 0;
+
+ virtual void Install_Callback(GSocket *socket, GSocketEvent event) = 0;
+ virtual void Uninstall_Callback(GSocket *socket, GSocketEvent event) = 0;
+
+ virtual void Enable_Events(GSocket *socket) = 0;
+ virtual void Disable_Events(GSocket *socket) = 0;
+
+ virtual ~GSocketManager() { }
+
+private:
+ // get the manager to use if we don't have it yet
+ static void Init();
+
+ static GSocketManager *ms_manager;
+};