a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync/*
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). All
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * rights reserved.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync *
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * Permission is hereby granted, free of charge, to any person obtaining a copy
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * of this software and associated documentation files (the "Software"), to deal
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * in the Software without restriction, including without limitation the rights
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * copies of the Software, and to permit persons to whom the Software is
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * furnished to do so, subject to the following conditions:
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync *
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * The above copyright notice and this permission notice shall be included in
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * all copies or substantial portions of the Software.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync *
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * THE SOFTWARE.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync/* Author: Rami Ylimäki <rami.ylimaki@vincit.fi> */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#ifndef CLIENT_H
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#define CLIENT_H
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#ifdef HAVE_DIX_CONFIG_H
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#include <dix-config.h>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#endif /* HAVE_DIX_CONFIG_H */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#include <X11/Xfuncproto.h>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#include <sys/types.h>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync/* Client IDs. Use GetClientPid, GetClientCmdName and GetClientCmdArgs
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * instead of accessing the fields directly. */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef struct {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync pid_t pid; /* process ID, -1 if not available */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync const char *cmdname; /* process name, NULL if not available */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync const char *cmdargs; /* process arguments, NULL if not available */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync} ClientIdRec, *ClientIdPtr;
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncstruct _Client;
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync/* Initialize and clean up. */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncvoid ReserveClientIds(struct _Client *client);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncvoid ReleaseClientIds(struct _Client *client);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync/* Determine client IDs for caching. Exported on purpose for
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * extensions such as SELinux. */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncextern _X_EXPORT pid_t DetermineClientPid(struct _Client *client);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncextern _X_EXPORT void DetermineClientCmd(pid_t, const char **cmdname,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync const char **cmdargs);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync/* Query cached client IDs. Exported on purpose for drivers. */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncextern _X_EXPORT pid_t GetClientPid(struct _Client *client);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncextern _X_EXPORT const char *GetClientCmdName(struct _Client *client);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncextern _X_EXPORT const char *GetClientCmdArgs(struct _Client *client);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#endif /* CLIENT_H */