aboutsummaryrefslogtreecommitdiffstats
path: root/libccnx-common/ccnx/common/codec/schema_v1/ccnxCodecSchemaV1_TlvDictionary.h
blob: e76492b66ada72cc8adc826c4975d72af8564001 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
/*
 * Copyright (c) 2017 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @file ccnxCodecSchemaV1_TlvDictionary.h
 * @brief <#Brief Description#>
 *
 * Used as keys to the CCNxTlvDictionary for the version 1 schema
 *
 */

#ifndef libccnx_ccnx_TlvDictionary_SchemaV1_h
#define libccnx_ccnx_TlvDictionary_SchemaV1_h

#include <ccnx/common/internal/ccnx_TlvDictionary.h>

/**
 * @typedef CCNxCodecSchemaV1TlvDictionary_CryptoSuite
 * @abstract The ValidationAlgorithm Type.
 * @constant <#name#> <#description#>
 * @discussion These are the wire-format values for the ValidationAlgorithm type.  The values
 *      specified follow from the CCNx Messages RFC.
 *
 *      It is not the same as the value stored in CCNxCodecSchemaV1TlvDictionary_ValidationFastArray_CRYPTO_SUITE,
 *      which is of type PARCCryptoSuite.
 */
typedef enum rta_tlv_schema_v1_crypto_suite {
    CCNxCodecSchemaV1TlvDictionary_CryptoSuite_CRC32C = 2,
    CCNxCodecSchemaV1TlvDictionary_CryptoSuite_HmacSha256 = 4,
    CCNxCodecSchemaV1TlvDictionary_CryptoSuite_RsaSha256 = 6,
    CCNxCodecSchemaV1TlvDictionary_CryptoSuite_EcSecp256K1 = 7,
} CCNxCodecSchemaV1TlvDictionary_CryptoSuite;

/**
 * @typedef <#CCNBHeaderType#>
 * @abstract <#Abstract#>
 * @constant CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_WireFormat The off-the-wire packet or a pre-encoded packet
 * @discussion
 *   The WireFormat header is a ficticious header for holding the off-the-wire packet received
 *   from the network or to send a pre-encoded packet down through the stack.
 *
 *   The Forwarder header is a ficticious header for holding special forwarder control block.  The
 *   forwarder control block, on ingress, contains information about where a packet arrived.  On
 *   egress, it contains information about how the packet should be transmitted, such as restricting
 *   it to a specific egress interface.
 *
 *   The protected region extent is used to determine they byte range used for verification.
 */


typedef enum rta_tlv_schema_v1_headers_fastarray {
    CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_TransportStack = 0,        /**< Array element 0 is used by RTA Transport stack */
    CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_FixedHeader = 1,
    CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_INTFRAG = 2,
    CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_OBJFRAG = 3,
    CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_WireFormat = 4,
    CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_Forwarder = 5,
    CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_InterestLifetime = 6,
    CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_RecommendedCacheTime = 7,
    CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_ProtectedStart = 8,        /**< Fictitious header for Protected Region Extent */
    CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_ProtectedLength = 9,       /**< Fictitious header for Protected Region length */
    CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_ContentObjectHashRegionStart = 10,  /**< Fictitious header for CO Hash Region Extent */
    CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_ContentObjectHashRegionLength = 11, /**< Fictitious header for CO Hash Region length */
    CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_InterestReturnCode = 12,
    CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_PathLabel = 13,
    CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_END = 14
} CCNxCodecSchemaV1TlvDictionary_HeadersFastArray;

/**
 * The ValidationFastArray are fields that may appear in the Validation Algorithm and the Validation Payload field.
 *
 * Note that the ValidationFastArray_CRYPTO_SUITE is always expressed in terms of PARCCryptoSuite.
 */
