blob: b627bdbe19198191e5742138e96dbe4229cd282d [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 Zhao078ac692017-03-02 16:28:51 -080024#include "face-status.hpp"
Qi Zhao7e524492017-03-02 15:05:45 -080025#include "fib-status.hpp"
26#include "rib-status.hpp"
27
28#include <ndn-cxx/face.hpp>
29#include <ndn-cxx/name.hpp>
30#include <ndn-cxx/util/scheduler.hpp>
Qi Zhao078ac692017-03-02 16:28:51 -080031#include <ndn-cxx/mgmt/nfd/face-status.hpp>
Qi Zhao7e524492017-03-02 15:05:45 -080032#include <ndn-cxx/mgmt/nfd/fib-entry.hpp>
33#include <ndn-cxx/mgmt/nfd/rib-entry.hpp>
34#include <ndn-cxx/mgmt/nfd/controller.hpp>
35#include <ndn-cxx/mgmt/nfd/status-dataset.hpp>
36
37#include <QObject>
38#include <QtQml/QQmlContext>
39#include <QtQml/QQmlApplicationEngine>
40
41namespace ndn {
42
43class StatusViewer : public QObject
44{
45 Q_OBJECT
46public:
47 explicit
48 StatusViewer(Face& face, KeyChain& keyChain);
49
50 void
51 onStatusRetrieved(const nfd::ForwarderStatus& status);
52
53 void
Qi Zhao078ac692017-03-02 16:28:51 -080054 onFaceStatusRetrieved(const std::vector<nfd::FaceStatus>& status);
55
56 void
Qi Zhao7e524492017-03-02 15:05:45 -080057 onFibStatusRetrieved(const std::vector<nfd::FibEntry>& status);
58
59 void
60 onRibStatusRetrieved(const std::vector<nfd::RibEntry>& status);
61
62 void
63 onStatusTimeout();
64
65private:
66 void
67 requestNfdStatus();
68
69signals:
70 void
71 showStatus();
72
73public slots:
74 void
75 present();
76
77private:
78 Face& s_face;
79 KeyChain& s_keyChain;
80 nfd::Controller* s_controller;
81 Scheduler s_scheduler;
82
83 QQmlApplicationEngine s_engine;
84
85 ForwarderStatusModel s_forwarderStatusModel;
Qi Zhao078ac692017-03-02 16:28:51 -080086 FaceStatusModel s_faceModel;
Qi Zhao7e524492017-03-02 15:05:45 -080087 FibStatusModel s_fibModel;
88 RibStatusModel s_ribModel;
89};
90
91} // namespace ndn
92
93#endif // NCC_STATUS_VIEWER_HPP