Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
handler.h
1
2
/***************************************************************************
3
* handler.h - Fawkes plugin network handler
4
*
5
* Created: Thu Feb 12 10:23:02 2009
6
* Copyright 2006-2009 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. A runtime exception applies to
14
* this software (see LICENSE.GPL_WRE file mentioned below for details).
15
*
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU Library General Public License for more details.
20
*
21
* Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22
*/
23
24
#ifndef __PLUGIN_NET_HANDLER_H_
25
#define __PLUGIN_NET_HANDLER_H_
26
27
#include <netcomm/fawkes/handler.h>
28
#include <core/threading/thread.h>
29
#include <core/utils/lock_queue.h>
30
#include <core/utils/lock_list.h>
31
#include <core/utils/lock_map.h>
32
#include <config/change_handler.h>
33
#include <utils/system/fam.h>
34
#include <plugin/listener.h>
35
36
#include <map>
37
#include <list>
38
#include <string>
39
#include <utility>
40
41
namespace
fawkes {
42
#if 0
/* just to make Emacs auto-indent happy */
43
}
44
#endif
45
46
class
ThreadCollector;
47
class
FawkesNetworkHub;
48
class
Plugin;
49
class
PluginLoader;
50
class
PluginListMessage;
51
class
Configuration;
52
class
FamThread;
53
54
class
PluginNetworkHandler
55
:
public
fawkes::Thread
,
56
public
fawkes::FawkesNetworkHandler
,
57
public
fawkes::PluginManagerListener
58
{
59
public
:
60
PluginNetworkHandler
(
PluginManager
*manager,
FawkesNetworkHub
*hub);
61
~
PluginNetworkHandler
();
62
63
virtual
void
handle_network_message(
FawkesNetworkMessage
*msg);
64
virtual
void
client_connected(
unsigned
int
clid);
65
virtual
void
client_disconnected(
unsigned
int
clid);
66
67
virtual
void
loop();
68
69
virtual
void
plugin_loaded(
const
char
*plugin_name);
70
virtual
void
plugin_unloaded(
const
char
*plugin_name);
71
72
private
:
73
PluginListMessage
* list_avail();
74
PluginListMessage
* list_loaded();
75
void
send_load_failure(
const
char
*plugin_name,
unsigned
int
client_id);
76
void
send_load_success(
const
char
*plugin_name,
unsigned
int
client_id);
77
void
send_unload_failure(
const
char
*plugin_name,
unsigned
int
client_id);
78
void
send_unload_success(
const
char
*plugin_name,
unsigned
int
client_id);
79
void
send_loaded(
const
char
*plugin_name);
80
void
send_unloaded(
const
char
*plugin_name);
81
82
void
load(
const
char
*plugin_list,
unsigned
int
clid);
83
void
unload(
const
char
*plugin_list,
unsigned
int
clid);
84
85
/** Stub to see name in backtrace for easier debugging. @see Thread::run() */
86
protected
:
virtual
void
run
() { Thread::run(); }
87
88
private
:
89
PluginManager
*__manager;
90
FawkesNetworkHub
*__hub;
91
92
LockQueue< FawkesNetworkMessage * >
__inbound_queue;
93
94
LockList<unsigned int>
__subscribers;
95
LockList<unsigned int>::iterator
__ssit;
96
};
97
98
}
// end namespace fawkes
99
100
#endif
src
libs
plugin
net
handler.h
Generated by
1.8.1.2