Instead of using binary-based data structures, the REXX socket library
represents all data structures as strings of space-delimited values,
where each value represents a field in the data structure.
The REXX language is a type-independent language. All data is manipulated
and represented using a character format. When an application passes
data into the REXX socket library, the data must be a space-delimited string. When
the REXX socket
library returns socket information, it returns the information as
a space-delimited string on the return value.
Rules: - All IPv4 addresses are represented as strings in dotted decimal
format.
- All IPv6 addresses are represented as strings in IPv6 colon hexadecimal
format.
- When a NAME string is returned as a result, the IP address is
in IPv4 dotted decimal or IPv6 colon hexadecimal format.
Tip: When you specify a NAME string as an
input parameter to a command, you can specify the ipaddress field either as an IP address or as a host name to be resolved by
a name server. For example, you can code NAME=”AF_INET 1049
MYHOST”, where AF_INET is the address family, 1049 is the
port number, and MYHOST is the host name to be resolved to an IP address.
struct sockaddr_in
This structure represents
an IPv4 socket address. In the REXX socket library, this structure is represented
by the NAME string. The NAME string has the following format:
NAME = “domain portid ipaddress”
where:
- domain
- The number 2 or AF_INET
- portid
- The local or remote port to which the socket is to be bound or
connected
- ipaddress
- The IPv4 address of the local or remote host to which the socket
is to be bound or connected
The following string is an example of an
IPv4 NAME string:
NAME = "AF_INET 24 10.11.103.1";
struct sockaddr_in6
This structure represents
an IPv6 socket address. In the REXX socket library, this structure is represented
by the NAME string. The NAME string has the following format:
NAME = “domain portid flowinfo ipaddress scopeid”
where:
- domain
- The number 19 or AF_INET6.
- portid
- The local or remote port to which the socket is to be bound or
connected.
- flowinfo
- This value must be set to 0.
- ipaddress
- The IPv6 address of the local or remote host to which the socket
is to be bound or connected.
- scopeid
- Identifies the interfaces that are applicable for the scope of
the address that is specified in the ipaddress field.
For a link-local IP address, the scopeid field
can specify a link index, which identifies a set of interfaces. For
all other scopes, the scopeid field must be set
to 0. Setting the scopeid field to 0 indicates
that any address type and scope can be specified.
The following string is an example of an
IPv6 NAME string:
NAME = "AF_INET6 24 0 2001:10:11:103::1 0"
struct ip_mreq
This structure represents
the mapping between an IPv4 multicast address and an IPv4 interface.
In the REXX socket library, this structure is represented by the
ipmreq string. The
ipmreq string has the following format:
ipmreq = "maddress iaddress"
where:
- maddress
- An IPv4 multicast address
- iaddress
- The IPv4 interface address
The following string is an example of an
IPv4
ipmreq string:
ipmreq = "224.224.224.1 10.123.21.3"
struct ipv6_mreq
This structure represents
the mapping between an IPv6 multicast address and an interface index.
In the REXX socket library, this structure is represented by the
ipmreq string. The
ipmreq string has the following format:
ipmreq = "maddress index"
where:
- maddress
- An IPv6 multicast address
- index
- An interface index number
The following string is an example of an
IPv6
ipmreq string:
ipmreq = "FF05::101 34"
struct ip_mreq_source
This structure represents
a multicast source filter. It is used with the IOCTL command to filter
the multicast packets that an application wants to receive; it also
defines the remote host from which the packets are sent. In the REXX socket library,
this structure is represented by the
ip_mreq_source string. The
ip_mreq_source string has the following
format:
ipmreqsource = "maddress saddress iaddress"
where:
- maddress
- An IPv4 multicast address
- saddress
- An IPv4 source address of a remote host
- iaddress
- An IPv4 interface address
The following string is an example of an
ip_mreq_source string:
ipmreqsource ="224.224.224.2 10.1.2.3 10.123.21.3"
Restriction: This structure supports IPv4 addresses
only.
struct group_req
This structure represents
a protocol-independent mapping between a multicast IP address and
an interface index. It is used with the IOCTL command to join and
leave multicast groups. In the REXX socket library, this structure is represented
by the
groupreq string. The
groupreq string has the following format:
groupreq = "index NAME"
where:
- index
- An interface index
- NAME
- The NAME string of a multicast socket address
The following strings are examples of
groupreq strings:
groupreq = "15664 AF_INET 5000 224.224.224.2"
groupreq = "15667 AF_INET6 5000 0 FF05::101 0"
struct group_req_source
This structure represents
a protocol-independent mapping between a multicast IP address, an
interface index, and a source address for a remote host. It is used
with the IOCTL command to filter the multicast packets that an application
wants to receive; it also defines the remote host from which the packets
are sent. In the REXX socket library, this structure is represented by the
groupreqsource string. The
groupreqsource string has the following format:
groupreqsource = "index M_NAME S_NAME"
where:
- index
- An interface index
- M_NAME
- The NAME string of a multicast socket address
- S_NAME
- The NAME string of a source socket address
The following strings are examples of
groupreqsource strings:
groupreqsource = "15664 AF_INET 5000 224.224.224.2 AF_INET 5000 10.1.2.3"
groupreqsource = "15667 AF_INET6 5000 0 FF05::101 0 AF_INET6 5000 0
2001:10:1:2::3 0"