1/*
2    Copyright Copyright (C) 2013 Andrey Uzunov
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation, either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>.
16*/
17
18/**
19 * @file mhd2spdy_spdy.h
20 * @brief  SPDY part of the proxy. libspdylay is used for the client side.
21 * @author Andrey Uzunov
22 */
23
24#ifndef SPDY_H
25#define SPDY_H
26
27#include "mhd2spdy_structures.h"
28
29
30struct SPDY_Connection *
31spdy_connect(const struct URI *uri,
32             uint16_t port,
33             bool is_tls);
34
35
36void
37spdy_ctl_poll(struct pollfd *pollfd,
38              struct SPDY_Connection *connection);
39
40
41bool
42spdy_ctl_select(fd_set * read_fd_set,
43                fd_set * write_fd_set,
44                fd_set * except_fd_set,
45                struct SPDY_Connection *connection);
46
47
48int
49spdy_exec_io(struct SPDY_Connection *connection);
50
51
52void
53spdy_diec(const char *func,
54          int error_code);
55
56
57int
58spdy_request(const char **nv,
59             struct Proxy *proxy,
60             bool with_body);
61
62
63void
64spdy_ssl_init_ssl_ctx(SSL_CTX *ssl_ctx,
65                      uint16_t *spdy_proto_version);
66
67
68void
69spdy_free_connection(struct SPDY_Connection * connection);
70
71
72void
73spdy_get_pollfdset(struct pollfd fds[],
74                   struct SPDY_Connection *connections[],
75                   unsigned int max_size,
76                   nfds_t *real_size);
77
78
79int
80spdy_get_selectfdset(fd_set * read_fd_set,
81                    fd_set * write_fd_set,
82                    fd_set * except_fd_set,
83                    struct SPDY_Connection *connections[],
84                    unsigned int max_size,
85                    nfds_t *real_size);
86
87
88void
89spdy_run(struct pollfd fds[],
90        struct SPDY_Connection *connections[],
91        int size);
92
93
94void
95spdy_run_select(fd_set * read_fd_set,
96                fd_set * write_fd_set,
97                fd_set * except_fd_set,
98                struct SPDY_Connection *connections[],
99                int size);
100
101
102#endif
103