HomePort
tcpd_intern.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011 Aalborg University. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification, are
5  * permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright notice, this list of
8  * conditions and the following disclaimer.
9  *
10  * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11  * of conditions and the following disclaimer in the documentation and/or other materials
12  * provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY Aalborg University ''AS IS'' AND ANY EXPRESS OR IMPLIED
15  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Aalborg University OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  *
24  * The views and conclusions contained in the software and documentation are those of the
25  * authors and should not be interpreted as representing official policies, either expressed
26  */
27 
28 #ifndef HOMEPORT_TCPD_INTERN_H
29 #define HOMEPORT_TCPD_INTERN_H
30 
31 #include "hpd/common/hpd_tcpd.h"
32 #include "hpd/hpd_types.h"
33 #include "hpd/common/hpd_queue.h"
34 #include <ev.h>
35 #include <netinet/in.h>
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 TAILQ_HEAD(hpd_tcpd_conns, hpd_tcpd_conn);
42 typedef struct hpd_tcpd_conns hpd_tcpd_conns_t;
43 
45 struct hpd_tcpd {
47  char port_str[6];
50  int sockfd;
51  ev_io watcher;
53 };
54 
56 struct hpd_tcpd_conn {
59  char ip[INET6_ADDRSTRLEN];
60  ev_timer timeout_watcher;
61  int timeout;
62  ev_io recv_watcher;
63  ev_io send_watcher;
64  char *send_msg;
65  size_t send_len;
66  int send_close;
67  void *ctx;
68 };
69 
70 #ifdef __cplusplus
71 }
72 #endif
73 
74 #endif //HOMEPORT_TCPD_INTERN_H
Instance of a tcpd.
Definition: tcpd_intern.h:45
int timeout
Restart timeout watcher ?
Definition: tcpd_intern.h:61
ev_io send_watcher
Send watcher.
Definition: tcpd_intern.h:63
TAILQ_HEAD(hpd_tcpd_conns, hpd_tcpd_conn)
ev_timer timeout_watcher
Timeout watcher.
Definition: tcpd_intern.h:60
#define HPD_TAILQ_FIELD
Definition: hpd_queue.h:37
char * send_msg
Data to send.
Definition: tcpd_intern.h:64
hpd_tcpd_t * tcpd
Webserver instance.
Definition: tcpd_intern.h:58
int send_close
Close socket after send ?
Definition: tcpd_intern.h:66
int sockfd
Socket file descriptor.
Definition: tcpd_intern.h:50
char ip[INET6_ADDRSTRLEN]
IP address of client.
Definition: tcpd_intern.h:59
hpd_tcpd_settings_t settings
Settings.
Definition: tcpd_intern.h:46
TAILQ_ENTRY(hpd_tcpd_conn) HPD_TAILQ_FIELD
const hpd_module_t * context
Definition: tcpd_intern.h:52
hpd_ev_loop_t * loop
Event loop.
Definition: tcpd_intern.h:48
hpd_tcpd_conns_t conns
Linked List of connections.
Definition: tcpd_intern.h:49
All data to represent a connection.
Definition: tcpd_intern.h:56
size_t send_len
Length of data to send.
Definition: tcpd_intern.h:65
void * ctx
Connection context.
Definition: tcpd_intern.h:67
struct hpd_tcpd_conns hpd_tcpd_conns_t
Definition: tcpd_intern.h:42
struct ev_loop hpd_ev_loop_t
Definition: hpd_types.h:51
char port_str[6]
Port number - as a string.
Definition: tcpd_intern.h:47
ev_io watcher
New connection watcher.
Definition: tcpd_intern.h:51
Settings struct for tcpd.
Definition: hpd_tcpd.h:94
ev_io recv_watcher
Recieve watcher.
Definition: tcpd_intern.h:62