Home | History | Annotate | Download | only in microspdy
      1 /*
      2     This file is part of libmicrospdy
      3     Copyright Copyright (C) 2012 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 
     19 /**
     20  * @file stream.h
     21  * @brief  SPDY streams handling
     22  * @author Andrey Uzunov
     23  */
     24 
     25 #ifndef STREAM_H
     26 #define STREAM_H
     27 
     28 #include "platform.h"
     29 
     30 
     31 /**
     32  * Reads data from session's read buffer and tries to create a new SPDY
     33  * stream. This function is called after control frame's header has been
     34  * read from the buffer (after the length field). If bogus frame is
     35  * received the function changes the read handler of the session and
     36  * fails, i.e. there is no need of further error handling by the caller.
     37  *
     38  * @param session SPDY_Session whose read buffer is being read
     39  * @return SPDY_YES if a new SPDY stream request was correctly received
     40  * 			and handled. SPDY_NO if the whole SPDY frame was not yet
     41  * 			received or memory error occurred.
     42  */
     43 int
     44 SPDYF_stream_new (struct SPDY_Session *session);
     45 
     46 
     47 /**
     48  * Destroys stream structure and whatever is in it.
     49  *
     50  * @param stream SPDY_Stream to destroy
     51  */
     52 void
     53 SPDYF_stream_destroy(struct SPDYF_Stream *stream);
     54 
     55 
     56 /**
     57  * Set stream flags if needed based on the type of the frame that was
     58  * just sent (e.g., close stream if it was RST_STREAM).
     59  *
     60  * @param response_queue sent for this stream
     61  */
     62 void
     63 SPDYF_stream_set_flags_on_write(struct SPDYF_Response_Queue *response_queue);
     64 
     65 
     66 /**
     67  * Find and return a session's stream, based on stream's ID.
     68  *
     69  * @param stream_id to search for
     70  * @param session whose streams are considered
     71  * @return SPDY_Stream with the desired ID. Can be NULL.
     72  */
     73 struct SPDYF_Stream *
     74 SPDYF_stream_find(uint32_t stream_id, struct SPDY_Session * session);
     75 
     76 #endif
     77