21 Internet protocol [internet]

21.21 Internet socket options [internet.socket.opt]

21.21.1 Class ip::multicast::outbound_interface [internet.multicast.outbound]

The outbound_interface class represents a socket option that specifies the network interface to use for outgoing multicast datagrams.

namespace std {
namespace experimental {
namespace net {
inline namespace v1 {
namespace ip {
namespace multicast {

  class outbound_interface
  {
  public:
    // constructors:
    explicit outbound_interface(const address_v4& network_interface) noexcept;
    explicit outbound_interface(unsigned int network_interface) noexcept;
  };

} // namespace multicast
} // namespace ip
} // inline namespace v1
} // namespace net
} // namespace experimental
} // namespace std

outbound_interface satisfies the requirements for Destructible (C++ 2014 [destructible]), CopyConstructible (C++ 2014 [copyconstructible]), CopyAssignable (C++ 2014 [copyassignable]), and SettableSocketOption ([socket.reqmts.settablesocketoption]).

Extensible implementations provide the following member functions:

namespace std {
namespace experimental {
namespace net {
inline namespace v1 {
namespace ip {
namespace multicast {

  class outbound_interface
  {
  public:
    template<class Protocol> int level(const Protocol& p) const noexcept;
    template<class Protocol> int name(const Protocol& p) const noexcept;
    template<class Protocol> const void* data(const Protocol& p) const noexcept;
    template<class Protocol> size_t size(const Protocol& p) const noexcept;
    // remainder unchanged
  private:
      in_addr v4_value_; // exposition only
      unsigned int v6_value_; // exposition only
  };

} // namespace multicast
} // namespace ip
} // inline namespace v1
} // namespace net
} // namespace experimental
} // namespace std

explicit outbound_interface(const address_v4& network_interface) noexcept;

Effects: For extensible implementations, v4_value_ is initialized to correspond to the IPv4 address network_interface, and v6_value_ is zero-initialized.

explicit outbound_interface(unsigned int network_interface) noexcept;

Effects: For extensible implementations, v6_value_ is initialized to network_interface, and v4_value_ is zero-initialized.

template<class Protocol> int level(const Protocol& p) const noexcept;

Returns: IPPROTO_IPV6 if p.family() == AF_INET6, otherwise IPPROTO_IP.

template<class Protocol> int name(const Protocol& p) const noexcept;

Returns: IPV6_MULTICAST_IF if p.family() == AF_INET6, otherwise IP_MULTICAST_IF.

template<class Protocol> const void* data(const Protocol& p) const noexcept;

Returns: addressof(v6_value_) if p.family() == AF_INET6, otherwise addressof(v4_value_).

template<class Protocol> size_t size(const Protocol& p) const noexcept;

Returns: sizeof(v6_value_) if p.family() == AF_INET6, otherwise sizeof(v4_value_).