Fawkes API  Fawkes Development Version
handler.h
1 
2 /***************************************************************************
3  * handler.h - Fawkes network traffic handler
4  *
5  * Created: Mon Nov 20 14:36:06 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. 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 __NETCOMM_FAWKES_HANDLER_H_
25 #define __NETCOMM_FAWKES_HANDLER_H_
26 
27 #include <netcomm/fawkes/message.h>
28 
29 namespace fawkes {
30 
32 {
33  public:
34  FawkesNetworkHandler(unsigned short int id);
35  virtual ~FawkesNetworkHandler();
36 
37  unsigned short int id() const;
38 
39  virtual void handle_network_message(FawkesNetworkMessage *msg) = 0;
40  virtual void client_connected(unsigned int clid) = 0;
41  virtual void client_disconnected(unsigned int clid) = 0;
42 
43  private:
44  unsigned short int _id;
45 
46 };
47 
48 } // end namespace fawkes
49 
50 #endif
FawkesNetworkHandler(unsigned short int id)
Constructor.
Definition: handler.cpp:62
virtual void client_disconnected(unsigned int clid)=0
Called when a client disconnected.
Fawkes library namespace.
Representation of a message that is sent over the network.
Definition: message.h:75
unsigned short int id() const
Get the component ID for this handler.
Definition: handler.cpp:78
virtual ~FawkesNetworkHandler()
Destructor.
Definition: handler.cpp:69
Network handler abstract base class.
Definition: handler.h:31
virtual void client_connected(unsigned int clid)=0
Called when a new client connected.
virtual void handle_network_message(FawkesNetworkMessage *msg)=0
Called for incoming messages that are addressed to the correct component ID.