Commit 30decc92 authored by Sebastian Hans's avatar Sebastian Hans
Browse files

REL-18 version

parents
Loading
Loading
Loading
Loading
+74 −0
Original line number Diff line number Diff line
package uicc.connection;

/**
 * The <code>BIPLink</code> interface represents a pure BIP logical connection to a remote entity.
 * 
 * Objects implementing <code>BIPLink</code> interface and returned by the <code>ConnectionServer.getConnection</code> method
 * are <b>Permanent Entry Point Objects</b>.
 *
 */
public interface BIPLink extends Observable
{
    /**
     * It request the opening of the BIP link.
     * 
     * @return the size of the allocated PDU buffer or <code>0</code> if the proactive command was not
     *         successful.
     * @exception ConnectionException with the following reason code:
     *         <ul>
     *    	    <li><code>TOOLKIT_RESOURCE_NOT_AVAILABLE</code> if the proactive command could not be
     *              issued.</li>
     *              <li><code>INVALID_STATE</code> if the BIP link is already opened.</li>
     *              <li><code>USER_CANCELLATION</code> if the user cancelled the opening of the BIP link.</li>
     *		    <li><code>UNSUPPORTED_OPERATION</code> if the Terminal Equipment does not support the required mechanisms to perform the action.
     *     		<li><code>RESOURCE_NOT_AVAILABLE</code> if there are not sufficient 
     *                resources available (on the UICC or on the terminal).
     *         </ul> 
     */
    public short open()
    		throws ConnectionException;

    /**
     * Closes the BIP link.
     * 
     * @return <code>true</code> if the proactive command has been successfully executed by the Terminal Equipment 
     *         <code>false</code> otherwise.
     *         
     * @exception ConnectionException with the following reason code:
     *         <ul>
     *         	    <li><code>TOOLKIT_RESOURCE_NOT_AVAILABLE</code> if the proactive command could not be
     *					issued.</li>
     *              <li><code>USER_CANCELLATION</code> if the user cancelled the closing of the BIP link</li>     
     *         </ul> 
     */
    public boolean close()
    		throws ConnectionException;

    /**
     * Sends data on the BIP link without any additional on-card reliable level.
     * 
     * <p>Note: The applet execution is resumed once the data has been sent.</p>
     * 
     * @param baData byte array containing the data to be sent
     * @param sOffset the starting offset of the data to be sent in the <code>baData</code> byte array
     * @param sLength the length of the data to be sent
     * 
     * @return <code>true</code> if the proactive command has been successfully executed by the Terminal Equipment;
     *         <code>false</code> otherwise.
     * 
     * @exception ArrayIndexOutOfBoundsException if <code>sOffset</code> and <code>sLength</code> are causing access
     *         outside of <code>baData</code> array bounds
     * @exception ConnectionException with the following reason code:
     *         <ul>
     *              <li><code>TOOLKIT_RESOURCE_NOT_AVAILABLE</code> if the proactive command could not be
     *              issued.</li>
     *              <li><code>INVALID_STATE</code> if the BIP link is not opened.</li>
     *		    <li><code>USER_CANCELLATION</code> if the user cancelled the connecting of the BIP link</li> 
     *         </ul>
     * @exception NullPointerException if <code>baData</code> is equal to <code>null</code>
     */
    public boolean send(byte[] baData, short sOffset, short sLength)
    		throws ArrayIndexOutOfBoundsException,
    		       ConnectionException,
    		       NullPointerException;
}
+41 −0
Original line number Diff line number Diff line
package uicc.connection;

/**
 * The Connection interface represents a data link connection to a remote entity.
 * 
 * Objects implementing <code>Connection</code> and returned by the <code>ConnectionServer.getConnection</code> method
 * are <b>Permanent Entry Point Objects</b>.
 *
  */
public interface Connection
{
    /**
     * Update the connection parameters.<br>
     *
     * This operation can be performed only on <code>Connection</code> objects not allowing the multiplexing.
     * 
     * @param connectionParameters parameters to build up an OPEN CHANNEL command according to ETSI TS 102 223
     * @param sOffset the starting offset of the parameters in the <code>connectionParameters</code> byte array
     * @param sLength the length of the parameters
     * 
     * @exception ArrayIndexOutOfBoundsException if <code>sOffset</code> and <code>sLength</code> are causing access
     *         outside of <code>connectionParameters</code> array bounds
     * @exception ConnectionException with the following reason code:
     *         <ul>
     *              <li><code>INVALID_STATE</code> if the connection is already opened.</li>
     *              <li><code>OPERATION_NOT_ALLOWED</code> if the <code>Connection</code> allows multiplexing.
     *         </ul> 
     * @exception NullPointerException if <code>connectionParameters</code> is equal to <code>null</code>
     */
    public void updateConnectionParameters(byte[] connectionParameters, short sOffset, short sLength)
    		throws ArrayIndexOutOfBoundsException,
    		       ConnectionException,
    		       NullPointerException;

