face: delete redundant protocol typedefs.
Change-Id: I32e1100e7395070a29ee813658aac82b63b6c4f2
diff --git a/daemon/face/datagram-face.hpp b/daemon/face/datagram-face.hpp
index 6a7accb..8050164 100644
--- a/daemon/face/datagram-face.hpp
+++ b/daemon/face/datagram-face.hpp
@@ -11,18 +11,18 @@
namespace nfd {
-template <class T>
+template <class Protocol>
class DatagramFace : public Face
{
public:
- typedef T protocol;
+ typedef Protocol protocol;
/** \brief Construct datagram face
*
* \param uri FaceUri for the face
* \param socket Protocol-specific socket for the created face
* \param isOnDemand If true, the face can be closed after it remains
- * unused for a certain amount of time.
+ * unused for a certain amount of time
*/
DatagramFace(const FaceUri& uri,
const shared_ptr<typename protocol::socket>& socket,
diff --git a/daemon/face/multicast-udp-face.cpp b/daemon/face/multicast-udp-face.cpp
index f0e752b..b5632e2 100644
--- a/daemon/face/multicast-udp-face.cpp
+++ b/daemon/face/multicast-udp-face.cpp
@@ -10,16 +10,14 @@
NFD_LOG_INIT("MulticastUdpFace");
-
MulticastUdpFace::MulticastUdpFace(const shared_ptr<MulticastUdpFace::protocol::socket>& socket)
: DatagramFace<protocol>(FaceUri(socket->local_endpoint()), socket, false)
+ , m_multicastGroup(m_socket->local_endpoint())
{
- NFD_LOG_DEBUG("Face creation. Multicast group: "
- << m_socket->local_endpoint());
- m_multicastGroup = m_socket->local_endpoint();
+ NFD_LOG_INFO("Creating multicast UDP face for group " << m_multicastGroup);
}
-const boost::asio::ip::udp::endpoint&
+const MulticastUdpFace::protocol::endpoint&
MulticastUdpFace::getMulticastGroup() const
{
return m_multicastGroup;
@@ -48,13 +46,13 @@
NFD_LOG_DEBUG("Sending data");
m_socket->async_send_to(boost::asio::buffer(data.wireEncode().wire(),
- data.wireEncode().size()),
+ data.wireEncode().size()),
m_multicastGroup,
bind(&DatagramFace<protocol>::handleSend, this, _1, data.wireEncode()));
-
+
// anything else should be done here?
}
-
+
bool
MulticastUdpFace::isMultiAccess() const
{
diff --git a/daemon/face/multicast-udp-face.hpp b/daemon/face/multicast-udp-face.hpp
index 2697a7f..774c567 100644
--- a/daemon/face/multicast-udp-face.hpp
+++ b/daemon/face/multicast-udp-face.hpp
@@ -9,25 +9,22 @@
#include "datagram-face.hpp"
-namespace nfd
-{
+namespace nfd {
/**
- * \brief Implementation of Face abstraction that uses
+ * \brief Implementation of Face abstraction that uses
* multicast UDP as underlying transport mechanism
*/
class MulticastUdpFace : public DatagramFace<boost::asio::ip::udp>
{
public:
- typedef boost::asio::ip::udp protocol;
-
/**
- * \brief Creates a Udp face for multicast communication
+ * \brief Creates a UDP-based face for multicast communication
*/
explicit
MulticastUdpFace(const shared_ptr<protocol::socket>& socket);
- const boost::asio::ip::udp::endpoint&
+ const protocol::endpoint&
getMulticastGroup() const;
// from Face
@@ -36,12 +33,12 @@
virtual void
sendData(const Data& data);
-
+
virtual bool
isMultiAccess() const;
-
+
private:
- boost::asio::ip::udp::endpoint m_multicastGroup;
+ protocol::endpoint m_multicastGroup;
};
} // namespace nfd
diff --git a/daemon/face/tcp-face.cpp b/daemon/face/tcp-face.cpp
index c543011..4655641 100644
--- a/daemon/face/tcp-face.cpp
+++ b/daemon/face/tcp-face.cpp
@@ -14,7 +14,8 @@
NFD_LOG_INCLASS_TEMPLATE_SPECIALIZATION_DEFINE(StreamFace, TcpFace::protocol, "TcpFace");
NFD_LOG_INCLASS_2TEMPLATE_SPECIALIZATION_DEFINE(StreamFace,
- TcpLocalFace::protocol, LocalFace, "TcpLocalFace");
+ TcpLocalFace::protocol, LocalFace,
+ "TcpLocalFace");
TcpFace::TcpFace(const shared_ptr<TcpFace::protocol::socket>& socket, bool isOnDemand)
: StreamFace<protocol>(FaceUri(socket->remote_endpoint()), socket, isOnDemand)
@@ -28,5 +29,4 @@
{
}
-
} // namespace nfd
diff --git a/daemon/face/tcp-face.hpp b/daemon/face/tcp-face.hpp
index 92ab627..b74380e 100644
--- a/daemon/face/tcp-face.hpp
+++ b/daemon/face/tcp-face.hpp
@@ -9,8 +9,7 @@
#include "stream-face.hpp"
-namespace nfd
-{
+namespace nfd {
/**
* \brief Implementation of Face abstraction that uses TCP
@@ -19,8 +18,6 @@
class TcpFace : public StreamFace<boost::asio::ip::tcp>
{
public:
- typedef boost::asio::ip::tcp protocol;
-
explicit
TcpFace(const shared_ptr<protocol::socket>& socket, bool isOnDemand);
};
@@ -35,8 +32,6 @@
class TcpLocalFace : public StreamFace<boost::asio::ip::tcp, LocalFace>
{
public:
- typedef boost::asio::ip::tcp protocol;
-
explicit
TcpLocalFace(const shared_ptr<protocol::socket>& socket, bool isOnDemand);
};
@@ -62,7 +57,6 @@
}
};
-
} // namespace nfd
#endif // NFD_FACE_TCP_FACE_HPP
diff --git a/daemon/face/udp-face.cpp b/daemon/face/udp-face.cpp
index 7de4d34..1cc0bc8 100644
--- a/daemon/face/udp-face.cpp
+++ b/daemon/face/udp-face.cpp
@@ -10,11 +10,8 @@
NFD_LOG_INCLASS_TEMPLATE_SPECIALIZATION_DEFINE(DatagramFace, UdpFace::protocol, "UdpFace");
-UdpFace::UdpFace(const shared_ptr<UdpFace::protocol::socket>& socket,
- bool isOnDemand)
- : DatagramFace<protocol>(FaceUri(socket->remote_endpoint()),
- socket,
- isOnDemand)
+UdpFace::UdpFace(const shared_ptr<UdpFace::protocol::socket>& socket, bool isOnDemand)
+ : DatagramFace<protocol>(FaceUri(socket->remote_endpoint()), socket, isOnDemand)
{
}
@@ -23,10 +20,11 @@
std::size_t nBytesReceived,
const boost::system::error_code& error)
{
- NFD_LOG_DEBUG("handleFirstReceive");
- //checking if the received message size is too big.
- //This check is redundant, since in the actual implementation a packet
- //cannot be bigger than MAX_NDN_PACKET_SIZE
+ NFD_LOG_TRACE("handleFirstReceive");
+
+ // Checking if the received message size is too big.
+ // This check is redundant, since in the actual implementation
+ // a packet cannot be larger than MAX_NDN_PACKET_SIZE.
if (!error && (nBytesReceived > MAX_NDN_PACKET_SIZE))
{
NFD_LOG_WARN("[id:" << this->getId()
@@ -35,8 +33,8 @@
<< MAX_NDN_PACKET_SIZE );
return;
}
+
receiveDatagram(buffer, nBytesReceived, error);
}
-
} // namespace nfd
diff --git a/daemon/face/udp-face.hpp b/daemon/face/udp-face.hpp
index 6c1e3a8..4e882c0 100644
--- a/daemon/face/udp-face.hpp
+++ b/daemon/face/udp-face.hpp
@@ -9,8 +9,7 @@
#include "datagram-face.hpp"
-namespace nfd
-{
+namespace nfd {
/**
* \brief Implementation of Face abstraction that uses UDP
@@ -19,12 +18,9 @@
class UdpFace : public DatagramFace<boost::asio::ip::udp>
{
public:
- typedef boost::asio::ip::udp protocol;
-
UdpFace(const shared_ptr<protocol::socket>& socket,
bool isOnDemand);
- //@todo if needed by other datagramFaces, it could be moved to datagram-face.hpp
/**
* \brief Manages the first datagram received by the UdpChannel socket set on listening
*/
@@ -32,7 +28,6 @@
handleFirstReceive(const uint8_t* buffer,
std::size_t nBytesReceived,
const boost::system::error_code& error);
-
};
} // namespace nfd
diff --git a/daemon/face/unix-stream-face.hpp b/daemon/face/unix-stream-face.hpp
index 8492f54..f90a5be 100644
--- a/daemon/face/unix-stream-face.hpp
+++ b/daemon/face/unix-stream-face.hpp
@@ -13,8 +13,7 @@
#error "Cannot include this file when UNIX sockets are not available"
#endif
-namespace nfd
-{
+namespace nfd {
/**
* \brief Implementation of Face abstraction that uses stream-oriented
@@ -23,8 +22,6 @@
class UnixStreamFace : public StreamFace<boost::asio::local::stream_protocol, LocalFace>
{
public:
- typedef boost::asio::local::stream_protocol protocol;
-
explicit
UnixStreamFace(const shared_ptr<protocol::socket>& socket);
};