typedef enum rta_tlv_schema_v1_validation_fastarray {
    CCNxCodecSchemaV1TlvDictionary_ValidationFastArray_KEYID = CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_END + 0,
    CCNxCodecSchemaV1TlvDictionary_ValidationFastArray_CRYPTO_SUITE = CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_END + 1,   // PARCCryptoSuite value
    CCNxCodecSchemaV1TlvDictionary_ValidationFastArray_KEY = CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_END + 2,
    CCNxCodecSchemaV1TlvDictionary_ValidationFastArray_CERT = CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_END + 3,
    CCNxCodecSchemaV1TlvDictionary_ValidationFastArray_KEYNAME_NAME = CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_END + 4,
    CCNxCodecSchemaV1TlvDictionary_ValidationFastArray_KEYNAME_KEYID = CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_END + 5,
    CCNxCodecSchemaV1TlvDictionary_ValidationFastArray_KEYNAME_OBJHASH = CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_END + 6,
    CCNxCodecSchemaV1TlvDictionary_ValidationFastArray_PAYLOAD = CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_END + 7,
    CCNxCodecSchemaV1TlvDictionary_ValidationFastArray_SIGNTIME = CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_END + 8,
    CCNxCodecSchemaV1TlvDictionary_ValidationFastArray_END = CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_END + 9
} CCNxCodecSchemaV1TlvDictionary_ValidationFastArray;


/**
 * The MessageFastArray are fields that may appear in the body of a CCNx message (Interest, Content Object, Control).
 *
 * The Hop Limit is part of the MessageFastArray even though it appears in the FixedHeader.  It is treated like a property
 * of the Interest.
 */
typedef enum rta_tlv_schema_v1_message_fastarray {
    CCNxCodecSchemaV1TlvDictionary_MessageFastArray_NAME = CCNxCodecSchemaV1TlvDictionary_ValidationFastArray_END + 0,
    CCNxCodecSchemaV1TlvDictionary_MessageFastArray_KEYID_RESTRICTION = CCNxCodecSchemaV1TlvDictionary_ValidationFastArray_END + 1,
    CCNxCodecSchemaV1TlvDictionary_MessageFastArray_OBJHASH_RESTRICTION = CCNxCodecSchemaV1TlvDictionary_ValidationFastArray_END + 2,
    CCNxCodecSchemaV1TlvDictionary_MessageFastArray_PAYLOAD = CCNxCodecSchemaV1TlvDictionary_ValidationFastArray_END + 4,
    CCNxCodecSchemaV1TlvDictionary_MessageFastArray_HOPLIMIT = CCNxCodecSchemaV1TlvDictionary_ValidationFastArray_END + 5,            /***< Virtual field */
    CCNxCodecSchemaV1TlvDictionary_MessageFastArray_PAYLOADTYPE = CCNxCodecSchemaV1TlvDictionary_ValidationFastArray_END + 6,
    CCNxCodecSchemaV1TlvDictionary_MessageFastArray_EXPIRY_TIME = CCNxCodecSchemaV1TlvDictionary_ValidationFastArray_END + 7,
    CCNxCodecSchemaV1TlvDictionary_MessageFastArray_ENDSEGMENT = CCNxCodecSchemaV1TlvDictionary_ValidationFastArray_END + 8,
    CCNxCodecSchemaV1TlvDictionary_MessageFastArray_HASH_GROUP = CCNxCodecSchemaV1TlvDictionary_ValidationFastArray_END + 9,
    CCNxCodecSchemaV1TlvDictionary_MessageFastArray_DATA_POINTER = CCNxCodecSchemaV1TlvDictionary_ValidationFastArray_END + 10,
    CCNxCodecSchemaV1TlvDictionary_MessageFastArray_MANIFEST_POINTER = CCNxCodecSchemaV1TlvDictionary_ValidationFastArray_END + 11,
    CCNxCodecSchemaV1TlvDictionary_MessageFastArray_END = CCNxCodecSchemaV1TlvDictionary_ValidationFastArray_END + 12
} CCNxCodecSchemaV1TlvDictionary_MessageFastArray;

//const int CCNxCodecSchemaV1TlvDictionary_HeadersFastArray_PathLabel = CCNxCodecSchemaV1TlvDictionary_MessageFastArray_END + 1;

/**
 * Each TLV container can have custom types in it, so each container has a "list"
 * Organization Extensions go here.
 */
