| /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| /** |
| * Copyright (C) 2014 Regents of the University of California. |
| * See COPYING for copyright and distribution information. |
| */ |
| #include "read-handle.hpp" |
| |
| namespace repo { |
| |
| void |
| ReadHandle::onInterest(const Name& prefix, const Interest& interest) |
| { |
| Data data; |
| if (getStorageHandle()->readData(interest, data)) { |
| getFace()->put(data); |
| } |
| } |
| |
| void |
| ReadHandle::onRegisterFailed(const Name& prefix, const std::string& reason) |
| { |
| std::cerr << "ERROR: Failed to register prefix in local hub's daemon" << std::endl; |
| getFace()->shutdown(); |
| } |
| |
| void |
| ReadHandle::listen(const Name& prefix) |
| { |
| getFace()->setInterestFilter(prefix, |
| bind(&ReadHandle::onInterest, this, _1, _2), |
| bind(&ReadHandle::onRegisterFailed, this, _1, _2)); |
| } |
| |
| } //namespace repo |