blob: 0cf59ed65dcc7a841f758dcdf02bfee4749699fd [file] [log] [blame]
Jeff Thompson25b4e612013-10-10 16:03:24 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
Jeff Thompson5cae5e52013-07-10 19:41:20 -07002/**
Jeff Thompson7687dc02013-09-13 11:54:07 -07003 * Copyright (C) 2013 Regents of the University of California.
4 * @author: Jeff Thompson <jefft0@remap.ucla.edu>
Jeff Thompson5cae5e52013-07-10 19:41:20 -07005 * See COPYING for copyright and distribution information.
6 */
7
Jeff Thompson25b4e612013-10-10 16:03:24 -07008#include <ndn-cpp/common.hpp>
9#include <ndn-cpp/key.hpp>
10#include "c/key.h"
Jeff Thompson5cae5e52013-07-10 19:41:20 -070011
12using namespace std;
13
14namespace ndn {
Jeff Thompson25b4e612013-10-10 16:03:24 -070015
Jeff Thompson0050abe2013-09-17 12:50:25 -070016void
17KeyLocator::get(struct ndn_KeyLocator& keyLocatorStruct) const
Jeff Thompson5cae5e52013-07-10 19:41:20 -070018{
19 keyLocatorStruct.type = type_;
Jeff Thompson93034532013-10-08 11:52:43 -070020 keyData_.get(keyLocatorStruct.keyData);
Jeff Thompson7329a132013-08-16 15:57:37 -070021 keyName_.get(keyLocatorStruct.keyName);
22 keyLocatorStruct.keyNameType = keyNameType_;
Jeff Thompson5cae5e52013-07-10 19:41:20 -070023}
24
Jeff Thompson0050abe2013-09-17 12:50:25 -070025void
26KeyLocator::set(const struct ndn_KeyLocator& keyLocatorStruct)
Jeff Thompson5cae5e52013-07-10 19:41:20 -070027{
28 type_ = keyLocatorStruct.type;
Jeff Thompson93034532013-10-08 11:52:43 -070029 keyData_ = Blob(keyLocatorStruct.keyData);
Jeff Thompson7329a132013-08-16 15:57:37 -070030 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 Thompson5cae5e52013-07-10 19:41:20 -070038}
39
40}
41