Back to index

lightning-sunbird  0.9+nobinonly
Static Public Member Functions | Static Protected Member Functions | Static Protected Attributes
tmIPCModule Class Reference

Basically an interface between the tmTransactionManager and the IPC daemon. More...

#include <tmIPCModule.h>

Collaboration diagram for tmIPCModule:
Collaboration graph
[legend]

List of all members.

Static Public Member Functions

static void Shutdown ()
 Clean up the TM.
static void Init ()
 Check the TM, create it if necessary.
static void HandleMsg (ipcClientHandle client, const nsID &target, const void *data, PRUint32 dataLen)
 Receives a message from the IPC daemon, creates a transaction and sends it to the TM to deal with.
static void SendMsg (PRUint32 aDestClientIPCID, tmTransaction *aTransaction)
 Sends the message to the IPC daemon to be deliverd to the client arg.

Static Protected Member Functions

static PRInt32 InitInternal ()
 tm should be null coming into this method.

Static Protected Attributes

static tmTransactionManagertm

Detailed Description

Basically an interface between the tmTransactionManager and the IPC daemon.

Does little else than format the data from one party into a format understandable to the other.

The reason for this class is to try and abstract the transportation layer the transaction service uses. By using this class the Transaction Manager itself only needs to know that clients are identified by PRUint32 IDs.

Definition at line 58 of file tmIPCModule.h.


Member Function Documentation

void tmIPCModule::HandleMsg ( ipcClientHandle  client,
const nsID target,
const void data,
PRUint32  dataLen 
) [static]

Receives a message from the IPC daemon, creates a transaction and sends it to the TM to deal with.

Definition at line 87 of file tmIPCModule.cpp.

                                                           {

  // make sure the trans mngr is there
  if (!tm && (InitInternal() < 0))
    return;

  // create the transaction
  tmTransaction *trans = new tmTransaction();

  // initialize it
  if (trans) {
    if(NS_SUCCEEDED(trans->Init(IPC_GetClientID(client),  // who owns it
                                TM_INVALID_ID,            // in data
                                TM_INVALID,               // in data
                                TM_INVALID,               // in data
                                (PRUint8 *)data,          // raw message
                                dataLen))) {              // length of message
      // pass it on to the trans mngr
      tm->HandleTransaction(trans);
    }
    else
      delete trans;
  }
}

Here is the call graph for this function:

void tmIPCModule::Init ( void  ) [static]

Check the TM, create it if necessary.

Definition at line 72 of file tmIPCModule.cpp.

                  {
  if (!tm)
    InitInternal();
}
PRInt32 tmIPCModule::InitInternal ( ) [static, protected]

tm should be null coming into this method.

This does NOT delete tm first.

Returns:
NS_OK if everything succeeds
-1 if initialization fails

Definition at line 130 of file tmIPCModule.cpp.

                          {

  tm = new tmTransactionManager();
  if (tm)
    return tm->Init();
  return -1;
}

Here is the caller graph for this function:

void tmIPCModule::SendMsg ( PRUint32  aDestClientIPCID,
tmTransaction aTransaction 
) [static]

Sends the message to the IPC daemon to be deliverd to the client arg.

Definition at line 118 of file tmIPCModule.cpp.

                                                                           {

  IPC_SendMsg(aDestClientIPCID,
              kTransModuleID,
              (void *)aTransaction->GetRawMessage(),
              aTransaction->GetRawMessageLength());
}

Here is the call graph for this function:

Clean up the TM.

Definition at line 78 of file tmIPCModule.cpp.

                      {
  if (tm) {
    delete tm;
    tm = nsnull;
  }
}

Member Data Documentation

tmTransactionManager * tmIPCModule::tm [static, protected]

Definition at line 103 of file tmIPCModule.h.


The documentation for this class was generated from the following files: