2001-12-27 23:30:36 +00:00
|
|
|
/*
|
|
|
|
|
* client.h
|
|
|
|
|
* This file is part of LCDd, the lcdproc server.
|
|
|
|
|
*
|
|
|
|
|
* This file is released under the GNU General Public License. Refer to the
|
|
|
|
|
* COPYING file distributed with this package.
|
|
|
|
|
*
|
|
|
|
|
* Copyright (c) 1999, William Ferrell, Scott Scriven
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
1999-12-09 23:15:14 +00:00
|
|
|
#ifndef CLIENTS_H
|
|
|
|
|
#define CLIENTS_H
|
|
|
|
|
|
|
|
|
|
#include "client_data.h"
|
2001-05-25 03:14:27 +00:00
|
|
|
#include "shared/LL.h"
|
1999-12-09 23:15:14 +00:00
|
|
|
|
2000-03-30 20:20:41 +00:00
|
|
|
typedef struct client {
|
2000-04-03 22:13:57 +00:00
|
|
|
int sock;
|
2001-09-21 21:08:10 +00:00
|
|
|
char addr[64];
|
2001-11-14 13:57:25 +00:00
|
|
|
int backlight_state;
|
2001-10-26 16:29:12 +00:00
|
|
|
LinkedList *messages;
|
2000-04-03 22:13:57 +00:00
|
|
|
client_data *data;
|
2000-03-30 20:20:41 +00:00
|
|
|
|
1999-12-09 23:15:14 +00:00
|
|
|
} client;
|
|
|
|
|
|
2001-10-26 16:29:12 +00:00
|
|
|
extern LinkedList *clients;
|
1999-12-09 23:15:14 +00:00
|
|
|
|
2001-12-30 00:15:25 +00:00
|
|
|
/* Initialize and kill client list...*/
|
2000-03-30 20:20:41 +00:00
|
|
|
int client_init ();
|
|
|
|
|
int client_shutdown ();
|
1999-12-09 23:15:14 +00:00
|
|
|
|
2001-12-30 00:15:25 +00:00
|
|
|
/* Create and destroy clients....*/
|
2000-03-30 20:20:41 +00:00
|
|
|
client *client_create (int sock);
|
|
|
|
|
int client_destroy (client * c);
|
1999-12-09 23:15:14 +00:00
|
|
|
|
2001-12-30 00:15:25 +00:00
|
|
|
/* Add and remove messages from the client's queue...*/
|
2000-03-30 20:20:41 +00:00
|
|
|
int client_add_message (client * c, char *message);
|
|
|
|
|
char *client_get_message (client * c);
|
1999-12-09 23:15:14 +00:00
|
|
|
|
2001-12-30 00:15:25 +00:00
|
|
|
/* Get and set the client's data...
|
|
|
|
|
* Not used at all yet, and may never be. Oh, well.
|
|
|
|
|
*/
|
2000-03-30 20:20:41 +00:00
|
|
|
int client_set (client * c, void *data);
|
|
|
|
|
void *client_get (client * c);
|
1999-12-09 23:15:14 +00:00
|
|
|
|
2001-12-30 00:15:25 +00:00
|
|
|
/* Search for a client with a particular filedescriptor...*/
|
2000-03-30 20:20:41 +00:00
|
|
|
client *client_find_sock (int sock);
|
1999-12-09 23:15:14 +00:00
|
|
|
|
|
|
|
|
#endif
|