/*
 * DO NOT EDIT.  THIS FILE IS GENERATED FROM tmITransactionService.idl
 */

#ifndef __gen_tmITransactionService_h__
#define __gen_tmITransactionService_h__


#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif

/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
class tmITransactionObserver; /* forward declaration */


/* starting interface:    tmITransactionService */
#define TMITRANSACTIONSERVICE_IID_STR "15561efb-8c58-4a47-813a-fa91cf730895"

#define TMITRANSACTIONSERVICE_IID \
  {0x15561efb, 0x8c58, 0x4a47, \
    { 0x81, 0x3a, 0xfa, 0x91, 0xcf, 0x73, 0x08, 0x95 }}

class NS_NO_VTABLE tmITransactionService : public nsISupports {
 public: 

  NS_DEFINE_STATIC_IID_ACCESSOR(TMITRANSACTIONSERVICE_IID)

  /** 
    * Connects the application to the transaction manager, defines the
    *   namespace and initializes internal storage
    *
    * @param aNamespace
    *        A string defining the scope of the transaction domains. It is
    *        used internally to seperate process listening to the same domain
    *        (ie. preferences) but for two different namespaces (ie. profile1 vs
    *        profile2).
    *
    * @returns NS_OK if all memory allocated properly and the IPC service was
    *          reached and attached to successfully.
    *
    * @returns an NS_ERROR_<foo> code specific to the failure otherwise
    */
  /* void init (in ACString aNamespace); */
  NS_IMETHOD Init(const nsACString & aNamespace) = 0;

  /** 
    * Links the observer passed in with the domain specified. This will allow
    *   the observer to post transactions dealing with this domain as well as
    *   receive transactions posted by other applications observing this
    *   domain.
    *
    * Return codes for this method confer information about the success of
    *   this call, not of the actual attaching of the observer to the domain.
    *   (except the TM_ERROR code - which means the observer can not attach)
    *   If the attach is successful the observer will have its OnAttachReply
    *   method called before this method returns.
    *
    * Note: This call is synchronous and will not return until the call to
    *       OnAttachReply is made.
    * 
    * @param aDomainName
    *        the name of the domain, in the current namespace, to listen for
    *        transactions from. i.e. cookies
    *
    * @param aObserver
    *        this will be used to notify the application when transactions
    *        and messages come in.
    *
    * @param aLockingCall
    *        Have the Transaction Sevice acquire a lock based on the domain
    *        before attaching. This should be used when persistant storage
    *        is being used to prevent data corruption.
    *
    * @returns NS_OK if the attach message was sent to the Transaction Manager.
    *
    * @returns an NS_ERROR_<foo> code specific to the failure otherwise
    *
    * @returns TM_ERROR_QUEUE_EXISTS if the queue already exists which means
    *          someone has already attached to it.
    */
  /* void attach (in ACString aDomainName, in tmITransactionObserver aObserver, in PRBool aLockingCall); */
  NS_IMETHOD Attach(const nsACString & aDomainName, tmITransactionObserver *aObserver, PRBool aLockingCall) = 0;

  /**
    * Sends a detach message to the Transaction Manager to unlink the observer
    *   associated with the domain passed in. 
    *
    * As in attach, return codes do not indicate success of detachment. The
    *   observer will have it's OnDetach method called if it is successfully
    *   detached.
    *
    * Note: This call is an asynchronous call.
    *
    * @param aDomainName
    *        the domain, in the current namespace, from which the client
    *        should be removed.
    *
    * @returns NS_OK if the detach message is sent to the Transaction Manager
    *
    * @returns NS_ERROR_FAILURE is something goes wrong
    *
    * @returns NS_ERRROR_UNEXPECTD if the domain does not have an observer 
    *          attached
    */
  /* void detach (in ACString aDomainName); */
  NS_IMETHOD Detach(const nsACString & aDomainName) = 0;

