blob: 528bcb0533ec185016ffa9618de77180a31a6822 [file] [log] [blame]
Alexander Afanasyev8b379052011-08-21 16:58:20 -07001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2011 University of California, Los Angeles
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19 */
20
21#ifndef _CCNB_PARSER_COMMON_H_
22#define _CCNB_PARSER_COMMON_H_
23
24namespace ns3 {
25
26/**
27 * \ingroup ccnx
28 * \defgroup ccnx-ccnb CCNB decoding routines
29 */
30/**
31 * \ingroup ccnx-ccnb
32 * \brief Namespace for ccnb parer
33 */
34namespace CcnbParser {
35
36// forward declarations
37class Block;
38class Blob;
39class Udata;
40class Tag;
41class Attr;
42class Dtag;
43class Dattr;
44class Ext;
45
Alexander Afanasyeve709f3d2011-08-21 17:55:45 -070046
47/**
48 * \brief Exception thrown if there is a parsing error
49 *
50 * \todo inherit this class from some exception class and provide meaningful error messages
51 */
52class CcnbDecodingException {};
53
Alexander Afanasyev8b379052011-08-21 16:58:20 -070054/**
55 * \brief Type tag for a ccnb start marker.
56 *
57 * \see http://www.ccnx.org/releases/latest/doc/technical/DTAG.html
58 */
59enum ccn_tt {
60 CCN_EXT, /**< starts composite extension - numval is subtype */
61 CCN_TAG, /**< starts composite - numval is tagnamelen-1 */
62 CCN_DTAG, /**< starts composite - numval is tagdict index (enum ccn_dtag) */
63 CCN_ATTR, /**< attribute - numval is attrnamelen-1, value follows */
64 CCN_DATTR, /**< attribute numval is attrdict index */
65 CCN_BLOB, /**< opaque binary data - numval is byte count */
66 CCN_UDATA, /**< UTF-8 encoded character data - numval is byte count */
67 CCN_NO_TOKEN /**< should not occur in encoding */
68};
69
70/** \brief CCN_CLOSE terminates composites */
71enum {CCN_CLOSE = 0};
72
73/**
74 * \brief DTAG identifies ccnb-encoded elements.
75 *
76 * \see http://www.ccnx.org/releases/latest/doc/technical/DTAG.html
77 */
78enum ccn_dtag {
79 CCN_DTAG_Any = 13,
80 CCN_DTAG_Name = 14,
81 CCN_DTAG_Component = 15,
82 CCN_DTAG_Certificate = 16,
83 CCN_DTAG_Collection = 17,
84 CCN_DTAG_CompleteName = 18,
85 CCN_DTAG_Content = 19,
86 CCN_DTAG_SignedInfo = 20,
87 CCN_DTAG_ContentDigest = 21,
88 CCN_DTAG_ContentHash = 22,
89 CCN_DTAG_Count = 24,
90 CCN_DTAG_Header = 25,
91 CCN_DTAG_Interest = 26, /* 20090915 */
92 CCN_DTAG_Key = 27,
93 CCN_DTAG_KeyLocator = 28,
94 CCN_DTAG_KeyName = 29,
95 CCN_DTAG_Length = 30,
96 CCN_DTAG_Link = 31,
97 CCN_DTAG_LinkAuthenticator = 32,
98 CCN_DTAG_NameComponentCount = 33, /* DeprecatedInInterest */
99 CCN_DTAG_RootDigest = 36,
100 CCN_DTAG_Signature = 37,
101 CCN_DTAG_Start = 38,
102 CCN_DTAG_Timestamp = 39,
103 CCN_DTAG_Type = 40,
104 CCN_DTAG_Nonce = 41,
105 CCN_DTAG_Scope = 42,
106 CCN_DTAG_Exclude = 43,
107 CCN_DTAG_Bloom = 44,
108 CCN_DTAG_BloomSeed = 45,
109 CCN_DTAG_AnswerOriginKind = 47,
110 CCN_DTAG_InterestLifetime = 48,
111 CCN_DTAG_Witness = 53,
112 CCN_DTAG_SignatureBits = 54,
113 CCN_DTAG_DigestAlgorithm = 55,
114 CCN_DTAG_BlockSize = 56,
115 CCN_DTAG_FreshnessSeconds = 58,
116 CCN_DTAG_FinalBlockID = 59,
117 CCN_DTAG_PublisherPublicKeyDigest = 60,
118 CCN_DTAG_PublisherCertificateDigest = 61,
119 CCN_DTAG_PublisherIssuerKeyDigest = 62,
120 CCN_DTAG_PublisherIssuerCertificateDigest = 63,
121 CCN_DTAG_ContentObject = 64, /* 20090915 */
122 CCN_DTAG_WrappedKey = 65,
123 CCN_DTAG_WrappingKeyIdentifier = 66,
124 CCN_DTAG_WrapAlgorithm = 67,
125 CCN_DTAG_KeyAlgorithm = 68,
126 CCN_DTAG_Label = 69,
127 CCN_DTAG_EncryptedKey = 70,
128 CCN_DTAG_EncryptedNonceKey = 71,
129 CCN_DTAG_WrappingKeyName = 72,
130 CCN_DTAG_Action = 73,
131 CCN_DTAG_FaceID = 74,
132 CCN_DTAG_IPProto = 75,
133 CCN_DTAG_Host = 76,
134 CCN_DTAG_Port = 77,
135 CCN_DTAG_MulticastInterface = 78,
136 CCN_DTAG_ForwardingFlags = 79,
137 CCN_DTAG_FaceInstance = 80,
138 CCN_DTAG_ForwardingEntry = 81,
139 CCN_DTAG_MulticastTTL = 82,
140 CCN_DTAG_MinSuffixComponents = 83,
141 CCN_DTAG_MaxSuffixComponents = 84,
142 CCN_DTAG_ChildSelector = 85,
143 CCN_DTAG_RepositoryInfo = 86,
144 CCN_DTAG_Version = 87,
145 CCN_DTAG_RepositoryVersion = 88,
146 CCN_DTAG_GlobalPrefix = 89,
147 CCN_DTAG_LocalName = 90,
148 CCN_DTAG_Policy = 91,
149 CCN_DTAG_Namespace = 92,
150 CCN_DTAG_GlobalPrefixName = 93,
151 CCN_DTAG_PolicyVersion = 94,
152 CCN_DTAG_KeyValueSet = 95,
153 CCN_DTAG_KeyValuePair = 96,
154 CCN_DTAG_IntegerValue = 97,
155 CCN_DTAG_DecimalValue = 98,
156 CCN_DTAG_StringValue = 99,
157 CCN_DTAG_BinaryValue = 100,
158 CCN_DTAG_NameValue = 101,
159 CCN_DTAG_Entry = 102,
160 CCN_DTAG_ACL = 103,
161 CCN_DTAG_ParameterizedName = 104,
162 CCN_DTAG_Prefix = 105,
163 CCN_DTAG_Suffix = 106,
164 CCN_DTAG_Root = 107,
165 CCN_DTAG_ProfileName = 108,
166 CCN_DTAG_Parameters = 109,
167 CCN_DTAG_InfoString = 110,
168 CCN_DTAG_StatusResponse = 112,
169 CCN_DTAG_StatusCode = 113,
170 CCN_DTAG_StatusText = 114,
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800171 CCN_DTAG_Nack = 200,
Alexander Afanasyev8b379052011-08-21 16:58:20 -0700172 CCN_DTAG_SequenceNumber = 256,
173 CCN_DTAG_CCNProtocolDataUnit = 17702112
174};
175
Alexander Afanasyev8b379052011-08-21 16:58:20 -0700176} // namespace CcnxParser
Alexander Afanasyev8b379052011-08-21 16:58:20 -0700177} // namespace ns3
178
179#endif // _CCNB_PARSER_COMMON_H_