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 | |
Giulio Grassi | 69871f0 | 2014-03-09 16:14:44 +0100 | [diff] [blame^] | 24 | UdpFace(const shared_ptr<protocol::socket>& socket, |
| 25 | bool isPermanent); |
Giulio Grassi | 624f6c6 | 2014-02-18 19:42:14 +0100 | [diff] [blame] | 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 |