GNU libmicrohttpd  0.9.29
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
io.c
Go to the documentation of this file.
1 /*
2  This file is part of libmicrospdy
3  Copyright (C) 2013 Andrey Uzunov
4 
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
25 #include "platform.h"
26 #include "structures.h"
27 #include "internal.h"
28 #include "io.h"
29 
30 
31 int
34 {
35  switch(io_subsystem)
36  {
38  daemon->fio_init = &SPDYF_openssl_init;
40  break;
41 
43  daemon->fio_init = &SPDYF_raw_init;
44  daemon->fio_deinit = &SPDYF_raw_deinit;
45  break;
46 
48  default:
49  SPDYF_DEBUG("Unsupported subsystem");
50  return SPDY_NO;
51  }
52 
53  return SPDY_YES;
54 }
55 
56 
57 int
60 {
61  switch(io_subsystem)
62  {
67  session->fio_recv = &SPDYF_openssl_recv;
68  session->fio_send = &SPDYF_openssl_send;
71  break;
72 
77  session->fio_recv = &SPDYF_raw_recv;
78  session->fio_send = &SPDYF_raw_send;
81  break;
82 
84  default:
85  SPDYF_DEBUG("Unsupported subsystem");
86  return SPDY_NO;
87  }
88 
89  return SPDY_YES;
90 }
void SPDYF_raw_close_session(struct SPDY_Session *session)
Definition: io_raw.c:86
SPDYF_IORecv fio_recv
Definition: structures.h:706
void SPDYF_openssl_close_session(struct SPDY_Session *session)
Definition: io_openssl.c:171
#define SPDY_YES
Definition: microspdy.h:93
int SPDYF_raw_is_pending(struct SPDY_Session *session)
Definition: io_raw.c:151
void SPDYF_openssl_deinit(struct SPDY_Daemon *daemon)
Definition: io_openssl.c:128
SPDYF_IODeinit fio_deinit
Definition: structures.h:955
int SPDYF_raw_init(struct SPDY_Daemon *daemon)
Definition: io_raw.c:46
SPDYF_IOCloseSession fio_close_session
Definition: structures.h:701
SPDYF_IONewSession fio_new_session
Definition: structures.h:696
void SPDYF_raw_deinit(struct SPDY_Daemon *daemon)
Definition: io_raw.c:55
SPDYF_IOInit fio_init
Definition: structures.h:950
internal functions and macros for the framing layer
platform-specific includes for libmicrohttpd
internal and public structures – most of the structs used by the library are defined here ...
Signatures for IO functions.
int SPDYF_raw_new_session(struct SPDY_Session *session)
Definition: io_raw.c:62
int SPDYF_raw_send(struct SPDY_Session *session, const void *buffer, size_t size)
Definition: io_raw.c:122
enum SPDY_IO_SUBSYSTEM io_subsystem
Definition: structures.h:991
#define SPDY_NO
Definition: microspdy.h:98
int SPDYF_openssl_new_session(struct SPDY_Session *session)
Definition: io_openssl.c:135
int SPDYF_io_set_session(struct SPDY_Session *session, enum SPDY_IO_SUBSYSTEM io_subsystem)
Definition: io.c:58
int SPDYF_openssl_before_write(struct SPDY_Session *session)
Definition: io_openssl.c:267
#define SPDYF_DEBUG(fmt,...)
Definition: internal.h:154
int SPDYF_raw_before_write(struct SPDY_Session *session)
Definition: io_raw.c:160
SPDYF_IOAfterWrite fio_after_write
Definition: structures.h:726
int SPDYF_openssl_is_pending(struct SPDY_Session *session)
Definition: io_openssl.c:256
int SPDYF_openssl_recv(struct SPDY_Session *session, void *buffer, size_t size)
Definition: io_openssl.c:185
int SPDYF_io_set_daemon(struct SPDY_Daemon *daemon, enum SPDY_IO_SUBSYSTEM io_subsystem)
Definition: io.c:32
SPDYF_IOSend fio_send
Definition: structures.h:711
int SPDYF_openssl_init(struct SPDY_Daemon *daemon)
Definition: io_openssl.c:78
int SPDYF_raw_after_write(struct SPDY_Session *session, int was_written)
Definition: io_raw.c:179
int SPDYF_openssl_after_write(struct SPDY_Session *session, int was_written)
Definition: io_openssl.c:276
SPDYF_IOIsPending fio_is_pending
Definition: structures.h:716
int SPDYF_raw_recv(struct SPDY_Session *session, void *buffer, size_t size)
Definition: io_raw.c:93
SPDY_IO_SUBSYSTEM
Definition: microspdy.h:318
SPDYF_IOBeforeWrite fio_before_write
Definition: structures.h:721
int SPDYF_openssl_send(struct SPDY_Session *session, const void *buffer, size_t size)
Definition: io_openssl.c:220