Eiffel Media API
Overview Cluster Class Classes Index      Previous Next      Top Features

em.network.classic

Class EM_INET_ADDRESS


Direct ancestors

EM_SHARED_SUBSYSTEMS, EM_SHARED_ERROR_HANDLER, EM_NETWORK_HELPER_FUNCTIONS, EM_NETWORK_CONSTANTS, KL_IMPORTED_STRING_ROUTINES, SDL_NET_FUNCTIONS_EXTERNAL, NET2_FUNCTIONS_EXTERNAL

Known direct descendants

EM_INET_SOCKET_ADDRESS

Creation

Features

Invariants

indexing

description

Represents Internet IPv4 addresses.

date

$Date: 2005/10/25 20:11:44 $

revision

$Revision: 1.19 $

class

EM_INET_ADDRESS

create

make_local

-- Creates a new IPv4 address for all network interfaces.

require
networking_enabled: network_subsystem.is_enabled
ensure
hostname_set: hostname.is_equal (

localhost

)
resolve_finished_event_created: resolve_finished_event /= Void
make_by_hostname (a_host: STRING)

-- Create an unresolved IPv4 address by a_host
-- a_host can be a full qualified hostname or an IPv4 address
-- in textual representation (x.x.x.x).

require
networking_enabled: network_subsystem.is_enabled
host_not_void: a_host /= Void
host_not_empty: not a_host.is_empty
ensure
hostname_set: hostname = a_host
resolve_finished_event_created: resolve_finished_event /= Void
make_by_ip (an_ip: INTEGER)

-- Creates a new IPv4 address from an_ip.
-- Use reverse_resolve to get the corresponding hostname.

require
networking_enabled: network_subsystem.is_enabled
ensure
ip_address_set: host_ip = an_ip
hostname_not_void: hostname /= Void
resolve_finished_event_created: resolve_finished_event /= Void
make_by_ip_string (an_ip_string: STRING)

-- Creates a new IPv4 address from an_ip_string
-- Use reverse_resolve to get the corresponding hostname.

require
an_ip_string_not_void: an_ip_string /= Void
is_valid_ip_string: is_valid_ip_string (an_ip_string)
ensure
hostname_not_void: hostname /= Void
resolve_finished_event_created: resolve_finished_event /= Void

feature -- Access

network_subsystem: EM_NETWORK_SUBSYSTEM

-- EiffelMedia network subsystem is

-- (From EM_SHARED_SUBSYSTEMS)

ensure
network_subsystem_not_void: Result /= void
host_ip: INTEGER

-- Host IPv4

hostname: STRING

-- Hostname

feature -- Status setting

resolve_blocking

-- Resolve host_ip from hostname.
-- This feature is blocking.

require
not_is_resolved: not is_resolved
is_reverse_resolved: is_reverse_resolved
resolve_non_blocking

-- Resolve host_ip from hostname.
-- This feature is non-blocking.
-- Subscribe to the resolve_finished_event and use is_resolved which indicates success or failure.

require
not_is_resolved: not is_resolved
is_reverse_resolved: is_reverse_resolved
reverse_resolve_blocking

-- Reverse resolve hostname from host_ip
-- This feature is blocking.

require
not_is_reverse_resolved: not is_reverse_resolved
is_resolved: is_resolved

feature -- Conversion

host_ip_as_string: STRING

-- Host IP in textual representation (xy.xy.xy.xy)

to_hex_string: STRING

-- To IP in hexadecimal representation

feature -- Events

feature -- Status

is_resolved: BOOLEAN

-- Is host_ip resolved?
-- Is host_ip ready for usage?

is_reverse_resolved: BOOLEAN

-- Is hostname reverse resolved?
-- Ist hostname ready for usage?

feature {EM_SOCKETS, EM_SOCKET, EM_UDP_PACKET} -- Implementation

ip_address_struct: IPADDRESS_STRUCT

-- IP Address Struct

invariant

hostname_set: hostname /= Void

-- From ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)

end