  /**
    * Sends a flush message to the Transaction Manager to remove all
    *   transactions for the domain. After this call there will be no
    *   transactions in the Transaction Manager for the namespace/domain
    *   pairing. It is up to the application to coordinate the flushing
    *   of the Transaction Manager with the writing of data to files,
    *   if needed.
    *
    * Note: This call is synchronous and will not return until the call to
    *       OnFlushReply is made.
    *
    * @param aDomainName
    *        The domain, in the current namespace, to flush.
    *
    * @param aLockingCall
    *        Have the Transaction Sevice acquire a lock based on the domain
    *        before flushing. This should be used when persistant storage
    *        is being used to prevent data corruption.
    *
    * @returns NS_OK if the flush message is sent to the Transaction Manager
    *
    * @returns NS_ERROR_FAILURE is something goes wrong
    *
    * @returns NS_ERRROR_UNEXPECTD if the domain does not have an observer 
    *          attached
    */
  /* void flush (in ACString aDomainName, in PRBool aLockingCall); */
  NS_IMETHOD Flush(const nsACString & aDomainName, PRBool aLockingCall) = 0;

  /**
    * Send the data to the Transaction Manager to be broadcast to any
    *   applications that have registered as observers of this particular
    *   namespace/domain pairing.
    *
    * If this domain is not being observed (attach has not been called for
    *   this domain) the message is queued until the attach is made and then
    *   the message is sent to the Transaction Manager with the proper domain
    *   information. 
    *
    *   XXXjg - this may not be neccessary with the synch attach call.
    *
    * Note: This call is an asynchronous call.
    *
    * @param aDomainName
    *        the domain, in the current namespace, to which the data will be
    *        sent.
    *
    * @param aData
    *        The actual data to be sent.
    *
    * @param aDataLen
    *        The length of the data argument
    */
  /* void postTransaction (in ACString aDomainName, [array, size_is (aDataLen), const] in octet aData, in unsigned long aDataLen); */
  NS_IMETHOD PostTransaction(const nsACString & aDomainName, const PRUint8 *aData, PRUint32 aDataLen) = 0;

};

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_TMITRANSACTIONSERVICE \
  NS_IMETHOD Init(const nsACString & aNamespace); \
  NS_IMETHOD Attach(const nsACString & aDomainName, tmITransactionObserver *aObserver, PRBool aLockingCall); \
  NS_IMETHOD Detach(const nsACString & aDomainName); \
  NS_IMETHOD Flush(const nsACString & aDomainName, PRBool aLockingCall); \
  NS_IMETHOD PostTransaction(const nsACString & aDomainName, const PRUint8 *aData, PRUint32 aDataLen); 

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_TMITRANSACTIONSERVICE(_to) \
  NS_IMETHOD Init(const nsACString & aNamespace) { return _to Init(aNamespace); } \
  NS_IMETHOD Attach(const nsACString & aDomainName, tmITransactionObserver *aObserver, PRBool aLockingCall) { return _to Attach(aDomainName, aObserver, aLockingCall); } \
  NS_IMETHOD Detach(const nsACString & aDomainName) { return _to Detach(aDomainName); } \
  NS_IMETHOD Flush(const nsACString & aDomainName, PRBool aLockingCall) { return _to Flush(aDomainName, aLockingCall); } \
  NS_IMETHOD PostTransaction(const nsACString & aDomainName, const PRUint8 *aData, PRUint32 aDataLen) { return _to PostTransaction(aDomainName, aData, aDataLen); } 

/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_TMITRANSACTIONSERVICE(_to) \
  NS_IMETHOD Init(const nsACString & aNamespace) { return !_to ? NS_ERROR_NULL_POINTER : _to->Init(aNamespace); } \
  NS_IMETHOD Attach(const nsACString & aDomainName, tmITransactionObserver *aObserver, PRBool aLockingCall) { return !_to ? NS_ERROR_NULL_POINTER : _to->Attach(aDomainName, aObserver, aLockingCall); } \
  NS_IMETHOD Detach(const nsACString & aDomainName) { return !_to ? NS_ERROR_NULL_POINTER : _to->Detach(aDomainName); } \
  NS_IMETHOD Flush(const nsACString & aDomainName, PRBool aLockingCall) { return !_to ? NS_ERROR_NULL_POINTER : _to->Flush(aDomainName, aLockingCall); } \
  NS_IMETHOD PostTransaction(const nsACString & aDomainName, const PRUint8 *aData, PRUint32 aDataLen) { return !_to ? NS_ERROR_NULL_POINTER : _to->PostTransaction(aDomainName, aData, aDataLen); } 

