Files
lcdproc/server/client.h
T

77 lines
1.7 KiB
C
Raw Normal View History

2008-11-30 22:31:20 +00:00
/** \file server/client.h
2008-11-30 12:01:53 +00:00
* Defines all the client data and actions.
*/
/* This file is part of LCDd, the lcdproc server.
2002-06-28 23:35:55 +00:00
*
2008-11-30 22:31:20 +00:00
* This file is released under the GNU General Public License.
* Refer to the COPYING file distributed with this package.
2002-06-28 23:35:55 +00:00
*
2011-01-05 23:34:37 +00:00
* Copyright (c) 1999, William Ferrell, Selene Scriven
2002-06-28 23:35:55 +00:00
* 2002, Joris Robijn
*/
#include "menu.h"
#include "menuitem.h"
/* These headers are placed here on purpose ! (circular references) */
#ifndef CLIENT_H
#define CLIENT_H
#include "shared/LL.h"
#include <stdio.h>
#define CLIENT_NAME_SIZE 256
2008-11-30 12:01:53 +00:00
/** Possible states of a client. */
typedef enum _clientstate {
2008-11-30 12:01:53 +00:00
NEW, /**< Client did not yet send \c hello. */
ACTIVE, /**< Client sent \c hello, but not yet \c bye. */
GONE /**< Client sent \c bye. */
} ClientState;
2008-11-30 12:01:53 +00:00
/** The structure representing a client in the server. */
typedef struct Client {
char *name;
ClientState state;
int sock;
int backlight;
int heartbeat;
2008-11-30 12:01:53 +00:00
LinkedList *messages; /**< Messages that the client sent. */
LinkedList *screenlist; /**< List of client's screens. */
2008-11-30 12:01:53 +00:00
Menu *menu; /**< Menu hierarchy, if any */
} Client;
2008-11-30 12:01:53 +00:00
#include "screen.h"
/* When a new client connects, set up a new client data struct */
2007-04-02 21:29:53 +00:00
Client *client_create(int sock);
/* Destroys the client data */
2007-04-02 21:29:53 +00:00
int client_destroy(Client *c);
/* Close the socket */
2007-04-02 21:29:53 +00:00
void client_close_sock(Client *c);
/* Add message to the client's queue...*/
2007-04-02 21:29:53 +00:00
int client_add_message(Client *c, char *message);
/* Get message from queue */
2007-04-02 21:29:53 +00:00
char *client_get_message(Client *c);
/* Find a named screen for the client */
2007-04-02 21:29:53 +00:00
Screen *client_find_screen(Client *c, char *id);
2007-04-02 21:29:53 +00:00
int client_add_screen(Client *c, Screen *s);
2007-04-02 21:29:53 +00:00
int client_remove_screen(Client *c, Screen *s);
2007-04-02 21:29:53 +00:00
int client_screen_count(Client *c);
#endif