blob: 0ac857e82745493899f6772f69f089508dc0ce86 [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 */
Alexander Afanasyevdc017002014-06-18 16:37:54 -070043 MulticastUdpFace(const shared_ptr<protocol::socket>& recvSocket,
44 const shared_ptr<protocol::socket>& sendSocket,
45 const protocol::endpoint& localEndpoint,
46 const protocol::endpoint& multicastEndpoint);
Giulio Grassi624f6c62014-02-18 19:42:14 +010047
Davide Pesaventod8d4d982014-03-21 18:47:58 +010048 const protocol::endpoint&
Giulio Grassi624f6c62014-02-18 19:42:14 +010049 getMulticastGroup() const;
50
51 // from Face
52 virtual void
53 sendInterest(const Interest& interest);
54
55 virtual void
56 sendData(const Data& data);
Davide Pesaventod8d4d982014-03-21 18:47:58 +010057
Giulio Grassi624f6c62014-02-18 19:42:14 +010058 virtual bool
59 isMultiAccess() const;
Davide Pesaventod8d4d982014-03-21 18:47:58 +010060
Giulio Grassi624f6c62014-02-18 19:42:14 +010061private:
Alexander Afanasyevcd591e12014-06-18 16:35:16 -070062 void
63 sendBlock(const Block& block);
64
65private:
Davide Pesaventod8d4d982014-03-21 18:47:58 +010066 protocol::endpoint m_multicastGroup;
Alexander Afanasyevdc017002014-06-18 16:37:54 -070067 shared_ptr<protocol::socket> m_sendSocket;
Giulio Grassi624f6c62014-02-18 19:42:14 +010068};
69
70} // namespace nfd
71
Alexander Afanasyev613e2a92014-04-15 13:36:58 -070072#endif // NFD_DAEMON_FACE_MULTICAST_UDP_FACE_HPP