Giulio Grassi | 624f6c6 | 2014-02-18 19:42:14 +0100 | [diff] [blame^] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (C) 2014 Named Data Networking Project |
| 4 | * See COPYING for copyright and distribution information. |
| 5 | */ |
| 6 | |
| 7 | #ifndef NFD_FACE_UDP_FACE_HPP |
| 8 | #define NFD_FACE_UDP_FACE_HPP |
| 9 | |
| 10 | #include "datagram-face.hpp" |
| 11 | |
| 12 | namespace nfd |
| 13 | { |
| 14 | |
| 15 | /** |
| 16 | * \brief Implementation of Face abstraction that uses UDP |
| 17 | * as underlying transport mechanism |
| 18 | */ |
| 19 | class UdpFace : public DatagramFace<boost::asio::ip::udp> |
| 20 | { |
| 21 | public: |
| 22 | typedef boost::asio::ip::udp protocol; |
| 23 | |
| 24 | explicit |
| 25 | UdpFace(const shared_ptr<protocol::socket>& socket); |
| 26 | |
| 27 | //@todo if needed by other datagramFaces, it could be moved to datagram-face.hpp |
| 28 | /** |
| 29 | * \brief Manages the first datagram received by the UdpChannel socket set on listening |
| 30 | */ |
| 31 | void |
| 32 | handleFirstReceive(const uint8_t* buffer, |
| 33 | std::size_t nBytesReceived, |
| 34 | const boost::system::error_code& error); |
| 35 | |
| 36 | }; |
| 37 | |
| 38 | } // namespace nfd |
| 39 | |
| 40 | #endif // NFD_FACE_UDP_FACE_HPP |