00001 00002 /*************************************************************************** 00003 * fuse_server.h - network image transport server interface 00004 * 00005 * Generated: Mon Jan 09 15:26:27 2006 00006 * Copyright 2005-2007 Tim Niemueller [www.niemueller.de] 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #ifndef __FIREVISION_FVUTILS_NET_FUSE_SERVER_H_ 00025 #define __FIREVISION_FVUTILS_NET_FUSE_SERVER_H_ 00026 00027 #include <core/threading/thread.h> 00028 #include <core/utils/lock_list.h> 00029 #include <netcomm/utils/incoming_connection_handler.h> 00030 00031 namespace fawkes { 00032 class ThreadCollector; 00033 class StreamSocket; 00034 class NetworkAcceptorThread; 00035 } 00036 namespace firevision { 00037 #if 0 /* just to make Emacs auto-indent happy */ 00038 } 00039 #endif 00040 00041 class FuseServerClientThread; 00042 00043 class FuseServer 00044 : public fawkes::Thread, 00045 public fawkes::NetworkIncomingConnectionHandler 00046 { 00047 public: 00048 00049 FuseServer(unsigned short int port, fawkes::ThreadCollector *collector = NULL); 00050 virtual ~FuseServer(); 00051 00052 virtual void add_connection(fawkes::StreamSocket *s) throw(); 00053 void connection_died(FuseServerClientThread *client) throw(); 00054 00055 virtual void loop(); 00056 00057 private: 00058 fawkes::NetworkAcceptorThread *__acceptor_thread; 00059 00060 fawkes::LockList<FuseServerClientThread *> __clients; 00061 fawkes::LockList<FuseServerClientThread *>::iterator __cit; 00062 00063 fawkes::LockList<FuseServerClientThread *> __dead_clients; 00064 00065 fawkes::ThreadCollector *__thread_collector; 00066 }; 00067 00068 } // end namespace firevision 00069 00070 #endif