A multicast_ip_socket is a special dgram_ip_socket that can be used to send packets to and receive packets from multicast groups. More...

#include <mn_basic_multicast_ip_socket.hpp>

+ Inheritance diagram for mn::net::basic_multicast_ip_socket:
+ Collaboration diagram for mn::net::basic_multicast_ip_socket:

Public Types

using self_typ = basic_multicast_ip_socket
 
using base_type = basic_dgram_ip_socket
 
using endpoint_type = typename base_type::endpoint_type
 
using ipaddress_type = typename base_type::ipaddress_type
 
using handle_type = typename base_type::handle_type
 
- Public Types inherited from mn::net::basic_dgram_ip_socket
using self_typ = basic_dgram_ip_socket
 
using base_type = basic_ip4_socket
 
using endpoint_type = typename base_type::endpoint_type
 
using ipaddress_type = typename base_type::ipaddress_type
 
using handle_type = typename base_type::handle_type
 
- Public Types inherited from mn::net::basic_ip4_socket
using handle_type = typename basic_ip_socket::handle_type
 
using endpoint_type = basic_ip4_endpoint
 
using ipaddress_type = basic_ip4_address
 
- Public Types inherited from mn::net::basic_ip_socket
using handle_type = int
 

Public Member Functions

 basic_multicast_ip_socket ()
 Construt an unconnected, unbound multicast socket. More...
 
int join_group (const ipaddress_type &groupAddress, const ipaddress_type &infAddress=MNNET_IPV4_ADDRESS_ANY)
 Joins the specified multicast group. More...
 
int leave_group ()
 Leaves the specified multicast group. More...
 
int leave_group (const ipaddress_type &groupAddress, const ipaddress_type &infAddress=MNNET_IPV4_ADDRESS_ANY)
 Leaves the specified multicast group. More...
 
void set_loopback (bool flag)
 Set the option socket_option_name::loopback. More...
 
void set_time_to_live (int value)
 Set the option socket_option_name::ttl. More...
 
void set_interface (const ipaddress_type &infAddress)
 Set the option IP_MULTICAST_IF. More...
 
bool get_loopback ()
 Get the value from option socket_option_name::multicast_loop. More...
 
int get_time_to_live ()
 Get the option IP_MULTICAST_TTL. More...
 
ipaddress_type get_interface ()
 Get the option IP_MULTICAST_IF. More...
 
virtual void swap (self_typ &rhs) noexcept
 
- Public Member Functions inherited from mn::net::basic_dgram_ip_socket
 basic_dgram_ip_socket ()
 Construt. More...
 
int send_to (char *buffer, int size, endpoint_type &ep, const socket_flags &socketFlags=socket_flags::none)
 send a buffer of data to the given enpoint More...
 
int recive_from (char *buffer, int size, endpoint_type *ep, const socket_flags &socketFlags=socket_flags::none)
 recive a buffer of data More...
 
int recive_from (char *buffer, int offset, int size, const socket_flags &socketFlags, endpoint_type *ep)
 recive a buffer of data More...
 
int send_to (char *buffer, int offset, int size, const socket_flags &socketFlags, endpoint_type &ep)
 send a buffer of data to the given enpoint More...
 
- Public Member Functions inherited from mn::net::basic_ip4_socket
 basic_ip4_socket (handle_type &hndl, endpoint_type *endp=nullptr) noexcept
 Construct the wrapper class from a given lwip socket handle and the endpoint. More...
 
 basic_ip4_socket (const socket_type &type, const protocol_type &protocol=protocol_type::unspec) noexcept
 Construct create a IPv4 Socket AF_INET. More...
 
 basic_ip4_socket (const basic_ip4_socket &other) noexcept
 a copy construtor More...
 
basic_ip4_socketoperator= (const basic_ip4_socket &other) noexcept
 a copy operator More...
 
bool bind (endpoint_type local_ep, bool reuseAddress=false, bool reusePort=false)
 Bind the socket on the given endpoint (ip and port) More...
 
bool bind (const unsigned int &port, bool reusePort=false)
 Bind the socket. More...
 
bool bind (ipaddress_type ip, const unsigned int &port, bool reuseAddress=false, bool reusePort=false)
 Bind the socket on the given ip and port. More...
 
endpoint_typeget_endpoint (bool local)
 Get the local or remote ip endpoint. More...
 
endpoint_typeget_local ()
 Get the local endpoint. More...
 
endpoint_typeget_remote ()
 Get the remote endpoint. More...
 
bool get_peername (endpoint_type &endpoint)
 Get the remote endpoint. More...
 
bool get_peername (ipaddress_type &ipPeerAddress, uint16_t &iPeerPort)
 Get the remote endpoint. More...
 
virtual basic_ip_socketget_copy ()
 Get a copy of this socket. More...
 
virtual void swap (basic_ip4_socket &rhs) noexcept
 
