File: client_data.h

package info (click to toggle)
poolcounter 1.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 244 kB
  • sloc: ansic: 1,065; python: 458; makefile: 33
file content (27 lines) | stat: -rw-r--r-- 821 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
typedef unsigned char u_char; /* needed by event.h */
#include <stddef.h>
#include <event.h>
#include "locks.h"

#define MAX_LOCKS_PER_CLIENT 4

struct client_data {
	struct event ev;
	int fd;
	size_t used_buffer;
	char buffer[1024];

	int next_lock;
	struct locks client_locks[MAX_LOCKS_PER_CLIENT];
};

struct client_data* new_client_data(int fd);
void free_client_data(struct client_data* cli_data);
struct locks* init_next_lock(struct client_data* cli_data, struct PoolCounter* parent, enum lock_state state);
int read_client_line(int fd, struct client_data* cli_data, char** line);
int recover_client_buffer(struct client_data* cli_data, int len, char** line);
void process_timeout(struct client_data* cli_data);
void send_client(struct client_data* cli_data, const char* msg);

#define PORT 7531
#define BACKLOG 20