blob: 743cf564f16a25b58d6e10b368b94e35639b43e5 [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 */
Junxiao Shi79494162014-04-02 18:25:11 -070043 MulticastUdpFace(const shared_ptr<protocol::socket>& socket,
44 const protocol::endpoint& localEndpoint);
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
50 virtual void
51 sendInterest(const Interest& interest);
52
53 virtual void
54 sendData(const Data& data);
Davide Pesaventod8d4d982014-03-21 18:47:58 +010055
Giulio Grassi624f6c62014-02-18 19:42:14 +010056 virtual bool
57 isMultiAccess() const;
Davide Pesaventod8d4d982014-03-21 18:47:58 +010058
Giulio Grassi624f6c62014-02-18 19:42:14 +010059private:
Alexander Afanasyevcd591e12014-06-18 16:35:16 -070060 void
61 sendBlock(const Block& block);
62
63private:
Davide Pesaventod8d4d982014-03-21 18:47:58 +010064 protocol::endpoint m_multicastGroup;
Giulio Grassi624f6c62014-02-18 19:42:14 +010065};
66
67} // namespace nfd
68
Alexander Afanasyev613e2a92014-04-15 13:36:58 -070069#endif // NFD_DAEMON_FACE_MULTICAST_UDP_FACE_HPP