2024-02-08 16:03:56 +01:00
|
|
|
/* SPDX-License-Identifier: MIT OR X11
|
|
|
|
|
*
|
|
|
|
|
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
|
|
|
|
|
* Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
|
|
*/
|
|
|
|
|
#ifndef _XSERVER_DIX_CLIENT_PRIV_H
|
|
|
|
|
#define _XSERVER_DIX_CLIENT_PRIV_H
|
|
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
2025-02-13 16:58:21 +01:00
|
|
|
#include <X11/Xdefs.h>
|
2025-02-14 13:24:40 +01:00
|
|
|
#include <X11/Xfuncproto.h>
|
2024-02-08 16:03:56 +01:00
|
|
|
|
|
|
|
|
/* Client IDs. Use GetClientPid, GetClientCmdName and GetClientCmdArgs
|
|
|
|
|
* instead of accessing the fields directly. */
|
|
|
|
|
struct _ClientId {
|
|
|
|
|
pid_t pid; /* process ID, -1 if not available */
|
|
|
|
|
const char *cmdname; /* process name, NULL if not available */
|
|
|
|
|
const char *cmdargs; /* process arguments, NULL if not available */
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct _Client;
|
|
|
|
|
|
|
|
|
|
/* Initialize and clean up. */
|
|
|
|
|
void ReserveClientIds(struct _Client *client);
|
|
|
|
|
void ReleaseClientIds(struct _Client *client);
|
|
|
|
|
|
2024-03-05 14:22:57 +01:00
|
|
|
/* Determine client IDs for caching. Exported on purpose for
|
|
|
|
|
* extensions such as SELinux. */
|
|
|
|
|
pid_t DetermineClientPid(struct _Client *client);
|
|
|
|
|
void DetermineClientCmd(pid_t, const char **cmdname, const char **cmdargs);
|
|
|
|
|
|
2024-03-05 14:51:53 +01:00
|
|
|
/* Query cached client IDs. Exported on purpose for drivers. */
|
|
|
|
|
pid_t GetClientPid(struct _Client *client);
|
|
|
|
|
const char *GetClientCmdName(struct _Client *client);
|
|
|
|
|
const char *GetClientCmdArgs(struct _Client *client);
|
|
|
|
|
|
2025-02-13 16:58:21 +01:00
|
|
|
Bool ClientIsLocal(struct _Client *client);
|
2025-02-13 17:01:44 +01:00
|
|
|
XID AuthorizationIDOfClient(struct _Client *client);
|
2025-02-13 17:06:29 +01:00
|
|
|
const char *ClientAuthorized(struct _Client *client,
|
|
|
|
|
unsigned int proto_n,
|
|
|
|
|
char *auth_proto,
|
|
|
|
|
unsigned int string_n,
|
|
|
|
|
char *auth_string);
|
2025-02-13 17:10:23 +01:00
|
|
|
Bool AddClientOnOpenFD(int fd);
|
2025-02-13 17:12:22 +01:00
|
|
|
void ListenOnOpenFD(int fd, int noxauth);
|
2025-02-13 17:15:43 +01:00
|
|
|
int ReadRequestFromClient(struct _Client *client);
|
2025-02-13 18:25:56 +01:00
|
|
|
int WriteFdToClient(struct _Client *client, int fd, Bool do_close);
|
2025-02-13 18:30:39 +01:00
|
|
|
Bool InsertFakeRequest(struct _Client *client, char *data, int count);
|
2025-02-14 14:04:33 +01:00
|
|
|
void FlushAllOutput(void);
|
2025-02-14 14:09:17 +01:00
|
|
|
void FlushIfCriticalOutputPending(void);
|
2025-02-14 14:11:42 +01:00
|
|
|
void ResetOsBuffers(void);
|
2025-02-14 14:12:54 +01:00
|
|
|
void NotifyParentProcess(void);
|
2025-02-14 14:43:05 +01:00
|
|
|
void CreateWellKnownSockets(void);
|
2025-02-14 14:51:03 +01:00
|
|
|
void ResetWellKnownSockets(void);
|
2025-02-13 16:58:21 +01:00
|
|
|
|
2025-02-14 13:24:40 +01:00
|
|
|
/* exported only for DRI module, but should not be used by external drivers */
|
|
|
|
|
_X_EXPORT void ResetCurrentRequest(struct _Client *client);
|
|
|
|
|
|
2024-02-08 16:03:56 +01:00
|
|
|
#endif /* _XSERVER_DIX_CLIENT_PRIV_H */
|