KDESu

stubprocess.h
1/*
2 This file is part of the KDE project, module kdesu.
3 SPDX-FileCopyrightText: 1999, 2000 Geert Jansen <jansen@kde.org>
4
5 SPDX-License-Identifier: GPL-2.0-only
6*/
7
8#ifndef KDESUSTUBPROCESS_H
9#define KDESUSTUBPROCESS_H
10
11#include "ptyprocess.h"
12
13#include <kdesu/kdesu_export.h>
14
15#include <QByteArray>
16#include <QList>
17
18namespace KDESu
19{
20namespace KDESuPrivate
21{
22class KCookie;
23}
24class StubProcessPrivate;
25
26/** \class StubProcess stubprocess.h KDESu/StubProcess
27 * Chat with kdesu_stub.
28 *
29 * StubProcess extends PtyProcess with functionality to chat with kdesu_stub.
30 */
31
32class KDESU_EXPORT StubProcess : public PtyProcess
33{
34public:
35 /**
36 * Different schedulers. SchedNormal is the normal Unix timesharing
37 * scheduler, while SchedRealtime is a POSIX.1b realtime scheduler.
38 */
39 enum Scheduler {
40 SchedNormal,
41 SchedRealtime,
42 };
43
45 ~StubProcess() override;
46
47 /**
48 * Set the command.
49 */
50 void setCommand(const QByteArray &command);
51
52 /**
53 * Set the target user.
54 */
55 void setUser(const QByteArray &user);
56
57 /**
58 * Set to "X only mode": Sycoca is not built and kdeinit is not launched.
59 */
60 void setXOnly(bool xonly);
61
62 /**
63 * Set the priority of the process. The priority value must be between 0
64 * and 100, 0 being the lowest priority. This value is mapped to the
65 * scheduler and system dependent priority range of the OS.
66 */
67 void setPriority(int prio);
68
69 /**
70 * Set the scheduler type.
71 */
72 void setScheduler(int sched);
73
74protected:
75 void virtual_hook(int id, void *data) override;
76
77 /**
78 * Exchange all parameters with kdesu_stub.
79 */
80 int converseStub(int check);
81
82 /**
83 * This virtual function can be overloaded when special behavior is
84 * desired. By default, it returns the value returned by KCookie.
85 */
86 virtual QByteArray display();
87
88 /**
89 * See display.
90 */
91 virtual QByteArray displayAuth();
92
93 // KF6 TODO: move to StubProcessPrivate
94 bool m_XOnly;
95 int m_priority;
96 int m_scheduler;
97 QByteArray m_command;
98 QByteArray m_user;
99 KDESuPrivate::KCookie *m_cookie;
100
101private:
102 KDESU_NO_EXPORT void writeString(const QByteArray &str);
103
104protected:
105 KDESU_NO_EXPORT explicit StubProcess(StubProcessPrivate &dd);
106
107private:
108 Q_DECLARE_PRIVATE(StubProcess)
109};
110
111}
112
113#endif // KDESUSTUBPROCESS_H
Synchronous communication with tty programs.
Definition ptyprocess.h:36
Chat with kdesu_stub.
Definition stubprocess.h:33
Scheduler
Different schedulers.
Definition stubprocess.h:39
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.