blob: 0f4a8d546573869426a61b5495ffe69458397bb4 [file] [log] [blame]
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -08001#include "ccnx-wrapper.h"
Zhenkai Zhu43eb2732012-12-28 00:48:26 -08002extern "C" {
3#include <ccn/fetch.h>
4}
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -08005#include <poll.h>
6#include <boost/throw_exception.hpp>
7#include <boost/date_time/posix_time/posix_time.hpp>
8#include <boost/random.hpp>
9#include <sstream>
10
11typedef boost::error_info<struct tag_errmsg, std::string> errmsg_info_str;
12typedef boost::error_info<struct tag_errmsg, int> errmsg_info_int;
13
14using namespace std;
15using namespace boost;
16
17namespace Ccnx {
18
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080019void
Zhenkai Zhu43eb2732012-12-28 00:48:26 -080020readRaw(Bytes &bytes, const unsigned char *src, size_t len)
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080021{
Zhenkai Zhu43eb2732012-12-28 00:48:26 -080022 if (len > 0)
23 {
24 bytes.resize(len);
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -080025 memcpy(&bytes[0], src, len);
Zhenkai Zhu43eb2732012-12-28 00:48:26 -080026 }
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080027}
28
Zhenkai Zhu974c5a62012-12-28 14:15:30 -080029const unsigned char *
30head(const Bytes &bytes)
31{
32 return &bytes[0];
33}
Zhenkai Zhu43eb2732012-12-28 00:48:26 -080034
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080035CcnxWrapper::CcnxWrapper()
36 : m_handle (0)
37 , m_keyStore (0)
38 , m_keyLoactor (0)
39 , m_running (true)
40 , m_connected (false)
41{
42 connectCcnd();
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080043 m_thread = thread (&CcnxWrapper::ccnLoop, this);
44}
45
46void
47CcnxWrapper::connectCcnd()
48{
Zhenkai Zhu3b82d432013-01-03 22:48:40 -080049 //if (m_handle != 0) {
50 //ccn_disconnect (m_handle);
51 //ccn_destroy (&m_handle);
52 //}
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -080053
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080054 m_handle = ccn_create ();
Zhenkai Zhud34106a2013-01-04 15:51:55 -080055 UniqueRecLock(m_mutex);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080056 if (ccn_connect(m_handle, NULL) < 0)
57 {
58 BOOST_THROW_EXCEPTION (CcnxOperationException() << errmsg_info_str("connection to ccnd failed"));
59 }
60 m_connected = true;
61
Zhenkai Zhu3b82d432013-01-03 22:48:40 -080062 //if (!m_registeredInterests.empty())
63 //{
64 // for (map<Name, InterestCallback>::const_iterator it = m_registeredInterests.begin(); it != m_registeredInterests.end(); ++it)
65 //{
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080066 // clearInterestFilter(it->first);
Zhenkai Zhu3b82d432013-01-03 22:48:40 -080067 // setInterestFilter(it->first, it->second);
68 //}
69 //}
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080070}
71
72CcnxWrapper::~CcnxWrapper()
73{
74 {
Zhenkai Zhu7f4258e2012-12-29 19:55:13 -080075 UniqueRecLock(m_mutex);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080076 m_running = false;
77 }
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -080078
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080079 m_thread.join ();
80 ccn_disconnect (m_handle);
81 ccn_destroy (&m_handle);
82 ccn_charbuf_destroy (&m_keyLoactor);
83 ccn_keystore_destroy (&m_keyStore);
84}
85
86void
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080087CcnxWrapper::ccnLoop ()
88{
89 static boost::mt19937 randomGenerator (static_cast<unsigned int> (std::time (0)));
90 static boost::variate_generator<boost::mt19937&, boost::uniform_int<> > rangeUniformRandom (randomGenerator, uniform_int<> (0,1000));
91
92 while (m_running)
93 {
94 try
95 {
96 int res = 0;
97 {
Zhenkai Zhu7f4258e2012-12-29 19:55:13 -080098 UniqueRecLock(m_mutex);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080099 res = ccn_run (m_handle, 0);
100 }
101
102 if (!m_running) break;
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800103
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800104 if (res < 0)
105 BOOST_THROW_EXCEPTION (CcnxOperationException()
106 << errmsg_info_str("ccn_run returned error"));
107
108
109 pollfd pfds[1];
110 {
Zhenkai Zhu7f4258e2012-12-29 19:55:13 -0800111 UniqueRecLock(m_mutex);
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800112
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800113 pfds[0].fd = ccn_get_connection_fd (m_handle);
114 pfds[0].events = POLLIN;
115 if (ccn_output_is_pending (m_handle))
116 pfds[0].events |= POLLOUT;
117 }
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800118
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800119 int ret = poll (pfds, 1, 1);
120 if (ret < 0)
121 {
122 BOOST_THROW_EXCEPTION (CcnxOperationException() << errmsg_info_str("ccnd socket failed (probably ccnd got stopped)"));
123 }
124 }
125 catch (CcnxOperationException &e)
126 {
127 // do not try reconnect for now
128 throw e;
129 /*
130 m_connected = false;
131 // probably ccnd has been stopped
132 // try reconnect with sleep
133 int interval = 1;
134 int maxInterval = 32;
135 while (m_running)
136 {
137 try
138 {
139 this_thread::sleep (boost::get_system_time () + TIME_SECONDS(interval) + TIME_MILLISECONDS (rangeUniformRandom ()));
140
141 connectCcnd();
142 _LOG_DEBUG("reconnect to ccnd succeeded");
143 break;
144 }
145 catch (CcnxOperationException &e)
146 {
147 this_thread::sleep (boost::get_system_time () + TIME_SECONDS(interval) + TIME_MILLISECONDS (rangeUniformRandom ()));
148
149 // do exponential backup for reconnect interval
150 if (interval < maxInterval)
151 {
152 interval *= 2;
153 }
154 }
155 }
156 */
157 }
158 catch (const std::exception &exc)
159 {
160 // catch anything thrown within try block that derives from std::exception
161 std::cerr << exc.what();
162 }
163 catch (...)
164 {
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800165 cout << "UNKNOWN EXCEPTION !!!" << endl;
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800166 }
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800167 }
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800168}
169
Zhenkai Zhu43eb2732012-12-28 00:48:26 -0800170Bytes
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800171CcnxWrapper::createContentObject(const Name &name, const unsigned char *buf, size_t len, int freshness)
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800172{
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800173 CcnxCharbufPtr ptr = name.toCcnxCharbuf();
174 ccn_charbuf *pname = ptr->getBuf();
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800175 ccn_charbuf *content = ccn_charbuf_create();
176
Zhenkai Zhud9d03f62013-01-04 16:57:46 -0800177 struct ccn_signing_params sp = CCN_SIGNING_PARAMS_INIT;
178 sp.freshness = freshness;
179
180 if (ccn_sign_content(m_handle, content, pname, &sp, buf, len) != 0)
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800181 {
Zhenkai Zhud9d03f62013-01-04 16:57:46 -0800182 BOOST_THROW_EXCEPTION(CcnxOperationException() << errmsg_info_str("sign content failed"));
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800183 }
Zhenkai Zhu43eb2732012-12-28 00:48:26 -0800184
185 Bytes bytes;
186 readRaw(bytes, content->buf, content->length);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800187
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800188 ccn_charbuf_destroy (&content);
189
Zhenkai Zhu43eb2732012-12-28 00:48:26 -0800190 return bytes;
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800191}
192
193int
Zhenkai Zhubad089c2012-12-28 10:28:27 -0800194CcnxWrapper::putToCcnd (const Bytes &contentObject)
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800195{
Zhenkai Zhu7f4258e2012-12-29 19:55:13 -0800196 UniqueRecLock(m_mutex);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800197 if (!m_running || !m_connected)
198 return -1;
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800199
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800200
Zhenkai Zhu974c5a62012-12-28 14:15:30 -0800201 if (ccn_put(m_handle, head(contentObject), contentObject.size()) < 0)
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800202 {
203 // BOOST_THROW_EXCEPTION(CcnxOperationException() << errmsg_info_str("ccnput failed"));
204 }
205
206 return 0;
207}
208
209int
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800210CcnxWrapper::publishData (const Name &name, const unsigned char *buf, size_t len, int freshness)
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800211{
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800212 Bytes co = createContentObject(name, buf, len, freshness);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800213 return putToCcnd(co);
214}
215
Zhenkai Zhu43eb2732012-12-28 00:48:26 -0800216int
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800217CcnxWrapper::publishData (const Name &name, const Bytes &content, int freshness)
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800218{
Zhenkai Zhu974c5a62012-12-28 14:15:30 -0800219 publishData(name, head(content), content.size(), freshness);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800220}
221
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800222
223static ccn_upcall_res
224incomingInterest(ccn_closure *selfp,
225 ccn_upcall_kind kind,
226 ccn_upcall_info *info)
227{
228 CcnxWrapper::InterestCallback *f = static_cast<CcnxWrapper::InterestCallback*> (selfp->data);
229
230 switch (kind)
231 {
232 case CCN_UPCALL_FINAL: // effective in unit tests
233 delete f;
234 delete selfp;
235 return CCN_UPCALL_RESULT_OK;
236
237 case CCN_UPCALL_INTEREST:
238 break;
239
240 default:
241 return CCN_UPCALL_RESULT_OK;
242 }
243
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800244 Name interest(info->interest_ccnb, info->interest_comps);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800245
246 (*f) (interest);
247 return CCN_UPCALL_RESULT_OK;
248}
249
250static ccn_upcall_res
251incomingData(ccn_closure *selfp,
252 ccn_upcall_kind kind,
253 ccn_upcall_info *info)
254{
Zhenkai Zhu974c5a62012-12-28 14:15:30 -0800255 Closure *cp = static_cast<Closure *> (selfp->data);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800256
257 switch (kind)
258 {
259 case CCN_UPCALL_FINAL: // effecitve in unit tests
Zhenkai Zhu19f81de2013-01-04 22:27:47 -0800260 delete cp;
261 cp = NULL;
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800262 delete selfp;
263 return CCN_UPCALL_RESULT_OK;
264
265 case CCN_UPCALL_CONTENT:
266 break;
267
268 case CCN_UPCALL_INTEREST_TIMED_OUT: {
269 if (cp != NULL && cp->getRetry() > 0) {
270 cp->decRetry();
271 return CCN_UPCALL_RESULT_REEXPRESS;
272 }
273
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800274 Name interest(info->interest_ccnb, info->interest_comps);
Zhenkai Zhu974c5a62012-12-28 14:15:30 -0800275 Closure::TimeoutCallbackReturnValue rv = cp->runTimeoutCallback(interest);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800276 switch(rv)
277 {
Zhenkai Zhu974c5a62012-12-28 14:15:30 -0800278 case Closure::RESULT_OK : return CCN_UPCALL_RESULT_OK;
279 case Closure::RESULT_REEXPRESS : return CCN_UPCALL_RESULT_REEXPRESS;
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800280 default : break;
281 }
282 return CCN_UPCALL_RESULT_OK;
283 }
284
285 default:
286 return CCN_UPCALL_RESULT_OK;
287 }
288
Zhenkai Zhu43eb2732012-12-28 00:48:26 -0800289 const unsigned char *pcontent;
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800290 size_t len;
Zhenkai Zhu43eb2732012-12-28 00:48:26 -0800291 if (ccn_content_get_value(info->content_ccnb, info->pco->offset[CCN_PCO_E], info->pco, &pcontent, &len) < 0)
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800292 {
293 // BOOST_THROW_EXCEPTION(CcnxOperationException() << errmsg_info_str("decode ContentObject failed"));
294 }
295
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800296 Name name(info->content_ccnb, info->content_comps);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800297
Zhenkai Zhu43eb2732012-12-28 00:48:26 -0800298 Bytes content;
299 // copy content and do processing on the copy
300 // otherwise the pointed memory may have been changed during the processing
301 readRaw(content, pcontent, len);
302
303 cp->runDataCallback(name, content);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800304
305 return CCN_UPCALL_RESULT_OK;
306}
307
Zhenkai Zhu19f81de2013-01-04 22:27:47 -0800308int CcnxWrapper::sendInterest (const Name &interest, const Closure *closure, const Selectors &selectors)
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800309{
Zhenkai Zhu7f4258e2012-12-29 19:55:13 -0800310 UniqueRecLock(m_mutex);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800311 if (!m_running || !m_connected)
312 return -1;
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800313
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800314 CcnxCharbufPtr namePtr = interest.toCcnxCharbuf();
315 ccn_charbuf *pname = namePtr->getBuf();
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800316 ccn_closure *dataClosure = new ccn_closure;
317
Zhenkai Zhu19f81de2013-01-04 22:27:47 -0800318 Closure *myClosure = closure->dup();
319 dataClosure->data = (void *)myClosure;
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800320
321 dataClosure->p = &incomingData;
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800322
323 CcnxCharbufPtr selectorsPtr = selectors.toCcnxCharbuf();
324 ccn_charbuf *templ = NULL;
325 if (selectorsPtr != CcnxCharbuf::Null)
326 {
327 templ = selectorsPtr->getBuf();
328 }
329
330 if (ccn_express_interest (m_handle, pname, dataClosure, templ) < 0)
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800331 {
332 }
333
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800334 return 0;
335}
336
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800337int CcnxWrapper::setInterestFilter (const Name &prefix, const InterestCallback &interestCallback)
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800338{
Zhenkai Zhu7f4258e2012-12-29 19:55:13 -0800339 UniqueRecLock(m_mutex);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800340 if (!m_running || !m_connected)
341 return -1;
342
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800343 CcnxCharbufPtr ptr = prefix.toCcnxCharbuf();
344 ccn_charbuf *pname = ptr->getBuf();
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800345 ccn_closure *interestClosure = new ccn_closure;
346
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800347 interestClosure->data = new InterestCallback (interestCallback); // should be removed when closure is removed
348 interestClosure->p = &incomingInterest;
349 int ret = ccn_set_interest_filter (m_handle, pname, interestClosure);
350 if (ret < 0)
351 {
352 }
353
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800354 m_registeredInterests.insert(pair<Name, InterestCallback>(prefix, interestCallback));
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800355}
356
357void
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800358CcnxWrapper::clearInterestFilter (const Name &prefix)
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800359{
Zhenkai Zhu7f4258e2012-12-29 19:55:13 -0800360 UniqueRecLock(m_mutex);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800361 if (!m_running || !m_connected)
362 return;
363
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800364 CcnxCharbufPtr ptr = prefix.toCcnxCharbuf();
365 ccn_charbuf *pname = ptr->getBuf();
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800366
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800367 int ret = ccn_set_interest_filter (m_handle, pname, 0);
368 if (ret < 0)
369 {
370 }
371
372 m_registeredInterests.erase(prefix);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800373}
374
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800375Name
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800376CcnxWrapper::getLocalPrefix ()
377{
378 struct ccn * tmp_handle = ccn_create ();
379 int res = ccn_connect (tmp_handle, NULL);
380 if (res < 0)
381 {
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800382 return Name();
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800383 }
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800384
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800385 string retval = "";
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800386
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800387 struct ccn_charbuf *templ = ccn_charbuf_create();
388 ccn_charbuf_append_tt(templ, CCN_DTAG_Interest, CCN_DTAG);
389 ccn_charbuf_append_tt(templ, CCN_DTAG_Name, CCN_DTAG);
390 ccn_charbuf_append_closer(templ); /* </Name> */
391 // XXX - use pubid if possible
392 ccn_charbuf_append_tt(templ, CCN_DTAG_MaxSuffixComponents, CCN_DTAG);
393 ccnb_append_number(templ, 1);
394 ccn_charbuf_append_closer(templ); /* </MaxSuffixComponents> */
395 ccnb_tagged_putf(templ, CCN_DTAG_Scope, "%d", 2);
396 ccn_charbuf_append_closer(templ); /* </Interest> */
397
398 struct ccn_charbuf *name = ccn_charbuf_create ();
399 res = ccn_name_from_uri (name, "/local/ndn/prefix");
400 if (res < 0) {
401 }
402 else
403 {
404 struct ccn_fetch *fetch = ccn_fetch_new (tmp_handle);
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800405
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800406 struct ccn_fetch_stream *stream = ccn_fetch_open (fetch, name, "/local/ndn/prefix",
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800407 NULL, 4, CCN_V_HIGHEST, 0);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800408 if (stream == NULL) {
409 }
410 else
411 {
412 ostringstream os;
413
414 int counter = 0;
415 char buf[256];
416 while (true) {
417 res = ccn_fetch_read (stream, buf, sizeof(buf));
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800418
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800419 if (res == 0) {
420 break;
421 }
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800422
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800423 if (res > 0) {
424 os << string(buf, res);
425 } else if (res == CCN_FETCH_READ_NONE) {
426 if (counter < 2)
427 {
428 ccn_run(tmp_handle, 1000);
429 counter ++;
430 }
431 else
432 {
433 break;
434 }
435 } else if (res == CCN_FETCH_READ_END) {
436 break;
437 } else if (res == CCN_FETCH_READ_TIMEOUT) {
438 break;
439 } else {
440 break;
441 }
442 }
443 retval = os.str ();
444 stream = ccn_fetch_close(stream);
445 }
446 fetch = ccn_fetch_destroy(fetch);
447 }
448
449 ccn_charbuf_destroy (&name);
450
451 ccn_disconnect (tmp_handle);
452 ccn_destroy (&tmp_handle);
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800453
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800454 return Name(retval);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800455}
456
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800457}