/* Network-Integrated Multimedia Middleware (NMM)
 * http://www.motama.com/nmm.html
 *
 * Copyright (C) 2006-2007
 * Motama GmbH, Saarbruecken, Germany
 * http://www.motama.com
 *
 * This file is part of NMM. 
 * 
 * NMM is free software; you can redistribute it and/or modify it    
 * under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; only version 2 of the License.      
 * 
 * NMM is distributed in the hope that it will be useful, but WITHOUT 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 
 * License for more details.  
 * 
 * You should have received a copy of the GNU General Public License 
 * along with NMM; if not, write to the Free Software Foundation,    
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */

#include "nmm/comm/IQueued.idl"
#include "INode.idl"

module NMM {

  /** Bidirectional queue control interface of a node.
   *
   * This interface provides methods for configuring and querying the current state of
   * the queues of a node. Every input stream of a node has a downstream queue, and every
   * output stream of a node has an upstream queue.
   *
   * Maximum downstream queue sizes can be set by number of buffers (size) or duration.
   *
   * @see IQueued, StreamQueue
   */
  interface IBiDirQueuedNode
  {
    /** Get the current size of a downstream queue.
     * This method returns the number of buffers currently queued in a downstream queue.
     *
     * @param id Input stream ID which identifies the queue
     * @return Current size of the queue (in number of buffers)
     */
    nmm_uint32 getDownstreamSize(in string id = "default") const;

    /** Get the maximum size of a downstream queue.
     * This method returns the maximum number of buffers that may be queued in a downstream queue.
     *
     * @param id Input stream ID which identifies the queue
     * @return Maximum size of the queue (in number of buffers)
     */
    nmm_uint32 getDownstreamMaxSize(in string id = "default") const;

    /** Get the mode of a downstream queue.
     * This method returns the queue mode of a downstream queue.
     *
     * @param id Input stream ID which identifies the queue
     * @return Queue mode
     */
    IQueued::Mode getDownstreamMode(in string id = "default") const;

    /** Set the maximum size of a downstream queue.
     * This method sets the maximum number of buffers that may be queued in a downstream queue.
     *
     * @param size Maximum size of the queue (in number of buffers)
     * @param id Input stream ID which identifies the queue
     */
    Result setDownstreamMaxSize(in nmm_uint32 size, in string id = "default") limited(INode::CONSTRUCTED);

    /** Set the maximum duration of a downstream queue.
     *
     * @param duration Maximum duration of the queue
     * @param id Input stream ID which identifies the queue
     */
    Result setDownstreamMaxDuration(in Interval duration, in string id = "default") limited(INode::CONSTRUCTED);

    /** Set the mode of a downstream queue.
     * This method sets the queue mode of a downstream queue.
     *
     * @param mode Queue mode
     * @param id Input stream ID which identifies the queue
     */
    Result setDownstreamMode(in IQueued::Mode mode, in string id = "default") limited(INode::CONSTRUCTED);


    /** Instream event set the downstream size to unlimited.
     *
     * @return SUCCESS
     */
    Result unlimitDownstreamSize() instream;

    /** Instream event set the downstream size back to limited.
     *
     * @return SUCCESS
     */
    Result limitDownstreamSize() instream;

    /** Get the current size of an upstream queue.
     * This method returns the number of buffers currently queued in an upstream queue.
     *
     * @param id Output stream ID which identifies the queue
     * @return Current size of the queue (in number of buffers)
     */
    nmm_uint32 getUpstreamSize(in string id = "default") const;

    /** Get the maximum size of an upstream queue.
     * This method returns the maximum number of buffers that may be queued in an upstream queue.
     *
     * @param id Output stream ID which identifies the queue
     * @return Maximum size of the queue (in number of buffers)
     */
    nmm_uint32 getUpstreamMaxSize(in string id = "default") const;

    /** Get the mode of an upstream queue.
     * This method returns the queue mode of an upstream queue.
     *
     * @param id Output stream ID which identifies the queue
     * @return Queue mode
     */
    IQueued::Mode getUpstreamMode(in string id = "default") const;

    /** Set the maximum size of an upstream queue.
     * This method sets the maximum number of buffers that may be queued in an upstream queue.
     *
     * @param size Maximum size of the queue (in number of buffers)
     * @param id Output stream ID which identifies the queue
     */
    Result setUpstreamMaxSize(in nmm_uint32 size, in string id = "default") limited(INode::CONSTRUCTED);

    /** Set the mode of an upstream queue.
     * This method sets the queue mode of an upstream queue.
     *
     * @param mode Queue mode
     * @param id Output stream ID which identifies the queue
     */
    Result setUpstreamMode(in IQueued::Mode mode, in string id = "default") limited(INode::CONSTRUCTED);

    /** Set the maximum size of a downstream queue.
     * This method sets the maximum number of buffers that may be queued in a downstream queue.
     *
     * @param size Maximum size of the queue (in number of buffers)
     * @param id Input stream ID which identifies the queue
     */
    Result setMaxSize(in nmm_uint32 size, in string id = "default") limited(INode::CONSTRUCTED);

    /** Set the mode of a downstream queue.
     * This method sets the queue mode of a downstream queue.
     *
     * @param mode Queue mode
     * @param id Input stream ID which identifies the queue
     */
    Result setMode(in IQueued::Mode mode, in string id = "default") limited(INode::CONSTRUCTED);
  };
  
}
