add more spacing
[personal-kdebase.git] / runtime / kdesu / kdesud / handler.h
blobd565150a20bc59dfed3c8fe8caeba8b3994bd1e3
1 /* vi: ts=8 sts=4 sw=4
3 * This file is part of the KDE project, module kdesu.
4 * Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
5 */
7 #ifndef __Handler_h_included__
8 #define __Handler_h_included__
10 #include <sys/types.h>
12 #include <QByteArray>
13 #include "secure.h"
15 /**
16 * A ConnectionHandler handles a client. It is called from the main program
17 * loop whenever there is data to read from a corresponding socket.
18 * It keeps reading data until a newline is read. Then, a command is parsed
19 * and executed.
22 class ConnectionHandler: public SocketSecurity
25 public:
26 ConnectionHandler(int fd);
27 ~ConnectionHandler();
29 /** Handle incoming data. */
30 int handle();
32 /* Send back exit code. */
33 void sendExitCode();
35 private:
36 enum Results { Res_OK, Res_NO };
38 int doCommand(QByteArray buf);
39 void respond(int ok, const QByteArray &s = QByteArray());
40 QByteArray makeKey(int namspace, const QByteArray &s1,
41 const QByteArray &s2 = QByteArray(), const QByteArray &s3 = QByteArray()) const;
43 int m_Fd, m_Timeout;
44 int m_Priority, m_Scheduler;
45 QByteArray m_Buf, m_Pass, m_Host;
46 public:
47 int m_exitCode;
48 bool m_hasExitCode;
49 bool m_needExitCode;
50 pid_t m_pid;
53 #endif