KDESu

handler.h
1/* vi: ts=8 sts=4 sw=4
2
3 This file is part of the KDE project, module kdesu.
4 SPDX-FileCopyrightText: 1999, 2000 Geert Jansen <jansen@kde.org>
5*/
6
7#ifndef __Handler_h_included__
8#define __Handler_h_included__
9
10#include <sys/types.h>
11
12#include "secure.h"
13#include <QByteArray>
14
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.
20 */
21
23{
24public:
25 ConnectionHandler(int fd);
27
28 ConnectionHandler(const ConnectionHandler &) = delete;
29 ConnectionHandler &operator=(const ConnectionHandler &) = delete;
30
31 /** Handle incoming data. */
32 int handle();
33
34 /* Send back exit code. */
35 void sendExitCode();
36
37private:
38 enum Results {
39 Res_OK,
40 Res_NO,
41 };
42
43 int doCommand(QByteArray buf);
44 void respond(int ok, const QByteArray &s = QByteArray());
45 QByteArray makeKey(int namspace, const QByteArray &s1, const QByteArray &s2 = QByteArray(), const QByteArray &s3 = QByteArray()) const;
46
47 int m_Fd, m_Timeout;
48 int m_Priority, m_Scheduler;
49 QByteArray m_Buf, m_Pass, m_Host;
50
51public:
52 int m_exitCode;
53 bool m_hasExitCode;
54 bool m_needExitCode;
55 pid_t m_pid;
56};
57
58#endif
A ConnectionHandler handles a client.
Definition handler.h:23
int handle()
Handle incoming data.
Definition handler.cpp:58
The Socket_security class authenticates the peer for you.
Definition secure.h:20
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:57:38 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.