debian: fix build-deps for focal
[amule.git] / src / ED2KLink.h
blob52915a4e671957c1e19c09dad7aa500155d3e909
1 //
2 // This file is part of the aMule Project.
3 //
4 // Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org )
5 // Copyright (c) 2002-2011 Merkur ( devs@emule-project.net / http://www.emule-project.net )
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 ED2KLINK_H
27 #define ED2KLINK_H
30 #include "MD4Hash.h" // Needed for CMD4Hash
31 #include "SHAHashSet.h" // Needed for CAICHHash
35 class CMemFile;
38 class CED2KLink
40 public:
41 typedef enum { kServerList, kServer , kFile , kInvalid } LinkType;
43 static CED2KLink* CreateLinkFromUrl(const wxString& link);
45 LinkType GetKind() const;
46 virtual wxString GetLink() const = 0;
48 virtual ~CED2KLink();
50 protected:
51 CED2KLink( LinkType type );
53 private:
54 LinkType m_type;
58 class CED2KFileLink : public CED2KLink
60 friend class CED2KLink;
61 CED2KFileLink(const wxString& link);
63 public:
64 virtual ~CED2KFileLink();
66 virtual wxString GetLink() const;
68 wxString GetName() const;
69 uint64 GetSize() const;
70 const CMD4Hash& GetHashKey() const;
72 // AICH data
73 bool HasValidAICHHash() const;
74 const CAICHHash& GetAICHHash() const;
76 CMemFile* m_hashset;
78 /**
79 * Structure used to store sources found in file links.
81 struct SED2KLinkSource
83 //! Hostname or dot-address.
84 wxString addr;
85 //! The source's TCP-port.
86 uint16 port;
87 //! Client hash for encryption
88 wxString hash;
89 //! Client cryptoptions
90 uint8 cryptoptions;
93 typedef std::deque<SED2KLinkSource> CED2KLinkSourceList;
94 CED2KLinkSourceList m_sources;
96 private:
97 CED2KFileLink(); // Not defined
98 CED2KFileLink(const CED2KFileLink&); // Not defined
99 CED2KFileLink& operator=(const CED2KFileLink&); // Not defined
101 wxString m_name;
102 uint64 m_size;
103 CMD4Hash m_hash;
104 bool m_bAICHHashValid;
105 CAICHHash m_AICHHash;
109 class CED2KServerLink : public CED2KLink
111 friend class CED2KLink;
112 CED2KServerLink(const wxString& link);
114 public:
115 virtual wxString GetLink() const;
117 uint32 GetIP() const;
118 uint16 GetPort() const;
120 private:
121 CED2KServerLink(); // Not defined
122 CED2KServerLink(const CED2KServerLink&); // Not defined
123 CED2KServerLink& operator=(const CED2KServerLink&); // Not defined
125 uint32 m_ip;
126 uint16 m_port;
130 class CED2KServerListLink : public CED2KLink
132 friend class CED2KLink;
133 CED2KServerListLink(const wxString& link);
135 public:
136 virtual wxString GetLink() const;
138 const wxString& GetAddress() const;
140 private:
141 CED2KServerListLink(); // Not defined
142 CED2KServerListLink(const CED2KFileLink&); // Not defined
143 CED2KServerListLink& operator=(const CED2KFileLink&); // Not defined
145 wxString m_address;
149 #endif
150 // File_checked_for_headers