Home | History | Annotate | Download | only in examples
      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 
     30 struct SPDY_Connection *
     31 spdy_connect(const struct URI *uri,
     32              uint16_t port,
     33              bool is_tls);
     34 
     35 
     36 void
     37 spdy_ctl_poll(struct pollfd *pollfd,
     38               struct SPDY_Connection *connection);
     39 
     40 
     41 bool
     42 spdy_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 
     48 int
     49 spdy_exec_io(struct SPDY_Connection *connection);
     50 
     51 
     52 void
     53 spdy_diec(const char *func,
     54           int error_code);
     55 
     56 
     57 int
     58 spdy_request(const char **nv,
     59              struct Proxy *proxy,
     60              bool with_body);
     61 
     62 
     63 void
     64 spdy_ssl_init_ssl_ctx(SSL_CTX *ssl_ctx,
     65                       uint16_t *spdy_proto_version);
     66 
     67 
     68 void
     69 spdy_free_connection(struct SPDY_Connection * connection);
     70 
     71 
     72 void
     73 spdy_get_pollfdset(struct pollfd fds[],
     74                    struct SPDY_Connection *connections[],
     75                    unsigned int max_size,
     76                    nfds_t *real_size);
     77 
     78 
     79 int
     80 spdy_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 
     88 void
     89 spdy_run(struct pollfd fds[],
     90         struct SPDY_Connection *connections[],
     91         int size);
     92 
     93 
     94 void
     95 spdy_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