typedef enum rta_tlv_schema_v1_lists {
    CCNxCodecSchemaV1TlvDictionary_Lists_HEADERS = 0,
    CCNxCodecSchemaV1TlvDictionary_Lists_MESSAGE_LIST = 1,
    CCNxCodecSchemaV1TlvDictionary_Lists_VALIDATION_ALG_LIST = 4,
    CCNxCodecSchemaV1TlvDictionary_Lists_VALIDATION_PAYLOAD_LIST = 5,
    CCNxCodecSchemaV1TlvDictionary_Lists_HASH_GROUP_LIST = 6,
    CCNxCodecSchemaV1TlvDictionary_Lists_END = 7
} CCNxCodecSchemaV1TlvDictionary_Lists;

/**
 * Creates an empty Interest dictionary
 *
 * The dictionary schema will be V1 and the dictionary type will be Interest.  No other
 * fields are pre-populated.
 *
 * @retval non-null An allocated Dictionary of type Interest
 * @retval null An error (likely no memory)
 *
 * Example:
 * @code
 * {
 *     // in a decoder
 *     if (messageType == _DecoderTlvType_Interest) {
 *         CCNxTlvDictionary *interest = ccnxCodecSchemaV1TlvDictionary_CreateInterest();
 *         // decode the rest of the packet
 *         return interest;
 *     }
 * }
 * @endcode
 */
CCNxTlvDictionary *ccnxCodecSchemaV1TlvDictionary_CreateInterest(void);

/**
 * Creates an empty Content Object dictionary
 *
 * The dictionary schema will be V1 and the dictionary type will be Content Object.  No other
 * fields are pre-populated.
 *
 * @retval non-null An allocated Dictionary of type Content Object
 * @retval null An error (likely no memory)
 *
 * Example:
 * @code
 * {
 *     // in a decoder
 *     if (messageType == _DecoderTlvType_ContentObject) {
 *         CCNxTlvDictionary *object = ccnxCodecSchemaV1TlvDictionary_CreateContentObject();
 *         // decode the rest of the packet
 *         return object;
 *     }
 * }
 * @endcode
 */
CCNxTlvDictionary *ccnxCodecSchemaV1TlvDictionary_CreateContentObject(void);

/**
 * Creates an empty Manifest dictionary
 *
 * The dictionary schema will be V1 and the dictionary type will be Content Object. The
 * PayloadType will be set to CCNxPayloadType_MANIFEST. No other fields are pre-populated.
 *
 * @retval non-null An allocated Dictionary of type Manifest
 * @retval null An error (likely no memory)
 *
 * Example:
 * @code
 * {
 *     // in a decoder
 *     if (messageType == _DecoderTlvType_Manifest) {
 *         CCNxTlvDictionary *object = ccnxCodecSchemaV1TlvDictionary_Manifest();
 *         // decode the rest of the packet
 *         return object;
 *     }
 * }
 * @endcode
 */
CCNxTlvDictionary *ccnxCodecSchemaV1TlvDictionary_CreateManifest(void);

/**
 * Creates an empty Control dictionary
 *
 * The dictionary schema will be V1 and the dictionary type will be Control.  No other
 * fields are pre-populated.
 *
 * @retval non-null An allocated Dictionary of type Control
 * @retval null An error (likely no memory)
 *
 * Example:
 * @code
 * {
 *     // in a decoder
 *     if (messageType == _DecoderTlvType_Control) {
 *         CCNxTlvDictionary *control = ccnxCodecSchemaV1TlvDictionary_CreateControl();
 *         // decode the rest of the packet
 *         return control;
 *     }
 * }
 * @endcode
 */
CCNxTlvDictionary *ccnxCodecSchemaV1TlvDictionary_CreateControl(void);

/**
 * Creates an empty InterestReturn dictionary
 *
 * The dictionary schema will be V1 and the dictionary type will be InterestReturn.  No other
 * fields are pre-populated.
 *
 * @retval non-null An allocated Dictionary of type InterestReturn
 * @retval null An error (likely no memory)
 *
 * Example:
 * @code
 * {
 *     // in a decoder
 *     if (messageType == _DecoderTlvType_InterestReturn) {
 *         CCNxTlvDictionary *interestReturn = ccnxCodecSchemaV1TlvDictionary_CreateInterestReturn();
 *         // decode the rest of the packet
 *         return interestReturn;
 *     }
 * }
 * @endcode
 */
CCNxTlvDictionary *ccnxCodecSchemaV1TlvDictionary_CreateInterestReturn(void);
#endif // libccnx_ccnx_TlvDictionary_SchemaV1_h