blob: db3ea586577a46c55d85c57d6d5de3b80929c57d [file] [log] [blame]
Jeff Thompson5cae5e52013-07-10 19:41:20 -07001/**
Jeff Thompson7687dc02013-09-13 11:54:07 -07002 * Copyright (C) 2013 Regents of the University of California.
3 * @author: Jeff Thompson <jefft0@remap.ucla.edu>
Jeff Thompson5cae5e52013-07-10 19:41:20 -07004 * See COPYING for copyright and distribution information.
5 */
6
7#include "common.hpp"
Jeff Thompson53412192013-08-06 13:35:50 -07008#include "key.hpp"
Jeff Thompson5cae5e52013-07-10 19:41:20 -07009
10using namespace std;
11
12namespace ndn {
13
Jeff Thompson0050abe2013-09-17 12:50:25 -070014void
15KeyLocator::get(struct ndn_KeyLocator& keyLocatorStruct) const
Jeff Thompson5cae5e52013-07-10 19:41:20 -070016{
17 keyLocatorStruct.type = type_;
Jeff Thompson93034532013-10-08 11:52:43 -070018 keyData_.get(keyLocatorStruct.keyData);
Jeff Thompson7329a132013-08-16 15:57:37 -070019 keyName_.get(keyLocatorStruct.keyName);
20 keyLocatorStruct.keyNameType = keyNameType_;
Jeff Thompson5cae5e52013-07-10 19:41:20 -070021}
22
Jeff Thompson0050abe2013-09-17 12:50:25 -070023void
24KeyLocator::set(const struct ndn_KeyLocator& keyLocatorStruct)
Jeff Thompson5cae5e52013-07-10 19:41:20 -070025{
26 type_ = keyLocatorStruct.type;
Jeff Thompson93034532013-10-08 11:52:43 -070027 keyData_ = Blob(keyLocatorStruct.keyData);
Jeff Thompson7329a132013-08-16 15:57:37 -070028 if (keyLocatorStruct.type == ndn_KeyLocatorType_KEYNAME) {
29 keyName_.set(keyLocatorStruct.keyName);
30 keyNameType_ = keyLocatorStruct.keyNameType;
31 }
32 else {
33 keyName_.clear();
34 keyNameType_ = (ndn_KeyNameType)-1;
35 }
Jeff Thompson5cae5e52013-07-10 19:41:20 -070036}
37
38}
39