#if 0
/* Use the code below as a template for the implementation class for this interface. */

/* Header file */
class tmTransactionService : public tmITransactionService
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_TMITRANSACTIONSERVICE

  tmTransactionService();
  virtual ~tmTransactionService();
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS1(tmTransactionService, tmITransactionService)

tmTransactionService::tmTransactionService()
{
  /* member initializers and constructor code */
}

tmTransactionService::~tmTransactionService()
{
  /* destructor code */
}

/* void init (in ACString aNamespace); */
NS_IMETHODIMP tmTransactionService::Init(const nsACString & aNamespace)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void attach (in ACString aDomainName, in tmITransactionObserver aObserver, in PRBool aLockingCall); */
NS_IMETHODIMP tmTransactionService::Attach(const nsACString & aDomainName, tmITransactionObserver *aObserver, PRBool aLockingCall)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void detach (in ACString aDomainName); */
NS_IMETHODIMP tmTransactionService::Detach(const nsACString & aDomainName)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void flush (in ACString aDomainName, in PRBool aLockingCall); */
NS_IMETHODIMP tmTransactionService::Flush(const nsACString & aDomainName, PRBool aLockingCall)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void postTransaction (in ACString aDomainName, [array, size_is (aDataLen), const] in octet aData, in unsigned long aDataLen); */
NS_IMETHODIMP tmTransactionService::PostTransaction(const nsACString & aDomainName, const PRUint8 *aData, PRUint32 aDataLen)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* End of implementation class template. */
#endif


/* starting interface:    tmITransactionObserver */
#define TMITRANSACTIONOBSERVER_IID_STR "656c0a6a-5cb3-45ec-8cb6-e7678897f937"

#define TMITRANSACTIONOBSERVER_IID \
  {0x656c0a6a, 0x5cb3, 0x45ec, \
    { 0x8c, 0xb6, 0xe7, 0x67, 0x88, 0x97, 0xf9, 0x37 }}

class NS_NO_VTABLE tmITransactionObserver : public nsISupports {
 public: 

  NS_DEFINE_STATIC_IID_ACCESSOR(TMITRANSACTIONOBSERVER_IID)

  /**
    * This gets called when a Transaction has been sent from the 
    *   TransactionManager. If the data passed in needs to be stored
    *   for longer than the life of the method the observer needs
    *   to make a copy.
    *
    * @param aQueueID
    *        The queue from which the transaction originated
    *
    * @param aData
    *        The data to be sent.
    *
    * @param aDataLen
    *        The length of the data argument
    */
  /* void onTransactionAvailable (in unsigned long aQueueID, [array, size_is (aDataLen), const] in octet aData, in unsigned long aDataLen); */
  NS_IMETHOD OnTransactionAvailable(PRUint32 aQueueID, const PRUint8 *aData, PRUint32 aDataLen) = 0;

  /**
    * Called after an application sends an Attach message to the
    *   Transaction Manager.
    *
    * @param aQueueID
    *        The client has been attached to the queue with this ID
    *
    * @param aStatus
    *        The status of the operation, as defined in tmUtils.h
    */
  /* void onAttachReply (in unsigned long aQueueID, in unsigned long aStatus); */
  NS_IMETHOD OnAttachReply(PRUint32 aQueueID, PRUint32 aStatus) = 0;

  /**
    * Called after an application sends a Detach message. Indicates 
    *   to the client that no more messages will be coming from the
    *   the TM to this client. Also, no messages posted from this
    *   client to the indicated queue will be accepted.
    *
    * @param aQueueID
    *        The client has been detached from the queue with this ID
    *
    * @param aStatus
    *        The status of the operation, as defined in tmUtils.h
    */
  /* void onDetachReply (in unsigned long aQueueID, in unsigned long aStatus); */
  NS_IMETHOD OnDetachReply(PRUint32 aQueueID, PRUint32 aStatus) = 0;

