hnfwd.h

Go to the documentation of this file.
00001 /**
00002  *  Copyright (C) 2004-2005 Alo Sarv <madcat_@users.sourceforge.net>
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017  */
00018 
00019 /** \file hnfwd.h Forward declarations for HydraNode Core classes */
00020 
00021 #ifndef __HNFWD_H__
00022 #define __HNFWD_H__
00023 
00024 #include <boost/function.hpp>
00025 #include <boost/shared_ptr.hpp>
00026 
00027 // networking subsystem
00028 class SocketWatcher;
00029 class SocketClient;
00030 class SocketServer;
00031 class UDPSocket;
00032 class IPV4Address;
00033 template<typename, typename, typename>
00034 class SSocket;
00035 template<typename, typename>
00036 class Scheduler;
00037 
00038 //! Socket types and protocols for easier SSocket class usage
00039 namespace Socket {
00040         class TCP;        //!< Protocol:  TCP
00041         class UDP;        //!< Protocol:  UDP
00042         class Client;     //!< Semantics: Client
00043         class Server;     //!< Semantics: Server
00044 }
00045 
00046 //! Various socket events passed to event handler
00047 enum SocketEvent {
00048         SOCK_CONNECTED = 1,   //!< Outgoing connection has been established
00049         SOCK_CONNFAILED,      //!< Outgoing connection failed
00050         SOCK_ACCEPT,          //!< Incoming connection is ready to be accepted
00051         SOCK_READ,            //!< Incoming data is ready for reading in socket
00052         SOCK_WRITE,           //!< Socket became writable
00053         SOCK_LOST,            //!< Socket connection has been lost
00054         SOCK_ERR,             //!< Error has accoured.
00055         SOCK_TIMEOUT          //!< The connection has timed out
00056 };
00057 
00058 // files management subsystem
00059 class FilesList;
00060 class SharedFile;
00061 class PartData;
00062 namespace Detail {
00063         class UsedRange;
00064         class LockedRange;
00065         typedef boost::shared_ptr<UsedRange  > UsedRangePtr;
00066         typedef boost::shared_ptr<LockedRange> LockedRangePtr;
00067 }
00068 
00069 // search API
00070 class Search;
00071 class SearchResult;
00072 typedef boost::shared_ptr<Search>                  SearchPtr;
00073 typedef boost::shared_ptr<SearchResult>            SearchResultPtr;
00074 typedef boost::function<void (SearchPtr)>          SearchHandler;
00075 typedef boost::function<bool (const std::string&)> LinkHandler;
00076 
00077 class HydraNode;
00078 
00079 // metadata subsystem
00080 //! Various file types
00081 enum FileType {
00082         FT_UNKNOWN = 0,                             //!< Unknown
00083         FT_ARCHIVE = 1,                             //!< zip/arj/rar/gz/bz2
00084         FT_VIDEO,                                   //!< avi/mpeg/mpg/wmv
00085         FT_AUDIO,                                   //!< mp3/mpc/ogg
00086         FT_IMAGE,                                   //!< png/gif/jpg/bmp
00087         FT_DOCUMENT,                                //!< txt/doc/kwd/sxw/rtf
00088         FT_PROGRAM,                                 //!< exe/com/bat/sh
00089         FT_CDIMAGE                                  //!< iso/bin/cue/nrg
00090 };
00091 class MetaData;
00092 class AudioMetaData;
00093 class VideoMetaData;
00094 class ArchiveMetaData;
00095 class ImageMetaData;
00096 class StreamData;
00097 
00098 // files identification subsystem
00099 class HashBase;
00100 class HashSetBase;
00101 class HashSetMaker;
00102 class ThreadWork;
00103 class HashWork;
00104 typedef boost::shared_ptr<ThreadWork> ThreadWorkPtr;
00105 typedef boost::shared_ptr<HashWork> HashWorkPtr;
00106 
00107 /**
00108  * Events emitted by HashWork object when the job has been completed by
00109  * Hasher.
00110  */
00111 enum HashEvent {
00112         HASH_COMPLETE    = 1,   //!< Full HashWork has been completed.
00113         HASH_VERIFIED    = 2,   //!< Range Hash has been verified.
00114         HASH_FAILED      = 3,   //!< Range Hash verification failed.
00115         HASH_FATAL_ERROR = 4    //!< Fatal error has occoured.
00116 };
00117 
00118 #endif