View Javadoc
1   /*
2    * Copyright (C) 2013 4th Line GmbH, Switzerland
3    *
4    * The contents of this file are subject to the terms of either the GNU
5    * Lesser General Public License Version 2 or later ("LGPL") or the
6    * Common Development and Distribution License Version 1 or later
7    * ("CDDL") (collectively, the "License"). You may not use this file
8    * except in compliance with the License. See LICENSE.txt for more
9    * information.
10   *
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14   */
15  
16  package org.fourthline.cling.model;
17  
18  /**
19   * Shared and immutable settings.
20   *
21   * @author Christian Bauer
22   */
23  public interface Constants {
24  
25      public static final String SYSTEM_PROPERTY_ANNOUNCE_MAC_ADDRESS = "org.fourthline.cling.network.announceMACAddress";
26  
27      public static final int UPNP_MULTICAST_PORT = 1900;
28  
29      public static final String IPV4_UPNP_MULTICAST_GROUP = "239.255.255.250";
30  
31      public static final String IPV6_UPNP_LINK_LOCAL_ADDRESS = "FF02::C";
32      public static final String IPV6_UPNP_SUBNET_ADDRESS = "FF03::C";
33      public static final String IPV6_UPNP_ADMINISTRATIVE_ADDRESS = "FF04::C";
34      public static final String IPV6_UPNP_SITE_LOCAL_ADDRESS = "FF05::C";
35      public static final String IPV6_UPNP_GLOBAL_ADDRESS = "FF0E::C";
36  
37      public static final int MIN_ADVERTISEMENT_AGE_SECONDS = 1800;
38      
39      // Parsing rules for: deviceType, serviceType, serviceId (UDA 1.0, section 2.5)
40  
41      // TODO: UPNP VIOLATION: Microsoft Windows Media Player Sharing 4.0, X_MS_MediaReceiverRegistrar service has type with periods instead of hyphens in the namespace!
42      // UDA 1.0 spec: "Period characters in the vendor domain name MUST be replaced with hyphens in accordance with RFC 2141"
43      // TODO: UPNP VIOLATION: Azureus/Vuze 4.2.0.2 sends a URN as a service identifier, so we need to match colons!
44      // TODO: UPNP VIOLATION: Intel UPnP Tools send dots in the service identifier suffix, match that...
45  
46      public static final String REGEX_NAMESPACE = "[a-zA-Z0-9\\-\\.]+";
47      public static final String REGEX_TYPE = "[a-zA-Z_0-9\\-]{1,64}";
48      public static final String REGEX_ID = "[a-zA-Z_0-9\\-:\\.]{1,64}";
49  
50      /*
51      Must not contain a hyphen character (-, 2D Hex in UTF- 8). First character must be a USASCII letter (A-Z, a-z),
52      USASCII digit (0-9), an underscore ("_"), or a non-experimental Unicode letter or digit greater than U+007F.
53      Succeeding characters must be a USASCII letter (A-Z, a-z), USASCII digit (0-9), an underscore ("_"), a
54      period ("."), a Unicode combiningchar, an extender, or a non-experimental Unicode letter or digit greater
55      than U+007F. The first three letters must not be "XML" in any combination of case. Case sensitive.
56       */
57      // TODO: I have no idea how to match or what even is a "unicode extender character", neither does the Unicode book
58      public static final String REGEX_UDA_NAME = "[a-zA-Z0-9^-_\\p{L}\\p{N}]{1}[a-zA-Z0-9^-_\\.\\\\p{L}\\\\p{N}\\p{Mc}\\p{Sk}]*";
59  
60      // Random patentable "inventions" by MSFT
61      public static final String SOAP_NS_ENVELOPE = "http://schemas.xmlsoap.org/soap/envelope/";
62      public static final String SOAP_URI_ENCODING_STYLE = "http://schemas.xmlsoap.org/soap/encoding/";
63      public static final String NS_UPNP_CONTROL_10 = "urn:schemas-upnp-org:control-1-0";
64      public static final String NS_UPNP_EVENT_10 = "urn:schemas-upnp-org:event-1-0";
65  
66      // State variable prefixes
67      public static final String ARG_TYPE_PREFIX = "A_ARG_TYPE_";
68  
69  }