blob: 7aab4a78746dce087ade93849196ca29cd20abdc [file] [log] [blame]
Giulio Grassi624f6c62014-02-18 19:42:14 +01001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Alexander Afanasyevcd591e12014-06-18 16:35:16 -07003 * Copyright (c) 2014, Regents of the University of California,
4 * Arizona Board of Regents,
5 * Colorado State University,
6 * University Pierre & Marie Curie, Sorbonne University,
7 * Washington University in St. Louis,
8 * Beijing Institute of Technology,
9 * The University of Memphis
Alexander Afanasyev9bcbc7c2014-04-06 19:37:37 -070010 *
11 * This file is part of NFD (Named Data Networking Forwarding Daemon).
12 * See AUTHORS.md for complete list of NFD authors and contributors.
13 *
14 * NFD is free software: you can redistribute it and/or modify it under the terms
15 * of the GNU General Public License as published by the Free Software Foundation,
16 * either version 3 of the License, or (at your option) any later version.
17 *
18 * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
19 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20 * PURPOSE. See the GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License along with
23 * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
Alexander Afanasyevcd591e12014-06-18 16:35:16 -070024 */
Giulio Grassi624f6c62014-02-18 19:42:14 +010025
Alexander Afanasyev613e2a92014-04-15 13:36:58 -070026#ifndef NFD_DAEMON_FACE_MULTICAST_UDP_FACE_HPP
27#define NFD_DAEMON_FACE_MULTICAST_UDP_FACE_HPP
Giulio Grassi624f6c62014-02-18 19:42:14 +010028
Alexander Afanasyeva39b90b2014-03-05 15:31:00 +000029#include "datagram-face.hpp"
Giulio Grassi624f6c62014-02-18 19:42:14 +010030
Davide Pesaventod8d4d982014-03-21 18:47:58 +010031namespace nfd {
Giulio Grassi624f6c62014-02-18 19:42:14 +010032
33/**
Davide Pesaventod8d4d982014-03-21 18:47:58 +010034 * \brief Implementation of Face abstraction that uses
Giulio Grassi624f6c62014-02-18 19:42:14 +010035 * multicast UDP as underlying transport mechanism
36 */
Alexander Afanasyevcd591e12014-06-18 16:35:16 -070037class MulticastUdpFace : public DatagramFace<boost::asio::ip::udp, Multicast>
Giulio Grassi624f6c62014-02-18 19:42:14 +010038{
39public:
Giulio Grassi624f6c62014-02-18 19:42:14 +010040 /**
Davide Pesaventod8d4d982014-03-21 18:47:58 +010041 * \brief Creates a UDP-based face for multicast communication
Giulio Grassi624f6c62014-02-18 19:42:14 +010042 */
Davide Pesavento292e5e12015-03-13 02:08:33 +010043 MulticastUdpFace(const protocol::endpoint& multicastGroup, const FaceUri& localUri,
44 protocol::socket recvSocket, protocol::socket sendSocket);
Giulio Grassi624f6c62014-02-18 19:42:14 +010045
Davide Pesaventod8d4d982014-03-21 18:47:58 +010046 const protocol::endpoint&
Giulio Grassi624f6c62014-02-18 19:42:14 +010047 getMulticastGroup() const;
48
49 // from Face
Davide Pesavento66ff0982015-01-29 22:39:00 +010050 void
51 sendInterest(const Interest& interest) DECL_OVERRIDE;
Giulio Grassi624f6c62014-02-18 19:42:14 +010052
Davide Pesavento66ff0982015-01-29 22:39:00 +010053 void
54 sendData(const Data& data) DECL_OVERRIDE;
Davide Pesaventod8d4d982014-03-21 18:47:58 +010055
Giulio Grassi624f6c62014-02-18 19:42:14 +010056private:
Alexander Afanasyevcd591e12014-06-18 16:35:16 -070057 void
58 sendBlock(const Block& block);
59
60private:
Davide Pesaventod8d4d982014-03-21 18:47:58 +010061 protocol::endpoint m_multicastGroup;
Davide Pesavento292e5e12015-03-13 02:08:33 +010062 protocol::socket m_sendSocket;
Giulio Grassi624f6c62014-02-18 19:42:14 +010063};
64
65} // namespace nfd
66
Alexander Afanasyev613e2a92014-04-15 13:36:58 -070067#endif // NFD_DAEMON_FACE_MULTICAST_UDP_FACE_HPP