Jeff Thompson | 25b4e61 | 2013-10-10 16:03:24 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
Jeff Thompson | 5cae5e5 | 2013-07-10 19:41:20 -0700 | [diff] [blame] | 2 | /** |
Jeff Thompson | 7687dc0 | 2013-09-13 11:54:07 -0700 | [diff] [blame] | 3 | * Copyright (C) 2013 Regents of the University of California. |
| 4 | * @author: Jeff Thompson <jefft0@remap.ucla.edu> |
Jeff Thompson | 5cae5e5 | 2013-07-10 19:41:20 -0700 | [diff] [blame] | 5 | * See COPYING for copyright and distribution information. |
| 6 | */ |
| 7 | |
Jeff Thompson | 25b4e61 | 2013-10-10 16:03:24 -0700 | [diff] [blame] | 8 | #include <ndn-cpp/common.hpp> |
| 9 | #include <ndn-cpp/key.hpp> |
| 10 | #include "c/key.h" |
Jeff Thompson | 5cae5e5 | 2013-07-10 19:41:20 -0700 | [diff] [blame] | 11 | |
| 12 | using namespace std; |
| 13 | |
| 14 | namespace ndn { |
Jeff Thompson | 25b4e61 | 2013-10-10 16:03:24 -0700 | [diff] [blame] | 15 | |
Jeff Thompson | 0050abe | 2013-09-17 12:50:25 -0700 | [diff] [blame] | 16 | void |
| 17 | KeyLocator::get(struct ndn_KeyLocator& keyLocatorStruct) const |
Jeff Thompson | 5cae5e5 | 2013-07-10 19:41:20 -0700 | [diff] [blame] | 18 | { |
| 19 | keyLocatorStruct.type = type_; |
Jeff Thompson | 9303453 | 2013-10-08 11:52:43 -0700 | [diff] [blame] | 20 | keyData_.get(keyLocatorStruct.keyData); |
Jeff Thompson | 7329a13 | 2013-08-16 15:57:37 -0700 | [diff] [blame] | 21 | keyName_.get(keyLocatorStruct.keyName); |
| 22 | keyLocatorStruct.keyNameType = keyNameType_; |
Jeff Thompson | 5cae5e5 | 2013-07-10 19:41:20 -0700 | [diff] [blame] | 23 | } |
| 24 | |
Jeff Thompson | 0050abe | 2013-09-17 12:50:25 -0700 | [diff] [blame] | 25 | void |
| 26 | KeyLocator::set(const struct ndn_KeyLocator& keyLocatorStruct) |
Jeff Thompson | 5cae5e5 | 2013-07-10 19:41:20 -0700 | [diff] [blame] | 27 | { |
| 28 | type_ = keyLocatorStruct.type; |
Jeff Thompson | 9303453 | 2013-10-08 11:52:43 -0700 | [diff] [blame] | 29 | keyData_ = Blob(keyLocatorStruct.keyData); |
Jeff Thompson | 7329a13 | 2013-08-16 15:57:37 -0700 | [diff] [blame] | 30 | if (keyLocatorStruct.type == ndn_KeyLocatorType_KEYNAME) { |
| 31 | keyName_.set(keyLocatorStruct.keyName); |
| 32 | keyNameType_ = keyLocatorStruct.keyNameType; |
| 33 | } |
| 34 | else { |
| 35 | keyName_.clear(); |
| 36 | keyNameType_ = (ndn_KeyNameType)-1; |
| 37 | } |
Jeff Thompson | 5cae5e5 | 2013-07-10 19:41:20 -0700 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | } |
| 41 | |