blob: 3f061fbdc2286226aa50a180d665d54b9c2c0aa3 [file] [log] [blame]
Steve DiBenedetto5b433982014-01-29 17:14:27 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (C) 2014 Named Data Networking Project
4 * See COPYING for copyright and distribution information.
5 */
6
7#ifndef NFD_MGMT_INTERNAL_FACE_HPP
8#define NFD_MGMT_INTERNAL_FACE_HPP
9
10#include "face/face.hpp"
11#include "app-face.hpp"
12
Steve DiBenedetto2c2b8892014-02-27 11:46:48 -070013#include "command-validator.hpp"
14
Steve DiBenedetto5b433982014-01-29 17:14:27 -070015namespace nfd {
16
17class InternalFace : public Face, public AppFace
18{
19public:
Alexander Afanasyeva0a10fb2014-02-13 19:56:15 -080020 /**
21 * \brief InternalFace-related error
22 */
Junxiao Shi16d1b7d2014-03-27 21:29:09 -070023 class Error : public Face::Error
Alexander Afanasyeva0a10fb2014-02-13 19:56:15 -080024 {
Junxiao Shi16d1b7d2014-03-27 21:29:09 -070025 public:
26 explicit
27 Error(const std::string& what)
28 : Face::Error(what)
29 {
30 }
Alexander Afanasyeva0a10fb2014-02-13 19:56:15 -080031 };
Steve DiBenedetto5b433982014-01-29 17:14:27 -070032
Steve DiBenedetto3970c892014-01-31 23:31:13 -070033 InternalFace();
Steve DiBenedetto5b433982014-01-29 17:14:27 -070034
Steve DiBenedetto2c2b8892014-02-27 11:46:48 -070035 CommandValidator&
36 getValidator();
37
38 virtual
39 ~InternalFace();
40
Steve DiBenedetto5b433982014-01-29 17:14:27 -070041 // Overridden Face methods for forwarder
42
43 virtual void
44 sendInterest(const Interest& interest);
45
46 virtual void
47 sendData(const Data& data);
48
Alexander Afanasyeva0a10fb2014-02-13 19:56:15 -080049 virtual void
50 close();
51
Steve DiBenedetto5b433982014-01-29 17:14:27 -070052 // Methods implementing AppFace interface. Do not invoke from forwarder.
53
54 virtual void
55 setInterestFilter(const Name& filter,
56 OnInterest onInterest);
57
58 virtual void
59 put(const Data& data);
60
Steve DiBenedetto5b433982014-01-29 17:14:27 -070061private:
Junxiao Shi16d1b7d2014-03-27 21:29:09 -070062 void
63 processInterest(const Interest& interest);
Steve DiBenedetto5b433982014-01-29 17:14:27 -070064
Junxiao Shi16d1b7d2014-03-27 21:29:09 -070065private:
Steve DiBenedetto5b433982014-01-29 17:14:27 -070066 std::map<Name, OnInterest> m_interestFilters;
Steve DiBenedetto2c2b8892014-02-27 11:46:48 -070067 CommandValidator m_validator;
Steve DiBenedetto5b433982014-01-29 17:14:27 -070068};
69
Steve DiBenedetto2c2b8892014-02-27 11:46:48 -070070inline CommandValidator&
71InternalFace::getValidator()
72{
73 return m_validator;
74}
75
76
Steve DiBenedetto5b433982014-01-29 17:14:27 -070077} // namespace nfd
78
79#endif //NFD_MGMT_INTERNAL_FACE_HPP