Lines Matching full:client

37  * used for client identification, when a client connects to the
38 * server. The information is freed when the client disconnects. The
58 #include "client.h"
77 * Try to determine a PID for a client from its connection
78 * information. This should be called only once when new client has
81 * @param[in] client Connection linked to some process.
83 * @return PID of the client. Error (-1) if PID can't be determined
84 * for the client.
89 DetermineClientPid(struct _Client * client) in DetermineClientPid() argument
94 if (client == NullClient) in DetermineClientPid()
97 if (client == serverClient) in DetermineClientPid()
100 if (GetLocalClientCreds(client, &lcc) != -1) { in DetermineClientPid()
110 * Try to determine a command line string for a client based on its
113 * client has connected, use GetClientCmdName/Args to determine the
116 * @param[in] pid Process ID of a client.
118 * @param[out] cmdname Client process name without arguments. You must
122 * @param[out] cmdargs Arguments to client process. Useful for
123 * identifying a client that is executed from a
205 /* Construct the arguments for client process. */ in DetermineClientCmd()
271 * Called when a new client connects. Allocates client ID information.
273 * @param[in] client Recently connected client.
276 ReserveClientIds(struct _Client *client) in ReserveClientIds() argument
279 if (client == NullClient) in ReserveClientIds()
282 assert(!client->clientIds); in ReserveClientIds()
283 client->clientIds = calloc(1, sizeof(ClientIdRec)); in ReserveClientIds()
284 if (!client->clientIds) in ReserveClientIds()
287 client->clientIds->pid = DetermineClientPid(client); in ReserveClientIds()
288 if (client->clientIds->pid != -1) in ReserveClientIds()
289 DetermineClientCmd(client->clientIds->pid, &client->clientIds->cmdname, in ReserveClientIds()
290 &client->clientIds->cmdargs); in ReserveClientIds()
292 DebugF("client(%lx): Reserved pid(%d).\n", in ReserveClientIds()
293 (unsigned long) client->clientAsMask, client->clientIds->pid); in ReserveClientIds()
294 DebugF("client(%lx): Reserved cmdname(%s) and cmdargs(%s).\n", in ReserveClientIds()
295 (unsigned long) client->clientAsMask, in ReserveClientIds()
296 client->clientIds->cmdname ? client->clientIds->cmdname : "NULL", in ReserveClientIds()
297 client->clientIds->cmdargs ? client->clientIds->cmdargs : "NULL"); in ReserveClientIds()
302 * Called when an existing client disconnects. Frees client ID
305 * @param[in] client Recently disconnected client.
308 ReleaseClientIds(struct _Client *client) in ReleaseClientIds() argument
311 if (client == NullClient) in ReleaseClientIds()
314 if (!client->clientIds) in ReleaseClientIds()
317 DebugF("client(%lx): Released pid(%d).\n", in ReleaseClientIds()
318 (unsigned long) client->clientAsMask, client->clientIds->pid); in ReleaseClientIds()
319 DebugF("client(%lx): Released cmdline(%s) and cmdargs(%s).\n", in ReleaseClientIds()
320 (unsigned long) client->clientAsMask, in ReleaseClientIds()
321 client->clientIds->cmdname ? client->clientIds->cmdname : "NULL", in ReleaseClientIds()
322 client->clientIds->cmdargs ? client->clientIds->cmdargs : "NULL"); in ReleaseClientIds()
324 free((void *) client->clientIds->cmdname); /* const char * */ in ReleaseClientIds()
325 free((void *) client->clientIds->cmdargs); /* const char * */ in ReleaseClientIds()
326 free(client->clientIds); in ReleaseClientIds()
327 client->clientIds = NULL; in ReleaseClientIds()
332 * Get cached PID of a client.
334 * param[in] client Client whose PID has been already cached.
336 * @return Cached client PID. Error (-1) if called:
337 * - before ClientStateInitial client state notification
338 * - after ClientStateGone client state notification
344 GetClientPid(struct _Client *client) in GetClientPid() argument
346 if (client == NullClient) in GetClientPid()
349 if (!client->clientIds) in GetClientPid()
352 return client->clientIds->pid; in GetClientPid()
356 * Get cached command name string of a client.
358 * param[in] client Client whose command line string has been already
361 * @return Cached client command name. Error (NULL) if called:
362 * - before ClientStateInitial client state notification
363 * - after ClientStateGone client state notification
370 GetClientCmdName(struct _Client *client) in GetClientCmdName() argument
372 if (client == NullClient) in GetClientCmdName()
375 if (!client->clientIds) in GetClientCmdName()
378 return client->clientIds->cmdname; in GetClientCmdName()
382 * Get cached command arguments string of a client.
384 * param[in] client Client whose command line string has been already
387 * @return Cached client command arguments. Error (NULL) if called:
388 * - before ClientStateInitial client state notification
389 * - after ClientStateGone client state notification
396 GetClientCmdArgs(struct _Client *client) in GetClientCmdArgs() argument
398 if (client == NullClient) in GetClientCmdArgs()
401 if (!client->clientIds) in GetClientCmdArgs()
404 return client->clientIds->cmdargs; in GetClientCmdArgs()