tdesu
client.h
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 <tqglobal.h>
00019 #include <tdelibs_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 <tqcstring.h>
00028 #include <tqvaluelist.h>
00029
00030 typedef TQValueList<TQCString> QCStringList;
00031
00050 class TDESU_EXPORT TDEsuClient {
00051 public:
00052 TDEsuClient();
00053 ~TDEsuClient();
00054
00065 int exec(const TQCString &command, const TQCString &user, const TQCString &options=0, const QCStringList &env=QCStringList());
00066
00071 int exitCode();
00072
00080 int setPass(const char *pass, int timeout);
00081
00085 int setHost(const TQCString &host);
00086
00090 int setPriority(int priority);
00091
00095 int setScheduler(int scheduler);
00096
00103 int delCommand(const TQCString &command, const TQCString &user);
00104
00114 int setVar(const TQCString &key, const TQCString &value, int timeout=0, const TQCString &group=0);
00115
00121 TQCString getVar(const TQCString &key);
00122
00128 TQValueList<TQCString> getKeys(const TQCString &group);
00129
00137 bool findGroup(const TQCString &group);
00138
00144 int delVar(const TQCString &key);
00145
00161 int delVars(const TQCString &special_key);
00162
00169 int delGroup(const TQCString &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 TQCString sock;
00197
00198 int command(const TQCString &cmd, TQCString *result=0L);
00199 TQCString escape(const TQCString &str);
00200
00201 class TDEsuClientPrivate;
00202 TDEsuClientPrivate *d;
00203 };
00204
00205 #endif //Q_OS_UNIX
00206
00207 #endif //__KDE_su_Client_h_Included__