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
29namespace fawkes {
30class FawkesNetworkClient;
31class FawkesNetworkMessage;
32class ArgumentParser;
33} // namespace fawkes
34
36{
37public:
41
42 void handle_signal(int signum);
43
44 void set_load_plugin(const char *plugin_name);
45 void set_unload_plugin(const char *plugin_name);
46 void set_watch_mode();
47 void set_list_mode();
48
49 void run();
50
51 static void print_usage(const char *program_name);
52
53private:
54 void load();
55 void unload();
56 void list_loaded();
57 void watch();
58 void list_avail();
59
60 virtual void deregistered(unsigned int id) noexcept;
61 virtual void inbound_received(fawkes::FawkesNetworkMessage *msg, unsigned int id) noexcept;
62 virtual void connection_died(unsigned int id) noexcept;
63 virtual void connection_established(unsigned int id) noexcept;
64
65private:
66 typedef enum {
67 M_LIST_LOADED,
68 M_LIST_AVAIL,
69 M_LOAD,
70 M_UNLOAD,
71 M_RELOAD,
72 M_WATCH,
73 M_UNKNOWN
74 } OperationMode;
75
77 OperationMode opmode;
78 const char * plugin_name;
79 const char * program_name_;
80 bool quit;
81
82 bool list_found;
83};
84
85#endif
Program to communicate with plugin manager via Fawkes network.
Definition: plugin_tool.h:36
void run()
Run opmode as requested determined by the arguments.
static void print_usage(const char *program_name)
Print usage.
Definition: plugin_tool.cpp:98
void set_list_mode()
Set list mode.
void set_watch_mode()
Set watch mode.
~PluginTool()
Destructor.
Definition: plugin_tool.cpp:90
void handle_signal(int signum)
Handle signals.
void set_load_plugin(const char *plugin_name)
Load plugin on next run.
void set_unload_plugin(const char *plugin_name)
Unload plugin on next run.
PluginTool(fawkes::ArgumentParser *argp, fawkes::FawkesNetworkClient *c)
Constructor.
Definition: plugin_tool.cpp:46
Parse command line arguments.
Definition: argparser.h:64
Message handler for FawkesNetworkClient.
Simple Fawkes network client.
Definition: client.h:52
Representation of a message that is sent over the network.
Definition: message.h:77
Interface for signal handling.
Definition: signal.h:36
Fawkes library namespace.