YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.multiroom.discovery.ServerEndpoint Class Reference

The control endpoint of a snapserver: a host (a name or an IP literal) and a TCP port. More...

Collaboration diagram for de.yaacc.multiroom.discovery.ServerEndpoint:
Collaboration graph

Public Member Functions

String getHost ()
 The host: a lower-case name, or the canonical text of an IP literal.
 
int getPort ()
 
InetAddress getAddress ()
 The address of an IP literal or of a discovered server; null for a host name (it is resolved by the caller).
 
ServerKey toKey ()
 The key of the server at this endpoint.
 
String toString ()
 host:port, an IPv6 literal in brackets; reads back through parse.
 
boolean equals (Object other)
 
int hashCode ()
 

Static Public Member Functions

static ServerEndpoint parse (String text, int defaultPort)
 As parse(String) with another port for an entry that has none (the client uses the stream port 1704).
 
static ServerEndpoint fromAddress (InetAddress address, int port)
 The endpoint of an address that was found on the network (the result of a service resolution).
 

Detailed Description

The control endpoint of a snapserver: a host (a name or an IP literal) and a TCP port.

Immutable.

parse is the one place where a manual entry host[:port] is checked, and it is strict: a host name (letters, digits and hyphens in dot-separated labels, the last label not all digits) or an IP literal (an IPv6 literal in brackets when a port follows), a port of 1 to 65535, and nothing else (no scheme, path, query, user info, white space, zone id or non-ASCII character). Nothing is resolved: the literals are parsed here by hand, so that no input can cause a name lookup (Java would read 1.2.3 as an IPv4 address and an unknown text as a host name to look up). An unspecified, multicast or broadcast literal is refused. A public address is allowed for a manual entry (the user chose it); the range filter for discovered servers is AddressFilter.

An IP literal is kept in one canonical form (IPv4 dotted, IPv6 as eight hexadecimal groups without compression), so that two writings of one address are one endpoint, and the same endpoint found by mDNS and typed by hand is one server. The text of an endpoint is an address of the user's network: show it, never log it.

Member Function Documentation

◆ fromAddress()

static ServerEndpoint de.yaacc.multiroom.discovery.ServerEndpoint.fromAddress ( InetAddress address,
int port )
static

The endpoint of an address that was found on the network (the result of a service resolution).

The address is kept and is what a connection uses: no name is resolved later. The caller checks the range with AddressFilter.

Returns
null for no address or a port outside 1 to 65535

Referenced by de.yaacc.fcast.discovery.FCastEndpoint.fromAddress(), and de.yaacc.snapcast.discovery.SnapcastDirectory.serviceFound().

Here is the caller graph for this function:

◆ parse()

static ServerEndpoint de.yaacc.multiroom.discovery.ServerEndpoint.parse ( String text,
int defaultPort )
static

The documentation for this class was generated from the following file: