Sockets and Networking


The Interix Software Development Kit (SDK) implements BSD-style socket interfaces, including bind() , accept() , and connect() . The Interix SDK implementation uses the Windows network stack, through the use of Winsock to access the network. This means that TCP/IP sockets and all of the installed Winsock protocols are supported.

For more information about Winsock, see the Winsock documentation at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/wsapiref_7v1u.asp .

Exceptions to socket support in Interix are discussed in the following sections:

  • Host Name to Address Translation

  • Network Groups

  • Network Socket Calls

  • Transport Level Interface (XTI) Calls

Host Name to Address Translation

Interix does not support the generic transport name-to-address translation routines. Interix does support the gethostby routines, except for the re-entrant versions (thatis, routines with the _r suffix). Table 10.18 shows other host or domain name get or set routines not supported by Interix.

Table 10.18: Host Name Translation Routines Not Supported by Interix

Function Name

Description

Suggested Interix Replacement

getdomainname

Gets the NIS domain name.

No equivalent in Interix. The principal Windows domain for the system can be obtained through getpdomain() .

gethostid

Gets the unique identifier of the current host.

No equivalent in Interix, but should be a very rare occurrence in any application except a network administration application.

gethostbyaddr_r,
gethostbyname_r,
gethostent_r

Re-entrant safe versions.

Replace with equivalents lacking the _r suffix. Interix is not multithreaded, and therefore does not need to support the re-entrant versions.

setdomainname

Sets the NIS domain name.

No equivalent in Interix.

sethostid

Sets the unique identifier of the current host.

No equivalent in Interix, but should never need to be set. It is restricted to the root user account.

sethostname

Sets the name of the host computer. (This call is restricted to the superuser and is normally used only when the system is booted .)

No equivalent in Interix.

Network Groups

Interix does not currently support the network group APIs. However, it does support network group designations in hosts .equiv and .rhosts files.

Network Socket Calls

These functions constitute the BSD sockets library. Interix provides all network functions in the main C library, libc.a; for compatibility, Interix includes an empty lisocket.a library.

Interix supports all the socket calls except those summarized in Table 10.19 and Table 10.20.

Table 10.19: Socket Calls Not Supported by Interix

Function Name

Description

Suggested Interix Replacement

cmsg macros

Access ancillary data.

No equivalent in Interix.

freeaddrinfo

Removes address entry from linked list.

Currently no API support for IPv6.

freehostent

Removes IP node entry from linked list.

Currently no API support for IPv6.

gai_strerror

Helps applications print error messages based on the EAI_*codes returned by getaddrinfo .

Currently no API support for IPv6.

getaddrinfo

Translates between node name and address.

Currently no API support for IPv6.

getipnodebyaddr

Gets IP node entry.

Currently no API support for IPv6.

getipnodebyname

Gets IP node entry.

Currently no API support for IPv6.

getnameinfo

Translates between node name and address.

Currently no API support for IPv6.

inet_ntop

Processes network address structures.

Currently no API support for IPv6.

inet_pton

Creates a network address structure.

Currently no API support for IPv6.

rcmd_af

Returns a stream to a remote command and includes support for Ipv6.

Currently no API support for IPv6.

recvmsg

Receives a message from a socket.

No equivalent in Interix.

rexec_af

Returns a stream to a remote command and includes support for Ipv6.

Currently no API support for IPv6.

rresvport_af

 

Currently no API support for IPv6.

sendmsg

Sends a message to a socket.

No equivalent in Interix.

The two sockets functions recvmsg and sendmsg appear in many network applications but are not supported by Interix. These functions are the only way to passan open file descriptor from one running process to another running process.

For examples of UNIX code using sockets that port directly to Interix, see Sockets and Networking in Chapter 9, Win32 Code Conversion.

Each re-entrant interface performs the same operation as its non-re-entrant counterpart . The only difference is the _r suffix. The re-entrant interfaces, however, use buffers supplied by the caller to store returned results, and they are safe for usein both single-threaded and multithreaded applications. If the application is not multithreaded, then the _r routines can be safely replaced by removing the _r suffix and the additional parameters.

Table 10.20: Interix Replacements for Re-entrant Routines

Function Name

Description

Suggested Interix Replacement

getnetbyaddr_r

Searches for a network entry with the network address.

getnetbyaddr

getnetbyname_r

Searches for a network entry with specified name.

getnetbyname

getnetent_r

Enumerates network entries from the database.

getnetent

getprotobyname_r

Sequentially searches from the beginning of the file until a matching protocol name is found, or EOF is encountered .

getprotobyname

getprotobynumber_r

Sequentially searches from the beginning of the file until a matching protocol number is found, or EOF is encountered.

getprotobynumber

getprotoent_r

Gets a matching protocol name.

getprotoent

getservbyname_r

Returns a pointer to an object containing the information from a network services database.

getservbyname

getservbyport_r

Returns a pointer to an object containing the information from a network services database.

getservbyport

getservent_r

Returns a pointer to an object containing the information from a network services database.

getservent

Transport Level Interface (XTI) Calls

The XTI APIs, defined by The Open Group s X/Open Transport Interface specification, define protocol-independent networking functions similar to those providedby the old SVR4 TLI (Transport Level Interface) APIs. XTI, and TLI before it, were primarily used as interfaces to the ISO OSI protocol family or to the STREAMS networking stack. In general, use of XTI should be replaced by use of the more standard BSD Sockets interface.

Interix support for XTI is limited solely to the functions and features required to access the UDP Internet protocol. Interix does not support some extended calls(see Table 10.21), which are mainly used with expedited data and the management or configuration of variables and parameters.

Table 10.21: Transport-level Interface Calls Not Supported by Interix

Function Name

Description

Suggested Interix Replacement

nlsgetcall

Gets client data passed via the listener.

No equivalent in Interix.

nlsprovider

Gets the name of the transport provider.

No equivalent in Interix.

nlsrequest

Formats and sends a listener service request message.

No equivalent in Interix.

t_rcvv

Receives data or expedited data sent over a connection and puts data into one or more noncontiguous buffers greater than or equal to.

No equivalent in Interix.

t_rcvvudata

Receives a data unit in one or more noncontiguous buffers.

No equivalent in Interix.

t_sndv

Sends data or expedited data from one or more noncontiguous buffers on a connection.

No equivalent in Interix.

t_sndvudata

Sends a data unit from one or more noncontiguous buffers.

No equivalent in Interix.

t_sysconf

Gets configurable XTI variables.

No equivalent in Interix.




UNIX Application Migration Guide
Unix Application Migration Guide (Patterns & Practices)
ISBN: 0735618380
EAN: 2147483647
Year: 2003
Pages: 134

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net