aboutsummaryrefslogtreecommitdiff
path: root/src/microspdy/stream.h
blob: a795ad288a2abb377e9e8bff9dff107e1f1bf0d2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
    This file is part of libmicrospdy
    Copyright (C) 2012 Andrey Uzunov

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

/**
 * @file stream.h
 * @brief  SPDY streams handling
 * @author Andrey Uzunov
 */

#ifndef STREAM_H
#define STREAM_H

#include "platform.h"


/**
 * Reads data from session's read buffer and tries to create a new SPDY
 * stream. This function is called after control frame's header has been
 * read from the buffer (after the length field). If bogus frame is
 * received the function changes the read handler of the session and
 * fails, i.e. there is no need of further error handling by the caller.
 *
 * @param session SPDY_Session whose read buffer is being read
 * @return SPDY_YES if a new SPDY stream request was correctly received
 * 			and handled. SPDY_NO if the whole SPDY frame was not yet
 * 			received or memory error occurred.
 */
int
SPDYF_stream_new (struct SPDY_Session *session);


/**
 * Destroys stream structure and whatever is in it.
 *
 * @param stream SPDY_Stream to destroy
 */
void
SPDYF_stream_destroy(struct SPDYF_Stream *stream);


/**
 * Set stream flags if needed based on the type of the frame that was
 * just sent (e.g., close stream if it was RST_STREAM).
 *
 * @param response_queue sent for this stream
 */
void
SPDYF_stream_set_flags(struct SPDYF_Response_Queue *response_queue);

#endif