taskrambler  v0.1.8
Web server and task management solution.
socket.h
Go to the documentation of this file.
1 /**
2  * \file
3  * Abstraction layer above BSD sockets. Capsules and simplifies connect
4  * accept and listen.
5  *
6  * \author Georg Hopp
7  *
8  * \copyright
9  * Copyright © 2012 Georg Hopp
10  *
11  * This program is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <http://www.gnu.org/licenses/>.
23  */
24 
25 #ifndef __SOCKET_H__
26 #define __SOCKET_H__
27 
28 #include <arpa/inet.h> // for in_port_t
29 
30 #include "class.h"
31 #include "logger.h"
32 
33 CLASS(Sock) {
34  Logger log;
35  in_port_t port;
36  struct sockaddr_in addr;
37  int handle;
38 };
39 
40 void socketConnect(Sock this, const char * addr, char (*)[16]);
41 void socketListen(Sock this, int backlog);
42 Sock socketAccept(Sock this, char (*remoteAddr)[16]);
43 void socketNonblock(Sock this);
44 
45 #endif // __SOCKET_H__
46 
47 // vim: set ts=4 sw=4:
48 
void socketListen(Sock this, int backlog)
Definition: listen.c:32
Sock socketAccept(Sock this, char(*remoteAddr)[16])
Definition: accept.c:32
void socketNonblock(Sock this)
Definition: nonblock.c:32
CLASS(Sock)
Definition: socket.h:33
void socketConnect(Sock this, const char *addr, char(*)[16])
Definition: connect.c:32