2 // This file is part of the aMule Project.
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 )
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
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
30 #include "MD4Hash.h" // Needed for CMD4Hash
31 #include "SHAHashSet.h" // Needed for CAICHHash
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;
51 CED2KLink( LinkType type
);
58 class CED2KFileLink
: public CED2KLink
60 friend class CED2KLink
;
61 CED2KFileLink(const wxString
& link
);
64 virtual ~CED2KFileLink();
66 virtual wxString
GetLink() const;
68 wxString
GetName() const;
69 uint64
GetSize() const;
70 const CMD4Hash
& GetHashKey() const;
73 bool HasValidAICHHash() const;
74 const CAICHHash
& GetAICHHash() const;
79 * Structure used to store sources found in file links.
81 struct SED2KLinkSource
83 //! Hostname or dot-address.
85 //! The source's TCP-port.
87 //! Client hash for encryption
89 //! Client cryptoptions
93 typedef std::deque
<SED2KLinkSource
> CED2KLinkSourceList
;
94 CED2KLinkSourceList m_sources
;
97 CED2KFileLink(); // Not defined
98 CED2KFileLink(const CED2KFileLink
&); // Not defined
99 CED2KFileLink
& operator=(const CED2KFileLink
&); // Not defined
104 bool m_bAICHHashValid
;
105 CAICHHash m_AICHHash
;
109 class CED2KServerLink
: public CED2KLink
111 friend class CED2KLink
;
112 CED2KServerLink(const wxString
& link
);
115 virtual wxString
GetLink() const;
117 uint32
GetIP() const;
118 uint16
GetPort() const;
121 CED2KServerLink(); // Not defined
122 CED2KServerLink(const CED2KServerLink
&); // Not defined
123 CED2KServerLink
& operator=(const CED2KServerLink
&); // Not defined
130 class CED2KServerListLink
: public CED2KLink
132 friend class CED2KLink
;
133 CED2KServerListLink(const wxString
& link
);
136 virtual wxString
GetLink() const;
138 const wxString
& GetAddress() const;
141 CED2KServerListLink(); // Not defined
142 CED2KServerListLink(const CED2KFileLink
&); // Not defined
143 CED2KServerListLink
& operator=(const CED2KFileLink
&); // Not defined
150 // File_checked_for_headers