|
1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* vim:expandtab:shiftwidth=4:tabstop=4: |
|
3 */ |
|
4 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
5 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
7 |
|
8 #ifndef nsRemoteClient_h__ |
|
9 #define nsRemoteClient_h__ |
|
10 |
|
11 #include "nscore.h" |
|
12 |
|
13 /** |
|
14 * Pure-virtual common base class for remoting implementations. |
|
15 */ |
|
16 |
|
17 class nsRemoteClient |
|
18 { |
|
19 public: |
|
20 /** |
|
21 * Initializes the client |
|
22 */ |
|
23 virtual nsresult Init() = 0; |
|
24 |
|
25 /** |
|
26 * Sends a command to a running instance. |
|
27 * |
|
28 * @param aProgram This is the preferred program that we want to use |
|
29 * for this particular command. |
|
30 * |
|
31 * @param aNoProgramFallback This boolean attribute tells the client |
|
32 * code that if the preferred program isn't found that it should |
|
33 * fail not send the command to another server. |
|
34 * |
|
35 * @param aUsername This allows someone to only talk to an instance |
|
36 * of the server that's running under a particular username. If |
|
37 * this isn't specified here it's pulled from the LOGNAME |
|
38 * environmental variable if it's set. |
|
39 * |
|
40 * @param aProfile This allows you to specify a particular server |
|
41 * running under a named profile. If it is not specified the |
|
42 * profile is not checked. |
|
43 * |
|
44 * @param aCommand This is the command that is passed to the server. |
|
45 * Please see the additional information located at: |
|
46 * http://www.mozilla.org/unix/remote.html |
|
47 * |
|
48 * @param aDesktopStartupID the contents of the DESKTOP_STARTUP_ID environment |
|
49 * variable defined by the Startup Notification specification |
|
50 * http://standards.freedesktop.org/startup-notification-spec/startup-notification-0.1.txt |
|
51 * |
|
52 * @param aResponse If there is a response, it will be here. This |
|
53 * includes error messages. The string is allocated using stdlib |
|
54 * string functions, so free it with free(). |
|
55 * |
|
56 * @return true if succeeded, false if no running instance was found. |
|
57 */ |
|
58 virtual nsresult SendCommand(const char *aProgram, const char *aUsername, |
|
59 const char *aProfile, const char *aCommand, |
|
60 const char* aDesktopStartupID, |
|
61 char **aResponse, bool *aSucceeded) = 0; |
|
62 |
|
63 /** |
|
64 * Send a complete command line to a running instance. |
|
65 * |
|
66 * @param aDesktopStartupID the contents of the DESKTOP_STARTUP_ID environment |
|
67 * variable defined by the Startup Notification specification |
|
68 * http://standards.freedesktop.org/startup-notification-spec/startup-notification-0.1.txt |
|
69 * |
|
70 * @see sendCommand |
|
71 * @param argc The number of command-line arguments. |
|
72 * |
|
73 */ |
|
74 virtual nsresult SendCommandLine(const char *aProgram, const char *aUsername, |
|
75 const char *aProfile, |
|
76 int32_t argc, char **argv, |
|
77 const char* aDesktopStartupID, |
|
78 char **aResponse, bool *aSucceeded) = 0; |
|
79 }; |
|
80 |
|
81 #endif // nsRemoteClient_h__ |