/* 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.
 *
 */

#ifndef NMM_IUDPControl_HPP
#define NMM_IUDPControl_HPP

#include "nmm/nmm_prefix.hpp"

#include "nmm/comm/Interface.hpp"
#include "nmm/comm/messaging/Event.hpp"
#include "nmm/comm/messaging/IllegalStateException.hpp"
#include <memory>

#include "IIPControl.hpp"

#include "visibility.hpp"

namespace NMM
{
  /** UDP control interface.
   * This interface is provided by the UDPStrategy for setting options and reading
   * statistics for the UDP transport protocol.
   *
   * @note Most of these options apply to the PacketINetStream and PacketONetStream
   * @note classes, which are used by the UDPStrategy, rather than the UDP protocol itself.
   * @note When this documetation refers to "packets", packets generated by these streams are meant.
   */

  class DLLEXPORT IUDPControl : virtual public IIPControl { 
  public:
    IUDPControl() : NMM::Interface(IUDPControl::IUDPControl_type, "NMM") { };

    IUDPControl(NMM::NMMObject& parent) : NMM::Interface (parent, IUDPControl::IUDPControl_type, "NMM") { };

    virtual ~IUDPControl() {};

    static const char* IUDPControl_type;

    virtual  string getInterfaceType() const { return IUDPControl_type; }

    NMM::Interface* copy() const { return new IUDPControl(*this); }
    static void used(); 
    static const char* resetStatistics_event;
    static const char* getTotalSentBytes_event;
    static const char* getTotalReceivedBytes_event;
    static const char* getTotalSentPackets_event;
    static const char* getTotalReceivedPackets_event;
    static const char* getTotalDiscardedPackets_event;
    static const char* getTotalLostPackets_event;
    /** @name Protocol Statistics
     */
//@{
    /** Reset all statistics.
     * This method resets all statistics that can be queried by the other methods
     * to their initial values.
     */

    virtual void resetStatistics()
      throw(const NMM::SerializedException&);
    /** Get total number of sent bytes.
     * This method returns the total number of bytes sent over the network.
     *
     * @return Total number of sent bytes
     */

    virtual nmm_uint32 getTotalSentBytes() const
      throw(const NMM::SerializedException&);
    /** Get total number of received bytes.
     * This method returns the total number of bytes received over the network.
     *
     * @return Total number of received bytes
     */

    virtual nmm_uint32 getTotalReceivedBytes() const
      throw(const NMM::SerializedException&);
    /** Get total number of sent packets.
     * This method returns the total number of packets which have been sent over the network.
     *
     * @return Total number of sent packets
     */

    virtual nmm_uint32 getTotalSentPackets() const
      throw(const NMM::SerializedException&);
    /** Get total number of received packets.
     * This method returns the total number of packets which have been received from the network.
     *
     * @return Total number of received packets
     */

    virtual nmm_uint32 getTotalReceivedPackets() const
      throw(const NMM::SerializedException&);
    /** Get total number of discarded packets.
     * This method returns the total number of packets which have been discarded because they arrived
     * out of order.
     *
     * @return Total number of discarded packets
     */

    virtual nmm_uint32 getTotalDiscardedPackets() const
      throw(const NMM::SerializedException&);
    /** Get total number of lost packets.
     * This method returns the total number of packets which are considered lost because they
     * were expected but did not arrive.
     *
     * @return Total number of lost packets
     */

    virtual nmm_uint32 getTotalLostPackets() const
      throw(const NMM::SerializedException&);

//@}

  };

  typedef auto_ptr<IUDPControl> IUDPControl_var;




}

#include "nmm/nmm_suffix.hpp"

#endif
