Fawkes API  Fawkes Development Version
hub.cpp
1 
2 /***************************************************************************
3  * hub.cpp - Fawkes network hub
4  *
5  * Created: Mon May 07 19:16:34 2007
6  * Copyright 2006-2007 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 #include <netcomm/fawkes/hub.h>
25 
26 namespace fawkes {
27 
28 /** @class FawkesNetworkHub netcomm/fawkes/hub.h
29  * Fawkes Network Hub.
30  * This interface is the main entry point for applications, plugins and
31  * threads that use the Fawkes network protocol. The hub provides means for
32  * broadcasting messages to all connected clients, for sending messages
33  * to a specific connected client and to add and remove handlers to process
34  * incoming messages.
35  *
36  * @ingroup NetComm
37  * @author Tim Niemueller
38  *
39  * @fn void FawkesNetworkHub::broadcast(FawkesNetworkMessage *msg) = 0
40  * Method to broadcast a message to all connected clients.
41  * This method shall be implemented thus that the message is sent to all
42  * connected clients.
43  * @param msg message to send.
44  *
45  * @fn void FawkesNetworkHub::broadcast(unsigned short int component_id, unsigned short int msg_id, void *payload, unsigned int payload_size) = 0
46  * This is an overloaded member function, provided for convenience. It
47  * differs from the above function only in what arguments it accepts.
48  * A FawkesNetworkMessage will be created transparently and broadcasted.
49  * @param component_id component id
50  * @param msg_id message id
51  * @param payload buffer with payload
52  * @param payload_size payload size
53  *
54  * @fn void FawkesNetworkHub::broadcast(unsigned short int component_id, unsigned short int msg_id) = 0
55  * This is an overloaded member function, provided for convenience. It
56  * differs from the above function only in what arguments it accepts.
57  * A FawkesNetworkMessage will be created transparently and broadcasted.
58  * This can be used for messages without payload.
59  * @param component_id component id
60  * @param msg_id message id
61  *
62  * @fn void FawkesNetworkHub::send(FawkesNetworkMessage *msg) = 0
63  * Method to send a message to a specific client. The recipient has to
64  * be specified in the message or sending the message will fail.
65  * @param msg message to send
66  *
67  * @fn void FawkesNetworkHub::send(unsigned int to_clid, unsigned short int component_id, unsigned short int msg_id) = 0
68  * This is an overloaded member function, provided for convenience. It
69  * differs from the above function only in what arguments it accepts.
70  * A FawkesNetworkMessage will be created transparently and send to
71  * the client with the given ID.
72  * This can be used for messages without payload.
73  * @param to_clid client ID of recipient
74  * @param component_id component id
75  * @param msg_id message ID
76  *
77  * @fn void FawkesNetworkHub::send(unsigned int to_clid, unsigned short int component_id, unsigned short int msg_id, void *payload, unsigned int payload_size) = 0
78  * This is an overloaded member function, provided for convenience. It
79  * differs from the above function only in what arguments it accepts.
80  * A FawkesNetworkMessage will be created transparently and send to
81  * the client with the given ID.
82  * @param to_clid client ID of recipient
83  * @param component_id component id
84  * @param msg_id message id
85  * @param payload buffer with payload
86  * @param payload_size payload size
87  *
88  * @fn void FawkesNetworkHub::send(unsigned int to_clid, unsigned short int component_id, unsigned short int msg_id, FawkesNetworkMessageContent *content) = 0
89  * This is an overloaded member function, provided for convenience. It
90  * differs from the above function only in what arguments it accepts.
91  * A FawkesNetworkMessage will be created transparently and send to
92  * the client with the given ID.
93  * @param to_clid client ID of recipient
94  * @param component_id component id
95  * @param msg_id message id
96  * @param content complex message content
97  *
98  * @fn void FawkesNetworkHub::add_handler(FawkesNetworkHandler *handler) = 0
99  * Add a message handler.
100  * This message handler is called for incoming messages that have an appropriate
101  * component ID (which is supplied by the handler).
102  * @param handler handler to add
103  *
104  * @fn void FawkesNetworkHub::remove_handler(FawkesNetworkHandler *handler) = 0
105  * Remove a message handler.
106  * The message handler is removed from the list of handlers and is no longer
107  * called for incoming data.
108  * @param handler handler to remove
109  *
110  * @fn void FawkesNetworkHub::force_send() = 0
111  * Force sending of all pending messages.
112  * This will order the sending of all pending outbound messages that are currently
113  * enqueued for clients. The method will block until this is done.
114  * It is not ensured that no messages are added during that time. Make sure that
115  * the call constraints guarantee this.
116  */
117 
118 /** Virtual empty destructor. */
120 {
121 }
122 
123 } // end namespace fawkes
Fawkes library namespace.
virtual ~FawkesNetworkHub()
Virtual empty destructor.
Definition: hub.cpp:119