Created by The Open Group, a consortium of developers and venders, UNIX® 98 improved the inter-operability of the UNIX operating system while incorporating much of the Internet-related function for which UNIX had become known.
i5/OS™ sockets provide programmers the ability to write socket applications that are compatible with UNIX 98 operating environment. Currently, IBM® supports two versions of most sockets APIs. The base i5/OS API uses Berkeley Socket Distribution (BSD) 4.3 structures and syntax. The other uses syntax and structures compatible with BSD 4.4 and the UNIX 98 programming interface specifications. You can select the UNIX 98 compatible interface by defining the _XOPEN_SOURCE macro to a value of 520 or greater.
When you specify the _XOPEN_OPEN macro, you can write UNIX 98 compatible applications with the same address families that are used in default i5/OS implementations; however, there are differences in the sockaddr address structure. The table compares the BSD 4.3 sockaddr address structure with the UNIX 98 compatible address structure:
BSD 4.3 structure | BSD 4.4/ UNIX 98 compatible structure |
---|---|
sockaddr address structure | |
struct sockaddr { u_short sa_family; char sa_data[14]; }; |
struct sockaddr { uint8_t sa_len; sa_family_t sa_family char sa_data[14]; }; |
sockaddr_in address structure | |
struct sockaddr_in { short sin_family; u_short sin_port; struct in_addr sin_addr; char sin_zero[8]; }; |
struct sockaddr_in { uint8_t sin_len; sa_family_t sin_family; u_short sin_port; struct in_addr sin_addr; char sin_zero[8]; }; |
sockaddr_in6 address structure | |
struct sockaddr_in6 { sa_family_t sin6_family; in_port_t sin6_port; uint32_t sin6_flowinfo; struct in6_addr sin6_addr; uint32_t sin6_scope_id; }; |
struct sockaddr_in6 { uint8_t sin6_len; sa_family_t sin6_family; in_port_t sin6_port; uint32_t sin6_flowinfo; struct in6_addr sin6_addr; uint32_t sin6_scope_id; }; |
sockaddr_un address structure | |
struct sockaddr_un { short sun_family; char sun_path[126]; }; |
struct sockaddr_un { uint8_t sun_len; sa_family_t sun_family; char sun_path[126] }; |
When you develop in ILE-based languages and an application is compiled with the _XOPEN_SOURCE macro, some sockets APIs are mapped to internal names. These internal names provide the same function as the original API. The table lists these affected APIs. If you are writing socket applications in some other C-based language, you can write directly to the internal name of these APIs. Use the link to the original API to see usage notes and details for both versions of these APIs.
API name | Internal name |
---|---|
accept() | qso_accept98() |
accept_and_recv() | qso_accept_and_recv98() |
bind() | qso_bind98() |
connect() | qso_connect98() |
endhostent() | qso_endhostent98() |
endnetent() | qso_endnetent98() |
endprotoent() | qso_endprotoent98() |
endservent() | qso_endservent98() |
getaddrinfo() | qso_getaddrinfo98() |
gethostbyaddr() | qso_gethostbyaddr98() |
gethostbyaddr_r() | qso_gethostbyaddr_r98() |
gethostname() | qso_gethostname98() |
gethostname_r() | qso_gethostname_r98() |
gethostbyname() | qso_gethostbyname98() |
gethostent() | qso_gethostent98() |
getnameinfo() | qso_getnameinfo98() |
getnetbyaddr() | qso_getnetbyaddr98() |
getnetbyname() | qso_getnetbyname98() |
getnetent() | qso_getnetent98() |
getpeername() | qso_getpeername98() |
getprotobyname() | qso_getprotobyname98() |
getprotobynumber() | qso_getprotobynumber98() |
getprotoent() | qso_getprotoent98() |
getsockname() | qso_getsockname98() |
getsockopt() | qso_getsockopt98() |
getservbyname() | qso_getservbyname98() |
getservbyport() | qso_getservbyport98() |
getservent() | qso_getservent98() |
inet_addr() | qso_inet_addr98() |
inet_lnaof() | qso_inet_lnaof98() |
inet_makeaddr() | qso_inet_makeaddr98() |
inet_netof() | qso_inet_netof98() |
inet_network() | qso_inet_network98() |
listen() | qso_listen98() |
Rbind() | qso_Rbind98() |
recv() | qso_recv98() |
recvfrom() | qso_recvfrom98() |
recvmsg() | qso_recvmsg98() |
send() | qso_send98() |
sendmsg() | qso_sendmsg98() |
sendto() | qso_sendto98() |
sethostent() | qso_sethostent98() |
setnetent() | qso_setnetent98() |
setprotoent() | qso_setprotoent98() |
setservent() | qso_setprotoent98() |
setsockopt() | qso_setsockopt98() |
shutdown() | qso_shutdown98() |
socket() | qso_socket98() |
socketpair() | qso_socketpair98() |