    /**
     * Returns the status of the <code>Connection</code>.
     * 
     * @return <code>true</code> if the Connection is connected, <code>false</code> otherwise. 
     */
    public boolean isConnected();
}
+12 −0
Original line number Diff line number Diff line
package uicc.connection;

/**
 * Notification about closing of a connection.
 * <code>BIPLink</code> and <code>UICCTransportLink</code> may be notified by that.
 *
 * The object implementing <code>ConnectionClosed</code> interface is a <b>Temporary Entry Point Object</b>.
 *
 */
public interface ConnectionClosed extends Event
{
}
+28 −0
Original line number Diff line number Diff line
package uicc.connection;


/**
 * <code>ConnectionConstants</code> encapsulates constants related to the connection services.
 */
public interface ConnectionConstants
{

    /**
     * <code>UICCTransportLink.connect()</code> method result:
     * if the connect operation has failed: 0
     */
    public final static short CONNECT_OPERATION_FAILED = (short) 0;

    /**
     * <code>UICCTransportLink.connect()</code> method result:
     * if the connect operation has been performed successfully: 1
     */
    public final static short CONNECT_OPERATION_PERFORMED_SUCCESSFULLY = (short) 1;

    /**
     * <code>UICCTransportLink.connect()</code> method result:
     * if the connect operation has been performed with modifications: 2
     */
    public final static short CONNECT_OPERATION_PERFORMED_WITH_MODIFICATIONS = (short) 2;

}
+73 −0
Original line number Diff line number Diff line
package uicc.connection;

import javacard.framework.CardRuntimeException;

/**
 * Exception class for the <code>uicc.connection</code> package.
 * 
 */
public class ConnectionException extends CardRuntimeException
{
    /** Reason code to indicate that the transport protocol type is not supported: 0 */
    public final static short TRANSPORT_PROTOCOL_NOT_SUPPORTED = (short) 0;

    /** Reason code to indicate that a proactive session is pending */
    public final static short TOOLKIT_RESOURCE_NOT_AVAILABLE = (short) 1;

    /** Reason code to indicate that the state of a connection or of a link does not correspond the requested action: 2 */
    public final static short INVALID_STATE = (short) 2;

    /** Reason code to indicate that the requested action was aborted because of a timeout: 3 */
    public final static short TIME_OUT = (short) 3;

    /** Reason code to indicate that the requested action was aborted by the user: 4 */
    public final static short USER_CANCELLATION = (short) 4;

    /** Reason code to indicate that the requested action would cause access out of data: 5 */
    public final static short OUT_OF_DATA_BOUNDARIES = (short) 5;

    /** Reason code to indicate that the requested operation is not allowed at this time: 6 */
    public final static short OPERATION_NOT_ALLOWED = (short) 6;

    /** Reason code to indicate that the connection has been refused by the remote entity: 7 */
    public final static short CONNECTION_REFUSED = (short) 7;

    /** Reason code to indicate that the parameters are invalid: 8 */
    public final static short INVALID_PARAMETERS = (short) 8;
    
    /** Reason code to indicate that the terminal does not support the required mechanisms to perform the action: 9 */
    public final static short UNSUPPORTED_OPERATION = (short) 9;
    
    /** Reason code to indicate that there are insufficient resources
     * on the UICC or on the terminal (e.g. timers:) 10 */
    public final static short RESOURCE_NOT_AVAILABLE = (short) 10;

    /** Reason code to indicate that no SCP81 key could be found to establish the TLS session: 11 */
    public final static short SCP81_KEY_NOT_FOUND = (short) 11;

    /** Reason code to indicate that invalid header fields set by application */
    public final static short INVALID_HEADER_FIELD = (short) 12;
     
    /**
     * Construct a ConnectionException instance with the specified reason. To
     * conserve on resources use <code>throwIt()</code> method to re-use the
     * JCRE instance of this class.
     *
     * @param  sReason for the exception
     */
    public ConnectionException(short sReason) 
    {
    	super(sReason);
    }

    /**
     * Throws the JCRE instance of the <code>ConnectionException</code> class with
     * the specified reason.
     *
     * @param  sReason for the exception.
     */
    public static void throwIt(short sReason) 
    		throws ConnectionException 
    {
    }
}