- Public Member Functions inherited from mn::net::basic_ip_socket
 basic_ip_socket (const handle_type &hndl) noexcept
 construtor from a raw handle More...
 
 basic_ip_socket (const address_family &fam, const socket_type &type, const protocol_type &protocol) noexcept
 construtor create the socket More...
 
 basic_ip_socket (const basic_ip_socket &other) noexcept
 copy construtor More...
 
virtual ~basic_ip_socket () noexcept
 deconstrutor, close the socket More...
 
virtual bool open ()
 Open the socket - only used when the socket not initialized. More...
 
virtual void close ()
 
virtual int available ()
 Returns the number of bytes available that can be read without causing the socket to block. More...
 
virtual void reset (const handle_type &hnd=MNTHREAD_NET_INVALID_SOCKET, bool bClosed=false)
 Reset the socket. More...
 
virtual bool initialized ()
 If the socket initialized. More...
 
int get_last_error (bool poolLast=true)
 Get the saved copy of the last lwip error code. More...
 
int get_handle ()
 Get the raw socket handle. More...
 
basic_ip_socketoperator= (const basic_ip_socket &other)
 
virtual void swap (basic_ip_socket &rhs) noexcept
 
void shutdown (const socket_shutdown_type &cmd)
 send shutdown More...
 
bool poll (const unsigned long &timeout, int mode)
 poll the socket More...
 
void set_reuse_address (bool flag)
 Set the option socket_option_name::reuse_addr. More...
 
void set_rause_port (bool flag)
 Set the option socket_option_name::reuse_port. More...
 
void set_linger (bool on, int seconds)
 Set the option socket_option_name::linger. More...
 
void set_no_delay (bool flag)
 Set the option socket_option_name::tcp_nodelay. More...
 
void set_keep_alive (bool flag)
 Set the option socket_option_name::keepalive. More...
 
void set_oob_inline (bool flag)
 Set the option socket_option_name::oob_inline. More...
 
void set_blocking (bool flag)
 Set the socket for bloking. More...
 
void set_nocheak (bool value)
 Set the option socket_option_name::no_check. More...
 
void set_send_buffer_size (int value)
 Set the size of the send buffer. More...
 
void set_recive_buffer_size (int value)
 Set the size of the recive buffer. More...
 
void set_send_timeout (int value)
 Set the option socket_option_name::send_timeout. More...
 
void set_recive_timeout (int value)
 Set the option socket_option_name::recive_timeout. More...
 
bool get_reuse_address ()
 Get the value of the option socket_option_name::reuse_addr. More...
 
bool get_rause_port ()
 Get the value of the option socket_option_name::reuse_port. More...
 
void get_linger (bool &on, int &seconds)
 Get the value of the option socket_option_name::linger. More...
 
bool get_no_delay ()
 Get the value of the option socket_option_name::no_delay. More...
 
bool get_keep_alive ()
 Get the value of the option socket_option_name::keepalive. More...
 
bool get_oob_inline ()
 Get the value of the option socket_option_name::oob_inline. More...
 
bool get_nocheak ()
 Get the value of the option socket_option_name::no_check. More...
 
bool get_blocking ()
 Is the socket blocking enabled. More...
 
int get_send_buffer_size ()
 Get the size of the send buffer. More...
 
int get_recive_buffer_size ()
 Get the size of the recive buffer. More...
 
int get_send_timeout ()
 Set the option socket_option_name::send_timeout. More...
 
int get_recive_timeout ()
 Set the option socket_option_name::recive_timeout. More...
 
int set_options (const socket_option_level &opt, const socket_option_name &name, int value)
 Sets the socket option specified by level and option to the given integer value. More...
 
int set_options (const socket_option_level &opt, const socket_option_name &name, unsigned int value)
 Sets the socket option specified by level and option to the given integer value. More...
 
int set_options (const socket_option_level &opt, const socket_option_name &name, basic_ip4_address value)
 Sets the socket option specified by level and option to the given integer value. More...
 
int set_options (const socket_option_level &opt, const socket_option_name &name, basic_ip6_address value)
 Sets the socket option specified by level and option to the given integer value. More...
 
int set_options (const socket_option_level &opt, const socket_option_name &name, bool value)
 Set a given option, version for boolen values. More...
 
int set_options (const socket_option_level &opt, const socket_option_name &name, void *value, uint32_t size)
 Set a given option, version for data. More...
 
int get_option_int (const socket_option_level &opt, const socket_option_name &name)
 Get a interger value of a given option. More...
 
bool get_option_bool (const socket_option_level &opt, const socket_option_name &name)
 Get a booles value of a given option. More...
 
int get_option_raw (const socket_option_level &opt, const socket_option_name &name, void *value, uint32_t size)
 Get a buffer value of a given option. More...
 
int ioctl (const ioctl_request_type &request, int &arg)
 A wrapper for the ioctl system call. More...
 
