#include <clients.h>
Public Member Functions | |
| DECLARE_EVENT_TABLE (Client *, ClientEvent) | |
| void | setServerAddr (IPV4Address addr) |
| void | startUpload () |
| Start uploading to this client. | |
| void | reqDownload () |
| Request to download current requested file from this client (e.g. | |
| void | sendQR () |
| Send queue ranking to the remote client. | |
| float | getScore () const |
| Calculates client score, based on credits and wait time in queue (if applicaple). | |
| void | addOffered (Download *file, bool doConn=true) |
| Add an offered file to this client's offered files list. | |
| void | remOffered (Download *file, bool cleanUp=true) |
| Remove an offered file. | |
| bool | isConnected () const |
| Check if the connection is currently established with this client. | |
| bool | callbackInProgress () const |
| Check whether there's LowID callback in progress. | |
| bool | reaskInProgress () const |
| Check whether we are currently in process of reasking the source. | |
| void | setOnQueue (uint32_t qr) |
| Set the current client state to indicate that we are on remote client's queue, waiting for an upload. | |
| void | removeFromQueue () |
| Resets all queue-related data and emits EVT_CANCEL_UPLOADREQ to indicate that this client no longer wants anything from us. | |
| void | verifyIdent () |
| Attempt to verify this client's identity. | |
| std::string | getIpPort () const |
| Small helper function for retrieving client IP/ID/port combination in printable format. | |
get-to-know-you-chit-chat | |
| void | onPacket (const ED2KPacket::Hello &p) |
| void | onPacket (const ED2KPacket::HelloAnswer &p) |
| void | onPacket (const ED2KPacket::MuleInfo &p) |
| void | onPacket (const ED2KPacket::MuleInfoAnswer &p) |
Uploading | |
| void | onPacket (const ED2KPacket::ReqFile &p) |
| void | onPacket (const ED2KPacket::SetReqFileId &p) |
| void | onPacket (const ED2KPacket::ReqHashSet &p) |
| void | onPacket (const ED2KPacket::StartUploadReq &p) |
| void | onPacket (const ED2KPacket::ReqChunks &p) |
| void | onPacket (const ED2KPacket::CancelTransfer &) |
Downloading | |
| void | onPacket (const ED2KPacket::FileName &p) |
| void | onPacket (const ED2KPacket::FileDesc &p) |
| void | onPacket (const ED2KPacket::NoFile &p) |
| void | onPacket (const ED2KPacket::FileStatus &p) |
| void | onPacket (const ED2KPacket::HashSet &p) |
| void | onPacket (const ED2KPacket::AcceptUploadReq &) |
| void | onPacket (const ED2KPacket::QueueRanking &p) |
| void | onPacket (const ED2KPacket::MuleQueueRank &p) |
| void | onPacket (const ED2KPacket::DataChunk &p) |
| void | onPacket (const ED2KPacket::PackedChunk &p) |
Source Exchange | |
| void | onPacket (const ED2KPacket::SourceExchReq &p) |
| void | onPacket (const ED2KPacket::AnswerSources &p) |
Miscellanous | |
| void | onPacket (const ED2KPacket::Message &p) |
| void | onPacket (const ED2KPacket::ChangeId &p) |
SecIdent | |
| void | onPacket (const ED2KPacket::SecIdentState &p) |
| void | onPacket (const ED2KPacket::PublicKey &p) |
| void | onPacket (const ED2KPacket::Signature &p) |
UDP packets | |
| void | onPacket (const ED2KPacket::ReaskFilePing &p) |
| void | onPacket (const ED2KPacket::FileNotFound &p) |
| void | onPacket (const ED2KPacket::ReaskAck &p) |
| void | onPacket (const ED2KPacket::QueueFull &p) |
Accessors for this client's information | |
| Hash< MD4Hash > | getHash () const |
| uint32_t | getId () const |
| uint16_t | getTcpPort () const |
| uint16_t | getUdpPort () const |
| IPV4Address | getServerAddr () const |
| std::string | getNick () const |
| bool | supportsPreview () const |
| bool | supportsMultiPacket () const |
| bool | supportsViewShared () const |
| bool | supportsPeerCache () const |
| uint8_t | getCommentVer () const |
| uint8_t | getExtReqVer () const |
| uint8_t | getSrcExchVer () const |
| uint8_t | getSecIdentVer () const |
| uint8_t | getComprVer () const |
| uint8_t | getUdpVer () const |
| bool | supportsUnicode () const |
| uint8_t | getAICHVer () const |
| bool | isLowId () const |
| bool | isHighId () const |
| uint8_t | getClientSoft () const |
| uint32_t | getVerMjr () const |
| uint32_t | getVerMin () const |
| uint32_t | getVerPch () const |
| uint32_t | getVerBld () const |
| std::string | getSoftStr () const |
| std::string | getVerStr () const |
| bool | isMule () const |
Other generic accessors | |
| ED2KClientSocket * | getSocket () const |
| void | setSocket (ED2KClientSocket *s) |
Accessors for extensions | |
| Detail::SourceInfoPtr | getSourceInfo () const |
| Detail::QueueInfoPtr | getQueueInfo () const |
| Detail::UploadInfoPtr | getUploadInfo () const |
| Detail::DownloadInfoPtr | getDownloadInfo () const |
Private Member Functions | |
| Client () | |
| Forbidden. | |
| ~Client () | |
| Allowed by ClientList. | |
| Client (const Client &) | |
| Copying forbidden. | |
| const Client & | operator= (const Client &) |
| Copying forbidden. | |
| Client (ED2KClientSocket *c) | |
| Only allowed constructor. | |
| Client (IPV4Address addr, Download *file) | |
| Construct a "source" type client, which has a file to offer for us. | |
| void | onSocketEvent (ED2KClientSocket *c, SocketEvent evt) |
| Event handler for socket events. | |
| void | destroy () |
| Scheduler the object for destruction. | |
| void | storeInfo (const ED2KPacket::Hello &p) |
| Copy client information from the hello packet to internal variables. | |
| void | processMuleInfo (const ED2KPacket::MuleInfo &p) |
| Processes, extracts and stores all useful information from this extinct packet, used by some older mule-based clients. | |
| void | merge (Client *c) |
| Merge sockets and parser from other client to this client, taking ownership of those two. | |
| void | onUploadReq (const Hash< ED2KHash > &hash) |
| Generalized version of upload requests - constructs the neccesery members and emits the neccesery events, indicating the client wishes to download something from us. | |
| void | sendChunkReqs (bool onlyNew=false) |
| Sends next three chunk requests to current downloadclient. | |
| void | sendNextChunk () |
| Sends next chunk to socket (when uploading). | |
| void | establishConnection () |
| Establish connection with the remote client either by directly connecting to it, or performing a low-id callback operation through server. | |
| void | reaskForDownload () |
| Performs UDP reask for download. | |
| void | checkDestroy () |
| Checks if this client is useful to us at all, and if not, emits EVT_DESTROY. | |
| void | sendSignature () |
| Send our signature to this client. | |
| void | sendPublicKey () |
| Send our public key to this client. | |
| void | initTransfer () |
| Called after successful handshake (and optionally, SecIdent), starts actual data transfer. | |
| void | handshakeCompleted () |
| Called by ClientList after received IDChange event from us, this indicates that merging (if any) with existing client has been completed, and we are ready to proceed, depending on context. | |
| void | verifyHashSet (boost::shared_ptr< ED2KHashSet > hs) |
| Verify the contents of the passed hashset by re-calculating the file- hash from the chunkhashes. | |
Static Private Member Functions | |
| static ED2KUDPSocket *& | getUdpSocket () |
| Returns reference to pointer to ClientUDPSocket; only allowed to be used by ClientList. | |
Private Attributes | |
| bool | m_callbackInProgress |
| TCP callback is in progress. | |
| bool | m_reaskInProgress |
| (UDP) reask is in progress | |
| uint8_t | m_failedUdpReasks |
| Number of failed UDP reasks (in row). | |
| uint64_t | m_lastReaskTime |
| When was last source reask done. | |
| uint32_t | m_sentChallenge |
| During identity verification, contains challenge sent TO the client. | |
| uint32_t | m_reqChallenge |
| During identity verification, contains challenge sent BY the client. | |
| bool | m_upReqInProgress |
| State: Upload request is in progress. | |
| bool | m_dnReqInProgress |
| State: Download request is in progress. | |
Information we have on this client | |
| uint32_t | m_id |
| Client ID ( <= 0x00fffff == LowID ). | |
| uint16_t | m_tcpPort |
| TCP port. | |
| uint16_t | m_udpPort |
| UDP port. | |
| uint32_t | m_features |
| Supported features. | |
| Hash< MD4Hash > | m_hash |
| Userhash. | |
| PublicKey | m_pubKey |
| Client's public key. | |
| IPV4Address | m_serverAddr |
| Server the client is connected to. | |
| std::string | m_nick |
| User nickname. | |
| uint32_t | m_clientSoft |
| Client soft and version. | |
Internal things | |
| boost::shared_ptr< ED2KParser< Client > > | m_parser |
| Stream parser. | |
| ED2KClientSocket * | m_socket |
| Socket. | |
| Credits * | m_credits |
| May be 0. | |
| Detail::QueueInfoPtr | m_queueInfo |
| Detail::UploadInfoPtr | m_uploadInfo |
| Detail::SourceInfoPtr | m_sourceInfo |
| Detail::DownloadInfoPtr | m_downloadInfo |
Friends | |
| class | ClientList |
The reasons for communication may be either because it wants something from us, because we want something from it, or even both. The exact purpose of the client is not defined by this object. Instead, the purpose is defined by member objects DownloadClient and/or UploadClient. As long as the client has at least a single purpose, it must be alive, however when it has fulfulled it's purpose, and no longer contains neither UploadClient nor DownloadClient, it must return to the source.
Definition at line 92 of file clients.h.
|
|
Forbidden.
|
|
|
Allowed by ClientList.
Definition at line 173 of file clients.cpp. References m_socket. |
|
|
Copying forbidden.
|
|
|
Only allowed constructor. The socket is required to initialize the client and perform initial handshaking with the client.
Definition at line 148 of file clients.cpp. References m_id, m_parser, m_tcpPort, and onSocketEvent(). |
|
||||||||||||
|
Construct a "source" type client, which has a file to offer for us.
Definition at line 163 of file clients.cpp. References addOffered(). |
|
||||||||||||
|
|
|
|
Definition at line 589 of file clients.cpp. References getVerMin(), isMule(), m_socket, and storeInfo(). Referenced by ClientList::onUdpData(). |
|
|
Definition at line 604 of file clients.cpp. References getIpPort(), and storeInfo(). |
|
|
Definition at line 611 of file clients.cpp. References getIpPort(), m_socket, and processMuleInfo(). |
|
|
Definition at line 621 of file clients.cpp. References getIpPort(), and processMuleInfo(). |
|
|
Definition at line 651 of file clients.cpp. References DownloadList::find(), getIpPort(), DownloadList::instance(), isConnected(), m_socket, m_sourceInfo, m_upReqInProgress, and reqDownload(). |
|
|
Definition at line 683 of file clients.cpp. References EVT_UPLOADREQ, getIpPort(), isConnected(), m_queueInfo, m_socket, and m_uploadInfo. |
|
|
Definition at line 773 of file clients.cpp. References getIpPort(), and m_socket. |
|
|
Definition at line 735 of file clients.cpp. References getIpPort(), and onUploadReq(). |
|
|
Definition at line 876 of file clients.cpp. References isConnected(), m_uploadInfo, and sendNextChunk(). |
|
|
Definition at line 984 of file clients.cpp. References EVT_CANCEL_UPLOADREQ, and TRACE_DEADSRC. |
|
|
Definition at line 1007 of file clients.cpp. References addOffered(), DownloadList::find(), Download::getHash(), getIpPort(), DownloadList::instance(), isConnected(), Download::isSourceReqAllowed(), m_socket, m_sourceInfo, Download::setLastSrcExch(), and TRACE_SRCEXCH. |
|
|
Definition at line 1055 of file clients.cpp. References Download::getPartData(), m_sourceInfo, and ED2KFile::ratingToString(). |
|
|
Definition at line 1147 of file clients.cpp. References DownloadList::find(), getIpPort(), DownloadList::instance(), m_sourceInfo, and remOffered(). |
|
|
Definition at line 1083 of file clients.cpp. References addOffered(), EVT_REASKFILEPING, DownloadList::find(), getIpPort(), Download::getPartData(), DownloadList::instance(), isConnected(), m_downloadInfo, m_lastReaskTime, m_socket, m_sourceInfo, and SOURCE_REASKTIME. |
|
|
Definition at line 1166 of file clients.cpp. References getIpPort(), Download::getPartData(), m_sourceInfo, and verifyHashSet(). |
|
|
Definition at line 1302 of file clients.cpp. References getIpPort(), Download::getPartData(), m_downloadInfo, m_sourceInfo, and sendChunkReqs(). |
|
|
Definition at line 1260 of file clients.cpp. References setOnQueue(). |
|
|
Definition at line 1264 of file clients.cpp. References setOnQueue(). |
|
|
Definition at line 1387 of file clients.cpp. References Credits::addDownloaded(), COL_RECV, CreditsDb::create(), and CreditsDb::instance(). |
|
|
Definition at line 1414 of file clients.cpp. References Credits::addDownloaded(), COL_RECV, CreditsDb::create(), getIpPort(), CreditsDb::instance(), isConnected(), m_credits, m_downloadInfo, m_hash, m_pubKey, and sendChunkReqs(). |
|
|
Definition at line 1441 of file clients.cpp. References DownloadList::find(), getIpPort(), Download::getSourceCount(), Download::getSources(), getSrcExchVer(), DownloadList::instance(), m_socket, m_sourceInfo, and TRACE_SRCEXCH. |
|
|
Definition at line 1467 of file clients.cpp. References Detail::foundServer, Detail::foundSource, getIpPort(), getSrcExchVer(), and TRACE_SRCEXCH. |
|
|
Definition at line 1516 of file clients.cpp. References getIpPort(). |
|
|
Definition at line 1499 of file clients.cpp. References Detail::changeId, getIpPort(), and isHighId(). |
|
|
Definition at line 1523 of file clients.cpp. References getIpPort(), m_pubKey, m_reqChallenge, m_sentChallenge, sendPublicKey(), sendSignature(), SI_KEYANDSIGNEEDED, SI_SIGNEEDED, TRACE_SECIDENT, and verifyIdent(). |
|
|
Definition at line 1550 of file clients.cpp. References PublicKey::clear(), getIpPort(), m_credits, m_pubKey, m_reqChallenge, sendSignature(), and TRACE_SECIDENT. |
|
|
Definition at line 1571 of file clients.cpp. References destroy(), CreditsDb::find(), Credits::getDownloaded(), getIpPort(), Credits::getPubKey(), getSecIdentVer(), Credits::getUploaded(), initTransfer(), CreditsDb::instance(), IP_LOCAL, IP_REMOTE, isHighId(), isLowId(), m_credits, m_pubKey, m_sentChallenge, m_socket, TRACE_SECIDENT, and CreditsDb::verifySignature(). |
|
|
Definition at line 1808 of file clients.cpp. References addOffered(), DownloadList::find(), getId(), getIpPort(), Download::getPartData(), getUdpPort(), getUdpVer(), DownloadList::instance(), isLowId(), m_queueInfo, m_uploadInfo, onUploadReq(), and s_clientUdpSocket. |
|
|
Definition at line 1906 of file clients.cpp. References getIpPort(), m_failedUdpReasks, m_lastReaskTime, m_reaskInProgress, m_sourceInfo, and remOffered(). |
|
|
Definition at line 1883 of file clients.cpp. References EVT_REASKFILEPING, getIpPort(), m_failedUdpReasks, m_lastReaskTime, m_reaskInProgress, m_sourceInfo, and SOURCE_REASKTIME. |
|
|
Definition at line 1921 of file clients.cpp. References EVT_REASKFILEPING, getIpPort(), m_failedUdpReasks, m_lastReaskTime, m_reaskInProgress, m_sourceInfo, and SOURCE_REASKTIME. |
|
|
Definition at line 151 of file clients.h. References m_hash. |
|
|
Definition at line 152 of file clients.h. References m_id. Referenced by getIpPort(), onPacket(), reaskForDownload(), and sendSignature(). |
|
|
Definition at line 153 of file clients.h. References m_tcpPort. Referenced by getIpPort(). |
|
|
Definition at line 154 of file clients.h. References m_udpPort. Referenced by onPacket(), and reaskForDownload(). |
|
|
Definition at line 155 of file clients.h. References m_serverAddr. |
|
|
Definition at line 156 of file clients.h. References m_nick. |
|
|
Definition at line 157 of file clients.h. References m_features. |
|
|
Definition at line 158 of file clients.h. References m_features. |
|
|
Definition at line 159 of file clients.h. References m_features. |
|
|
Definition at line 160 of file clients.h. References m_features. |
|
|
Definition at line 161 of file clients.h. References m_features. |
|
|
Definition at line 162 of file clients.h. References m_features. |
|
|
Definition at line 163 of file clients.h. References m_features. Referenced by onPacket(). |
|
|
Definition at line 164 of file clients.h. References m_features. Referenced by handshakeCompleted(), onPacket(), sendSignature(), and verifyIdent(). |
|
|
Definition at line 165 of file clients.h. References m_features. Referenced by sendNextChunk(). |
|
|
Definition at line 166 of file clients.h. References m_features. Referenced by onPacket(), and reaskForDownload(). |
|
|
Definition at line 167 of file clients.h. References m_features. |
|
|
Definition at line 168 of file clients.h. References m_features. |
|
|
Definition at line 169 of file clients.h. References m_id. Referenced by establishConnection(), onPacket(), reaskForDownload(), and sendSignature(). |
|
|
Definition at line 170 of file clients.h. References m_id. Referenced by getIpPort(), onPacket(), and reaskForDownload(). |
|
|
Definition at line 171 of file clients.h. References m_clientSoft. Referenced by getVerStr(), isMule(), and storeInfo(). |
|
|
Definition at line 172 of file clients.h. References m_clientSoft. Referenced by getVerStr(). |
|
|
Definition at line 173 of file clients.h. References m_clientSoft. Referenced by getVerStr(), onPacket(), and processMuleInfo(). |
|
|
Definition at line 174 of file clients.h. References m_clientSoft. Referenced by getVerStr(). |
|
|
Definition at line 175 of file clients.h. References m_clientSoft. Referenced by getVerStr(). |
|
|
Definition at line 542 of file clients.cpp. References CS_AMULE, CS_CDONKEY, CS_DONKEY, CS_EMULE, CS_EMULEPLUS, CS_HYBRID, CS_HYDRANODE, CS_LPHANT, CS_LXMULE, CS_MLDONKEY, CS_MLDONKEY_NEW, CS_MLDONKEY_NEW2, CS_OLDEMULE, CS_SHAREAZA, CS_UNKNOWN, and m_clientSoft. Referenced by processMuleInfo(), and storeInfo(). |
|
|
Definition at line 566 of file clients.cpp. References CS_EMULE, getClientSoft(), getVerBld(), getVerMin(), getVerMjr(), and getVerPch(). Referenced by processMuleInfo(), and storeInfo(). |
|
|
Definition at line 580 of file clients.cpp. References CS_EMULE, getClientSoft(), and m_hash. Referenced by onPacket(), processMuleInfo(), and sendQR(). |
|
|
Definition at line 183 of file clients.h. References m_socket. |
|
|
Definition at line 184 of file clients.h. References m_socket. |
|
|
Definition at line 190 of file clients.h. References m_serverAddr. Referenced by ClientList::addSource(). |