blob: ac815b87da2e81104a0c859cf631757a494a4704 [file] [log] [blame]
Qi Zhao7e524492017-03-02 15:05:45 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2017, Regents of the University of California,
4 *
5 * This file is part of NFD Control Center. See AUTHORS.md for complete list of NFD
6 * authors and contributors.
7 *
8 * NFD Control Center is free software: you can redistribute it and/or modify it under the
9 * terms of the GNU General Public License as published by the Free Software Foundation,
10 * either version 3 of the License, or (at your option) any later version.
11 *
12 * NFD Control Center is distributed in the hope that it will be useful, but WITHOUT ANY
13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along with NFD
17 * Control Center, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef NCC_STATUS_VIEWER_HPP
21#define NCC_STATUS_VIEWER_HPP
22
23#include "forwarder-status.hpp"
Qi Zhaobd19e072017-03-05 15:12:46 -080024#include "channel-status.hpp"
Qi Zhao078ac692017-03-02 16:28:51 -080025#include "face-status.hpp"
Qi Zhao7e524492017-03-02 15:05:45 -080026#include "fib-status.hpp"
27#include "rib-status.hpp"
Qi Zhaobd19e072017-03-05 15:12:46 -080028#include "strategy-status.hpp"
Qi Zhao7e524492017-03-02 15:05:45 -080029
30#include <ndn-cxx/face.hpp>
31#include <ndn-cxx/name.hpp>
32#include <ndn-cxx/util/scheduler.hpp>
Qi Zhaobd19e072017-03-05 15:12:46 -080033#include <ndn-cxx/mgmt/nfd/channel-status.hpp>
Qi Zhao078ac692017-03-02 16:28:51 -080034#include <ndn-cxx/mgmt/nfd/face-status.hpp>
Qi Zhao7e524492017-03-02 15:05:45 -080035#include <ndn-cxx/mgmt/nfd/fib-entry.hpp>
36#include <ndn-cxx/mgmt/nfd/rib-entry.hpp>
Qi Zhaobd19e072017-03-05 15:12:46 -080037#include <ndn-cxx/mgmt/nfd/strategy-choice.hpp>
Qi Zhao7e524492017-03-02 15:05:45 -080038#include <ndn-cxx/mgmt/nfd/controller.hpp>
39#include <ndn-cxx/mgmt/nfd/status-dataset.hpp>
40
41#include <QObject>
42#include <QtQml/QQmlContext>
43#include <QtQml/QQmlApplicationEngine>
44
45namespace ndn {
46
47class StatusViewer : public QObject
48{
49 Q_OBJECT
50public:
51 explicit
52 StatusViewer(Face& face, KeyChain& keyChain);
53
54 void
55 onStatusRetrieved(const nfd::ForwarderStatus& status);
56
57 void
Qi Zhaobd19e072017-03-05 15:12:46 -080058 onChannelStatusRetrieved(const std::vector<nfd::ChannelStatus>& status);
59
60 void
Qi Zhao078ac692017-03-02 16:28:51 -080061 onFaceStatusRetrieved(const std::vector<nfd::FaceStatus>& status);
62
63 void
Qi Zhao7e524492017-03-02 15:05:45 -080064 onFibStatusRetrieved(const std::vector<nfd::FibEntry>& status);
65
66 void
67 onRibStatusRetrieved(const std::vector<nfd::RibEntry>& status);
68
69 void
Qi Zhaobd19e072017-03-05 15:12:46 -080070 onStrategyChoiceStatusRetrieved(const std::vector<nfd::StrategyChoice>& status);
71
72 void
Qi Zhao7e524492017-03-02 15:05:45 -080073 onStatusTimeout();
74
75private:
76 void
77 requestNfdStatus();
78
79signals:
80 void
81 showStatus();
82
83public slots:
84 void
85 present();
86
87private:
88 Face& s_face;
89 KeyChain& s_keyChain;
90 nfd::Controller* s_controller;
91 Scheduler s_scheduler;
92
93 QQmlApplicationEngine s_engine;
94
95 ForwarderStatusModel s_forwarderStatusModel;
Qi Zhaobd19e072017-03-05 15:12:46 -080096 ChannelStatusModel s_channelModel;
Qi Zhao078ac692017-03-02 16:28:51 -080097 FaceStatusModel s_faceModel;
Qi Zhao7e524492017-03-02 15:05:45 -080098 FibStatusModel s_fibModel;
99 RibStatusModel s_ribModel;
Qi Zhaobd19e072017-03-05 15:12:46 -0800100 StrategyStatusModel s_strategyModel;
Qi Zhao7e524492017-03-02 15:05:45 -0800101};
102
103} // namespace ndn
104
105#endif // NCC_STATUS_VIEWER_HPP