VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/ipc/ipcd/client/public/ipcIService.idl@ 1

Last change on this file since 1 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.2 KB
Line 
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 IPC.
15 *
16 * The Initial Developer of the Original Code is
17 * Netscape Communications Corporation.
18 * Portions created by the Initial Developer are Copyright (C) 2002
19 * the Initial Developer. All Rights Reserved.
20 *
21 * Contributor(s):
22 * Darin Fisher <[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#include "nsISupports.idl"
39
40interface ipcIMessageObserver;
41interface ipcIClientObserver;
42
43/**
44 * ipcIService
45 *
46 * the IPC service provides the means to communicate with an external IPC
47 * daemon and/or other mozilla-based applications on the same physical system.
48 * the IPC daemon hosts modules (some builtin and others dynamically loaded)
49 * with which applications may interact.
50 *
51 * at application startup, the IPC service will attempt to establish a
52 * connection with the IPC daemon. the IPC daemon will be automatically
53 * started if necessary. when a connection has been established, the IPC
54 * service will enumerate the "ipc-startup-category" and broadcast an
55 * "ipc-startup" notification using the observer service.
56 *
57 * when the connection to the IPC daemon is closed, an "ipc-shutdown"
58 * notification will be broadcast.
59 *
60 * each client has a name. the client name need not be unique across all
61 * clients, but it is usually good if it is. the IPC service does not require
62 * unique names. instead, the IPC daemon assigns each client a unique ID that
63 * is good for the current "session." clients can query other clients by name
64 * or by ID. the IPC service supports forwarding messages from one client to
65 * another via the IPC daemon.
66 *
67 * for performance reasons, this system should not be used to transfer large
68 * amounts of data. instead, applications may choose to utilize shared memory,
69 * and rely on the IPC service for synchronization and small message transfer
70 * only.
71 */
72[scriptable, uuid(53d3e3a7-528f-4b09-9eab-9416272568c0)]
73interface ipcIService : nsISupports
74{
75 /**************************************************************************
76 * properties of this process
77 */
78
79 /**
80 * returns the "client ID" assigned to this process by the IPC daemon.
81 *
82 * @throws NS_ERROR_NOT_AVAILABLE if no connection to the IPC daemon.
83 */
84 readonly attribute unsigned long ID;
85
86 /**
87 * this process can appear under several client names. use the following
88 * methods to add or remove names for this process.
89 *
90 * for example, the mozilla browser might have the primary name "mozilla",
91 * but it could also register itself under the names "browser", "mail",
92 * "news", "addrbook", etc. other IPC clients can then query the IPC
93 * daemon for the client named "mail" in order to talk with a mail program.
94 *
95 * XXX An IPC client name resembles a XPCOM contract ID.
96 */
97 void addName(in string aName);
98 void removeName(in string aName);
99
100 /**
101 * add a new observer of client status change notifications.
102 */
103 void addClientObserver(in ipcIClientObserver aObserver);
104
105 /**
106 * remove an observer of client status change notifications.
107 */
108 void removeClientObserver(in ipcIClientObserver aObserver);
109
110 /**************************************************************************
111 * client query methods
112 */
113
114 /**
115 * resolve the given client name to the id of a connected client. this
116 * involves a round trip to the daemon, and as a result the calling thread
117 * may block on this function call while waiting for the daemon to respond.
118 */
119 unsigned long resolveClientName(in string aName);
120
121
122 /**
123 * tests whether a particular client is connected to the IPC daemon.
124 */
125 boolean clientExists(in unsigned long aClientID);
126
127
128 // XXX need other functions to enumerate clients, clients implementing targets, etc.
129 // enumerator getClients();
130 // enumerator getClientsSupportingTarget(in nsIDRef aTarget);
131 // enumerator getClientNames(in unsigned long aClientID);
132 // enumerator getClientTargets(in unsigned long aClientID);
133
134
135 /**************************************************************************
136 * message methods
137 */
138
139 /**
140 * set a message observer for a particular message target.
141 *
142 * @param aTarget
143 * the message target being observed. any existing observer will
144 * be replaced.
145 * @param aObserver
146 * the message observer to receive incoming messages for the
147 * specified target. pass null to remove the existing observer.
148 * @param aOnCurrentThread
149 * if true, then the message observer will be called on the same
150 * thread that calls defineTarget. otherwise, aObserver will be
151 * called on a background thread.
152 */
153 void defineTarget(in nsIDRef aTarget,
154 in ipcIMessageObserver aObserver,
155 in boolean aOnCurrentThread);
156
157 /**
158 * send message asynchronously to a client or a module in the IPC daemon.
159 * there is no guarantee that the message will be delivered.
160 *
161 * @param aClientID
162 * the client ID of the foreign application that should receive this
163 * message. pass 0 to send a message to a module in the IPC daemon.
164 * @param aTarget
165 * the target of the message. if aClientID is 0, then this is the
166 * ID of the daemon module that should receive this message.
167 * @param aData
168 * the message data.
169 * @param aDataLen
170 * the message length.
171 */
172 void sendMessage(in unsigned long aReceiverID,
173 in nsIDRef aTarget,
174 [array, const, size_is(aDataLen)]
175 in octet aData,
176 in unsigned long aDataLen);
177
178 /**
179 * block the calling thread until a matching message is received.
180 *
181 * @param aSenderID
182 * pass 0 to wait for a message from the daemon. pass PR_UINT32_MAX
183 * to wait for a message from any source. otherwise, pass a client
184 * id to wait for a message from that particular client.
185 * @param aTarget
186 * wait for a message to be delivered to this target.
187 * @param aObserver
188 * this observer's OnMessageAvailable method is called when a
189 * matching message is available. pass null to use the default
190 * observer associated with aTarget.
191 * @param aTimeout
192 * indicates maximum length of time in milliseconds that this
193 * function may block the calling thread.
194 *
195 * @throws IPC_ERROR_WOULD_BLOCK if the timeout expires.
196 *
197 * the observer's OnMessageAvailable method may throw IPC_WAIT_NEXT_MESSAGE
198 * to indicate that it does not wish to handle the message that it was
199 * given, and that it will wait to be called with the next message. this
200 * enables the observer to keep messages in the queue that do not match the
201 * desired message. messages that remain in the queue will be dispatched
202 * asynchronously to the default message handler after waitMessage finishes.
203 *
204 * NOTE: this function may hang the calling thread until a matching message
205 * is received, so use it with caution.
206 */
207 void waitMessage(in unsigned long aSenderID,
208 in nsIDRef aTarget,
209 in ipcIMessageObserver aObserver,
210 in unsigned long aTimeout);
211
212 /**
213 * Call this method to disable the default message observer for a target.
214 */
215 void disableMessageObserver(in nsIDRef aTarget);
216
217 /**
218 * Call this method to re-enable the default message observer for a target.
219 */
220 void enableMessageObserver(in nsIDRef aTarget);
221};
222
223%{C++
224// category and observer event defines (XXX not yet implemented)
225#define IPC_SERVICE_STARTUP_CATEGORY "ipc-startup-category"
226#define IPC_SERVICE_STARTUP_TOPIC "ipc-startup"
227#define IPC_SERVICE_SHUTDOWN_TOPIC "ipc-shutdown"
228%}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette