face: use MAX_NDN_PACKET_SIZE constant from ndn-cxx
refs #2099
Change-Id: I46331436e0605f77f6b6ac7b49d50fe1570817b8
diff --git a/daemon/face/datagram-face.hpp b/daemon/face/datagram-face.hpp
index d065487..5b1b3d9 100644
--- a/daemon/face/datagram-face.hpp
+++ b/daemon/face/datagram-face.hpp
@@ -98,7 +98,7 @@
protected:
shared_ptr<typename protocol::socket> m_socket;
- uint8_t m_inputBuffer[MAX_NDN_PACKET_SIZE];
+ uint8_t m_inputBuffer[ndn::MAX_NDN_PACKET_SIZE];
bool m_hasBeenUsedRecently;
NFD_LOG_INCLASS_DECLARE();
@@ -115,7 +115,7 @@
{
setOnDemand(isOnDemand);
- m_socket->async_receive(boost::asio::buffer(m_inputBuffer, MAX_NDN_PACKET_SIZE), 0,
+ m_socket->async_receive(boost::asio::buffer(m_inputBuffer, ndn::MAX_NDN_PACKET_SIZE), 0,
bind(&DatagramFace<T, U>::handleReceive, this, _1, _2));
}
@@ -211,7 +211,7 @@
NFD_LOG_DEBUG("handleReceive: " << nBytesReceived);
receiveDatagram(m_inputBuffer, nBytesReceived, error);
if (m_socket->is_open())
- m_socket->async_receive(boost::asio::buffer(m_inputBuffer, MAX_NDN_PACKET_SIZE), 0,
+ m_socket->async_receive(boost::asio::buffer(m_inputBuffer, ndn::MAX_NDN_PACKET_SIZE), 0,
bind(&DatagramFace<T, U>::handleReceive, this, _1, _2));
}
diff --git a/daemon/face/face.hpp b/daemon/face/face.hpp
index 240e270..a79c405 100644
--- a/daemon/face/face.hpp
+++ b/daemon/face/face.hpp
@@ -53,10 +53,6 @@
const FaceId FACEID_RESERVED_MAX = 255;
-/// pratical limit of packet size in octets
-const size_t MAX_NDN_PACKET_SIZE = 8800;
-
-
/** \brief represents a face
*/
class Face : noncopyable, public enable_shared_from_this<Face>
diff --git a/daemon/face/stream-face.hpp b/daemon/face/stream-face.hpp
index 3715719..e719da3 100644
--- a/daemon/face/stream-face.hpp
+++ b/daemon/face/stream-face.hpp
@@ -86,7 +86,7 @@
shared_ptr<typename protocol::socket> m_socket;
private:
- uint8_t m_inputBuffer[MAX_NDN_PACKET_SIZE];
+ uint8_t m_inputBuffer[ndn::MAX_NDN_PACKET_SIZE];
size_t m_inputBufferSize;
std::queue<Block> m_sendQueue;
@@ -128,7 +128,7 @@
{
FaceBase::setOnDemand(isOnDemand);
StreamFaceValidator<T, FaceBase>::validateSocket(*socket);
- m_socket->async_receive(boost::asio::buffer(m_inputBuffer, MAX_NDN_PACKET_SIZE), 0,
+ m_socket->async_receive(boost::asio::buffer(m_inputBuffer, ndn::MAX_NDN_PACKET_SIZE), 0,
bind(&StreamFace<T, FaceBase>::handleReceive, this, _1, _2));
}
@@ -312,7 +312,7 @@
// ignore unknown packet and proceed
}
}
- if (!isOk && m_inputBufferSize == MAX_NDN_PACKET_SIZE && offset == 0)
+ if (!isOk && m_inputBufferSize == ndn::MAX_NDN_PACKET_SIZE && offset == 0)
{
NFD_LOG_WARN("[id:" << this->getId()
<< ",uri:" << this->getRemoteUri()
@@ -339,7 +339,7 @@
}
m_socket->async_receive(boost::asio::buffer(m_inputBuffer + m_inputBufferSize,
- MAX_NDN_PACKET_SIZE - m_inputBufferSize), 0,
+ ndn::MAX_NDN_PACKET_SIZE - m_inputBufferSize), 0,
bind(&StreamFace<T, U>::handleReceive, this, _1, _2));
}
diff --git a/daemon/face/udp-channel.cpp b/daemon/face/udp-channel.cpp
index 151f235..d1c82b1 100644
--- a/daemon/face/udp-channel.cpp
+++ b/daemon/face/udp-channel.cpp
@@ -76,7 +76,7 @@
onFaceCreatedNewPeerCallback = onFaceCreated;
onConnectFailedNewPeerCallback = onListenFailed;
- m_socket->async_receive_from(boost::asio::buffer(m_inputBuffer, MAX_NDN_PACKET_SIZE),
+ m_socket->async_receive_from(boost::asio::buffer(m_inputBuffer, ndn::MAX_NDN_PACKET_SIZE),
m_newRemoteEndpoint,
bind(&UdpChannel::newPeer, this,
boost::asio::placeholders::error,
@@ -240,7 +240,7 @@
// dispatch the datagram to the face for processing
face->receiveDatagram(m_inputBuffer, nBytesReceived, error);
- m_socket->async_receive_from(boost::asio::buffer(m_inputBuffer, MAX_NDN_PACKET_SIZE),
+ m_socket->async_receive_from(boost::asio::buffer(m_inputBuffer, ndn::MAX_NDN_PACKET_SIZE),
m_newRemoteEndpoint,
bind(&UdpChannel::newPeer, this,
boost::asio::placeholders::error,
diff --git a/daemon/face/udp-channel.hpp b/daemon/face/udp-channel.hpp
index da2b14b..bcefd8b 100644
--- a/daemon/face/udp-channel.hpp
+++ b/daemon/face/udp-channel.hpp
@@ -157,7 +157,7 @@
**/
shared_ptr<boost::asio::ip::udp::socket> m_socket;
- uint8_t m_inputBuffer[MAX_NDN_PACKET_SIZE];
+ uint8_t m_inputBuffer[ndn::MAX_NDN_PACKET_SIZE];
typedef std::map< udp::Endpoint, shared_ptr<UdpFace> > ChannelFaceMap;
ChannelFaceMap m_channelFaces;
diff --git a/daemon/face/websocket-face.cpp b/daemon/face/websocket-face.cpp
index 5c999a1..abd8b3c 100644
--- a/daemon/face/websocket-face.cpp
+++ b/daemon/face/websocket-face.cpp
@@ -21,7 +21,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
#include "websocket-face.hpp"
#include "core/global-io.hpp"
@@ -99,7 +99,7 @@
WebSocketFace::handleReceive(const std::string& msg)
{
// Copy message into Face internal buffer
- if (msg.size() > MAX_NDN_PACKET_SIZE)
+ if (msg.size() > ndn::MAX_NDN_PACKET_SIZE)
{
NFD_LOG_WARN("[id:" << this->getId()
<< "] Received WebSocket message size ["