summaryrefslogtreecommitdiff
path: root/other/fizzbounce/client.h
blob: 23f8b35ab97081bd3c00c6ac84d6e74f513a0ee4 (plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

#include <netinet/in.h>
#include <pthread.h>

#ifndef	FIZZ_CLIENT_H
#define	FIZZ_CLIENT_H

typedef struct	client {
	pthread_t		tid;		/* thread id */
	pthread_mutex_t		cl_mutex;	/* client mutex */
	int			cs;		/* client socket */
	struct sockaddr_in	csa;

	char			*connip;
	unsigned short		connport;
	char			*ircip, *ircport;
	int			ss;		/* control connection socket to server */
	struct sockaddr_in	css;		/* server socket address */
} client;

/* cl_handle
 *
 * thread that handles one client. once a new client connects this thread
 * is started and handles anything the client wants.
 * client *cl is a new client structure, which has to be initialized already
 *
 * returns nothing
 */

void	*cl_handle (client *cl);

/* cl_add
 *
 * adds a new client and returns
 * NULL on failure
 * client * to new client if succes
 */
client	*cl_add (void);

/* cl_init
 *
 * initializes a fresh client structure =)
 */
void	cl_init (client *cl);

#endif