blob: 887f8ae6df8fb131f0aa9b8e1c7287d39cbae452 [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)
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080037 , m_running (true)
38 , m_connected (false)
39{
40 connectCcnd();
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080041 m_thread = thread (&CcnxWrapper::ccnLoop, this);
42}
43
44void
45CcnxWrapper::connectCcnd()
46{
Zhenkai Zhu3b82d432013-01-03 22:48:40 -080047 //if (m_handle != 0) {
48 //ccn_disconnect (m_handle);
49 //ccn_destroy (&m_handle);
50 //}
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -080051
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080052 m_handle = ccn_create ();
Zhenkai Zhud34106a2013-01-04 15:51:55 -080053 UniqueRecLock(m_mutex);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080054 if (ccn_connect(m_handle, NULL) < 0)
55 {
56 BOOST_THROW_EXCEPTION (CcnxOperationException() << errmsg_info_str("connection to ccnd failed"));
57 }
58 m_connected = true;
59
Zhenkai Zhu3b82d432013-01-03 22:48:40 -080060 //if (!m_registeredInterests.empty())
61 //{
62 // for (map<Name, InterestCallback>::const_iterator it = m_registeredInterests.begin(); it != m_registeredInterests.end(); ++it)
63 //{
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080064 // clearInterestFilter(it->first);
Zhenkai Zhu3b82d432013-01-03 22:48:40 -080065 // setInterestFilter(it->first, it->second);
66 //}
67 //}
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080068}
69
70CcnxWrapper::~CcnxWrapper()
71{
72 {
Zhenkai Zhu7f4258e2012-12-29 19:55:13 -080073 UniqueRecLock(m_mutex);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080074 m_running = false;
75 }
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -080076
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080077 m_thread.join ();
78 ccn_disconnect (m_handle);
79 ccn_destroy (&m_handle);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080080}
81
82void
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080083CcnxWrapper::ccnLoop ()
84{
85 static boost::mt19937 randomGenerator (static_cast<unsigned int> (std::time (0)));
86 static boost::variate_generator<boost::mt19937&, boost::uniform_int<> > rangeUniformRandom (randomGenerator, uniform_int<> (0,1000));
87
88 while (m_running)
89 {
90 try
91 {
92 int res = 0;
93 {
Zhenkai Zhu7f4258e2012-12-29 19:55:13 -080094 UniqueRecLock(m_mutex);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -080095 res = ccn_run (m_handle, 0);
96 }
97
98 if (!m_running) break;
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -080099
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800100 if (res < 0)
101 BOOST_THROW_EXCEPTION (CcnxOperationException()
102 << errmsg_info_str("ccn_run returned error"));
103
104
105 pollfd pfds[1];
106 {
Zhenkai Zhu7f4258e2012-12-29 19:55:13 -0800107 UniqueRecLock(m_mutex);
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800108
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800109 pfds[0].fd = ccn_get_connection_fd (m_handle);
110 pfds[0].events = POLLIN;
111 if (ccn_output_is_pending (m_handle))
112 pfds[0].events |= POLLOUT;
113 }
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800114
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800115 int ret = poll (pfds, 1, 1);
116 if (ret < 0)
117 {
118 BOOST_THROW_EXCEPTION (CcnxOperationException() << errmsg_info_str("ccnd socket failed (probably ccnd got stopped)"));
119 }
120 }
121 catch (CcnxOperationException &e)
122 {
123 // do not try reconnect for now
124 throw e;
125 /*
126 m_connected = false;
127 // probably ccnd has been stopped
128 // try reconnect with sleep
129 int interval = 1;
130 int maxInterval = 32;
131 while (m_running)
132 {
133 try
134 {
135 this_thread::sleep (boost::get_system_time () + TIME_SECONDS(interval) + TIME_MILLISECONDS (rangeUniformRandom ()));
136
137 connectCcnd();
138 _LOG_DEBUG("reconnect to ccnd succeeded");
139 break;
140 }
141 catch (CcnxOperationException &e)
142 {
143 this_thread::sleep (boost::get_system_time () + TIME_SECONDS(interval) + TIME_MILLISECONDS (rangeUniformRandom ()));
144
145 // do exponential backup for reconnect interval
146 if (interval < maxInterval)
147 {
148 interval *= 2;
149 }
150 }
151 }
152 */
153 }
154 catch (const std::exception &exc)
155 {
156 // catch anything thrown within try block that derives from std::exception
157 std::cerr << exc.what();
158 }
159 catch (...)
160 {
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800161 cout << "UNKNOWN EXCEPTION !!!" << endl;
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800162 }
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800163 }
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800164}
165
Zhenkai Zhu43eb2732012-12-28 00:48:26 -0800166Bytes
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800167CcnxWrapper::createContentObject(const Name &name, const unsigned char *buf, size_t len, int freshness)
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800168{
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800169 CcnxCharbufPtr ptr = name.toCcnxCharbuf();
170 ccn_charbuf *pname = ptr->getBuf();
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800171 ccn_charbuf *content = ccn_charbuf_create();
172
Zhenkai Zhud9d03f62013-01-04 16:57:46 -0800173 struct ccn_signing_params sp = CCN_SIGNING_PARAMS_INIT;
174 sp.freshness = freshness;
175
176 if (ccn_sign_content(m_handle, content, pname, &sp, buf, len) != 0)
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800177 {
Zhenkai Zhud9d03f62013-01-04 16:57:46 -0800178 BOOST_THROW_EXCEPTION(CcnxOperationException() << errmsg_info_str("sign content failed"));
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800179 }
Zhenkai Zhu43eb2732012-12-28 00:48:26 -0800180
181 Bytes bytes;
182 readRaw(bytes, content->buf, content->length);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800183
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800184 ccn_charbuf_destroy (&content);
185
Zhenkai Zhu43eb2732012-12-28 00:48:26 -0800186 return bytes;
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800187}
188
189int
Zhenkai Zhubad089c2012-12-28 10:28:27 -0800190CcnxWrapper::putToCcnd (const Bytes &contentObject)
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800191{
Zhenkai Zhu7f4258e2012-12-29 19:55:13 -0800192 UniqueRecLock(m_mutex);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800193 if (!m_running || !m_connected)
194 return -1;
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800195
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800196
Zhenkai Zhu974c5a62012-12-28 14:15:30 -0800197 if (ccn_put(m_handle, head(contentObject), contentObject.size()) < 0)
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800198 {
199 // BOOST_THROW_EXCEPTION(CcnxOperationException() << errmsg_info_str("ccnput failed"));
200 }
201
202 return 0;
203}
204
205int
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800206CcnxWrapper::publishData (const Name &name, const unsigned char *buf, size_t len, int freshness)
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800207{
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800208 Bytes co = createContentObject(name, buf, len, freshness);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800209 return putToCcnd(co);
210}
211
Zhenkai Zhu43eb2732012-12-28 00:48:26 -0800212int
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800213CcnxWrapper::publishData (const Name &name, const Bytes &content, int freshness)
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800214{
Zhenkai Zhu974c5a62012-12-28 14:15:30 -0800215 publishData(name, head(content), content.size(), freshness);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800216}
217
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800218
219static ccn_upcall_res
220incomingInterest(ccn_closure *selfp,
221 ccn_upcall_kind kind,
222 ccn_upcall_info *info)
223{
224 CcnxWrapper::InterestCallback *f = static_cast<CcnxWrapper::InterestCallback*> (selfp->data);
225
226 switch (kind)
227 {
228 case CCN_UPCALL_FINAL: // effective in unit tests
229 delete f;
230 delete selfp;
231 return CCN_UPCALL_RESULT_OK;
232
233 case CCN_UPCALL_INTEREST:
234 break;
235
236 default:
237 return CCN_UPCALL_RESULT_OK;
238 }
239
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800240 Name interest(info->interest_ccnb, info->interest_comps);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800241
242 (*f) (interest);
243 return CCN_UPCALL_RESULT_OK;
244}
245
246static ccn_upcall_res
247incomingData(ccn_closure *selfp,
248 ccn_upcall_kind kind,
249 ccn_upcall_info *info)
250{
Zhenkai Zhu974c5a62012-12-28 14:15:30 -0800251 Closure *cp = static_cast<Closure *> (selfp->data);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800252
253 switch (kind)
254 {
255 case CCN_UPCALL_FINAL: // effecitve in unit tests
Zhenkai Zhu19f81de2013-01-04 22:27:47 -0800256 delete cp;
257 cp = NULL;
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800258 delete selfp;
259 return CCN_UPCALL_RESULT_OK;
260
261 case CCN_UPCALL_CONTENT:
262 break;
263
264 case CCN_UPCALL_INTEREST_TIMED_OUT: {
265 if (cp != NULL && cp->getRetry() > 0) {
266 cp->decRetry();
267 return CCN_UPCALL_RESULT_REEXPRESS;
268 }
269
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800270 Name interest(info->interest_ccnb, info->interest_comps);
Zhenkai Zhu974c5a62012-12-28 14:15:30 -0800271 Closure::TimeoutCallbackReturnValue rv = cp->runTimeoutCallback(interest);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800272 switch(rv)
273 {
Zhenkai Zhu974c5a62012-12-28 14:15:30 -0800274 case Closure::RESULT_OK : return CCN_UPCALL_RESULT_OK;
275 case Closure::RESULT_REEXPRESS : return CCN_UPCALL_RESULT_REEXPRESS;
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800276 default : break;
277 }
278 return CCN_UPCALL_RESULT_OK;
279 }
280
281 default:
282 return CCN_UPCALL_RESULT_OK;
283 }
284
Zhenkai Zhu43eb2732012-12-28 00:48:26 -0800285 const unsigned char *pcontent;
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800286 size_t len;
Zhenkai Zhu43eb2732012-12-28 00:48:26 -0800287 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 -0800288 {
289 // BOOST_THROW_EXCEPTION(CcnxOperationException() << errmsg_info_str("decode ContentObject failed"));
290 }
291
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800292 Name name(info->content_ccnb, info->content_comps);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800293
Zhenkai Zhu43eb2732012-12-28 00:48:26 -0800294 Bytes content;
295 // copy content and do processing on the copy
296 // otherwise the pointed memory may have been changed during the processing
297 readRaw(content, pcontent, len);
298
299 cp->runDataCallback(name, content);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800300
301 return CCN_UPCALL_RESULT_OK;
302}
303
Zhenkai Zhu19f81de2013-01-04 22:27:47 -0800304int CcnxWrapper::sendInterest (const Name &interest, const Closure *closure, const Selectors &selectors)
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800305{
Zhenkai Zhu7f4258e2012-12-29 19:55:13 -0800306 UniqueRecLock(m_mutex);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800307 if (!m_running || !m_connected)
308 return -1;
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800309
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800310 CcnxCharbufPtr namePtr = interest.toCcnxCharbuf();
311 ccn_charbuf *pname = namePtr->getBuf();
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800312 ccn_closure *dataClosure = new ccn_closure;
313
Zhenkai Zhu19f81de2013-01-04 22:27:47 -0800314 Closure *myClosure = closure->dup();
315 dataClosure->data = (void *)myClosure;
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800316
317 dataClosure->p = &incomingData;
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800318
319 CcnxCharbufPtr selectorsPtr = selectors.toCcnxCharbuf();
320 ccn_charbuf *templ = NULL;
321 if (selectorsPtr != CcnxCharbuf::Null)
322 {
323 templ = selectorsPtr->getBuf();
324 }
325
326 if (ccn_express_interest (m_handle, pname, dataClosure, templ) < 0)
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800327 {
328 }
329
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800330 return 0;
331}
332
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800333int CcnxWrapper::setInterestFilter (const Name &prefix, const InterestCallback &interestCallback)
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800334{
Zhenkai Zhu7f4258e2012-12-29 19:55:13 -0800335 UniqueRecLock(m_mutex);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800336 if (!m_running || !m_connected)
337 return -1;
338
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800339 CcnxCharbufPtr ptr = prefix.toCcnxCharbuf();
340 ccn_charbuf *pname = ptr->getBuf();
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800341 ccn_closure *interestClosure = new ccn_closure;
342
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800343 interestClosure->data = new InterestCallback (interestCallback); // should be removed when closure is removed
344 interestClosure->p = &incomingInterest;
345 int ret = ccn_set_interest_filter (m_handle, pname, interestClosure);
346 if (ret < 0)
347 {
348 }
349
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800350 m_registeredInterests.insert(pair<Name, InterestCallback>(prefix, interestCallback));
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800351}
352
353void
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800354CcnxWrapper::clearInterestFilter (const Name &prefix)
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800355{
Zhenkai Zhu7f4258e2012-12-29 19:55:13 -0800356 UniqueRecLock(m_mutex);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800357 if (!m_running || !m_connected)
358 return;
359
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800360 CcnxCharbufPtr ptr = prefix.toCcnxCharbuf();
361 ccn_charbuf *pname = ptr->getBuf();
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800362
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800363 int ret = ccn_set_interest_filter (m_handle, pname, 0);
364 if (ret < 0)
365 {
366 }
367
368 m_registeredInterests.erase(prefix);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800369}
370
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800371Name
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800372CcnxWrapper::getLocalPrefix ()
373{
374 struct ccn * tmp_handle = ccn_create ();
375 int res = ccn_connect (tmp_handle, NULL);
376 if (res < 0)
377 {
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800378 return Name();
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800379 }
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800380
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800381 string retval = "";
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800382
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800383 struct ccn_charbuf *templ = ccn_charbuf_create();
384 ccn_charbuf_append_tt(templ, CCN_DTAG_Interest, CCN_DTAG);
385 ccn_charbuf_append_tt(templ, CCN_DTAG_Name, CCN_DTAG);
386 ccn_charbuf_append_closer(templ); /* </Name> */
387 // XXX - use pubid if possible
388 ccn_charbuf_append_tt(templ, CCN_DTAG_MaxSuffixComponents, CCN_DTAG);
389 ccnb_append_number(templ, 1);
390 ccn_charbuf_append_closer(templ); /* </MaxSuffixComponents> */
391 ccnb_tagged_putf(templ, CCN_DTAG_Scope, "%d", 2);
392 ccn_charbuf_append_closer(templ); /* </Interest> */
393
394 struct ccn_charbuf *name = ccn_charbuf_create ();
395 res = ccn_name_from_uri (name, "/local/ndn/prefix");
396 if (res < 0) {
397 }
398 else
399 {
400 struct ccn_fetch *fetch = ccn_fetch_new (tmp_handle);
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800401
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800402 struct ccn_fetch_stream *stream = ccn_fetch_open (fetch, name, "/local/ndn/prefix",
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800403 NULL, 4, CCN_V_HIGHEST, 0);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800404 if (stream == NULL) {
405 }
406 else
407 {
408 ostringstream os;
409
410 int counter = 0;
411 char buf[256];
412 while (true) {
413 res = ccn_fetch_read (stream, buf, sizeof(buf));
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800414
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800415 if (res == 0) {
416 break;
417 }
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800418
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800419 if (res > 0) {
420 os << string(buf, res);
421 } else if (res == CCN_FETCH_READ_NONE) {
422 if (counter < 2)
423 {
424 ccn_run(tmp_handle, 1000);
425 counter ++;
426 }
427 else
428 {
429 break;
430 }
431 } else if (res == CCN_FETCH_READ_END) {
432 break;
433 } else if (res == CCN_FETCH_READ_TIMEOUT) {
434 break;
435 } else {
436 break;
437 }
438 }
439 retval = os.str ();
440 stream = ccn_fetch_close(stream);
441 }
442 fetch = ccn_fetch_destroy(fetch);
443 }
444
445 ccn_charbuf_destroy (&name);
446
447 ccn_disconnect (tmp_handle);
448 ccn_destroy (&tmp_handle);
Zhenkai Zhu0d8f5d52012-12-30 12:54:07 -0800449
Zhenkai Zhucb2d0dd2013-01-03 14:10:48 -0800450 return Name(retval);
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800451}
452
Zhenkai Zhu1ddeb6f2012-12-27 14:04:18 -0800453}