blob: 9d27af29c9677ed23c8dfd21552f345a65bc992a [file] [log] [blame]
Eric Newberry261dbc22015-07-22 23:18:18 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Teng Liang02960742017-10-24 00:36:45 -07002/*
Teng Liang8b6eda92018-01-25 20:41:54 -07003 * Copyright (c) 2013-2018 Regents of the University of California.
Eric Newberry261dbc22015-07-22 23:18:18 -07004 *
5 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6 *
7 * ndn-cxx library is free software: you can redistribute it and/or modify it under the
8 * terms of the GNU Lesser General Public License as published by the Free Software
9 * Foundation, either version 3 of the License, or (at your option) any later version.
10 *
11 * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14 *
15 * You should have received copies of the GNU General Public License and GNU Lesser
16 * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20 */
21
22#ifndef NDN_CXX_LP_FIELDS_HPP
23#define NDN_CXX_LP_FIELDS_HPP
24
Alexander Afanasyeve3874232017-03-26 16:58:59 -050025#include "field-decl.hpp"
Junxiao Shi4b469982015-12-03 18:20:19 +000026
Junxiao Shi4b469982015-12-03 18:20:19 +000027#include "cache-policy.hpp"
28#include "nack-header.hpp"
Teng Liange3ecad72018-08-28 21:12:53 -070029#include "prefix-announcement-header.hpp"
Eric Newberry261dbc22015-07-22 23:18:18 -070030
31#include <boost/mpl/set.hpp>
32
33namespace ndn {
34namespace lp {
35
Alexander Afanasyeve3874232017-03-26 16:58:59 -050036typedef FieldDecl<field_location_tags::Header,
37 Sequence,
38 tlv::Sequence> SequenceField;
Eric Newberry261dbc22015-07-22 23:18:18 -070039BOOST_CONCEPT_ASSERT((Field<SequenceField>));
40
Alexander Afanasyeve3874232017-03-26 16:58:59 -050041typedef FieldDecl<field_location_tags::Header,
42 uint64_t,
Junxiao Shi974b81a2018-04-21 01:37:03 +000043 tlv::FragIndex,
44 false,
45 NonNegativeIntegerTag,
46 NonNegativeIntegerTag> FragIndexField;
Eric Newberry261dbc22015-07-22 23:18:18 -070047BOOST_CONCEPT_ASSERT((Field<FragIndexField>));
48
Alexander Afanasyeve3874232017-03-26 16:58:59 -050049typedef FieldDecl<field_location_tags::Header,
50 uint64_t,
Junxiao Shi974b81a2018-04-21 01:37:03 +000051 tlv::FragCount,
52 false,
53 NonNegativeIntegerTag,
54 NonNegativeIntegerTag> FragCountField;
Eric Newberry261dbc22015-07-22 23:18:18 -070055BOOST_CONCEPT_ASSERT((Field<FragCountField>));
56
Alexander Afanasyeve3874232017-03-26 16:58:59 -050057typedef FieldDecl<field_location_tags::Header,
58 NackHeader,
59 tlv::Nack> NackField;
Eric Newberry261dbc22015-07-22 23:18:18 -070060BOOST_CONCEPT_ASSERT((Field<NackField>));
61
Alexander Afanasyeve3874232017-03-26 16:58:59 -050062typedef FieldDecl<field_location_tags::Header,
63 uint64_t,
Junxiao Shi974b81a2018-04-21 01:37:03 +000064 tlv::NextHopFaceId,
65 false,
66 NonNegativeIntegerTag,
67 NonNegativeIntegerTag> NextHopFaceIdField;
Eric Newberry261dbc22015-07-22 23:18:18 -070068BOOST_CONCEPT_ASSERT((Field<NextHopFaceIdField>));
69
Alexander Afanasyeve3874232017-03-26 16:58:59 -050070typedef FieldDecl<field_location_tags::Header,
71 CachePolicy,
72 tlv::CachePolicy> CachePolicyField;
Eric Newberry261dbc22015-07-22 23:18:18 -070073BOOST_CONCEPT_ASSERT((Field<CachePolicyField>));
74
Alexander Afanasyeve3874232017-03-26 16:58:59 -050075typedef FieldDecl<field_location_tags::Header,
76 uint64_t,
Junxiao Shi974b81a2018-04-21 01:37:03 +000077 tlv::IncomingFaceId,
78 false,
79 NonNegativeIntegerTag,
80 NonNegativeIntegerTag> IncomingFaceIdField;
Eric Newberry261dbc22015-07-22 23:18:18 -070081BOOST_CONCEPT_ASSERT((Field<IncomingFaceIdField>));
82
Alexander Afanasyeve3874232017-03-26 16:58:59 -050083typedef FieldDecl<field_location_tags::Header,
84 uint64_t,
Junxiao Shi974b81a2018-04-21 01:37:03 +000085 tlv::CongestionMark,
86 false,
87 NonNegativeIntegerTag,
88 NonNegativeIntegerTag> CongestionMarkField;
Eric Newberry4d261b62016-11-10 13:40:09 -070089BOOST_CONCEPT_ASSERT((Field<CongestionMarkField>));
90
Alexander Afanasyeve3874232017-03-26 16:58:59 -050091typedef FieldDecl<field_location_tags::Header,
92 Sequence,
93 tlv::Ack,
94 true> AckField;
Eric Newberry5fade682017-01-21 22:35:47 -070095BOOST_CONCEPT_ASSERT((Field<AckField>));
96
Alexander Afanasyeve3874232017-03-26 16:58:59 -050097typedef FieldDecl<field_location_tags::Header,
98 Sequence,
99 tlv::TxSequence> TxSequenceField;
Eric Newberry1de6be62017-04-03 22:58:41 -0700100BOOST_CONCEPT_ASSERT((Field<TxSequenceField>));
101
Teng Liang02960742017-10-24 00:36:45 -0700102typedef FieldDecl<field_location_tags::Header,
103 EmptyValue,
104 tlv::NonDiscovery> NonDiscoveryField;
105BOOST_CONCEPT_ASSERT((Field<NonDiscoveryField>));
106
Teng Liang8b6eda92018-01-25 20:41:54 -0700107typedef FieldDecl<field_location_tags::Header,
Teng Liange3ecad72018-08-28 21:12:53 -0700108 PrefixAnnouncementHeader,
Teng Liang8b6eda92018-01-25 20:41:54 -0700109 tlv::PrefixAnnouncement> PrefixAnnouncementField;
110BOOST_CONCEPT_ASSERT((Field<PrefixAnnouncementField>));
Junxiao Shi974b81a2018-04-21 01:37:03 +0000111
112/** \brief Declare the Fragment field.
113 *
114 * The fragment (i.e. payload) is the bytes between two provided iterators. During encoding,
115 * these bytes are copied from the Buffer into the LpPacket.
Eric Newberry261dbc22015-07-22 23:18:18 -0700116 */
Alexander Afanasyeve3874232017-03-26 16:58:59 -0500117typedef FieldDecl<field_location_tags::Fragment,
118 std::pair<Buffer::const_iterator, Buffer::const_iterator>,
119 tlv::Fragment> FragmentField;
Eric Newberry261dbc22015-07-22 23:18:18 -0700120BOOST_CONCEPT_ASSERT((Field<FragmentField>));
121
Junxiao Shi974b81a2018-04-21 01:37:03 +0000122/** \brief Set of all field declarations.
Eric Newberry261dbc22015-07-22 23:18:18 -0700123 */
124typedef boost::mpl::set<
125 FragmentField,
126 SequenceField,
127 FragIndexField,
128 FragCountField,
129 NackField,
130 NextHopFaceIdField,
131 CachePolicyField,
Eric Newberry4d261b62016-11-10 13:40:09 -0700132 IncomingFaceIdField,
Eric Newberry5fade682017-01-21 22:35:47 -0700133 CongestionMarkField,
Eric Newberry1de6be62017-04-03 22:58:41 -0700134 AckField,
Teng Liang02960742017-10-24 00:36:45 -0700135 TxSequenceField,
Teng Liang8b6eda92018-01-25 20:41:54 -0700136 NonDiscoveryField,
137 PrefixAnnouncementField
Eric Newberry261dbc22015-07-22 23:18:18 -0700138 > FieldSet;
139
140} // namespace lp
141} // namespace ndn
142
Junxiao Shi4b469982015-12-03 18:20:19 +0000143#endif // NDN_CXX_LP_FIELDS_HPP