taskrambler  v0.1.8
Web server and task management solution.
server.h
Go to the documentation of this file.
1 /**
2  * \file
3  * Server class. Handles acceptance and closing of connection and uses
4  * a class that has to implement the stream reader and writer interface
5  * to handle incoming reads and outgoing writes.
6  *
7  * \author Georg Hopp
8  *
9  * \copyright
10  * Copyright © 2012 Georg Hopp
11  *
12  * This program is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <http://www.gnu.org/licenses/>.
24  */
25 
26 #ifndef __SERVER_H__
27 #define __SERVER_H__
28 
29 #include <stdio.h> // for printf() and fprintf()
30 #include <poll.h> // for poll system call and related
31 
32 #include <openssl/ssl.h>
33 
34 #include "class.h"
35 #include "socket.h"
36 #include "logger.h"
37 #include "stream.h"
38 
39 struct conns {
40  Sock sock;
41  Stream stream;
42  void * worker;
43 };
44 
45 CLASS(Server) {
46  Logger logger;
47  Sock sock;
48  Sock sockSSL;
49  SSL_CTX * ctx;
50  void * worker;
51 
52  nfds_t nfds;
53  struct pollfd * fds;
54  long max_fds;
55 
56  struct conns * conns;
57 };
58 
59 void serverRun(Server this);
60 
61 #endif // __SERVER_H__
62 
63 // vim: set ts=4 sw=4:
Stream stream
Definition: server.h:41
Logger logger
Definition: taskrambler.c:66
void serverRun(Server this)
Definition: run.c:36
Sock sock
Definition: server.h:40
void * worker
Definition: server.h:42
Definition: server.h:39
CLASS(Server)
Definition: server.h:45