plugin_tool.h

00001 
00002 /***************************************************************************
00003  *  plugin_tool.h - Fawkes plugin tool
00004  *
00005  *  Created: Sun Nov 26 16:44:00 2006
00006  *  Copyright  2006  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.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  Read the full text in the LICENSE.GPL file in the doc directory.
00021  */
00022 
00023 #ifndef __TOOLS_PLUGIN_PLUGIN_TOOL_H_
00024 #define __TOOLS_PLUGIN_PLUGIN_TOOL_H_
00025 
00026 #include <netcomm/fawkes/client_handler.h>
00027 #include <utils/system/signal.h>
00028 
00029 namespace fawkes {
00030   class FawkesNetworkClient;
00031   class FawkesNetworkMessage;
00032   class ArgumentParser;
00033 }
00034 
00035 class PluginTool
00036 : public fawkes::SignalHandler,
00037   public fawkes::FawkesNetworkClientHandler
00038 {
00039  public:
00040   PluginTool(fawkes::ArgumentParser *argp, fawkes::FawkesNetworkClient *c);
00041   PluginTool(fawkes::FawkesNetworkClient *c);
00042   ~PluginTool();
00043 
00044   void handle_signal(int signum);
00045 
00046   void set_load_plugin(const char *plugin_name);
00047   void set_unload_plugin(const char *plugin_name);
00048   void set_watch_mode();
00049   void set_list_mode();
00050 
00051   void run();
00052 
00053   static void print_usage(const char *program_name);
00054 
00055  private:
00056   void load();
00057   void unload();
00058   void list_loaded();
00059   void watch();
00060   void list_avail();
00061 
00062   virtual void deregistered(unsigned int id) throw();
00063   virtual void inbound_received(fawkes::FawkesNetworkMessage *msg,
00064                                 unsigned int id) throw();
00065   virtual void connection_died(unsigned int id) throw();
00066   virtual void connection_established(unsigned int id) throw();
00067 
00068  private:
00069   typedef enum {
00070     M_LIST_LOADED,
00071     M_LIST_AVAIL,
00072     M_LOAD,
00073     M_UNLOAD,
00074     M_RELOAD,
00075     M_WATCH,
00076     M_UNKNOWN
00077   } OperationMode;
00078 
00079   fawkes::FawkesNetworkClient *c;
00080   OperationMode   opmode;
00081   const char     *plugin_name;
00082   const char     *__program_name;
00083   bool            quit;
00084 
00085   bool            list_found;
00086 };
00087 
00088 
00089 #endif

Generated on Tue Feb 22 13:32:32 2011 for Fawkes API by  doxygen 1.4.7