Module SockAddr

This module implements inet_ntoa and inet_aton, and provides an interface to SockAddr services provided by the Zorp core.

Imported modules

Functions

Function inet_aton

Converts an internet address to a 32 bit integer

Synopsis

inet_aton ( ip )

Description

splits on the dot, atoi the parts, and bitshift the whole thing into one

Arguments

Table 4-116. Arguments for .inet_aton()

ipA dotted-quad string

Returns

unsigned long in network byte order

Function inet_ntoa

Converts a 32 bit integer into IP number's string representation

Synopsis

inet_ntoa ( ip )

Description

Masks the necessary bytes out and formats them into a string.

Arguments

Table 4-117. Arguments for .inet_ntoa()

ip The ip number in 32 bit integer (network byte order)

Returns

string representation of IP

Class SockAddrInet

This class encapsulates an IPv4 address:port pair, similar to the struct sockaddr_in in C. It is implemented and exported by the Zorp core.

Attributes

Table 4-118. Attributes for class SockAddrInet

ip ip address (network byte order)
ip_sip address in string representation
portport number (network byte order)

Class SockAddrInetRange

Specialized SockAddrInet class which allocates a new port within the given range of ports when a listener bounds to it.

Attributes

Table 4-119. Attributes for class SockAddrInetRange

ipip address (network byte order)
ip_sip address in string representation
portport number (network byte order)