KDEsu
client.h
Go to the documentation of this file.
00001 /* vi: ts=8 sts=4 sw=4 00002 * 00003 * This file is part of the KDE project, module kdesu. 00004 * Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org> 00005 * 00006 * This is free software; you can use this library under the GNU Library 00007 * General Public License, version 2. See the file "COPYING.LIB" for the 00008 * exact licensing terms. 00009 * 00010 * client.h: client to access kdesud. 00011 */ 00012 00013 #ifndef __KDE_su_Client_h_Included__ 00014 #define __KDE_su_Client_h_Included__ 00015 00016 #include <QtCore/QBool> 00017 #include <QtCore/QList> 00018 #include <kdesu/kdesu_export.h> 00019 00020 #ifdef Q_OS_UNIX 00021 00022 #include <sys/types.h> 00023 #include <sys/socket.h> 00024 #include <sys/un.h> 00025 00026 #include <QtCore/QByteArray> 00027 00028 namespace KDESu { 00029 00048 class KDESU_EXPORT KDEsuClient { 00049 public: 00050 KDEsuClient(); 00051 ~KDEsuClient(); 00052 00063 int exec(const QByteArray &command, const QByteArray &user, const QByteArray &options=0, const QList<QByteArray> &env=QList<QByteArray>()); 00064 00069 int exitCode(); 00070 00078 int setPass(const char *pass, int timeout); 00079 00083 int setHost(const QByteArray &host); 00084 00088 int setPriority(int priority); 00089 00093 int setScheduler(int scheduler); 00094 00101 int delCommand(const QByteArray &command, const QByteArray &user); 00102 00112 int setVar(const QByteArray &key, const QByteArray &value, int timeout=0, const QByteArray &group=0); 00113 00119 QByteArray getVar(const QByteArray &key); 00120 00126 QList<QByteArray> getKeys(const QByteArray &group); 00127 00135 bool findGroup(const QByteArray &group); 00136 00142 int delVar(const QByteArray &key); 00143 00159 int delVars(const QByteArray &special_key); 00160 00167 int delGroup(const QByteArray &group); 00168 00173 int ping(); 00174 00178 int stopServer(); 00179 00183 int startServer(); 00184 00188 bool isServerSGID(); 00189 00190 private: 00191 int connect(); 00192 00193 int command(const QByteArray &cmd, QByteArray *result=0L); 00194 QByteArray escape(const QByteArray &str); 00195 00196 class KDEsuClientPrivate; 00197 KDEsuClientPrivate* const d; 00198 }; 00199 00200 } //END namespace KDESu 00201 00202 #endif //Q_OS_UNIX 00203 00204 #endif //__KDE_su_Client_h_Included__
KDE 4.6 API Reference