|
YAACC - UPNP Client and Server
|
The FCast receivers the app knows, from three sources that are merged by endpoint (one receiver found by mDNS and typed in by hand is one entry): discovered ones (mDNS announcements, which are not authenticated and so are filtered and capped), manual ones (typed in, pasted or scanned: the user chose them) and remembered ones (the selected receivers of the last run, so that a selection survives a restart before the first scan; shown as offline until they are seen). More...

Classes | |
| class | Entry |
| One receiver, as of the moment it was read. | |
| class | Known |
| A name and an address that the user or an earlier run gave. | |
| interface | Listener |
| Told after every change; called outside the directory's lock, so it may read the directory. More... | |
Public Member Functions | |
| FCastDirectory (MonotonicClock clock, long graceMillis) | |
| void | addListener (Listener listener) |
| void | removeListener (Listener listener) |
| boolean | serviceFound (String serviceId, String serviceName, InetAddress address, int port, FCastServiceTxt hints) |
| An announcement was resolved. | |
| void | serviceLost (String serviceId) |
| The platform says the service is gone. | |
| void | discoveryRestarted () |
| A scan starts: what the last one found is unconfirmed until it is announced again (or the grace time is over). | |
| void | discoveryStopped () |
| The scan ended: nothing can confirm or deny an entry any more, so none is dropped for staleness. | |
| void | clearDiscovered () |
| The discovery was switched off: forget everything it found (manual and remembered receivers stay). | |
| int | setManual (Collection< Known > receivers) |
| Replaces the manual receivers (the stored list). | |
| int | setRemembered (Collection< Known > receivers) |
| Replaces the remembered receivers (the selection of the last run). | |
| List< Entry > | snapshot () |
| The receivers, sorted by name (case insensitive) and then by address. | |
| Entry | find (FCastEndpoint endpoint) |
| Entry | findById (String id) |
Static Public Attributes | |
| static final int | MAX_DISCOVERED = 64 |
| The most discovered receivers. | |
| static final int | MAX_SERVICE_IDS = 128 |
| The most service names remembered for the lost events. | |
| static final int | MAX_ENTRIES = MAX_DISCOVERED + FCastStoredReceivers.MAX_MANUAL + FCastStoredReceivers.MAX_REMEMBERED |
| The most entries of all kinds: the discovered ones, the manual ones and the remembered ones are capped independently of each other. | |
| static final int | MIN_DISCOVERED_PORT = 1024 |
| The lowest port accepted from an announcement (an announcement must not aim the app at a system service). | |
| static final long | DEFAULT_GRACE_MILLIS = 30_000L |
| How long what a restarted scan knew may stay unconfirmed. | |
The FCast receivers the app knows, from three sources that are merged by endpoint (one receiver found by mDNS and typed in by hand is one entry): discovered ones (mDNS announcements, which are not authenticated and so are filtered and capped), manual ones (typed in, pasted or scanned: the user chose them) and remembered ones (the selected receivers of the last run, so that a selection survives a restart before the first scan; shown as offline until they are seen).
A smaller sibling of the Snapcast directory (decision D15). Thread safe; the listeners are called outside the lock.
What a hostile network can do. Anybody on the LAN can announce _fcast._tcp. A discovered receiver is accepted only at an address of the local network (AddressFilter: no loopback, no public address) and at a port from 1024 up; at most {@value MAX_DISCOVERED} discovered receivers and {@value MAX_SERVICE_IDS} service names are kept, and a flood does not push out the entries that are known (the new announcement is refused: evicting the old ones would let an attacker replace the real receivers). Names are display text, cleaned and cut.
Staleness. The platform reports a service that goes away (serviceLost); a scan that starts again marks what it knew as unconfirmed for graceMillis, and what is not announced again in that time is dropped (checked whenever the entries are read: no timer). Nothing is dropped while no scan runs (nobody could confirm it).
| Entry de.yaacc.fcast.discovery.FCastDirectory.find | ( | FCastEndpoint | endpoint | ) |
Referenced by de.yaacc.fcast.discovery.FCastDirectory.findById().

| Entry de.yaacc.fcast.discovery.FCastDirectory.findById | ( | String | id | ) |
fcast:...), or null Referenced by de.yaacc.fcast.discovery.FCastReceivers.findReceiver().


| boolean de.yaacc.fcast.discovery.FCastDirectory.serviceFound | ( | String | serviceId, |
| String | serviceName, | ||
| InetAddress | address, | ||
| int | port, | ||
| FCastServiceTxt | hints ) |
An announcement was resolved.
| serviceId | the key of the service for the lost events (FCastServiceType#serviceId) |
| serviceName | the instance name (display text) |
| address | the resolved address (a number: no name lookup) |
| hints | the TXT hints, may be null |

| int de.yaacc.fcast.discovery.FCastDirectory.setManual | ( | Collection< Known > | receivers | ) |
Replaces the manual receivers (the stored list).
| int de.yaacc.fcast.discovery.FCastDirectory.setRemembered | ( | Collection< Known > | receivers | ) |
Replaces the remembered receivers (the selection of the last run).
Referenced by de.yaacc.fcast.discovery.FCastReceivers.restore(), and de.yaacc.fcast.discovery.FCastReceivers.selectionChanged().

| List< Entry > de.yaacc.fcast.discovery.FCastDirectory.snapshot | ( | ) |
The receivers, sorted by name (case insensitive) and then by address.
Drops what a scan did not confirm in time.
Referenced by de.yaacc.fcast.discovery.FCastReceivers.receivers().
