fuse_server.h

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 class FuseServerClientThread;
00037
00038 class FuseServer
00039 : public fawkes::Thread,
00040   public fawkes::NetworkIncomingConnectionHandler
00041 {
00042  public:
00043
00044   FuseServer(unsigned short int port, fawkes::ThreadCollector *collector = NULL);
00045   virtual ~FuseServer();
00046
00047   virtual void add_connection(fawkes::StreamSocket *s) throw();
00048   void connection_died(FuseServerClientThread *client) throw();
00049
00050   virtual void loop();
00051
00052  private:
00053   fawkes::NetworkAcceptorThread *__acceptor_thread;
00054
00055   fawkes::LockList<FuseServerClientThread *>  __clients;
00056   fawkes::LockList<FuseServerClientThread *>::iterator  __cit;
00057
00058   fawkes::LockList<FuseServerClientThread *>  __dead_clients;
00059
00060   fawkes::ThreadCollector *__thread_collector;
00061 };
00062
00063
00064 #endif