network.endpoints.ip - Palamecia/mint GitHub Wiki

Module

load network.endpoints.ip

This module provides the Network.IpEndPoint class which provides an abstract interface to implement end point classes that manage communication with a peer using one specific protocol from layer 4 of the OSI model over the IP protocol.

Packages

Enums

Network.IpSocketOption

This enum describes the options of an IP endpoint's socket. The effetive value of the option code can depend on the current system.

Constant Value Description
MCAST_BLOCK_SOURCE 2 Block multicast source.
MCAST_JOIN_GROUP 0 Join multicast group.
MCAST_JOIN_SOURCE_GROUP 4 Join source-specific multicast.
MCAST_LEAVE_GROUP 1 Leave multicast group.
MCAST_LEAVE_SOURCE_GROUP 5 Leave source-specific multicast.
MCAST_UNBLOCK_SOURCE 3 Unblock multicast source.

Network.IpV4SocketOption

This enum describes the options of an IP v4 endpoint's socket. The effetive value of the option code can depend on the current system.

Constant Value Description
ADD_MEMBERSHIP 9 Join or leave multicast group (Network.IpV4MulticastGroup, write only).
ADD_SOURCE_MEMBERSHIP 13 Join or leave source-specific multicast (Network.IpV4MulticastSourceGroup, wr...
BLOCK_SOURCE 11 Block or unblock multicast source (Network.IpV4MulticastSourceGroup, write on...
DROP_MEMBERSHIP 10 Join or leave multicast group (Network.IpV4MulticastGroup, write only).
DROP_SOURCE_MEMBERSHIP 14 Join or leave source-specific multicast (Network.IpV4MulticastSourceGroup, wr...
HDRINCL 0 IP header included with data (boolean).
MULTICAST_IF 6 Specify outgoing interface (string).
MULTICAST_LOOP 8 Specify loopback (boolean).
MULTICAST_TTL 7 Specify outgoing TTL (number).
OPTIONS 1 IP header options (number).
RECVDSTADDR 2 Return destination IP address (boolean).
RECVIF 3 Return received interface index (boolean).
TOS 4 Type-of-service and precedence (number).
TTL 5 TTL (number).
UNBLOCK_SOURCE 12 Block or unblock multicast source (Network.IpV4MulticastSourceGroup, write on...

Network.IpV6SocketOption

This enum describes the options of an IP v6 endpoint's socket. The effetive value of the option code can depend on the current system.

Constant Value Description
CHECKSUM 0 Offset of checksum field for raw sockets (number).
DONTFRAG 1 Drop instead of fragment large packets (boolean).
JOIN_GROUP 18 Join multicast group (Network.IpV6MulticastGroup, write only).
LEAVE_GROUP 19 Leave multicast group (Network.IpV6MulticastGroup, write only).
MULTICAST_HOPS 16 Specify outgoing hop limit (number).
MULTICAST_IF 15 Specify outgoing interface (number).
MULTICAST_LOOP 17 Specify loopback (boolean).
NEXTHOP 2 Specify next-hop address.
PATHMTU 3 Retrieve current path MTU.
RECVDSTOPTS 4 Receive destination options (boolean).
RECVHOPLIMIT 5 Receive unicast hop limit (boolean).
RECVHOPOPTS 6 Receive hop-by-hop options (boolean).
RECVPATHMTU 7 Receive path MTU (boolean).
RECVPKTINFO 8 Receive packet information (boolean).
RECVRTHDR 9 Receive source route (boolean).
RECVTCLASS 10 Receive traffic class (boolean).
UNICAT_HOPS 11 Default unicast hop limit (number).
USE_MIN_MTU 12 Use minimum MTU (boolean).
V6ONLY 13 Disable v4 compatibility (boolean).
XXX 14 Sticky ancillary data (number).

Classes

Network.IpEndPoint

This class provides an abstract interface to implement end point classes that manage communication with a peer using one specific protocol from layer 4 of the OSI model over the IP protocol. It also implement the internal mechanisms of the interface.

Inherits

Members

Modifiers Member Description
- final address Internal IP address.
+ @ const addressVersion Returns version of the IP protocol corresponding to the address format as a n...
+ override const close Closes the communication with the peer if the end point was in the Network.En...
+ override const finalizeClose Finalize the close to the peer. Return true if the close succed; otherwise ...
+ override const finalizeConnection Finalize the connection to the peer. Return true if the connection succed; ...
- @ g_lib Global library handle.
+ const getAddress Returns the end point's IP address as a string.
+ const getIpVersion Returns the internet protocol (IP) version used by the end point as a number ...
+ override const getSocket Returns the end point's socket as a number or none if the end point has no ...
+ override const getSocketOption Returns the value of the endpoint's socket option described by option. The ...
- final ipVersion Internal IP version.
+ override const isNonBlocking Returns true if the end point performs I/O operations without blocking (i.e...
+ @ const isV4Address Returns true if the IP address described by the address parameter follow ...
+ @ const isV6Address Returns true if the IP address described by the address parameter follow ...
+ const new Creates a new end point for the IP address descibed by address. The protoco...
- final nonBlocking Internal non blocking state.
+ override const setNonBlocking Sets the non blocking mode of the end point to enabled. Returns true if t...
# const setSocket Sets the end point's socket to socket. If the end point already had a socke...
+ override const setSocketOption Sets the value of the endpoint's socket option described by option to val...
- final socket Internal socket.

Network.IpV4MulticastGroup

This class provides multicast group information for IPv4 addresses.

Members

Modifiers Member Description
- final d_ptr Object data.
- @ g_lib Global library handle.
+ const getInterfaceAddress Returns the local IPv4 address of the interface on which the multicast group ...
+ const getMulticastAddress Returns the address of the IPv4 multicast group.
+ const new Creates a new multicast group object for the given data. The data parameter...
+ const setInterfaceAddress Sets the local IPv4 address of the interface on which the multicast group sho...
+ const setMulticastAddress Sets the address of the IPv4 multicast group. Returns true on success; othe...
~ const to_ip_mreq Returns the pointer to the internal struct ip_mreq instance.

Network.IpV4MulticastSourceGroup

This class provides multicast group information for IPv4 addresses.

Members

Modifiers Member Description
- final d_ptr Object data.
- @ g_lib Global library handle.
+ const getInterfaceAddress Returns the local IPv4 address of the interface on which the multicast group ...
+ const getMulticastAddress Returns the address of the IPv4 multicast group.
+ const getSourceAddress Returns the address of the IPv4 multicast source.
+ const new Creates a new multicast group object for the given data. The data parameter...
+ const setInterfaceAddress Sets the local IPv4 address of the interface on which the multicast group sho...
+ const setMulticastAddress Sets the address of the IPv4 multicast group. Returns true on success; othe...
+ const setSourceAddress Sets the address of the IPv4 multicast source. Returns true on success; oth...
~ const to_ip_mreq_source Returns the pointer to the internal struct ip_mreq_source instance.

Network.IpV6MulticastGroup

This class provides multicast group information for IPv6 addresses.

Members

Modifiers Member Description
- final d_ptr Object data.
- @ g_lib Global library handle.
+ const getInterfaceIndex Returns the interface index of the local interface on which the multicast gro...
+ const getMulticastAddress Returns the address of the IPv6 multicast group.
+ const new Creates a new multicast group object for the given data. The data parameter...
+ const setInterfaceIndex Sets interface index of the local interface on which the multicast group shou...
+ const setMulticastAddress Sets the address of the IPv6 multicast group. Returns true on success; othe...
~ const to_ipv6_mreq Returns the pointer to the internal struct ipv6_mreq instance.

Descriptions

Network.IpEndPoint.address

''

Internal IP address.

Network.IpEndPoint.addressVersion

def (address)

Returns version of the IP protocol corresponding to the address format as a number. If the address format does not match an IP address format, none is returned.

Network.IpEndPoint.close

def (self)

Closes the communication with the peer if the end point was in the Network.EndPoint.State.Connected state or stops listening if the end point was in the Network.EndPoint.State.Listening state.

An instance of Exception.SocketError is raised on error.

Network.IpEndPoint.finalizeClose

def (self)

Finalize the close to the peer. Return true if the close succed; otherwise returns false.

An instance of Exception.SocketError is raised on error.

Network.IpEndPoint.finalizeConnection

def (self)

Finalize the connection to the peer. Return true if the connection succed; otherwise returns false. On success, the end point enter the Network.EndPoint.State.Connected state.

An instance of Exception.SocketError is raised on error.

Network.IpEndPoint.g_lib

lib ('libmint-network')

Global library handle.

Network.IpEndPoint.getAddress

def (const self)

Returns the end point's IP address as a string.

Network.IpEndPoint.getIpVersion

def (const self)

Returns the internet protocol (IP) version used by the end point as a number (4 for IP v4 and 6 for IP v6) or none if the version is unknown.

Network.IpEndPoint.getSocket

def (const self)

Returns the end point's socket as a number or none if the end point has no socket.

Network.IpEndPoint.getSocketOption

def (self, % option)

Returns the value of the endpoint's socket option described by option. The option parameter must be a value of the Network.IpV4SocketOption, Network.IpV6SocketOption, Network.IpSocketOption or Network.SocketOption enum. If the option is not supported by the system, none is returned;

An instance of Exception.SocketError is raised on error.

Network.IpEndPoint.ipVersion

none

Internal IP version.

Network.IpEndPoint.isNonBlocking

def (const self)

Returns true if the end point performs I/O operations without blocking (i.e. Network.EndPoint.read or Network.EndPoint.write returns immediately without waiting for I/O completion); otherwise returns false.

Network.IpEndPoint.isV4Address

def (address)

Returns true if the IP address described by the address parameter follow the IP v4 format; otherwise returns false.

Network.IpEndPoint.isV6Address

def (address)

Returns true if the IP address described by the address parameter follow the IP v6 format; otherwise returns false.

Network.IpEndPoint.new

def (self, address)

Creates a new end point for the IP address descibed by address. The protocol version is automaticaly detected using the address format.

Network.IpEndPoint.nonBlocking

none

Internal non blocking state.

Network.IpEndPoint.setNonBlocking

def (self, enabled)

Sets the non blocking mode of the end point to enabled. Returns true if the mode was successfully changed; otherwise returns false.

An instance of Exception.SocketError is raised on error.

Network.IpEndPoint.setSocket

def (self, socket)

Sets the end point's socket to socket. If the end point already had a socket, the previous socket is closed and replaced.

Network.IpEndPoint.setSocketOption

def (self, % option, value)

Sets the value of the endpoint's socket option described by option to value. The option parameter must be a value of the Network.IpV4SocketOption, Network.IpV6SocketOption, Network.IpSocketOption or Network.SocketOption enum. Returns true if the option is supported by the system; otherwise returns false.

An instance of Exception.SocketError is raised on error.

Network.IpEndPoint.socket

none

Internal socket.

Network.IpSocketOption.MCAST_BLOCK_SOURCE

2

Block multicast source.

Network.IpSocketOption.MCAST_JOIN_GROUP

0

Join multicast group.

Network.IpSocketOption.MCAST_JOIN_SOURCE_GROUP

4

Join source-specific multicast.

Network.IpSocketOption.MCAST_LEAVE_GROUP

1

Leave multicast group.

Network.IpSocketOption.MCAST_LEAVE_SOURCE_GROUP

5

Leave source-specific multicast.

Network.IpSocketOption.MCAST_UNBLOCK_SOURCE

3

Unblock multicast source.

Network.IpV4MulticastGroup.d_ptr

null

Object data.

Network.IpV4MulticastGroup.g_lib

lib ('libmint-network')

Global library handle.

Network.IpV4MulticastGroup.getInterfaceAddress

def (const self)

Returns the local IPv4 address of the interface on which the multicast group should be joined or dropped.

Network.IpV4MulticastGroup.getMulticastAddress

def (const self)

Returns the address of the IPv4 multicast group.

Network.IpV4MulticastGroup.new

def (self, data)

Creates a new multicast group object for the given data. The data parameter can be an instance of Network.IpV4MulticastGroup, in this case the object is returned as the new instance, or an instance of the ip_mreq C struct. The parameter can also provide a toIpV4MulticastGroup method that will be used to create the object.

def (self, const multiaddr, const interface)

Creates a new multicast group object. The multiaddr parameter must be a string used to specifies the address of the IPv4 multicast group. The interface parameter must be a string used to specifies the local IPv4 address of the interface. If this parameter specifies an IPv4 address of 0.0.0.0, the default IPv4 multicast interface is used.

Network.IpV4MulticastGroup.setInterfaceAddress

def (const self, const address)

Sets the local IPv4 address of the interface on which the multicast group should be joined or dropped. This value is in network byte order. If this member specifies an IPv4 address of 0.0.0.0, the default IPv4 multicast interface is used. Returns true on success; otherwise returns false.

Network.IpV4MulticastGroup.setMulticastAddress

def (const self, const address)

Sets the address of the IPv4 multicast group. Returns true on success; otherwise returns false.

Network.IpV4MulticastGroup.to_ip_mreq

def (const self)

Returns the pointer to the internal struct ip_mreq instance.

Network.IpV4MulticastSourceGroup.d_ptr

null

Object data.

Network.IpV4MulticastSourceGroup.g_lib

lib ('libmint-network')

Global library handle.

Network.IpV4MulticastSourceGroup.getInterfaceAddress

def (const self)

Returns the local IPv4 address of the interface on which the multicast group should be joined, dropped, blocked, or unblocked.

Network.IpV4MulticastSourceGroup.getMulticastAddress

def (const self)

Returns the address of the IPv4 multicast group.

Network.IpV4MulticastSourceGroup.getSourceAddress

def (const self)

Returns the address of the IPv4 multicast source.

Network.IpV4MulticastSourceGroup.new

def (self, data)

Creates a new multicast group object for the given data. The data parameter can be an instance of Network.IpV4MulticastSourceGroup, in this case the object is returned as the new instance, or an instance of the ip_mreq_source C struct. The parameter can also provide a toIpV4MulticastSourceGroup method that will be used to create the object.

def (self, const multiaddr, const sourceaddr, const interface)

Creates a new multicast group object. The multiaddr parameter must be a string used to specifies the address of the IPv4 multicast group. The sourceaddr parameter must be a string used to specifies the address of the IPv4 multicast source. The interface parameter must be a string used to specifies the local IPv4 address of the interface. If this parameter specifies an IPv4 address of 0.0.0.0, the default IPv4 multicast interface is used.

Network.IpV4MulticastSourceGroup.setInterfaceAddress

def (const self, const address)

Sets the local IPv4 address of the interface on which the multicast group should be joined, dropped, blocked, or unblocked. This value is in network byte order. If this method specifies an IPv4 address of 0.0.0.0, the default IPv4 multicast interface is used. Returns true on success; otherwise returns false.

Network.IpV4MulticastSourceGroup.setMulticastAddress

def (const self, const address)

Sets the address of the IPv4 multicast group. Returns true on success; otherwise returns false.

Network.IpV4MulticastSourceGroup.setSourceAddress

def (const self, const address)

Sets the address of the IPv4 multicast source. Returns true on success; otherwise returns false.

Network.IpV4MulticastSourceGroup.to_ip_mreq_source

def (const self)

Returns the pointer to the internal struct ip_mreq_source instance.

Network.IpV4SocketOption.ADD_MEMBERSHIP

9

Join or leave multicast group (Network.IpV4MulticastGroup, write only).

Network.IpV4SocketOption.ADD_SOURCE_MEMBERSHIP

13

Join or leave source-specific multicast (Network.IpV4MulticastSourceGroup, write only).

Network.IpV4SocketOption.BLOCK_SOURCE

11

Block or unblock multicast source (Network.IpV4MulticastSourceGroup, write only).

Network.IpV4SocketOption.DROP_MEMBERSHIP

10

Join or leave multicast group (Network.IpV4MulticastGroup, write only).

Network.IpV4SocketOption.DROP_SOURCE_MEMBERSHIP

14

Join or leave source-specific multicast (Network.IpV4MulticastSourceGroup, write only).

Network.IpV4SocketOption.HDRINCL

0

IP header included with data (boolean).

Network.IpV4SocketOption.MULTICAST_IF

6

Specify outgoing interface (string).

Network.IpV4SocketOption.MULTICAST_LOOP

8

Specify loopback (boolean).

Network.IpV4SocketOption.MULTICAST_TTL

7

Specify outgoing TTL (number).

Network.IpV4SocketOption.OPTIONS

1

IP header options (number).

Network.IpV4SocketOption.RECVDSTADDR

2

Return destination IP address (boolean).

Network.IpV4SocketOption.RECVIF

3

Return received interface index (boolean).

Network.IpV4SocketOption.TOS

4

Type-of-service and precedence (number).

Network.IpV4SocketOption.TTL

5

TTL (number).

Network.IpV4SocketOption.UNBLOCK_SOURCE

12

Block or unblock multicast source (Network.IpV4MulticastSourceGroup, write only).

Network.IpV6MulticastGroup.d_ptr

null

Object data.

Network.IpV6MulticastGroup.g_lib

lib ('libmint-network')

Global library handle.

Network.IpV6MulticastGroup.getInterfaceIndex

def (const self)

Returns the interface index of the local interface on which the multicast group should be joined or dropped.

Network.IpV6MulticastGroup.getMulticastAddress

def (const self)

Returns the address of the IPv6 multicast group.

Network.IpV6MulticastGroup.new

def (self, data)

Creates a new multicast group object for the given data. The data parameter can be an instance of Network.IpV6MulticastGroup, in this case the object is returned as the new instance, or an instance of the ipv6_mreq C struct. The parameter can also provide a toIpV6MulticastGroup method that will be used to create the object.

def (self, const multiaddr, const interface)

Creates a new multicast group object. The multiaddr parameter must be a string used to specifies the address of the IPv6 multicast group. The interface parameter must be a number used to specifies the index of the local interfaceon which the multicast group should be joined or dropped. If this parameter specifies an interface index of 0, the default multicast interface is used.

Network.IpV6MulticastGroup.setInterfaceIndex

def (const self, const index)

Sets interface index of the local interface on which the multicast group should be joined or dropped. If this method specifies an interface index of 0, the default multicast interface is used.

Network.IpV6MulticastGroup.setMulticastAddress

def (const self, const address)

Sets the address of the IPv6 multicast group. Returns true on success; otherwise returns false.

Network.IpV6MulticastGroup.to_ipv6_mreq

def (const self)

Returns the pointer to the internal struct ipv6_mreq instance.

Network.IpV6SocketOption.CHECKSUM

0

Offset of checksum field for raw sockets (number).

Network.IpV6SocketOption.DONTFRAG

1

Drop instead of fragment large packets (boolean).

Network.IpV6SocketOption.JOIN_GROUP

18

Join multicast group (Network.IpV6MulticastGroup, write only).

Network.IpV6SocketOption.LEAVE_GROUP

19

Leave multicast group (Network.IpV6MulticastGroup, write only).

Network.IpV6SocketOption.MULTICAST_HOPS

16

Specify outgoing hop limit (number).

Network.IpV6SocketOption.MULTICAST_IF

15

Specify outgoing interface (number).

Network.IpV6SocketOption.MULTICAST_LOOP

17

Specify loopback (boolean).

Network.IpV6SocketOption.NEXTHOP

2

Specify next-hop address.

Network.IpV6SocketOption.PATHMTU

3

Retrieve current path MTU.

Network.IpV6SocketOption.RECVDSTOPTS

4

Receive destination options (boolean).

Network.IpV6SocketOption.RECVHOPLIMIT

5

Receive unicast hop limit (boolean).

Network.IpV6SocketOption.RECVHOPOPTS

6

Receive hop-by-hop options (boolean).

Network.IpV6SocketOption.RECVPATHMTU

7

Receive path MTU (boolean).

Network.IpV6SocketOption.RECVPKTINFO

8

Receive packet information (boolean).

Network.IpV6SocketOption.RECVRTHDR

9

Receive source route (boolean).

Network.IpV6SocketOption.RECVTCLASS

10

Receive traffic class (boolean).

Network.IpV6SocketOption.UNICAT_HOPS

11

Default unicast hop limit (number).

Network.IpV6SocketOption.USE_MIN_MTU

12

Use minimum MTU (boolean).

Network.IpV6SocketOption.V6ONLY

13

Disable v4 compatibility (boolean).

Network.IpV6SocketOption.XXX

14

Sticky ancillary data (number).