NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
field-info.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #include "field-info.hpp"
23 
24 #include <boost/mpl/for_each.hpp>
25 #include <boost/bind.hpp>
26 
27 namespace ndn {
28 namespace lp {
29 namespace detail {
30 
32 {
33  typedef void result_type;
34 
35  template<typename T>
36  void
38  {
39  if (T::TlvType::value != info->tlvType) {
40  return;
41  }
42  info->isRecognized = true;
43  info->canIgnore = false;
44  info->isRepeatable = T::IsRepeatable::value;
45  info->locationSortOrder = getLocationSortOrder<typename T::FieldLocation>();
46  }
47 };
48 
50  : tlvType(0)
51  , isRecognized(false)
52  , canIgnore(false)
53  , isRepeatable(false)
54  , locationSortOrder(getLocationSortOrder<field_location_tags::Header>())
55 {
56 }
57 
58 FieldInfo::FieldInfo(uint64_t tlv)
59  : tlvType(tlv)
60  , isRecognized(false)
61  , canIgnore(false)
62  , isRepeatable(false)
63  , locationSortOrder(getLocationSortOrder<field_location_tags::Header>())
64 {
65  boost::mpl::for_each<FieldSet>(boost::bind(ExtractFieldInfo(), this, _1));
66  if (!isRecognized) {
68  (tlvType & 0x01) == 0x01;
69  }
70 }
71 
72 } // namespace detail
73 } // namespace lp
74 } // namespace ndn
bool canIgnore
can this unknown field be ignored
Definition: field-info.hpp:55
Copyright (c) 2011-2015 Regents of the University of California.
lower bound of 3-octet header field
Definition: tlv.hpp:62
upper bound of 3-octet header field
Definition: tlv.hpp:67
int getLocationSortOrder()
bool isRepeatable
is the field repeatable
Definition: field-info.hpp:60
bool isRecognized
is this field known
Definition: field-info.hpp:50
void operator()(FieldInfo *info, T)
Definition: field-info.cpp:37
int locationSortOrder
sort order of field_location_tag
Definition: field-info.hpp:65
uint64_t tlvType
TLV-TYPE of the field; 0 if field does not exist.
Definition: field-info.hpp:45