NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
nfd-face-traits.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NDN_MANAGEMENT_NFD_FACE_TRAITS_HPP
23 #define NDN_MANAGEMENT_NFD_FACE_TRAITS_HPP
24 
25 #include "../encoding/tlv-nfd.hpp"
26 
27 namespace ndn {
28 namespace nfd {
29 
35 template<class C>
37 {
38 public:
39  class Error : public tlv::Error
40  {
41  public:
42  explicit
43  Error(const std::string& what)
44  : tlv::Error(what)
45  {
46  }
47  };
48 
50  : m_faceId(0)
54  {
55  }
56 
57  uint64_t
58  getFaceId() const
59  {
60  return m_faceId;
61  }
62 
63  C&
64  setFaceId(uint64_t faceId)
65  {
66  wireReset();
67  m_faceId = faceId;
68  return static_cast<C&>(*this);
69  }
70 
71  const std::string&
72  getRemoteUri() const
73  {
74  return m_remoteUri;
75  }
76 
77  C&
78  setRemoteUri(const std::string& remoteUri)
79  {
80  wireReset();
81  m_remoteUri = remoteUri;
82  return static_cast<C&>(*this);
83  }
84 
85  const std::string&
86  getLocalUri() const
87  {
88  return m_localUri;
89  }
90 
91  C&
92  setLocalUri(const std::string& localUri)
93  {
94  wireReset();
95  m_localUri = localUri;
96  return static_cast<C&>(*this);
97  }
98 
99  FaceScope
100  getFaceScope() const
101  {
102  return m_faceScope;
103  }
104 
105  C&
107  {
108  wireReset();
109  m_faceScope = faceScope;
110  return static_cast<C&>(*this);
111  }
112 
115  {
116  return m_facePersistency;
117  }
118 
119  C&
121  {
122  wireReset();
123  m_facePersistency = facePersistency;
124  return static_cast<C&>(*this);
125  }
126 
127  LinkType
128  getLinkType() const
129  {
130  return m_linkType;
131  }
132 
133  C&
135  {
136  wireReset();
137  m_linkType = linkType;
138  return static_cast<C&>(*this);
139  }
140 
141 protected:
142  virtual void
143  wireReset() const = 0;
144 
145 protected:
146  uint64_t m_faceId;
147  std::string m_remoteUri;
148  std::string m_localUri;
152 };
153 
154 } // namespace nfd
155 } // namespace ndn
156 
157 #endif // NDN_MANAGEMENT_NFD_FACE_TRAITS_HPP
const std::string & getLocalUri() const
Copyright (c) 2011-2015 Regents of the University of California.
FacePersistency getFacePersistency() const
FacePersistency m_facePersistency
FaceScope getFaceScope() const
C & setFaceId(uint64_t faceId)
const std::string & getRemoteUri() const
C & setLocalUri(const std::string &localUri)
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
virtual void wireReset() const =0
C & setRemoteUri(const std::string &remoteUri)
C & setFaceScope(FaceScope faceScope)
providers getters and setters of face information fields
C & setLinkType(LinkType linkType)
uint64_t getFaceId() const
C & setFacePersistency(FacePersistency facePersistency)
Error(const std::string &what)
represents an error in TLV encoding or decoding
Definition: tlv.hpp:50
LinkType getLinkType() const