blob: 8022e3dcdd2d33696ca719272379fc95beeeeee5 [file] [log] [blame]
Junxiao Shi2c29f3a2014-01-24 19:59:00 -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_FACE_FACE_H
8#define NFD_FACE_FACE_H
9
10#include "common.hpp"
Junxiao Shi32bfeb32014-01-25 18:22:02 -070011#include "util/event-emitter.hpp"
Junxiao Shi2c29f3a2014-01-24 19:59:00 -070012
13namespace ndn {
14
15/** \class FaceId
16 * \brief identifies a face
17 */
18typedef int FaceId;
19
20/** \class Face
21 * \brief represents a face
22 */
23class Face : noncopyable
24{
Junxiao Shi32bfeb32014-01-25 18:22:02 -070025public:
26 Face(FaceId id);
27
28 virtual
29 ~Face();
30
31 /// fires when an Interest is received
32 EventEmitter<const Interest&> onReceiveInterest;
33
34 /// fires when a Data is received
35 EventEmitter<const Data&> onReceiveData;
36
37 /// send an Interest
38 virtual void
Alexander Afanasyeva9034b02014-01-26 18:32:02 -080039 sendInterest(const Interest& interest) = 0;
Junxiao Shi32bfeb32014-01-25 18:22:02 -070040
41 /// send a Data
42 virtual void
Alexander Afanasyeva9034b02014-01-26 18:32:02 -080043 sendData(const Data& data) = 0;
Junxiao Shi32bfeb32014-01-25 18:22:02 -070044
45 /** \brief Get whether underlying communicate is up
46 * In this base class this property is always true.
47 */
48 virtual bool
49 isUp() const;
50
51 /** \brief Set the description
52 * This is typically invoked by mgmt on set description command
53 */
54 virtual void
55 setDescription(const std::string& description);
56
57 /// Get the description
58 virtual const std::string&
59 getDescription() const;
60
61 /** \brief Get whether packets sent this Face may reach multiple peers
62 * In this base class this property is always false.
63 */
64 virtual bool
65 isMultiAccess() const;
66
67 /// Get whether the face has opted in for local control header
68 virtual bool
69 isLocalControlHeaderEnabled() const;
70
71protected:
72 // void
73 // receiveInterest();
74
75 // void
76 // receiveData();
77
78private:
79 FaceId m_id;
80 std::string m_description;
Junxiao Shi2c29f3a2014-01-24 19:59:00 -070081};
82
83} // namespace ndn
84
85#endif // NFD_FACE_FACE_H