1 | /* ***** BEGIN LICENSE BLOCK *****
|
---|
2 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
---|
3 | *
|
---|
4 | * The contents of this file are subject to the Mozilla Public License Version
|
---|
5 | * 1.1 (the "License"); you may not use this file except in compliance with
|
---|
6 | * the License. You may obtain a copy of the License at
|
---|
7 | * http://www.mozilla.org/MPL/
|
---|
8 | *
|
---|
9 | * Software distributed under the License is distributed on an "AS IS" basis,
|
---|
10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
---|
11 | * for the specific language governing rights and limitations under the
|
---|
12 | * License.
|
---|
13 | *
|
---|
14 | * The Original Code is Mozilla Transaction Manager.
|
---|
15 | *
|
---|
16 | * The Initial Developer of the Original Code is
|
---|
17 | * Netscape Communications Corp.
|
---|
18 | * Portions created by the Initial Developer are Copyright (C) 2003
|
---|
19 | * the Initial Developer. All Rights Reserved.
|
---|
20 | *
|
---|
21 | * Contributor(s):
|
---|
22 | * John Gaunt <[email protected]>
|
---|
23 | *
|
---|
24 | * Alternatively, the contents of this file may be used under the terms of
|
---|
25 | * either the GNU General Public License Version 2 or later (the "GPL"), or
|
---|
26 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
---|
27 | * in which case the provisions of the GPL or the LGPL are applicable instead
|
---|
28 | * of those above. If you wish to allow use of your version of this file only
|
---|
29 | * under the terms of either the GPL or the LGPL, and not to allow others to
|
---|
30 | * use your version of this file under the terms of the MPL, indicate your
|
---|
31 | * decision by deleting the provisions above and replace them with the notice
|
---|
32 | * and other provisions required by the GPL or the LGPL. If you do not delete
|
---|
33 | * the provisions above, a recipient may use your version of this file under
|
---|
34 | * the terms of any one of the MPL, the GPL or the LGPL.
|
---|
35 | *
|
---|
36 | * ***** END LICENSE BLOCK ***** */
|
---|
37 |
|
---|
38 | #ifndef _tmIPCModule_H_
|
---|
39 | #define _tmIPCModule_H_
|
---|
40 |
|
---|
41 | #include "ipcModuleUtil.h"
|
---|
42 | #include "tmUtils.h"
|
---|
43 |
|
---|
44 | // forward declarations
|
---|
45 | class tmTransaction;
|
---|
46 | class tmTransactionManager;
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * Basically an interface between the tmTransactionManager and the IPC
|
---|
50 | * daemon. Does little else than format the data from one party into
|
---|
51 | * a format understandable to the other.
|
---|
52 | *
|
---|
53 | * The reason for this class is to try and abstract the transportation
|
---|
54 | * layer the transaction service uses. By using this class the Transaction
|
---|
55 | * Manager itself only needs to know that clients are identified by
|
---|
56 | * PRUint32 IDs.
|
---|
57 | */
|
---|
58 | class tmIPCModule
|
---|
59 | {
|
---|
60 | public:
|
---|
61 |
|
---|
62 | ////////////////////////////////////////////////////////////////////////////
|
---|
63 | // ipcModule API - called from IPC daemon
|
---|
64 |
|
---|
65 | /**
|
---|
66 | * Clean up the TM
|
---|
67 | */
|
---|
68 | static void Shutdown();
|
---|
69 |
|
---|
70 | /**
|
---|
71 | * Check the TM, create it if neccessary.
|
---|
72 | */
|
---|
73 | static void Init();
|
---|
74 |
|
---|
75 | /**
|
---|
76 | * Receives a message from the IPC daemon, creates a transaction and sends
|
---|
77 | * it to the TM to deal with.
|
---|
78 | */
|
---|
79 | static void HandleMsg(ipcClientHandle client,
|
---|
80 | const nsID &target,
|
---|
81 | const void *data,
|
---|
82 | PRUint32 dataLen);
|
---|
83 |
|
---|
84 | ////////////////////////////////////////////////////////////////////////////
|
---|
85 | // tmIPCModule API - called from tmTransactionManager
|
---|
86 |
|
---|
87 | /**
|
---|
88 | * Sends the message to the IPC daemon to be deliverd to the client arg.
|
---|
89 | */
|
---|
90 | static void SendMsg(PRUint32 aDestClientIPCID, tmTransaction *aTransaction);
|
---|
91 |
|
---|
92 | protected:
|
---|
93 |
|
---|
94 | /**
|
---|
95 | * tm should be null coming into this method. This does NOT delete tm
|
---|
96 | * first.
|
---|
97 | *
|
---|
98 | * @returns NS_OK if everything succeeds
|
---|
99 | * @returns -1 if initialization fails
|
---|
100 | */
|
---|
101 | static PRInt32 InitInternal();
|
---|
102 |
|
---|
103 | static tmTransactionManager *tm;
|
---|
104 |
|
---|
105 | };
|
---|
106 |
|
---|
107 | #endif
|
---|
108 |
|
---|
109 |
|
---|