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