1 : /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim:expandtab:shiftwidth=4:tabstop=4:
3 : */
4 : /* ***** BEGIN LICENSE BLOCK *****
5 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 : *
7 : * The contents of this file are subject to the Mozilla Public License Version
8 : * 1.1 (the "License"); you may not use this file except in compliance with
9 : * the License. You may obtain a copy of the License at
10 : * http://www.mozilla.org/MPL/
11 : *
12 : * Software distributed under the License is distributed on an "AS IS" basis,
13 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 : * for the specific language governing rights and limitations under the
15 : * License.
16 : *
17 : * The Original Code is mozilla.org code.
18 : *
19 : * The Initial Developer of the Original Code is Christopher Blizzard.
20 : * Portions created by the Initial Developer are Copyright (C) 2001
21 : * the Initial Developer. All Rights Reserved.
22 : *
23 : * Contributor(s):
24 : * Benjamin Smedberg <benjamin@smedbergs.us>
25 : *
26 : * Alternatively, the contents of this file may be used under the terms of
27 : * either the GNU General Public License Version 2 or later (the "GPL"), or
28 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 : * in which case the provisions of the GPL or the LGPL are applicable instead
30 : * of those above. If you wish to allow use of your version of this file only
31 : * under the terms of either the GPL or the LGPL, and not to allow others to
32 : * use your version of this file under the terms of the MPL, indicate your
33 : * decision by deleting the provisions above and replace them with the notice
34 : * and other provisions required by the GPL or the LGPL. If you do not delete
35 : * the provisions above, a recipient may use your version of this file under
36 : * the terms of any one of the MPL, the GPL or the LGPL.
37 : *
38 : * ***** END LICENSE BLOCK ***** */
39 :
40 : #ifndef nsRemoteClient_h__
41 : #define nsRemoteClient_h__
42 :
43 : #include "nscore.h"
44 :
45 : /**
46 : * Pure-virtual common base class for remoting implementations.
47 : */
48 :
49 : class nsRemoteClient
50 0 : {
51 : public:
52 : /**
53 : * Initializes the client
54 : */
55 : virtual nsresult Init() = 0;
56 :
57 : /**
58 : * Sends a command to a running instance.
59 : *
60 : * @param aProgram This is the preferred program that we want to use
61 : * for this particular command.
62 : *
63 : * @param aNoProgramFallback This boolean attribute tells the client
64 : * code that if the preferred program isn't found that it should
65 : * fail not send the command to another server.
66 : *
67 : * @param aUsername This allows someone to only talk to an instance
68 : * of the server that's running under a particular username. If
69 : * this isn't specified here it's pulled from the LOGNAME
70 : * environmental variable if it's set.
71 : *
72 : * @param aProfile This allows you to specify a particular server
73 : * running under a named profile. If it is not specified the
74 : * profile is not checked.
75 : *
76 : * @param aCommand This is the command that is passed to the server.
77 : * Please see the additional information located at:
78 : * http://www.mozilla.org/unix/remote.html
79 : *
80 : * @param aDesktopStartupID the contents of the DESKTOP_STARTUP_ID environment
81 : * variable defined by the Startup Notification specification
82 : * http://standards.freedesktop.org/startup-notification-spec/startup-notification-0.1.txt
83 : *
84 : * @param aResponse If there is a response, it will be here. This
85 : * includes error messages. The string is allocated using stdlib
86 : * string functions, so free it with free().
87 : *
88 : * @return true if succeeded, false if no running instance was found.
89 : */
90 : virtual nsresult SendCommand(const char *aProgram, const char *aUsername,
91 : const char *aProfile, const char *aCommand,
92 : const char* aDesktopStartupID,
93 : char **aResponse, bool *aSucceeded) = 0;
94 :
95 : /**
96 : * Send a complete command line to a running instance.
97 : *
98 : * @param aDesktopStartupID the contents of the DESKTOP_STARTUP_ID environment
99 : * variable defined by the Startup Notification specification
100 : * http://standards.freedesktop.org/startup-notification-spec/startup-notification-0.1.txt
101 : *
102 : * @see sendCommand
103 : * @param argc The number of command-line arguments.
104 : *
105 : */
106 : virtual nsresult SendCommandLine(const char *aProgram, const char *aUsername,
107 : const char *aProfile,
108 : PRInt32 argc, char **argv,
109 : const char* aDesktopStartupID,
110 : char **aResponse, bool *aSucceeded) = 0;
111 : };
112 :
113 : #endif // nsRemoteClient_h__
|