  /**
    * The reply from the TM indicating all messages have been removed
    *   from the queue indicated.
    *
    * @param aQueueID
    *        The queue that has been flushed.
    *
    * @param aStatus
    *        The status of the operation, as defined in tmUtils.h
    */
  /* void onFlushReply (in unsigned long aQueueID, in unsigned long aStatus); */
  NS_IMETHOD OnFlushReply(PRUint32 aQueueID, PRUint32 aStatus) = 0;

};

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_TMITRANSACTIONOBSERVER \
  NS_IMETHOD OnTransactionAvailable(PRUint32 aQueueID, const PRUint8 *aData, PRUint32 aDataLen); \
  NS_IMETHOD OnAttachReply(PRUint32 aQueueID, PRUint32 aStatus); \
  NS_IMETHOD OnDetachReply(PRUint32 aQueueID, PRUint32 aStatus); \
  NS_IMETHOD OnFlushReply(PRUint32 aQueueID, PRUint32 aStatus); 

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_TMITRANSACTIONOBSERVER(_to) \
  NS_IMETHOD OnTransactionAvailable(PRUint32 aQueueID, const PRUint8 *aData, PRUint32 aDataLen) { return _to OnTransactionAvailable(aQueueID, aData, aDataLen); } \
  NS_IMETHOD OnAttachReply(PRUint32 aQueueID, PRUint32 aStatus) { return _to OnAttachReply(aQueueID, aStatus); } \
  NS_IMETHOD OnDetachReply(PRUint32 aQueueID, PRUint32 aStatus) { return _to OnDetachReply(aQueueID, aStatus); } \
  NS_IMETHOD OnFlushReply(PRUint32 aQueueID, PRUint32 aStatus) { return _to OnFlushReply(aQueueID, aStatus); } 

/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_TMITRANSACTIONOBSERVER(_to) \
  NS_IMETHOD OnTransactionAvailable(PRUint32 aQueueID, const PRUint8 *aData, PRUint32 aDataLen) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnTransactionAvailable(aQueueID, aData, aDataLen); } \
  NS_IMETHOD OnAttachReply(PRUint32 aQueueID, PRUint32 aStatus) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnAttachReply(aQueueID, aStatus); } \
  NS_IMETHOD OnDetachReply(PRUint32 aQueueID, PRUint32 aStatus) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnDetachReply(aQueueID, aStatus); } \
  NS_IMETHOD OnFlushReply(PRUint32 aQueueID, PRUint32 aStatus) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnFlushReply(aQueueID, aStatus); } 

#if 0
/* Use the code below as a template for the implementation class for this interface. */

/* Header file */
class tmTransactionObserver : public tmITransactionObserver
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_TMITRANSACTIONOBSERVER

  tmTransactionObserver();
  virtual ~tmTransactionObserver();
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS1(tmTransactionObserver, tmITransactionObserver)

tmTransactionObserver::tmTransactionObserver()
{
  /* member initializers and constructor code */
}

tmTransactionObserver::~tmTransactionObserver()
{
  /* destructor code */
}

/* void onTransactionAvailable (in unsigned long aQueueID, [array, size_is (aDataLen), const] in octet aData, in unsigned long aDataLen); */
NS_IMETHODIMP tmTransactionObserver::OnTransactionAvailable(PRUint32 aQueueID, const PRUint8 *aData, PRUint32 aDataLen)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void onAttachReply (in unsigned long aQueueID, in unsigned long aStatus); */
NS_IMETHODIMP tmTransactionObserver::OnAttachReply(PRUint32 aQueueID, PRUint32 aStatus)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void onDetachReply (in unsigned long aQueueID, in unsigned long aStatus); */
NS_IMETHODIMP tmTransactionObserver::OnDetachReply(PRUint32 aQueueID, PRUint32 aStatus)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void onFlushReply (in unsigned long aQueueID, in unsigned long aStatus); */
NS_IMETHODIMP tmTransactionObserver::OnFlushReply(PRUint32 aQueueID, PRUint32 aStatus)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* End of implementation class template. */
#endif


#endif /* __gen_tmITransactionService_h__ */
