server.h 617 Bytes
#ifndef __SERVER_H__
#define __SERVER_H__

#include <stdio.h>      /* for printf() and fprintf() */
#include <sys/select.h> /* for select system call and related */

#include "socket.h"
#include "logger.h"
#include "cclass.h"


CLASS(SERVER) {
	LOGGER       logger;
	SOCK         sock;
	unsigned int max_fd;
	fd_set       fdset;

	struct {
		SOCK         sock;
		char *       wbuf;
		char *       rbuf;
		unsigned int rpos;
		unsigned int wpos;
	} conns[FD_SETSIZE];
};


void server_run(SERVER this);
void server_close(SERVER this);
void server_shutdown(SERVER this);

#endif // __SERVER_H__

// vim: set ts=4 sw=4: