Fawkes API  Fawkes Development Version
gossip_group_manager.h
1 
2 /***************************************************************************
3  * gossip_group_manager.h - Fawkes Gossip group manager
4  *
5  * Created: Fri Feb 28 16:54:34 2014
6  * Copyright 2006-2014 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 __PLUGINS_GOSSIP_GOSSIP_GOSSIP_GROUP_MANAGER_H_
25 #define __PLUGINS_GOSSIP_GOSSIP_GOSSIP_GROUP_MANAGER_H_
26 
27 #include <core/utils/refptr.h>
28 
29 #include <map>
30 #include <list>
31 #include <string>
32 
33 namespace fawkes {
34 #if 0 /* just to make Emacs auto-indent happy */
35 }
36 #endif
37 
38 class GossipGroup;
39 class ServicePublisher;
40 
42 {
43  public:
46  GossipGroupConfiguration(std::string &name,
47  std::string &broadcast_address,
48  unsigned short broadcast_port);
49  GossipGroupConfiguration(std::string &name,
50  std::string &broadcast_address,
51  unsigned short send_port, unsigned short recv_port);
52 
53  std::string name; ///< name of the group
54  std::string broadcast_addr; ///< Broadcast IP Addr
55  unsigned short send_port; ///< UDP port to send messages to
56  unsigned short recv_port; ///< UDP port to list on for messages
57  std::string crypto_key; ///< encryption key
58  std::string crypto_cipher; ///< encryption cipher
59 };
60 
62 {
63  friend class GossipAspectIniFin;
64  public:
65  GossipGroupManager(std::string &service_name, ServicePublisher *service_publisher,
66  std::map<std::string, GossipGroupConfiguration> &initial_groups);
67  virtual ~GossipGroupManager();
68 
69  virtual RefPtr<GossipGroup> join_group(const std::string &name);
70  virtual void leave_group(RefPtr<GossipGroup> &group);
71 
72  private:
73  void create_group(GossipGroupConfiguration &gc);
74 
75  private:
76  std::string service_name_;
77  ServicePublisher *service_publisher_;
78  std::map<std::string, RefPtr<GossipGroup> > groups_;
79 };
80 
81 } // end namespace fawkes
82 
83 #endif
84 
std::string crypto_key
encryption key
std::string name
name of the group
Service publisher interface.
Fawkes library namespace.
unsigned short recv_port
UDP port to list on for messages.
Group configuration for initial groups.
std::string crypto_cipher
encryption cipher
Abstract class for a Gossip group manager.
GossipAspect initializer/finalizer.
Definition: gossip_inifin.h:37
unsigned short send_port
UDP port to send messages to.
RefPtr<> is a reference-counting shared smartpointer.
Definition: refptr.h:49
std::string broadcast_addr
Broadcast IP Addr.