-
Notifications
You must be signed in to change notification settings - Fork 390
/
ifmap_manager.h
72 lines (60 loc) · 2.53 KB
/
ifmap_manager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
* Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
*/
#ifndef ctrlplane_ifmap_manager_h
#define ctrlplane_ifmap_manager_h
#include "ifmap_channel.h"
#include <boost/function.hpp>
#include <boost/asio/io_service.hpp>
#include <boost/scoped_ptr.hpp>
class DiscoveryServiceClient;
class IFMapStateMachine;
class IFMapServer;
class IFMapDSPeerInfo;
class IFMapPeerServerInfoUI;
class PeerIFMapServerFinder;
// This class is the window to the ifmap server for the rest of the system
class IFMapManager {
public:
typedef boost::function<bool(const char *data, size_t length,
uint64_t sequence_number)> PollReadCb;
IFMapManager();
IFMapManager(IFMapServer *ifmap_server, const std::string& url,
const std::string& user, const std::string& passwd,
const std::string& certstore, PollReadCb readcb,
boost::asio::io_service *io_service);
IFMapManager(IFMapServer *ifmap_server, const std::string& url,
const std::string& user, const std::string& passwd,
const std::string& certstore, PollReadCb readcb,
boost::asio::io_service *io_service,
DiscoveryServiceClient *ds_client);
virtual ~IFMapManager();
virtual void Start(const std::string &host, const std::string &port);
boost::asio::io_service *io_service() { return io_service_; }
IFMapChannel *channel() { return channel_.get(); }
IFMapStateMachine *state_machine() { return state_machine_.get(); }
PollReadCb pollreadcb() { return pollreadcb_; }
void SetChannel(IFMapChannel *channel);
IFMapServer *ifmap_server() { return ifmap_server_; }
std::string get_host_port() {
return channel_->get_host() + ":" + channel_->get_port();
}
std::string get_url();
uint64_t GetChannelSequenceNumber();
void GetPeerServerInfo(IFMapPeerServerInfoUI &server_info);
void RetrieveStaticHostPort(const std::string& url);
void GetAllDSPeerInfo(IFMapDSPeerInfo *ds_peer_info);
bool get_init_done();
virtual void ResetConnection(const std::string &host,
const std::string &port);
bool PeerDown();
void SetStartStaleEntriesCleanup(bool value);
private:
PollReadCb pollreadcb_;
boost::asio::io_service *io_service_;
boost::scoped_ptr<IFMapChannel> channel_;
boost::scoped_ptr<IFMapStateMachine> state_machine_;
boost::scoped_ptr<PeerIFMapServerFinder> peer_finder_;
IFMapServer *ifmap_server_;
};
#endif // ctrlplane_ifmap_manager_h