Fawkes API  Fawkes Development Version
plugin_tool.h
1 
2 /***************************************************************************
3  * plugin_tool.h - Fawkes plugin tool
4  *
5  * Created: Sun Nov 26 16:44:00 2006
6  * Copyright 2006 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef __TOOLS_PLUGIN_PLUGIN_TOOL_H_
24 #define __TOOLS_PLUGIN_PLUGIN_TOOL_H_
25 
26 #include <netcomm/fawkes/client_handler.h>
27 #include <utils/system/signal.h>
28 
29 namespace fawkes {
30  class FawkesNetworkClient;
31  class FawkesNetworkMessage;
32  class ArgumentParser;
33 }
34 
36 : public fawkes::SignalHandler,
38 {
39  public:
42  ~PluginTool();
43 
44  void handle_signal(int signum);
45 
46  void set_load_plugin(const char *plugin_name);
47  void set_unload_plugin(const char *plugin_name);
48  void set_watch_mode();
49  void set_list_mode();
50 
51  void run();
52 
53  static void print_usage(const char *program_name);
54 
55  private:
56  void load();
57  void unload();
58  void list_loaded();
59  void watch();
60  void list_avail();
61 
62  virtual void deregistered(unsigned int id) throw();
63  virtual void inbound_received(fawkes::FawkesNetworkMessage *msg,
64  unsigned int id) throw();
65  virtual void connection_died(unsigned int id) throw();
66  virtual void connection_established(unsigned int id) throw();
67 
68  private:
69  typedef enum {
70  M_LIST_LOADED,
71  M_LIST_AVAIL,
72  M_LOAD,
73  M_UNLOAD,
74  M_RELOAD,
75  M_WATCH,
76  M_UNKNOWN
77  } OperationMode;
78 
80  OperationMode opmode;
81  const char *plugin_name;
82  const char *__program_name;
83  bool quit;
84 
85  bool list_found;
86 };
87 
88 
89 #endif
Message handler for FawkesNetworkClient.
Simple Fawkes network client.
Definition: client.h:52
Fawkes library namespace.
Representation of a message that is sent over the network.
Definition: message.h:75
Interface for signal handling.
Definition: signal.h:35
Parse command line arguments.
Definition: argparser.h:66
Program to communicate with plugin manager via Fawkes network.
Definition: plugin_tool.h:35