KDEsu
client.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __KDE_su_Client_h_Included__
00016 #define __KDE_su_Client_h_Included__
00017
00018 #include <qglobal.h>
00019 #include <kdelibs_export.h>
00020
00021 #ifdef Q_OS_UNIX
00022
00023 #include <sys/types.h>
00024 #include <sys/socket.h>
00025 #include <sys/un.h>
00026
00027 #include <qcstring.h>
00028 #include <qvaluelist.h>
00029
00030 typedef QValueList<QCString> QCStringList;
00031
00050 class KDESU_EXPORT KDEsuClient {
00051 public:
00052 KDEsuClient();
00053 ~KDEsuClient();
00054
00065 int exec(const QCString &command, const QCString &user, const QCString &options=0, const QCStringList &env=QCStringList());
00066
00071 int exitCode();
00072
00080 int setPass(const char *pass, int timeout);
00081
00085 int setHost(const QCString &host);
00086
00090 int setPriority(int priority);
00091
00095 int setScheduler(int scheduler);
00096
00103 int delCommand(const QCString &command, const QCString &user);
00104
00114 int setVar(const QCString &key, const QCString &value, int timeout=0, const QCString &group=0);
00115
00121 QCString getVar(const QCString &key);
00122
00128 QValueList<QCString> getKeys(const QCString &group);
00129
00137 bool findGroup(const QCString &group);
00138
00144 int delVar(const QCString &key);
00145
00161 int delVars(const QCString &special_key);
00162
00169 int delGroup(const QCString &group);
00170
00175 int ping();
00176
00180 int stopServer();
00181
00185 int startServer();
00186
00190 bool isServerSGID();
00191
00192 private:
00193 int connect();
00194
00195 int sockfd;
00196 QCString sock;
00197
00198 int command(const QCString &cmd, QCString *result=0L);
00199 QCString escape(const QCString &str);
00200
00201 class KDEsuClientPrivate;
00202 KDEsuClientPrivate *d;
00203 };
00204
00205 #endif //Q_OS_UNIX
00206
00207 #endif //__KDE_su_Client_h_Included__