You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.1 KiB
53 lines
1.1 KiB
15 years ago
|
/* vi: ts=8 sts=4 sw=4
|
||
|
*
|
||
13 years ago
|
* This file is part of the KDE project, module tdesu.
|
||
15 years ago
|
* Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
|
||
|
*/
|
||
|
|
||
|
#ifndef __Handler_h_included__
|
||
|
#define __Handler_h_included__
|
||
|
|
||
|
#include <sys/types.h>
|
||
|
|
||
14 years ago
|
#include <tqcstring.h>
|
||
15 years ago
|
#include "secure.h"
|
||
|
|
||
|
/**
|
||
|
* A ConnectionHandler handles a client. It is called from the main program
|
||
|
* loop whenever there is data to read from a corresponding socket.
|
||
|
* It keeps reading data until a newline is read. Then, a command is parsed
|
||
|
* and executed.
|
||
|
*/
|
||
|
|
||
|
class ConnectionHandler: public SocketSecurity
|
||
|
{
|
||
|
|
||
|
public:
|
||
|
ConnectionHandler(int fd);
|
||
|
~ConnectionHandler();
|
||
|
|
||
|
/** Handle incoming data. */
|
||
|
int handle();
|
||
|
|
||
|
/* Send back exit code. */
|
||
|
void sendExitCode();
|
||
|
|
||
|
private:
|
||
|
enum Results { Res_OK, Res_NO };
|
||
|
|
||
14 years ago
|
int doCommand(TQCString buf);
|
||
|
void respond(int ok, TQCString s=0);
|
||
|
TQCString makeKey(int namspace, TQCString s1, TQCString s2=0, TQCString s3=0);
|
||
15 years ago
|
|
||
|
int m_Fd, m_Timeout;
|
||
|
int m_Priority, m_Scheduler;
|
||
14 years ago
|
TQCString m_Buf, m_Pass, m_Host;
|
||
15 years ago
|
public:
|
||
|
int m_exitCode;
|
||
|
bool m_hasExitCode;
|
||
|
bool m_needExitCode;
|
||
|
pid_t m_pid;
|
||
|
};
|
||
|
|
||
|
#endif
|