Commit f82eea29 authored by (no author)'s avatar (no author)

This commit was manufactured by cvs2svn to create tag

'I01PlusECNs_to_956'.
parent c8a2ab36
package org.ocap;
import java.io.*;
/**
* This class provides system utility functions.
*
* @author Brent Foust
* @author Frank Sandoval
* @author Shigeaki Watanabe
*/
public final class OcapSystem
{
/**
* Do not use. This is to prevent a public constructor from being
* generated.
*/
private OcapSystem()
{
}
/**
* Called by the monitor application to inform the OCAP implementation
* that it is configuring and the boot process may resume after it
* calls the <code>monitorConfiguredSignal</code> method, see Section
* 20.2.2.3 Boot Process while connected to the cable network – CableCARD
* device present.
* <br>
* On invocation of this method, the APIs used for conformance testing,
* specifically, <code>org.ocap.test.OCAPTest</code> SHALL be initialized
* for use. This means that the implementation SHALL perform the
* following actions:
* <ul>
* <li>a. Open a socket for receiving UDP datagrams on a port, the value
* of which is specified in the <code>port</code> parameter passed to this
* method.</li>
* <li>b. Wait to receive a datagram that contains a string formatted
* thus: <code>ate:a.b.c.d:xxxx:ppp</code> (string may be null-terminated),
* where 'a.b.c.d' represents an IPv4 address, and 'xxxx' represents an
* IP port number, and 'ppp' represents protocol type ('TCP' for TCP/IP and
* 'UDP' for UDP/IP). Any received datagrams which do not contain a
* properly formatted payload string SHALL be ignored. Once a datagram
* with a properly formatted string has been received, the datagram
* socket SHALL be closed.</li>
* <li>c. Attempt to establish a TCP or UDP socket connection to the test system
* using the IPv4 address and port number obtained in b. The protocol type
* for the socket connection is specified by 'ppp' string in b. This connected
* socket SHALL be used solely to transmit and receive data originating
* from the <code>org.ocap.test.OCAPTest</code> APIs and SHALL NOT be
* accessible to applications through other APIs. The TCP or UDP socket
* connection shall have a timeout of 'infinite'. If this method
* does not complete within the specified timeout period, an
* <code>IOException</code> SHALL be thrown.</li>
* <li>d. Return control to the caller.</li>
* </ul>
* <br>
* If this method is called with both the <code>port</code> and
* <code>timeout</code> parameters set to 0, then the OCAP
* implementation SHALL not enable the conformance testing APIs, which
* SHALL just return silently, without performing any action.
* <br>
* If the monitor application does not call this method in the time
* specified in section 20.2.2.3 Boot Process while connected to the
* cable network - CableCARD device present, then the OCAP
* implementation SHALL behave the same as if this method had been called
* with 0 specified for both the <code>port</code> and <code>timeout</code>
* parameters.
* If the monitor application does not call this method in the time
* specified in section 20.2.2.3 Boot Process while connected to the
* cable network - CableCARD device present, then the implementation
* SHALL behave the same as if this method had been called with 0
* specified for both the <code>port</code> and <code>timeout</code>
* parameters.
*
* @param port the IP port number to listen for datagrams from the test
* system on.
*
* @param timeout the time, in seconds to allow for a communications
* channel to be established with the test system.
*
* @throws SecurityException if application does not have
* MonitorAppPermission("signal configured").
*
* @throws IOException if a communications channel cannot be established
* with the test system within the amount of time specified by the
* <code>timeout</code> parameter.
*/
public static void monitorConfiguringSignal(int port, int timeout)
throws IOException
{
}
/**
* Called by the Initial Monitor Application to inform the OCAP
* implementation it has completed its configuration process and
* that the boot processing may resume. It is recommended that
* the monitor call this method as soon as possible after the
* <code>monitorConfiguringSignal</code> method has been
* called.
*/ public static void monitorConfiguredSignal()
{
}
}
package org.ocap.application;
import org.dvb.application.AppID;
import org.dvb.application.AppsDatabaseFilter;
import java.util.Enumeration;
/**
* <em>AppFilter</em> provides a means of filtering AppIDs. As a
* subclass of {@link AppsDatabaseFilter}, the method {@link #accept}
* makes a <code>true</code>/<code>false</code> decision based on an AppID.
*
* <p>An AppFilter contains a list of zero or more {@link AppPattern}s. Each
* AppPattern has the attributes: <em>pattern</em>, <em>action</em>, and
* <em>priority</em>. <em>pattern</em> specifies a group of AppIDs with
* a pair of ranges for organization ID and application ID.
* <em>action</em> specifies an action assigned to the AppID group;
* either {@link AppPattern#ALLOW}, {@link AppPattern#DENY}, or {@link
* AppPattern#ASK}. <em>priority</em> specifies this AppPattern's
* position in the search order: the biggest number comes first.
* Applications can insert an AppPattern anywhere in the search
* order by using the priority attribute effectively
* (<code>AppFilter.add</code>). When two or more AppPatterns in an
* AppFilter have the same priority, the search order among them is
* undefined. It is not recommendable to use AppPatterns that have the
* same priority but different actions.
*
* <p>When <code>accept</code> is called, the given AppID is compared to
* the AppID group of each AppPattern in the search order until a match
* is found. Then, it returns <code>true</code> or <code>false</code>
* if the action of matching AppPattern is <code>ALLOW</code> or
* <code>DENY</code> respectively. If no match is found,
* <code>accept</code> returns <code>true</code>.
*
* <p>If the action of matching AppPattern is <code>ASK</code>, then
* AppFilter calls <code>AppFilterHandler.accept</code> for the final
* decision; the matching AppPattern is handed over to this method.
* Applications can specify the <code>AppFilterHandler</code> with
* <code>AppFilter.setAskHandler</code>. If no AppFilterHandler is set,
* AppFilter returns <code>true</code>.
*
*
* <p>AppPatterns can have an expiration time and MSO-private
* information (<em>expirationTime</em> and <em>info</em>).
* <code>accept</code> and <code>getAppPatterns</code> methods ignore
* AppPatterns that have expired. The implementation may delete expired
* AppPatterns from AppFilter.
*
* <p><b>Example:</b>
*
* <blockquote><pre>
* import org.ocap.application.*;
* import org.dvb.application.AppID;
*
* AppManagerProxy am = ...;
* AppPattern[] patterns = {
* &#47;* note that search order is dictated by "priority" *&#47;
* new AppPattern("10-5f:1-ff", AppPattern.ALLOW, 40), // #3
* new AppPattern("30:2c-34", AppPattern.ALLOW, 100), // #1
* new AppPattern("20-40", AppPattern.DENY, 80), // #2
* };
* AppFilter af = new AppFilter(patterns);
*
* &#47;* false - matches "20-40" *&#47;
* boolean badOne = af.accept(new AppID(0x30, 0x10));
*
* &#47;* true - matches "30:2c-34" *&#47;
* boolean goodOne = af.accept(new AppID(0x30, 0x30));
*
* &#47;* will be the second entry: priority between 100 and 80 *&#47;
* af.add(new AppPattern("40-4f:1000-1fff", DENY, 90));
*
* &#47;* register af with the system *&#47;
* am.setAppFilter(af);
* </pre></blockquote>
*
* @see AppPattern
* @see AppFilterHandler
* @see AppManagerProxy
* @see org.dvb.application.AppID
* @see org.dvb.application.AppsDatabaseFilter
*/
public class AppFilter extends AppsDatabaseFilter {
/**
* Constructs an empty AppFilter.
*/
public AppFilter() {
}
/**
* Constructs an AppFilter with initial AppPatterns.
*
* @param patterns AppPatterns to constitute an AppFilter.
*/
public AppFilter(AppPattern[] patterns) {
}
/**
* Returns the AppPatterns in this AppFilter.
*
* @return the enumeration of AppPatterns. When this AppFilter
* has no AppPattern, this method returns an empty Enumeration,
* not <code>null</code>.
*/
public Enumeration getAppPatterns() {
return null;
}
/**
* Returns whether this AppFilter accepts the given AppID.
*
* @param appID an AppID to test.
*
* @return <code>true</code> if <code>appID</code> passes this
* filter.
*/
public boolean accept(AppID appID) {
return true;
}
/**
* Adds an AppPattern to this AppFilter.
*
* @param pattern the AppPattern to add
*/
public void add(AppPattern pattern) {
}
/**
* Removes an AppPattern that equals to <code>pattern</code> in this
* AppFilter. If this AppFilter does not contain
* <code>pattern</code>, it is unchanged.
*
* @param pattern the AppPattern to remove.
*
* @return <code>true</code> if the AppFilter contained the
* specified AppPattern.
*
* @see AppPattern#equals
*/
public boolean remove(AppPattern pattern) {
return false;
}
/**
* Sets the handler to call when <code>accept</code> hits an
* AppPatterns with action {@link AppPattern#ASK}.
*
* <p>If a handler is already registered with this AppFilter, the
* new handler replaces it.
*
* @param handler the handler to set.
*/
public void setAskHandler(AppFilterHandler handler) {
}
}
package org.ocap.application;
import org.dvb.application.AppID;
import org.dvb.application.AppsDatabaseFilter;
/**
* Application programs can provide an implementation of this
* interface to an {@link AppFilter} to make part of decision
* for <code>AppFilter.accept</code>.
*
* @see AppFilter#setAskHandler
*/
public interface AppFilterHandler {
/**
* This method is called by {@link AppFilter#accept} when it finds a
* matching <code>AppPattern</code> whose action is
* <code>ASK</code>.
*
* <p>The return value of this method will be the return value of
* <code>AppFilter.accept</code>. The semantics of this method is
* identical to {@link AppsDatabaseFilter#accept} except that the
* additional parameter <code>matchingItem</code> could be used as a
* hint.
*
* @param appID an AppID to test.
*
* @param matchingItem the <code>AppPattern</code> in
* <code>AppFilter</code> that matched <code>appID</code>
*
* @return <code>true</code> if <code>appID</code> passes this
* filter.
*/
public boolean accept(AppID appID, AppPattern matchingItem);
}
This diff is collapsed.
package org.ocap.application;
import java.util.Date;
/**
* AppPattern is an element that constitutes an {@link AppFilter}. An
* AppPattern has the following attributes:
*
* <ul>
*
* <li><em>idPattern</em> - a group of AppIDs.
*
* <li><em>action</em> - an action (ALLOW, DENY, or ASK) for matching
* applications.
*
* <li><em>priority</em> - a priority that determines the search order
* position in an AppFilter. The highest priority is 255, the lowest is
* 0.
*
* <li><em>expirationTime</em> - An expiration time. Optional.
*
* <li><em>info</em> - an MSO-private data. Optional. Could be a
* String. {@link AppFilterHandler} may use it for making a decision.
*
* </ul>
*
* <p><code>idPattern</code> specifies an AppID group with a String: a
* pair of ranges for Organization IDs and Application IDs. The syntax
* is:
*
* <blockquote><code>"oid1[-oid2][:aid1[-aid2]]"</code></blockquote>
*
* <ul>
*
* <li><code>oid1</code> and <code>oid2</code> specify a range of
* Organization IDs inclusive. Each of them must be a 32-bit value.
*
* <li><code>aid1</code> and <code>aid2</code> specify a range of
* Application IDs inclusive. Each of them must be a 16-bit value.
*
* <li><code>oid2</code> and <code>aid2</code> must be greater than
* <code>oid1</code> and <code>aid1</code>, respectively.
*
* <li>The encoding of these IDs follows <em>14.5 Text encoding of
* application identifiers</em> of <em>DVB-MHP 1.1.2 [11]</em>;
* hexadecimal, lower case, no leading zeros.
*
* <li>Symbols in brackets are optional.
*
* <li>When <code>oid2</code> is omitted, only <code>oid1</code> is in
* the range.
*
* <li>When <code>aid2</code> is omitted, only <code>aid1</code> is in
* the range.
*
* <li>When both <code>aid1</code> and <code>aid2</code> are omitted,
* all Application IDs are in the range.
*
* </ul>
*
* <p>See {@link AppFilter} for the examples.
*
* @see AppFilter
* @see AppFilterHandler
*/
public class AppPattern {
/**
* When <code>AppFilter.accept</code> finds a matching
* <code>AppPattern</code> with this action, it returns
* <code>true</code>.
*
* @see AppFilter#accept
*/
public static final int ALLOW = 1;
/**
* When <code>AppFilter.accept</code> finds a matching
* <code>AppPattern</code> with this action, it returns
* <code>false</code>.
*
* @see AppFilter#accept
*/
public static final int DENY = 2;
/**
* When <code>AppFilter.accept</code> finds a matching
* <code>AppPattern</code> with this action, it asks
* <code>AppFilterHandler.accept</code> for the decision.
*
* @see AppFilter#accept
* @see AppFilterHandler#accept
*/
public static final int ASK = 3;
/**
* Constructs a new AppPattern with no expiration.
*
* @param idPattern a String to specify an AppID group.
*
* @param action an action.
*
* @param priority a search order priority.
*
* @throws IllegalArgumentException <code>idPattern</code> has a bad
* format, <code>action</code> or <code>priority</code> is out of
* range.
*/
public AppPattern(String idPattern, int action, int priority) {
}
/**
* Constructs a new AppPattern with an expiration time and MSO
* private information.
*
* @param idPattern a String to specify an AppID group.
*
* @param action an action.
*
* @param priority a search order priority.
*
* @param expirationTime time for this AppPattern to expire. <code>null</code>
* it never expires.
*
* @param info MSO specific information. Can be <code>null</code>.
*
* @throws IllegalArgumentException <code>idPattern</code> has a bad
* format, <code>action</code> or <code>priority</code> is out of
* range.
*/
public AppPattern(String idPattern, int action, int priority,
Date expirationTime, Object info) {
}
/**
* Returns the pattern string that specifies a group of AppIDs.
*
* @return the pattern string.
*/
public String getAppIDPattern() {
return null;
}
/**
* Returns the action associated with this AppPattern.
*
* @return the action.
*/
public int getAction() {
return 0;
}
/**
* Returns the search order priority of this AppPattern.
*
* @return the search order priority.
*/
public int getPriority() {
return 0;
}
/**
* Returns the time for this AppPattern to expire or
* <code>null</code> if it never expires.
*
* @return the expiration time or <code>null</code>.
*/
public Date getExpirationTime() {
return null;
}
/**
* Returns MSO-private information of this AppPattern.
*
* @return the MSO private information.
*/
public Object getPrivateInfo() {
return null;
}
/**
* Indicates whether some other object is "equal to" this one.
*
* <p>This method does not factor in <code>expirationTime</code> or
* <code>info</code> attributes, but does compare
* <code>idPattern</code>, <code>action</code>, and
* <code>priority</code> attributes.
*/
public boolean equals(Object that) {
return false;
}
public int hashCode() {
return 0;
}
}
// AppSignalHandler.java
package org.ocap.application;
/**
* <P>
* A class implementing this interface can interrupt updating
* application information in the AppsDatabase caused by XAIT acquisition.
* </P><P>
* An application which has a MonitorAppPermission("registrar")
* may have a class implementing this interface, and may set an instance of
* it in the AppManagerProxy.
* </P><P>
* Whenever a new version of the XAIT is received by the OCAP
* implementation, the {@link AppSignalHandler#notifyXAITUpdate}
* method shall be called before updating application information in the
* AppsDatabase.
* If the method returns true or if no AppSignalHandler is set, the
* OCAP implementation shall update application information using the new
* version of the XAIT and update the stored applications as defined by
* the storage priorities in new XAIT. Otherwise the OCAP implementation
* shall ignore the new XAIT.
* </P>
*/
public interface AppSignalHandler
{
/**
* This is a callback method to inquire of an application which has
* MonitorAppPermission("registrar") whether the AppDatabase
* shall update current application information using a new version
* of the XAIT or not.
*
* @param newApps A list of instances of the OCAPAppAttributes class
* associated with all the applications whose details
* are listed in the new version of the XAIT
* that is received by the OCAP implementation.
*
* @return true if the AppsDatabase shall update entire application
* information using the new version of XAIT immediately.
* false if the AppDatabase shall keep application information
* as it is.
*/
public boolean notifyXAITUpdate(OcapAppAttributes[] newApps);
}
\ No newline at end of file