face: deduplicate multicast UDP socket setup

In preparation for adding IPv6 support.

Change-Id: I5a3be2007f7fecc44915a5d6794093143ce9c0f9
Refs: #4222
diff --git a/daemon/face/multicast-udp-transport.hpp b/daemon/face/multicast-udp-transport.hpp
index 9b903d0..b0fb4d4 100644
--- a/daemon/face/multicast-udp-transport.hpp
+++ b/daemon/face/multicast-udp-transport.hpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
@@ -28,6 +28,8 @@
 
 #include "datagram-transport.hpp"
 
+#include <ndn-cxx/net/network-interface.hpp>
+
 namespace nfd {
 namespace face {
 
@@ -45,6 +47,16 @@
 class MulticastUdpTransport final : public DatagramTransport<boost::asio::ip::udp, Multicast>
 {
 public:
+  class Error : public std::runtime_error
+  {
+  public:
+    explicit
+    Error(const std::string& what)
+      : std::runtime_error(what)
+    {
+    }
+  };
+
   /**
    * \brief Creates a UDP-based transport for multicast communication
    * \param localEndpoint local endpoint
@@ -59,6 +71,17 @@
                         protocol::socket&& sendSocket,
                         ndn::nfd::LinkType linkType);
 
+  static void
+  openRxSocket(protocol::socket& sock,
+               const protocol::endpoint& multicastGroup,
+               const boost::asio::ip::address& localAddress,
+               const shared_ptr<const ndn::net::NetworkInterface>& netif = nullptr);
+
+  static void
+  openTxSocket(protocol::socket& sock,
+               const protocol::endpoint& localEndpoint,
+               bool enableLoopback = false);
+
 private:
   void
   doSend(Transport::Packet&& packet) final;