@Override public List<NetworkAddress> getActiveStreamServers(InetAddress preferredAddress) throws RouterException { // Simulate an active stream server, otherwise the notification/search response // protocols won't even run try { return Arrays.asList( new NetworkAddress( InetAddress.getByName("127.0.0.1"), NetworkAddressFactoryImpl.DEFAULT_TCP_HTTP_LISTEN_PORT ) ); } catch (UnknownHostException ex) { throw new RuntimeException(ex); } }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Location location = (Location) o; if (!networkAddress.equals(location.networkAddress)) return false; if (!path.equals(location.path)) return false; return true; }
public Location(NetworkAddress networkAddress, String path) { this.networkAddress = networkAddress; this.path = path; this.url = createAbsoluteURL(networkAddress.getAddress(), networkAddress.getPort(), path); }
public OutgoingNotificationRequestRootDevice(Location location, LocalDevice device, NotificationSubtype type) { super(location, device, type); getHeaders().add(UpnpHeader.Type.NT, new RootDeviceHeader()); getHeaders().add(UpnpHeader.Type.USN, new USNRootDeviceHeader(device.getIdentity().getUdn())); if ("true".equals(System.getProperty(Constants.SYSTEM_PROPERTY_ANNOUNCE_MAC_ADDRESS)) && location.getNetworkAddress().getHardwareAddress() != null) { getHeaders().add( UpnpHeader.Type.EXT_IFACE_MAC, new InterfaceMacHeader(location.getNetworkAddress().getHardwareAddress()) ); } }
@Override public int hashCode() { int result = networkAddress.hashCode(); result = 31 * result + path.hashCode(); return result; }
public OutgoingSearchResponse(IncomingDatagramMessage request, Location location, LocalDevice device) { super(new UpnpResponse(UpnpResponse.Status.OK), request.getSourceAddress(), request.getSourcePort()); getHeaders().add(UpnpHeader.Type.MAX_AGE, new MaxAgeHeader(device.getIdentity().getMaxAgeSeconds())); getHeaders().add(UpnpHeader.Type.LOCATION, new LocationHeader(location.getURL())); getHeaders().add(UpnpHeader.Type.SERVER, new ServerHeader()); getHeaders().add(UpnpHeader.Type.EXT, new EXTHeader()); if ("true".equals(System.getProperty(Constants.SYSTEM_PROPERTY_ANNOUNCE_MAC_ADDRESS)) && location.getNetworkAddress().getHardwareAddress() != null) { getHeaders().add( UpnpHeader.Type.EXT_IFACE_MAC, new InterfaceMacHeader(location.getNetworkAddress().getHardwareAddress()) ); } }
@Override public int hashCode() { int result = networkAddress.hashCode(); result = 31 * result + path.hashCode(); return result; }
/** * @return An HTTP URL with the address, port, and path of this location. */ public URL getURL() { return URIUtil.createAbsoluteURL(networkAddress.getAddress(), networkAddress.getPort(), path); }
public OutgoingNotificationRequestRootDevice(Location location, LocalDevice device, NotificationSubtype type) { super(location, device, type); getHeaders().add(UpnpHeader.Type.NT, new RootDeviceHeader()); getHeaders().add(UpnpHeader.Type.USN, new USNRootDeviceHeader(device.getIdentity().getUdn())); if (location.getNetworkAddress().getHardwareAddress() != null) { getHeaders().add( UpnpHeader.Type.EXT_IFACE_MAC, new InterfaceMacHeader(location.getNetworkAddress().getHardwareAddress()) ); } }
(preferredServer = streamServers.get(preferredAddress)) != null) { streamServerAddresses.add( new NetworkAddress( preferredAddress, preferredServer.getPort(), byte[] hardwareAddress = networkAddressFactory.getHardwareAddress(entry.getKey()); streamServerAddresses.add( new NetworkAddress(entry.getKey(), entry.getValue().getPort(), hardwareAddress) );
@Override public int hashCode() { int result = networkAddress.hashCode(); result = 31 * result + path.hashCode(); return result; }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Location location = (Location) o; if (!networkAddress.equals(location.networkAddress)) return false; if (!path.equals(location.path)) return false; return true; }
public Location(NetworkAddress networkAddress, String path) { this.networkAddress = networkAddress; this.path = path; this.url = createAbsoluteURL(networkAddress.getAddress(), networkAddress.getPort(), path); }
public OutgoingSearchResponse(IncomingDatagramMessage request, Location location, LocalDevice device) { super(new UpnpResponse(UpnpResponse.Status.OK), request.getSourceAddress(), request.getSourcePort()); getHeaders().add(UpnpHeader.Type.MAX_AGE, new MaxAgeHeader(device.getIdentity().getMaxAgeSeconds())); getHeaders().add(UpnpHeader.Type.LOCATION, new LocationHeader(location.getURL())); getHeaders().add(UpnpHeader.Type.SERVER, new ServerHeader()); getHeaders().add(UpnpHeader.Type.EXT, new EXTHeader()); if (location.getNetworkAddress().getHardwareAddress() != null) { getHeaders().add( UpnpHeader.Type.EXT_IFACE_MAC, new InterfaceMacHeader(location.getNetworkAddress().getHardwareAddress()) ); } }
@Override public List<NetworkAddress> getActiveStreamServers(InetAddress preferredAddress) throws RouterException { // Simulate an active stream server, otherwise the notification/search response // protocols won't even run try { return Arrays.asList( new NetworkAddress( InetAddress.getByName("127.0.0.1"), NetworkAddressFactoryImpl.DEFAULT_TCP_HTTP_LISTEN_PORT ) ); } catch (UnknownHostException ex) { throw new RuntimeException(ex); } }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Location location = (Location) o; if (!networkAddress.equals(location.networkAddress)) return false; if (!path.equals(location.path)) return false; return true; }
public OutgoingNotificationRequestRootDevice(Location location, LocalDevice device, NotificationSubtype type) { super(location, device, type); getHeaders().add(UpnpHeader.Type.NT, new RootDeviceHeader()); getHeaders().add(UpnpHeader.Type.USN, new USNRootDeviceHeader(device.getIdentity().getUdn())); if ("true".equals(System.getProperty(Constants.SYSTEM_PROPERTY_ANNOUNCE_MAC_ADDRESS)) && location.getNetworkAddress().getHardwareAddress() != null) { getHeaders().add( UpnpHeader.Type.EXT_IFACE_MAC, new InterfaceMacHeader(location.getNetworkAddress().getHardwareAddress()) ); } }
(preferredServer = streamServers.get(preferredAddress)) != null) { streamServerAddresses.add( new NetworkAddress( preferredAddress, preferredServer.getPort(), byte[] hardwareAddress = networkAddressFactory.getHardwareAddress(entry.getKey()); streamServerAddresses.add( new NetworkAddress(entry.getKey(), entry.getValue().getPort(), hardwareAddress) );
public OutgoingSearchResponse(IncomingDatagramMessage request, Location location, LocalDevice device) { super(new UpnpResponse(UpnpResponse.Status.OK), request.getSourceAddress(), request.getSourcePort()); getHeaders().add(UpnpHeader.Type.MAX_AGE, new MaxAgeHeader(device.getIdentity().getMaxAgeSeconds())); getHeaders().add(UpnpHeader.Type.LOCATION, new LocationHeader(location.getURL())); getHeaders().add(UpnpHeader.Type.SERVER, new ServerHeader()); getHeaders().add(UpnpHeader.Type.EXT, new EXTHeader()); if ("true".equals(System.getProperty(Constants.SYSTEM_PROPERTY_ANNOUNCE_MAC_ADDRESS)) && location.getNetworkAddress().getHardwareAddress() != null) { getHeaders().add( UpnpHeader.Type.EXT_IFACE_MAC, new InterfaceMacHeader(location.getNetworkAddress().getHardwareAddress()) ); } }
@Override public List<NetworkAddress> getActiveStreamServers(InetAddress preferredAddress) throws RouterException { // Simulate an active stream server, otherwise the notification/search response // protocols won't even run try { return Arrays.asList( new NetworkAddress( InetAddress.getByName("127.0.0.1"), NetworkAddressFactoryImpl.DEFAULT_TCP_HTTP_LISTEN_PORT ) ); } catch (UnknownHostException ex) { throw new RuntimeException(ex); } }