#include <FACE_common.idl>

module FACE {

  //! String containing the connection name used in the TSS create_connection
  //! function.
  typedef string<64> CONNECTION_NAME_TYPE;

  //! Length of the TS Message.
  typedef long MESSAGE_SIZE_TYPE;

  //! Link to the Data Model Type Information.
  typedef long long MESSAGE_TYPE_GUID;

  //! Defined by the Transport Services configuration file
  //! For the TWO_WAY direction types, if a single connection
  //! is being used for both the request and the reply,
  //! SOURCE is to be used at the endpoint where the request
  //! originates and DESTINATION is to be used at the endpoint
  //! where the reply originates.
  enum CONNECTION_DIRECTION_TYPE {
    SOURCE,         //! maps to O_WRONLY (ARINC 653 and POSIX)
    DESTINATION,    //! maps to O_RDONLY (ARINC 653 and POSIX)
    BI_DIRECTIONAL, //! maps to O_RDWR (POSIX ONLY)
    ONE_WAY_REQUEST_SOURCE,
    ONE_WAY_REQUEST_DESTINATION,
    TWO_WAY_REQUEST_SYNCHRONOUS_SOURCE,
    TWO_WAY_REQUEST_SYNCHRONOUS_DESTINATION,
    TWO_WAY_REQUEST_REPLY_ASYNCHRONOUS_SOURCE,
    TWO_WAY_REQUEST_REPLY_ASYNCHRONOUS_DESTINATION,
    NOT_DEFINED_CONNECTION_DIRECTION_TYPE
  };

  //! Unique identifier for a TSS connection obtained in create_connection
  //! but used in other TSS functions.
  typedef long long CONNECTION_ID_TYPE;

  //! Used to tie together request/response messages.
  typedef long long TRANSACTION_ID_TYPE;

  //! Defined by the Transport Services configuration file.
  enum CONNECTION_TYPE {
    SAMPLING_PORT,   //! ARINC 653 sampling port
    QUEUING_PORT,    //! ARINC 653 queuing port
    SOCKET,          //! POSIX socket
                     //! POSIX message queue is between POSIX processes
                     //! belonging to the same partition
    MQ,              //! POSIX queue
                     //! POSIX shared memory is between POSIX processes
                     //! belonging to the same partition
    SHM,             //! POSIX shared memory
    CORBA,           //! CORBA
    DDS              //! Data Distribution Services
  };

  //! A WAITSET allows a component to specify one or more
  //! conditions that must be met in order for a callback to be
  //! invoked (or until a timeout expires).
  typedef boolean WAITSET_TYPE[32];

  //! Defined by the Transport Services configuration file.
  enum QUEUING_DISCIPLINE_TYPE {
    FIFO,
    PRIORITY,
    NOT_DEFINED_QUEUING_DISCIPLINE_TYPE
  };

  //! Defined by the Transport Services configuration file.
  enum CONNECTION_DOMAIN_TYPE {
    UNIX,     //! AF_UNIX
    INET,     //! AF_INET
    NOT_DEFINED_CONNECTION_DOMAIN_TYPE
  };

  //! Defined by the Transport Services configuration file.
  enum SOCKET_TYPE {
    STREAM,      //! SOCK_STREAM
    DGRAM,       //! SOCK_DGRAM
    SEQPACKET,   //! SOCK_SEQPACKET
    NOT_DEFINED_SOCKET_TYPE
  };

  //! Defined by the Transport Services configuration file.
  enum RECEIVE_FLAG_TYPE {
    PEEK,
    OOB_RECEIVE_FLAG_TYPE,  //! Out of Band
    WAITALL,
    NOT_DEFINED_RECEIVE_FLAG_TYPE
  };

  //! Defined by the Transport Services configuration file.
  enum SEND_FLAG_TYPE {
    EOR,                 //! End of Record
    OOB_SEND_FLAG_TYPE,  //! Out of band
    NOSIGNAL,
    NOT_DEFINED_SEND_FLAG_TYPE
  };

  //! Defined by the Transport Services configuration file.
  enum VALIDITY_TYPE {
    INVALID,     //! Also 'empty' and 'down'
    VALID        //! Also 'occupied' and 'UP'
  };

  /* Addressed in Validity_Type */
  /* typedef enum { EMPTY = 0, OCCUPIED = 1} EMPTY_INDICATOR_TYPE; */
  /* typedef enum { DOWN = 0, UP = 1} EVENT_STATE_TYPE; */

  //! Support publish/subscribe and request/response.
  enum MESSAGING_PATTERN_TYPE {
    PUB_SUB,
    CLIENT,
    SERVER
  };

  typedef long WAITING_RANGE_TYPE;

  //! Elements defined by the Transport Services configuration file.
  struct TRANSPORT_CONNECTION_STATUS_TYPE {
    MESSAGE_RANGE_TYPE        MESSAGE;
    MESSAGE_RANGE_TYPE        MAX_MESSAGE;
    MESSAGE_SIZE_TYPE         MAX_MESSAGE_SIZE;
    CONNECTION_DIRECTION_TYPE CONNECTION_DIRECTION;
    WAITING_RANGE_TYPE        WAITING_PROCESSES_OR_MESSAGES;
    SYSTEM_TIME_TYPE          REFRESH_PERIOD; //! Maximum age of a valid message
    VALIDITY_TYPE             LAST_MSG_VALIDITY;
  };
  
};
