Yingdi Yu | 77627ab | 2015-07-21 16:13:49 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Yingdi Yu | 0a312e5 | 2015-07-22 13:14:53 -0700 | [diff] [blame] | 3 | * Copyright (c) 2014-2015, Regents of the University of California. |
Yingdi Yu | 77627ab | 2015-07-21 16:13:49 -0700 | [diff] [blame] | 4 | * |
Yingdi Yu | 0a312e5 | 2015-07-22 13:14:53 -0700 | [diff] [blame] | 5 | * This file is part of ndn-tools (Named Data Networking Essential Tools). |
| 6 | * See AUTHORS.md for complete list of ndn-tools authors and contributors. |
Yingdi Yu | 77627ab | 2015-07-21 16:13:49 -0700 | [diff] [blame] | 7 | * |
Yingdi Yu | 0a312e5 | 2015-07-22 13:14:53 -0700 | [diff] [blame] | 8 | * ndn-tools is free software: you can redistribute it and/or modify it under the terms |
| 9 | * of the GNU General Public License as published by the Free Software Foundation, |
| 10 | * either version 3 of the License, or (at your option) any later version. |
Yingdi Yu | 77627ab | 2015-07-21 16:13:49 -0700 | [diff] [blame] | 11 | * |
Yingdi Yu | 0a312e5 | 2015-07-22 13:14:53 -0700 | [diff] [blame] | 12 | * ndn-tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 13 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 14 | * PURPOSE. See the GNU General Public License for more details. |
Yingdi Yu | 77627ab | 2015-07-21 16:13:49 -0700 | [diff] [blame] | 15 | * |
Yingdi Yu | 0a312e5 | 2015-07-22 13:14:53 -0700 | [diff] [blame] | 16 | * You should have received a copy of the GNU General Public License along with |
| 17 | * ndn-tools, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
Yingdi Yu | 77627ab | 2015-07-21 16:13:49 -0700 | [diff] [blame] | 18 | * |
Yingdi Yu | 0a312e5 | 2015-07-22 13:14:53 -0700 | [diff] [blame] | 19 | * @author Yingdi Yu <yingdi@cs.ucla.edu> |
Yingdi Yu | 77627ab | 2015-07-21 16:13:49 -0700 | [diff] [blame] | 20 | */ |
| 21 | |
Yingdi Yu | 0a312e5 | 2015-07-22 13:14:53 -0700 | [diff] [blame] | 22 | #ifndef NDN_TOOLS_PIB_PIB_COMMON_HPP |
| 23 | #define NDN_TOOLS_PIB_PIB_COMMON_HPP |
Yingdi Yu | 77627ab | 2015-07-21 16:13:49 -0700 | [diff] [blame] | 24 | |
| 25 | namespace ndn { |
| 26 | namespace pib { |
| 27 | |
| 28 | /// @sa http://redmine.named-data.net/projects/ndn-cxx/wiki/PublicKey_Info_Base |
| 29 | |
| 30 | enum { |
| 31 | OFFSET_USER = 2, |
| 32 | OFFSET_VERB = 3, |
| 33 | OFFSET_PARAM = 4, |
| 34 | OFFSET_TIMESTAMP = 5, |
| 35 | OFFSET_NONCE = 6, |
| 36 | OFFSET_SIG_INFO = 7, |
| 37 | OFFSET_SIG_VALUE = 8, |
| 38 | |
| 39 | MIN_PIB_INTEREST_SIZE = 5, |
| 40 | SIGNED_PIB_INTEREST_SIZE = 9 |
| 41 | }; |
| 42 | |
| 43 | enum Type { |
| 44 | TYPE_USER = 0, |
| 45 | TYPE_ID = 1, |
| 46 | TYPE_KEY = 2, |
| 47 | TYPE_CERT = 3, |
| 48 | TYPE_DEFAULT = 255 |
| 49 | }; |
| 50 | |
| 51 | enum DefaultOpt { |
| 52 | DEFAULT_OPT_NO = 0, |
| 53 | DEFAULT_OPT_KEY = 1, // 0x01 |
| 54 | DEFAULT_OPT_ID = 3, // 0x03 |
| 55 | DEFAULT_OPT_USER = 7 // 0x07 |
| 56 | }; |
| 57 | |
| 58 | enum DefaultOptMask { |
| 59 | DEFAULT_OPT_KEY_MASK = 0x1, |
| 60 | DEFAULT_OPT_ID_MASK = 0x2, |
| 61 | DEFAULT_OPT_USER_MASK = 0x4 |
| 62 | }; |
| 63 | |
| 64 | enum ErrCode { |
| 65 | ERR_SUCCESS = 0, |
| 66 | |
| 67 | // Invalid query |
| 68 | ERR_INCOMPLETE_COMMAND = 1, |
| 69 | ERR_WRONG_VERB = 2, |
| 70 | ERR_WRONG_PARAM = 3, |
| 71 | ERR_WRONG_SIGNER = 4, |
| 72 | ERR_INTERNAL_ERROR = 5, |
| 73 | |
| 74 | // Non existing entity |
| 75 | ERR_NON_EXISTING_USER = 128, |
| 76 | ERR_NON_EXISTING_ID = 129, |
| 77 | ERR_NON_EXISTING_KEY = 130, |
| 78 | ERR_NON_EXISTING_CERT = 131, |
| 79 | |
| 80 | // No default setting |
| 81 | ERR_NO_DEFAULT_ID = 256, |
| 82 | ERR_NO_DEFAULT_KEY = 257, |
| 83 | ERR_NO_DEFAULT_CERT = 258, |
| 84 | |
| 85 | // Delete default setting |
| 86 | ERR_DELETE_DEFAULT_SETTING = 384 |
| 87 | }; |
| 88 | |
| 89 | } // namespace pib |
| 90 | |
| 91 | |
| 92 | namespace tlv { |
| 93 | namespace pib { |
| 94 | |
| 95 | enum ParamType { |
| 96 | GetParam = 128, // 0x80 |
| 97 | DefaultParam = 129, // 0x81 |
| 98 | ListParam = 130, // 0x82 |
| 99 | UpdateParam = 131, // 0x83 |
| 100 | DeleteParam = 132 // 0x84 |
| 101 | }; |
| 102 | |
| 103 | enum EntityType { |
| 104 | User = 144, // 0x90 |
| 105 | Identity = 145, // 0x91 |
| 106 | PublicKey = 146, // 0x92 |
| 107 | Certificate = 147 // 0x93 |
| 108 | }; |
| 109 | |
| 110 | // Other |
| 111 | enum { |
| 112 | Bytes = 148, // 0x94 |
| 113 | DefaultOpt = 149, // 0x95 |
| 114 | NameList = 150, // 0x96 |
| 115 | Type = 151, // 0x97 |
| 116 | Error = 152, // 0x98 |
| 117 | TpmLocator = 153, // 0x99 |
| 118 | |
| 119 | // ErrorCode |
| 120 | ErrorCode = 252 // 0xfc |
| 121 | }; |
| 122 | |
| 123 | } // namespace pib |
| 124 | } // namespace tlv |
| 125 | } // namespace ndn |
| 126 | |
| 127 | |
Yingdi Yu | 0a312e5 | 2015-07-22 13:14:53 -0700 | [diff] [blame] | 128 | #endif // NDN_TOOLS_PIB_PIB_COMMON_HPP |