// $Id

// ===================================================================
// 
// = FILENAME
//    remora.idl
//
// = AUTHOR
//    Seth Widoff
// 
// ===================================================================

// The IDL interface for the published Remora interfaces.

module remora
{
  struct Statistic
  {
    string label_;
    long value_;
    long max_;
  };

  struct Control
  {
    string label_;
    long value_;
    long min_;
    long max_;
  };

  typedef long Token;
  typedef sequence<Statistic> Statistics_List;
  typedef sequence<Control> Controls_List;

  exception Invalid_Statistic {};
  exception Invalid_Control {};
  
  interface Statistics_Update
    {
      void acceptNewStatistic(in Statistic stat) raises (Invalid_Statistic);

      void updateStatistic(in Statistic stat) raises (Invalid_Statistic);

      void removeStatistic(in string label) raises (Invalid_Statistic);
    };

  interface Controls_Update
    {
      void acceptNewControl(in Control control) raises (Invalid_Control);

      void getControlState(inout Control control) raises (Invalid_Control);

      void removeControl(in string label) raises (Invalid_Control);
    };
  
  // Located in an applet, the client receives and displays 
  // statistics from the  server.
  interface Remora_Statistics_Client : Statistics_Update
    {
      oneway void acceptManyStatistics(in Statistics_List stats, in long length);
      
      oneway void updateManyStatistics(in Statistics_List stats, in long length);
      // Update all statistics registered with the client
      
      oneway void shutdownStatistics();
      // Suggest that the client shut itself down
    };

  interface Remora_Controls_Client : Controls_Update
    {
      oneway void acceptManyControls(in Controls_List controls, in long length);
      // Deliver many new controls to the client.

      oneway void shutdownControls();
    };

  // Located on the server side, the Agent delivers statistics to
  // registered clients. 
  interface Remora_Statistics_Agent : Statistics_Update
    {
      oneway void setFrequency(in long id, in long update_time);
      // Set the frequency at which the Agent will transmit	
      // the statistics to the clients.
      
      long registerClient(in Remora_Statistics_Client client, in long update_time);
      // Register a client for periodic updates.
      
      oneway void terminateRegistration(in long client_id);
      // Unregister the client from the server.
    };

  interface Remora_Controls_Agent : Controls_Update
    {
      Token grabControlLock(in Remora_Controls_Client client);

      void releaseControlLock(in Token token);
    };
};