int ioctl (const ioctl_request_type &request, void *arg)
 A wrapper for the ioctl system call. More...
 
int set_fcntl (int arg)
 A wrapper for the fcntl system call. More...
 
int get_fcntl ()
 A wrapper for the fcntl system call. More...
 

Protected Member Functions

 basic_multicast_ip_socket (handle_type &hndl, endpoint_type *endp=nullptr)
 
 basic_multicast_ip_socket (const protocol_type &protocol)
 
- Protected Member Functions inherited from mn::net::basic_dgram_ip_socket
 basic_dgram_ip_socket (handle_type &hndl, endpoint_type *endp=nullptr)
 
 basic_dgram_ip_socket (const protocol_type &protocol)
 
- Protected Member Functions inherited from mn::net::basic_ip_socket
virtual bool open (const address_family &fam, const socket_type &type, const protocol_type &protocol)
 Open the socket - only used when the socket not initialized. More...
 

Private Attributes

ipaddress_type m_ipMulticast
 

Additional Inherited Members

- Protected Attributes inherited from mn::net::basic_ip4_socket
endpoint_typem_pEndPoint
 A saved / cached copy of the endpoint on binde the socket. More...
 
- Protected Attributes inherited from mn::net::basic_ip_socket
handle_type m_iHandle
 Reference to the underlying socket handle for this socket. More...
 
address_family m_eFam
 A saved / cached copy of the address family type of this socket. More...
 
socket_type m_eType
 A saved / cached copy of the socket type of this socket. More...
 
protocol_type m_eProtocol
 A saved / cached copy of the protocal type of this socket. More...
 
bool m_bBlocked
 A saved / cached copy of a blocked flag. More...
 

Detailed Description

A multicast_ip_socket is a special dgram_ip_socket that can be used to send packets to and receive packets from multicast groups.

Member Typedef Documentation

◆ base_type

◆ endpoint_type

◆ handle_type

◆ ipaddress_type

◆ self_typ

Constructor & Destructor Documentation

◆ basic_multicast_ip_socket() [1/3]

mn::net::basic_multicast_ip_socket::basic_multicast_ip_socket ( )
inline

Construt an unconnected, unbound multicast socket.

◆ basic_multicast_ip_socket() [2/3]

mn::net::basic_multicast_ip_socket::basic_multicast_ip_socket ( handle_type hndl,
endpoint_type endp = nullptr 
)
inlineprotected

◆ basic_multicast_ip_socket() [3/3]

mn::net::basic_multicast_ip_socket::basic_multicast_ip_socket ( const protocol_type protocol)
inlineprotected

Member Function Documentation

◆ get_interface()

basic_multicast_ip_socket::ipaddress_type mn::net::basic_multicast_ip_socket::get_interface ( )

Get the option IP_MULTICAST_IF.

Returns
The interface address.

◆ get_loopback()

bool mn::net::basic_multicast_ip_socket::get_loopback ( )

Get the value from option socket_option_name::multicast_loop.

Returns
If true then enabled the option multicast_loop and if false when not

◆ get_time_to_live()

int mn::net::basic_multicast_ip_socket::get_time_to_live ( )

Get the option IP_MULTICAST_TTL.

Returns
The value of the option IP_MULTICAST_TTL.

◆ join_group()

int mn::net::basic_multicast_ip_socket::join_group ( const ipaddress_type groupAddress,
const ipaddress_type infAddress = MNNET_IPV4_ADDRESS_ANY 
)

Joins the specified multicast group.

◆ leave_group() [1/2]

int mn::net::basic_multicast_ip_socket::leave_group ( )

Leaves the specified multicast group.

◆ leave_group() [2/2]

int mn::net::basic_multicast_ip_socket::leave_group ( const ipaddress_type groupAddress,
const ipaddress_type infAddress = MNNET_IPV4_ADDRESS_ANY 
)

Leaves the specified multicast group.

◆ set_interface()

void mn::net::basic_multicast_ip_socket::set_interface ( const ipaddress_type infAddress)

Set the option IP_MULTICAST_IF.

Parameters
valueThe value for the option in millis

◆ set_loopback()

void mn::net::basic_multicast_ip_socket::set_loopback ( bool  flag)

Set the option socket_option_name::loopback.

Parameters
flagif true then enable the option and false when not

◆ set_time_to_live()

void mn::net::basic_multicast_ip_socket::set_time_to_live ( int  value)

Set the option socket_option_name::ttl.

Parameters
valueThe value for the option in millis

◆ swap()

virtual void mn::net::basic_multicast_ip_socket::swap ( self_typ rhs)
inlinevirtualnoexcept

Member Data Documentation

◆ m_ipMulticast

ipaddress_type mn::net::basic_multicast_ip_socket::m_ipMulticast
private

The documentation for this class was generated from the following files: