debian: fix build-deps for focal
[amule.git] / src / libs / ec / cpp / ECMuleSocket.h
blobcbb664a4f0a66fdaf1d0544c5f1e94a179ecd6be
1 //
2 // This file is part of the aMule Project.
3 //
4 // Copyright (c) 2004-2011 aMule Team ( admin@amule.org / http://www.amule.org )
5 // Copyright (c) 2004-2011 Angel Vidal ( kry@amule.org )
6 //
7 // Any parts of this program derived from the xMule, lMule or eMule project,
8 // or contributed by third-party developers are copyrighted by their
9 // respective authors.
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 of the License, or
14 // (at your option) any later version.
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #ifndef ECMULESOCKET_H
27 #define ECMULESOCKET_H
29 #include "../../../LibSocket.h"
30 #include "ECSocket.h"
32 /*! \class CECMuleSocket
34 * \brief Socket handler for External Communications (EC)
37 class CECMuleSocket : public CECSocket, public CLibSocket {
38 public:
39 CECMuleSocket(bool use_events);
40 virtual ~CECMuleSocket();
42 bool ConnectSocket(class amuleIPV4Address& address);
44 virtual void OnConnect() {} // This is overwritten in RemoteConnect
45 virtual void OnConnect(int) { OnConnect(); } // This is called from LibSocketAsio
46 virtual void OnSend(int) { OnOutput(); }
47 virtual void OnReceive(int) { OnInput(); }
49 private:
50 bool InternalConnect(uint32_t ip, uint16_t port, bool wait);
52 int InternalGetLastError();
54 bool InternalWaitOnConnect(long secs = -1, long msecs = 0) { return CLibSocket::WaitOnConnect(secs,msecs); };
55 bool InternalWaitForWrite(long secs = -1, long msecs = 0) { return CLibSocket::WaitForWrite(secs,msecs); };
56 bool InternalWaitForRead(long secs = -1, long msecs = 0) { return CLibSocket::WaitForRead(secs,msecs); };
58 bool InternalError() { return CLibSocket::LastError() != 0; }
59 void InternalClose() { CLibSocket::Close(); }
61 uint32 InternalRead(void* ptr, uint32 len) { return CLibSocket::Read(ptr, len); };
62 uint32 InternalWrite(const void* ptr, uint32 len) { return CLibSocket::Write(ptr, len); };
64 bool InternalIsConnected() { return CLibSocket::IsConnected(); }
65 void InternalDestroy() { CLibSocket::Destroy(); }
68 #endif // ECMULESOCKET_H